pdf.js

How to render PDF using pdf.js viewer in PyQt?

自古美人都是妖i 提交于 2019-11-27 14:53:44
I have tried adding the pdf.js viewer files in my project and it works in browsers like Chrome, Mozilla, Safari, etc, but it's not loading some pages in node-webkit and PyQt webkit. I am trying to load the file using an iframe, like this: <iframe src="/test/?file=/assets/pdf/example.pdf#page=3"> </iframe> I've found this thread over at the Qt Forums , where thebeast44 posted a snippet of Qt code answering your question. My translation to python is below. You'll also need to unpack the res folder from the author's original code , I think he just modified the viewer... I've also attached said

How to search with pdf.js?

家住魔仙堡 提交于 2019-11-27 14:51:16
问题 I'm displaying a pdf file with pdf.js in my Ionic App. I do not use viewer.js and viewer.html, because I need a totally different layout. Now I have a custom search bar and I want to highlight terms in my pdf file. Is there a function I can invoke to do this? I'm rendering the file like this: $scope.renderPages = function(pdfDoc) { $scope.pdfFile = pdfDoc; for(var num = 1; num <= pdfDoc.numPages; num++){ pdfDoc.getPage(num).then($scope.renderPage); } } $scope.renderPage = function(page) { var

How to know if PDF.JS has finished rendering?

佐手、 提交于 2019-11-27 11:47:55
问题 I am using PDF.JS to render pdf pages into different canvas elements. my requirement is to capture the output of the canvas and to display it as an image. Is there some event to know if the rendering of the pdf page in canvas has been finished or not. because when I try to capture the output of canvas it is blank. but the pdf page is rendered properly. it looks like my capture event is being called before the pdf.js finishes the rendering process. here is my code: page.render(renderContext);

Render .pdf to single Canvas using pdf.js and ImageData

你。 提交于 2019-11-27 11:34:20
问题 I am trying to read an entire .pdf Document using PDF.js and then render all the pages on a single canvas. My idea: render each page onto a canvas and get the ImageData (context.getImageData()), clear the canvas do the next page. I store all the ImageDatas in an array and once all pages are in there I want to put all the ImageDatas from the array onto a single canvas. var pdf = null; PDFJS.disableWorker = true; var pages = new Array(); //Prepare some things var canvas = document

Is there a minimalistic PDF.js sample that supports text selection?

倖福魔咒の 提交于 2019-11-27 09:32:44
问题 I'm trying PDF.js. My problem is that the Hello World demo does not support text selection. It will draw everything in a canvas without the text layer. The official PDF.js demo does support text selection but the code is too complex. I was wondering if somebody has a minimalistic demo with the text layer. 回答1: I have committed the example to Mozilla's pdf.js repository and it is available under the examples directory. The original example that I committed to pdf.js no longer exists, but I

Printing PDF using pdf.js

谁说胖子不能爱 提交于 2019-11-27 06:12:46
问题 I am embedding a single page PDF in a page using pdf.js and I want to be able to print just the PDF, not the whole HTML page. Is this possible? 回答1: I had previously loaded a pdf document onto a canvas using pdf.js. The canvas only contains one page. So This is what worked for me for a single page: var canvas = document.getElementById('pdfPage'); var win = window.open('', '', ''); var html = "<img src='" + canvas.toDataURL() + "'>"; win.document.write(html); win.document.close(); win.focus();

How to Use pdf.js [closed]

↘锁芯ラ 提交于 2019-11-27 02:42:17
I am considering using pdf.js (an open source tool that allows embedding of a pdf in a webpage). There isn't any documentation on how to use it. I assume what I do is make an html page with the script referenced in the header, and then in the body, I put some sort of function call with an array of the file name and location. Can anyone help me out here? Try Google'ing pdf.js documentation /* create the PDF document */ var doc = new pdf(); doc.text(20, 20, 'hello, I am PDF.'); doc.text(20, 30, 'i was created in the browser using javascript.'); doc.text(20, 40, 'i can also be created from node

Pdf.js and viewer.js. Pass a stream or blob to the viewer

﹥>﹥吖頭↗ 提交于 2019-11-27 00:46:55
I'm having troubles in finding a solution for this: I retrieve a PDF blob from a SQL filestream field using Javascript in this way (it's a lightswitch project) var blob = new Blob([screen.WebReportsPdfFilesStream.selectedItem.Pdf], { type: "application/pdf;base64" }); I have the blob and I can even convert it in a filestream or to base64("JVBERi0....." or "%PDF 1.6 ......", etc.) No problem so far. Now I need to display it in a viewer. I prefer the viewer to open in a new window but i'm open to embed it into my page somehow. I'm wondering if I can directly pass the blob or the stream to the

How to render PDF using pdf.js viewer in PyQt?

China☆狼群 提交于 2019-11-26 18:25:17
问题 I have tried adding the pdf.js viewer files in my project and it works in browsers like Chrome, Mozilla, Safari, etc, but it's not loading some pages in node-webkit and PyQt webkit. I am trying to load the file using an iframe, like this: <iframe src="/test/?file=/assets/pdf/example.pdf#page=3"> </iframe> 回答1: I've found this thread over at the Qt Forums, where thebeast44 posted a snippet of Qt code answering your question. My translation to python is below. You'll also need to unpack the res

How to Use pdf.js [closed]

一世执手 提交于 2019-11-26 10:08:19
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I am considering using pdf.js (an open source tool that allows embedding of a pdf in a webpage). There isn\'t any documentation on how to use it. I assume what I do is make an html page with the script referenced