Questions tagged [pdf.js]

pdf.js is an HTML5-based Portable Document Format (PDF) renderer.

The pdf.js project is community-driven and supported by Mozilla Labs. Its goal is to create a general-purpose, web standards-based platform for parsing and rendering PDFs, and eventually release a PDF reader extension powered by pdf.js.

Integration with Firefox is a possibility if the experiment proves successful.

More information can be found on GitHub (including an online demo) and on the MozillaWiki PDF.js page.

1275 questions
93
votes
2 answers

How to Use pdf.js

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,…
Chris
  • 1,881
  • 3
  • 20
  • 27
83
votes
3 answers

Pdf.js: rendering a pdf file using a base64 file source instead of url

I'm trying to render a page from a pdf with pdf.js Normally, using a url, I can do this: PDFJS.getDocument("http://www.server.com/file.pdf").then(function getPdfHelloWorld(pdf) { // // Fetch the first page // pdf.getPage(1).then(function…
Alex
  • 2,036
  • 4
  • 22
  • 31
65
votes
11 answers

How to display whole PDF (not only one page) with PDF.JS?

I've created this demo: http://polishwords.com.pl/dev/pdfjs/test.html It displays one page. I would like to display all pages. One below another, or place some buttons to change page or even better load all standard controls of PDF.JS like in…
Tom Smykowski
  • 25,487
  • 54
  • 159
  • 236
48
votes
2 answers

Extract text from pdf file using javascript

I want to extract text from pdf file using only Javascript in the client side without using the server. I've already found a javascript code in the following link: extract text from pdf in Javascript and then in…
Coccinelle
  • 527
  • 1
  • 5
  • 6
43
votes
1 answer

Edit *existing* PDF in a browser

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 and toggle through the pages with a dropdown. According to everything I've been able…
neilsimp1
  • 1,242
  • 1
  • 11
  • 25
42
votes
3 answers

PDF.js scale PDF on fixed width

I have a fixed box where I want to display my PDF's in rendered by PDF.js. As PDF.js documentation is not really accessible (spitting through their source files), I'd like to know whether it's possible to scale a rendered PDF on a fixed width. When…
sluijs
  • 4,146
  • 4
  • 30
  • 36
32
votes
16 answers

How to know if PDF.JS has finished rendering?

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…
Malik Ahmed Khan Awan
  • 1,920
  • 2
  • 15
  • 15
28
votes
5 answers

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

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:…
Efrael
  • 557
  • 1
  • 4
  • 11
27
votes
3 answers

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

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…
Andre Pena
  • 56,650
  • 48
  • 196
  • 243
27
votes
3 answers

PDF.js not working on IE9

Does anyone have any clue how to get PDF.js to work on IE 9? I have tried everything I can think of to get it to work and no go. I have downloaded the hack.js file and tried adding it before and after pdf.js and before and after viewer.js. That…
jfreak53
  • 2,239
  • 7
  • 37
  • 53
25
votes
4 answers

pdf.js with text selection

How to make the text in a PDF selectable? Have tried here. The PDF is written fine, but no text…
clarkk
  • 27,151
  • 72
  • 200
  • 340
25
votes
8 answers

Prevent PDF auto download by idm using pdf.js

I'm using PDF.Js to embed PDF file for preview, and I removed the script of download and open files from the viewer.js , but when I test the page and PDF file try to show, the Internet Download Manager download it and abort the preview .. after…
user3003810
  • 941
  • 3
  • 18
  • 45
25
votes
4 answers

Use PDF.js to statically convert a PDF to HTML

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…
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
21
votes
4 answers

Pdf image quality is bad using pdf.js

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…
ryo.ss
  • 221
  • 1
  • 2
  • 4
20
votes
1 answer

pdf.js with local pdf file

I'm trying out the pdf.js library and just want to display a local pdf file on my server instead of the pdf file provided by the example.