2011-06-29 17:00:16 +09:00
|
|
|
# pdf.js
|
|
|
|
|
2011-06-17 01:37:15 +09:00
|
|
|
|
2011-09-16 08:28:38 +09:00
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
|
|
pdf.js is an HTML5 technology experiment that explores building a faithful
|
|
|
|
and efficient Portable Document Format (PDF) renderer without native code
|
|
|
|
assistance.
|
|
|
|
|
|
|
|
pdf.js is community-driven and supported by Mozilla Labs. Our 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Getting started
|
|
|
|
|
2011-09-16 08:39:18 +09:00
|
|
|
**Online demo**
|
|
|
|
|
2011-09-16 08:28:38 +09:00
|
|
|
For an online demo, visit:
|
|
|
|
|
|
|
|
http://andreasgal.github.com/pdf.js/web/viewer.html
|
|
|
|
|
|
|
|
This demo provides an interactive interface for displaying and browsing PDFs
|
|
|
|
using the pdf.js API.
|
|
|
|
|
2011-09-25 18:44:29 +09:00
|
|
|
**Getting the code**
|
|
|
|
|
|
|
|
To get a local copy of the current code, clone it using git:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
git clone git://github.com/andreasgal/pdf.js.git pdfjs
|
|
|
|
cd pdfjs
|
|
|
|
```
|
|
|
|
|
|
|
|
Next, you need to start a local web server as some browsers don't allow opening
|
|
|
|
PDF files for a file:// url:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
make server
|
|
|
|
```
|
|
|
|
|
|
|
|
If everything worked out, you can now serve
|
|
|
|
|
|
|
|
http://localhost:8888/web/viewer.html
|
|
|
|
|
|
|
|
You can also view all the test pdf files on the right side serving
|
|
|
|
|
|
|
|
http://localhost:8888/test/pdfs/?frame
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-16 08:39:18 +09:00
|
|
|
**Hello world**
|
|
|
|
|
2011-09-16 08:28:38 +09:00
|
|
|
For a "hello world" example, take a look at:
|
|
|
|
|
|
|
|
examples/helloworld/
|
|
|
|
|
|
|
|
This example illustrates the bare minimum ingredients for integrating pdf.js
|
|
|
|
in a custom project.
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-25 18:48:12 +09:00
|
|
|
## Contributing
|
|
|
|
|
|
|
|
pdf.js is a community-driver project, so contributors are always welcome.
|
|
|
|
Simply fork our repo and contribute away. A great place to start is our
|
|
|
|
open issues. For better consistency and long-term stability, please do look around the
|
|
|
|
code and try to follow our conventions.
|
|
|
|
|
|
|
|
If you __don't want to hack__ on the project or have short spare times, you still
|
|
|
|
can help! Just open PDFs in the
|
|
|
|
[online demo](http://andreasgal.github.com/pdf.js/web/viewer.html) and report
|
|
|
|
any breakage in rendering.
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-16 08:28:38 +09:00
|
|
|
## Running the Tests
|
|
|
|
|
|
|
|
pdf.js comes with browser-level regression tests that allow one to probe
|
|
|
|
whether it's able to successfully parse PDFs, as well as compare its output
|
|
|
|
against reference images, pixel-by-pixel.
|
|
|
|
|
|
|
|
To run the tests, first configure the browser manifest file at:
|
|
|
|
|
|
|
|
test/resources/browser_manifests/browser_manifest.json
|
|
|
|
|
|
|
|
Sample manifests for different platforms are provided in that directory.
|
|
|
|
|
|
|
|
To run all the bundled tests, type:
|
|
|
|
|
|
|
|
$ make test
|
|
|
|
|
|
|
|
and cross your fingers. Different types of tests are available, see the test
|
|
|
|
manifest file at:
|
|
|
|
|
|
|
|
test/test_manifest.json
|
|
|
|
|
|
|
|
The test type `eq` tests whether the output images are identical to reference
|
|
|
|
images. The test type `load` simply tests whether the file loads without
|
|
|
|
raising any errors.
|
|
|
|
|
|
|
|
|
|
|
|
## Additional resources
|
2011-06-29 17:00:16 +09:00
|
|
|
|
2011-07-03 01:30:46 +09:00
|
|
|
Our demo site is here:
|
|
|
|
|
2011-09-16 08:28:38 +09:00
|
|
|
http://andreasgal.github.com/pdf.js/web/viewer.html
|
2011-07-03 01:30:46 +09:00
|
|
|
|
2011-06-17 01:37:15 +09:00
|
|
|
You can read more about pdf.js here:
|
|
|
|
|
2011-06-29 17:01:49 +09:00
|
|
|
http://andreasgal.com/2011/06/15/pdf-js/
|
2011-07-03 01:28:13 +09:00
|
|
|
|
2011-06-29 17:01:49 +09:00
|
|
|
http://blog.mozilla.com/cjones/2011/06/15/overview-of-pdf-js-guts/
|
2011-06-17 01:37:15 +09:00
|
|
|
|
2011-09-16 08:28:38 +09:00
|
|
|
Follow us on twitter: @pdfjs
|
2011-06-17 01:37:15 +09:00
|
|
|
|
2011-06-29 17:01:49 +09:00
|
|
|
http://twitter.com/#!/pdfjs
|
2011-06-29 08:02:02 +09:00
|
|
|
|
2011-09-20 03:11:14 +09:00
|
|
|
Join our mailing list:
|
2011-06-29 08:02:02 +09:00
|
|
|
|
2011-06-29 17:01:49 +09:00
|
|
|
dev-pdf-js@lists.mozilla.org
|
2011-09-20 03:11:14 +09:00
|
|
|
|
|
|
|
Subscribe either using lists.mozilla.org or Google Groups:
|
|
|
|
|
|
|
|
https://lists.mozilla.org/listinfo/dev-pdf-js
|
2011-09-25 18:44:29 +09:00
|
|
|
|
2011-09-20 03:11:14 +09:00
|
|
|
https://groups.google.com/group/mozilla.dev.pdf-js/topics
|
2011-06-29 08:02:02 +09:00
|
|
|
|
2011-09-16 08:28:38 +09:00
|
|
|
Talk to us on IRC:
|
2011-06-29 08:02:02 +09:00
|
|
|
|
2011-06-29 17:01:49 +09:00
|
|
|
#pdfjs on irc.mozilla.org
|