pdf.js

PDF.js is randomly crashing the Google Chrome tab

巧了我就是萌 提交于 2019-12-31 04:51:07
问题 My problem may seem a bit vague (it is to me too), but here is my attempted explanation of it. A few months ago, I implemented PDF.js in my web application. It was really useful, and I am using it for interactions with my clients. Suddenly, last week, my clients reported to me "Aw, Snap" messages in Google Chrome on their PCs when they try to launch PDF.js. I have an iMac and two PCs at home, so I decided to test this out. When I used Google Chrome on my iMac to launch PDF.js, I found it

PDF.JS: Render PDF using an ArrayBuffer or Blob instead of URL

天大地大妈咪最大 提交于 2019-12-28 15:20:20
问题 I know of a similar question to this one: Pdf.js: rendering a pdf file using a base64 file source instead of url. That question was awesomely answered by Codetoffel but my question is different in that my PDF is retrieved via a RESTful call to my Web API implementation. Let me explain... First, here's a basic way to use PDF.JS to open a PDF via a URL: PDFJS.getDocument("/api/path/to/my.pdf").then(function (pdf) { pdf.getPage(1).then(function (page) { var scale = 1; var viewport = page

Use PDF.js to statically convert a PDF to HTML

时光毁灭记忆、已成空白 提交于 2019-12-28 12:16:10
问题 PDF.js is the latest library from Mozilla, and is a standards-based PDF renderer that is written entirely in Javascript. Currently you cannot access the generated HTML, and the library can only be used as a viewer. Is it possible to use PDF.js to statically convert a PDF to its HTML equivalent? Considering it renders in a browser, it must be HTML+CSS, and the JS would be used only for navigation. After converting it to HTML I plan to use our existing HTML workflow to import/index/consume the

$_SERVER['HTTP_RANGE'] returns Null every time?

天大地大妈咪最大 提交于 2019-12-25 07:16:32
问题 In the given code only else condition is running every time. I have used pdf.js library and trying to break the pdf in chunks. I user this code on server side but it seems like only else condition is running and perhaps isset($_SERVER['HTTP_RANGE'] returns null . So the pdf gets loaded in the first go itself . if(isset($_SERVER['HTTP_RANGE'])) { $fp = @fopen($filepath, 'rb'); $size = filesize($filepath); // File size $length = $size; // Content length $start = 0; // Start byte $end = $size -

mozilla pdf.js webview ask for internet

天大地大妈咪最大 提交于 2019-12-24 14:35:04
问题 I'm using mozilla/pdf.js to display a pdf in a webview in my Android application. The framework doesn't need any internet connection to render the pdf. If downloaded the .js file and everything so it can use that. Still every time I want to open a new pdf Android opens the default browser with the wireless settings dialog. After closing the app and opening it again the PDF is rendered. My internet connection both wireless as data is disabled, so it doesn't need anything of internet, I'm sure

PDF.js getTextContent returning text in wrong order

主宰稳场 提交于 2019-12-23 06:23:23
问题 I'm having a problem extracting text from a pdf using PDF.js. I'm using a PDF that was exported from Excel, and thus has multiple rows/columns. Here's the function I'm using to get the text: gettext: function(url, name){ var self = this; var data = url; console.log('attempting to get text'); return pdfjs.getDocument(data).then(function(pdf) { var pages = []; for (var i = 0; i <= 1; i++) { pages.push(i); } return Promise.all(pages.map(function(pageNumber) { return pdf.getPage(pageNumber + 1)

how to implement pdf.js to view pdf files in the pdf viewer?

删除回忆录丶 提交于 2019-12-23 04:57:18
问题 i want to open pdf files that are linked to in a document in a new page in the pdf.js viewer. i have downloaded the zip file from github: https://github.com/mozilla/pdf.js and gone to both of the index.html files in the examples folder. i get blank pages when opening either of these files. can anyone please tell me how to implement pdf.js so that i can open pdf documents in a new page in the pdf viewer? thank you. 回答1: Try using '?file=url' in query-string with viewer.html. For example: www

pdf.js : How can we get the current pdf page number using pdf.js

纵然是瞬间 提交于 2019-12-23 02:42:36
问题 I want to get the current page number from pdf.js when user Click's some Button.I'm not opening pdf file in iframe like that Below link using iframe I'm using the pdf.js Directly From the GitHub Project My Question is how can I get the Current page Number from pdf.js 回答1: PDFViewerApplication.pdfViewer.currentPageNumber is a getter and setter. Examples: // Go to page 5 PDFViewerApplication.pdfViewer.currentPageNumber = 5; // Move two pages forward PDFViewerApplication.pdfViewer

pdf.js get info about embedded fonts

蹲街弑〆低调 提交于 2019-12-23 02:30:52
问题 I am using pdf.js. Fetching the Text I get blocks with font info Object { str: "blabla", dir: "ltr", width: 191.433141, height: 12.546, transform: Array[6], fontName: "g_d0_f2" } Is it possible to get somehow more information about g_d0_f2 . 回答1: Notice the PDF.js getTextContent will not and not suppose to match glyphs in PDFs. The PDF32000 specification has two different algorithms for text display and extraction. Even if you can lookup font data in the page.commonObjs, it might not be

pdf.js: Changing current page number programmatically

徘徊边缘 提交于 2019-12-21 21:19:41
问题 With pdf.js is there a way to programmatically change the current page of a PDF being viewed? For example, a call to change the current page to page 5. (I know that I can initially set the page by specifying the page number in the URL, but I want to change it programmatically after it has been opened.) 回答1: PDFViewerApplication.pdfViewer.currentPageNumber is a getter and setter. Examples: // Go to page 5 PDFViewerApplication.pdfViewer.currentPageNumber = 5; // Move two pages forward