pdf.js

Convert pdf to a single page editable html

给你一囗甜甜゛ 提交于 2019-12-03 14:52:32
I have been trying to convert a pdf file to a single nice html page .After surfing about it. The solutions I have got are little bit lacking to my requirements.As I have to create individual html pages for say about 200 pdf files.As online converters might not be a leading solution. So I tried the following solutions along with the requirements not being fulfilled. embed tag of html5 + embeds a pdf into html page nicely. - HTML page is not editable since it simply embeds the pdf to html page. pdftohtml + Converts the pdf to single html page. - the look is not very nice. pdf.js + Converts the

Links, Hyperlinks into a canvas using PDF.js

大城市里の小女人 提交于 2019-12-03 14:25:50
I'm using PDF.js library to render a pdf into the canvas. That pdf has hyperlinks in there, The PDF.js library is drawing the pdf into the canvas but the hyperlinks doesn't work. Any Idea if it possible that hyperlinks works into the canvas? Thanks Here is a fiddle that shows you how to enable annotations (including hyperlinks) in PDF files. The original PDF file used in the fiddle is here . I used viewer code ( web/page_view.js , web/viewer.css ) as refrence to write this fiddle. HTML: <!doctype html> <html lang="en"> <head> <link href="style.css" rel="stylesheet" media="screen" /> <script

Pdf image quality is bad using pdf.js

你说的曾经没有我的故事 提交于 2019-12-03 11:44:37
I am using pdf.js. But, image quality of PDF is low quality. Please tell me solution method. var TARGET_PAGE = 1; var PAGE_SCALE = 1; function viewPDF(targetPage,pageScale){ PDFJS.getDocument(targetPath).then(function (pdf) { return pdf.getPage(targetPage); }).then(function (page) { var scale = pageScale; var viewport = page.getViewport(scale); var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); canvas.height = viewport.height; canvas.width = viewport.width; var renderContext = { canvasContext: context, viewport: viewport }; page.render(renderContext);

pdf.js with text selection

人走茶凉 提交于 2019-12-03 07:28:24
问题 How to make the text in a PDF selectable? Have tried here. The PDF is written fine, but no text selection https://github.com/mozilla/pdf.js https://github.com/mozilla/pdf.js/blob/master/web/text_layer_builder.css https://github.com/mozilla/pdf.js/blob/master/web/text_layer_builder.js 'use strict'; PDFJS.getDocument('file.pdf').then(function(pdf){ var page_num = 1; pdf.getPage(page_num).then(function(page){ var scale = 1.5; var viewport = page.getViewport(scale); var canvas = document

Edit *existing* PDF in a browser

六月ゝ 毕业季﹏ 提交于 2019-12-03 04:24:43
问题 I have a web application that is currently getting a base64 representation of a PDF from the server. I'm able to use Mozilla's pdf.js to display this on a <canvas> and toggle through the pages with a dropdown. According to everything I've been able to find and Can Mozilla's pdf.js modify PDFs?, it's not possible to edit the PDF with pdf.js. I've found jsPDF and while I'm able to take the canvas and do a .toDataURL() with it for each page and build a new PDF document with it, but there are two

pdf.js with text selection

杀马特。学长 韩版系。学妹 提交于 2019-12-02 22:20:31
How to make the text in a PDF selectable? Have tried here. The PDF is written fine, but no text selection https://github.com/mozilla/pdf.js https://github.com/mozilla/pdf.js/blob/master/web/text_layer_builder.css https://github.com/mozilla/pdf.js/blob/master/web/text_layer_builder.js 'use strict'; PDFJS.getDocument('file.pdf').then(function(pdf){ var page_num = 1; pdf.getPage(page_num).then(function(page){ var scale = 1.5; var viewport = page.getViewport(scale); var canvas = document.getElementById('the-canvas'); var context = canvas.getContext('2d'); canvas.height = viewport.height; canvas

Edit *existing* PDF in a browser

回眸只為那壹抹淺笑 提交于 2019-12-02 18:43:13
I have a web application that is currently getting a base64 representation of a PDF from the server. I'm able to use Mozilla's pdf.js to display this on a <canvas> and toggle through the pages with a dropdown. According to everything I've been able to find and Can Mozilla's pdf.js modify PDFs? , it's not possible to edit the PDF with pdf.js. I've found jsPDF and while I'm able to take the canvas and do a .toDataURL() with it for each page and build a new PDF document with it, but there are two issues: The newly generated PDF will just be a series of images on each page, so any text in the

PDF.js Message: file origin does not match viewer's (Amazon S3)

扶醉桌前 提交于 2019-12-02 08:41:12
In a Rails app, using the pdfjs_viewer-rails gem ( https://github.com/senny/pdfjs_viewer-rails ), I keep seeing this error: PDF.js v1.3.91 (build: d1e83b5) Message: file origin does not match viewer's I presume this is because the PDF is hosted on Amazon S3, and I have read through the discussion of CORS here ( https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr ). However, I have been unable to assemble a COSR configuration that works. My current bucket configuration is: <?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03

Qt 5.8 and Pdf.js error

爱⌒轻易说出口 提交于 2019-12-02 05:44:28
I have a problem with pdf.js and Qt 5.8, i tried to do the same code in this link Using pdf.js with Qt5.8 in my application but he doesn't work i dont know why, qt show me this message about JS : "js: Uncaught TypeError: Cannot read property 'PDFJS' of undefined". this is my code in mainwindow : QWebEngineView *view; QString pdfFileURL; QString pathToPDFjs = QString("file:///"+qApp->applicationDirPath()+"/libraries/PDF/viewer.html"); pdfFileURL = "file:///C:/Users/Administrateur/Desktop/CV.pdf"; view = new QWebEngineView(); this->setCentralWidget(view); view->load(QUrl::fromUserInput

PDF.js is randomly crashing the Google Chrome tab

ぃ、小莉子 提交于 2019-12-02 04:29:17
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 worked fine. When I used Google Chrome on my first PC to launch PDF.js, I found it worked fine. When I used