pdf.js

Django - JS : How to display the first PDF page as cover

旧城冷巷雨未停 提交于 2021-02-19 07:15:26
问题 I would like to improve my script in order to set PDF cover page for each object when user sets the mouve over the object on the template. Actual process: Up to now, I can upload .pdf and .epub file formats according to an object with some additionnals fields : title , language ... The PDF is stored into media directory in my project. In the main page, I display all objects like this : As you can see in the end of each publication, there is a glyphicon which let, up to now, to display inside

Django - JS : How to display the first PDF page as cover

馋奶兔 提交于 2021-02-19 07:14:09
问题 I would like to improve my script in order to set PDF cover page for each object when user sets the mouve over the object on the template. Actual process: Up to now, I can upload .pdf and .epub file formats according to an object with some additionnals fields : title , language ... The PDF is stored into media directory in my project. In the main page, I display all objects like this : As you can see in the end of each publication, there is a glyphicon which let, up to now, to display inside

Pdfjs viewer with external file upload

独自空忆成欢 提交于 2021-02-11 06:30:23
问题 I am loading the pdf.js viewer in my webpage in a div using the pdf.js API methods such as run and open. In this page I also have a file upload section to attach related documents. The issue is when I upload a document in the file upload section, using dropzone, the pdf viewer thinks I am uploading a document to it and changes the existing document. Is there a setting to turn this off? I thought there would be something in network.js but I haven't found anything promising yet. 回答1: Here is

Pdfjs viewer with external file upload

前提是你 提交于 2021-02-11 06:25:15
问题 I am loading the pdf.js viewer in my webpage in a div using the pdf.js API methods such as run and open. In this page I also have a file upload section to attach related documents. The issue is when I upload a document in the file upload section, using dropzone, the pdf viewer thinks I am uploading a document to it and changes the existing document. Is there a setting to turn this off? I thought there would be something in network.js but I haven't found anything promising yet. 回答1: Here is

pdf.js default viewer doesn't show pdf file

和自甴很熟 提交于 2021-01-29 05:41:44
问题 I'm using pdf.js library with the recommended default settings: <iframe src="https://myserver.tld/lib/pdf.js/web/viewer.html?file=https://myserver.tld/generator.php?id=1" width="800px" height="600px"> So basicly I use a self-hosted verion of pdf.js and want the default viewer to display a pdf file which is generated by a php-script (https://myserver.tld/generator.php?id=1). It works fine to direct download the pdf file by typing https://myserver.tld/generator.php?id=1 in the browser. Using

How do I display all pages in a PDF (stored in base64) using PDF.js?

会有一股神秘感。 提交于 2021-01-28 01:19:49
问题 I am using the following script to display a PDF using PDF.js, but it does not show anything on the canvas. Can you tell me where I am going wrong with this? I tried looking for documentation online, but could not find any help. @Model.B is the base64 string. <script> var pdfData = atob("@Model.B"); var pdfjsLib = window['pdfjs-dist/build/pdf']; pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js'; var loadingTask = pdfjsLib.getDocument({ data: pdfData });

Load PDF into fabricjs canvas

别来无恙 提交于 2021-01-01 03:32:33
问题 I have a fabricjs canvas that I need to input a PDF, similar to how images are loaded. I expect that I'd need to convert the PDF to a PNG via PDFjs before loading onto canvas? document.getElementById('imgLoader').onchange = function handleImage(e) { var reader = new FileReader(); reader.onload = function (event) { console.log('fdsf'); var imgObj = new Image(); imgObj.src = event.target.result; imgObj.onload = function () { var image = new fabric.Image(imgObj); image.set({ left: 320, top: 5, }

PDF.JS PDF is not rendering properly, appears mirrored and upside down

六月ゝ 毕业季﹏ 提交于 2020-12-30 08:37:07
问题 I'm trying to get pdf.js to work in IE. I've copied the code almost exactly from the "Hello World using base64 encoded PDF" example on the pdf.js site at https://mozilla.github.io/pdf.js/examples/. The PDF is upside down and mirrored. I've looked around and a common cause of this is re-using the canvas for multiple renders, but I'm not doing that I'm just rendering once, so I really have no idea. At the top of my html document i have: $html .= '<canvas width="600px" height="2000px" id="the

Asp.net MVC Razor视图模版动态渲染PDF,Razor模版生成静态Html

柔情痞子 提交于 2020-10-27 17:40:41
1.前言     上一篇文章我开源了轮子, Asp.net Core 3.1 Razor视图模版动态渲 染PD F ,然后,很多小伙伴有很多私信找我了。那么我下面就简单的给大家说一下,关于小伙伴问的这些问题。 我项目的电子签章部分代码可否开源?   答:我项目电子签章也是使用第三方的电子签章,电子签章并不是自己实现的,项目里面的电子签章代码无非也是对接第三方的接口。这部分代码开源出去也没有什么意义。我们是使用数字广东的方案,如果您也是使用该数字签章,可以私下沟通我看看能不能帮助您。 电子签章实现难不难,怎么实现自己的电子签章?   答:电子签章要实现,估计不是太难,按照我的理解,当然我没有具体深入研究(如果这里我有妄自菲薄的意思,请谅解,毕竟我能力有限,只是按照我的理解来分析),我个人觉得电子签章应该就是利用数字证书给PDF签名,然后加密保护文档,然后校验文档的真伪,就要考虑怎么验证这个文档没有被删改,是当初我们签章的这个文档,而且这个签名不能被伪造。个人觉得不是很复杂,但是,电子签章的法律有效性却不是这么简单的。按照国家法律规定,利用的签名平台应该有资质的,国家认可的第三方签章平台,也就是说,私人自己制作的签章,打起官司来,很难得到法律支持。 项目为什么CSS样式不起效?   答:你是否使用了外链的CSS样式,因为渲染Razor视图是在后台渲染,无法找到外链的文件路径