pdf.js

Pdf.js (for node) not rendering entire contents of pdf

好久不见. 提交于 2019-12-12 04:36:47
问题 I am trying to search the text of of a pdf using https://www.npmjs.com/package/pdfjs-dist-for-node. My code looks like this: gettext: function(){ var data = '../static/example.pdf'; return pdfjs.getDocument(data).then(function(pdf) { var pages = []; for (var i = 0; i < pdf.numPages; i++) { pages.push(i); } return Promise.all(pages.map(function(pageNumber) { return pdf.getPage(pageNumber + 1).then(function(page) { return page.getTextContent().then(function(textContent) { return textContent

How to disable hyperlinks within a PDF rendered by PDF.js

久未见 提交于 2019-12-12 03:39:50
问题 I'm looking into PDF.js for use in a web app. So far, it's meeting all of our business requirements. However, management has requested that we have the ability to disable hyperlinks within the PDF. We don't necessarily have to get rid of the blue text and underline, but if the user clicks on the hyperlink, it shouldn't go anywhere. I've looked carefully through what API there is and couldn't find anything for it. I also looked through the source code, but nothing jumped out at me as something

推荐的将PDF嵌入HTML的方法?

和自甴很熟 提交于 2019-12-11 20:36:27
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 将PDF嵌入HTML的推荐方法是什么? iFrame? 宾语? 嵌入? Adobe对此有何评价? 就我而言,PDF是即时生成的,因此在刷新之前无法将其上传到第三方解决方案。 #1楼 看看这段代码-将PDF嵌入HTML <!-- Embed PDF File --> <object data="YourFile.pdf" type="application/x-pdf" title="SamplePdf" width="500" height="720"> <a href="YourFile.pdf">shree</a> </object> #2楼 同时使用 <object> 和 <embed> 将使您具有更广泛的浏览器兼容性。 <object data="http://yoursite.com/the.pdf" type="application/pdf" width="750px" height="750px"> <embed src="http://yoursite.com/the.pdf" type="application/pdf"> <p>This browser does not support PDFs. Please download the PDF to view it: <a href=

Strip Adobe Reader and Version requirements from PDF before outputting it to browser

吃可爱长大的小学妹 提交于 2019-12-11 18:28:11
问题 I am planning on using pdf.js to have PDF context via the browser with Javascript. The problem is that some PDFs, the ones I am using, require Adobe's Reader with a specific Version. pdf.js does does not yet(ever?) support spoofing of these. What I need to know is if there's a way in C# to open the PDF and remove these Reader and Version requirements and how to do it. I was planning on using itextsharp to do other PDF manipulation server-side so an example using this would be most helpful. I

pdfjs: How to create more than one canvas to show all the pages?

情到浓时终转凉″ 提交于 2019-12-11 11:09:03
问题 I am following the approach of here. The problem is that all the pages are in first canvas. This is because I have only one canvas and I am not sure how I can generate more canvas one after other? function handlePages(page) { var viewport = page.getViewport(canvas.width / page.getViewport(1.0).width); var ctx = canvas.getContext('2d'); canvas.height = viewport.height; canvas.width = viewport.width; page.render({ canvasContext: ctx, viewport: viewport }); //Add it to the web page div

Draw rectangle in canvas with loaded pdf file using pdf.js

社会主义新天地 提交于 2019-12-11 04:59:09
问题 I am trying to draw rectangle over a pdf file. when i draw rectangle in pdf, rectangle not draw properly. I want to draw only one rectangle at a time, when i draw new rectangle the old rectangle should be remove, but it is not happening. Here is my code:- Rendering code of pdf (Rendering is working properly) function pdfFile (file) { pdfjsLib.workerSrc = 'pdf.worker.js'; pdfjsLib.getDocument(file).promise.then(function(pdfDoc) { pdf = pdfDoc; document.getElementById('page_count').textContent

How can I restyle a word when rendering a pdf with pdf.js?

冷暖自知 提交于 2019-12-11 02:28:54
问题 When I runder a pdf with pdf.js I would like to be able to restyle some words (e.g. highlight) is this possible? 回答1: Yes, it is possible to highlight words while working with PDF.js As a page contains a canvas (for the rendered content) an HTMLDivElement (for the non-rendered text content) you can use the latter one to select text elements. Having access to the Selection API on your browser, you can get the selection via document.getSelection() . The following code demonstrates how to do

Does pdf.js only work with certain pdfs?

情到浓时终转凉″ 提交于 2019-12-10 19:59:41
问题 I am trying to convert pdf pages to canvas using pdf.js . I used the answer in Render .pdf to single Canvas using pdf.js and ImageData by K3N to achieve this. The code is avaliable here Fiddle1. The problem is that this seems to work with certain pdfs only. For example the code works fine for http://arxiv.org/pdf/1207.0102v2.pdf in Fiddle2. However, when I tried the same code for http://infolab.stanford.edu/pub/papers/google.pdf in Fiddle3 it failed to work. Why is this happening and can it

Find PDF page count with Node (on Windows)

假如想象 提交于 2019-12-10 13:39:43
问题 I did a lot of research (I guess not enough?) and am trying to find an easy to use library to find the page count of a PDF using Node.js. The library would need to be usable on a Windows OS. Anyone know how best to approach this? Worst case situation, I was thinking about doing something with PhantomJS and the PDF.js library. Thanks for any help!! 回答1: Since it's built on pdf.js, pdf2json it should work in windows. I managed to find the page count of a test document like so: var PDFParser =

PDF doesn't load at all in javafx webview

本秂侑毒 提交于 2019-12-10 12:15:32
问题 The purpose of this code is to display a pdf file through webview. The pdf is read on button click, but the screen just remains white and loads forever. There are no errors as the pdf viewer loads in the web view once i click the button, and nothing happens. public class customFXMLController implements Initializable { @FXML private TabPane tabPane; @FXML private WebView web; @FXML private Button btn; WebEngine engine; @Override public void initialize(URL location, ResourceBundle rb) { engine