Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html5 component for rendering and annotating PDF documents in the browser?

I am trying to build a webapp that can view and annotate PDF files in a browser without flash player installed (like an iPad). Are there any free or cheap components that render a PDF in html, JS and canvas? Thanks!

like image 509
user648891 Avatar asked Mar 07 '11 21:03

user648891


3 Answers

Not that I am aware of. (I am assuming you googled for it, so I am skipping that). This is obviously a missing thing for the web -- (I found a toy implementation here: http://ajaxian.com/archives/wps-postscript-and-pdf-interpreter-for-html-5-canvas - but it is just a toy for now).

A serious product could adapt Ghostscript itself to Javascript using a project like http://code.google.com/p/emscripten/ -- which can compile C code to LLVM and then to javascript. There is an example of the entire Python interpreter built into javascript in this way running here: http://syntensity.com/static/python.html

Certainly it would not be trivial, and the output part to canvas, and UI, would need to be written anyway. I think it won't fit your needs now, but I am writing it here, so that maybe someone could make this happen.

In the mean time, you could consider running Ghostscript (http://pages.cs.wisc.edu/~ghost/doc/intro.htm) server side, and deliver pre-rendered PNG images to the browser. That would be far easier to do, although it would demand a lot of server juice.

like image 73
jsbueno Avatar answered Nov 01 '22 23:11

jsbueno


I was looking for something similar recently:

pdf.js (by Andreas Gal @ mozilla inter alia) is under development with the goal to render PDF directly with HTML5 and JavaScript. It's on github [ https://github.com/andreasgal/pdf.js ]

It's worth reading the announcement post and comments (140+) [ http://andreasgal.com/2011/06/15/pdf-js/ ]

like image 44
martin Avatar answered Nov 01 '22 21:11

martin


<iframe src="http://docs.google.com/gview?url=http://domain.com/pdf.pdf&embedded=true" 
style="width:600px; height:500px;" frameborder="0"></iframe>

Google docs allows you to embed PDFs, Microsoft Office Docs, and other applications by just linking to their services with an iframe. Its user-friendly, versatile, and attractive.

like image 2
John Foley Avatar answered Nov 01 '22 23:11

John Foley