|
1 |
| -pdf.js has moved to: https://github.com/mozilla/pdf.js |
| 1 | +# pdf.js |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +pdf.js is an HTML5 technology experiment that explores building a faithful |
| 8 | +and efficient Portable Document Format (PDF) renderer without native code |
| 9 | +assistance. |
| 10 | + |
| 11 | +pdf.js is community-driven and supported by Mozilla Labs. Our goal is to |
| 12 | +create a general-purpose, web standards-based platform for parsing and |
| 13 | +rendering PDFs, and eventually release a PDF reader extension powered by |
| 14 | +pdf.js. Integration with Firefox is a possibility if the experiment proves |
| 15 | +successful. |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +## Getting started |
| 20 | + |
| 21 | +### Online demo |
| 22 | + |
| 23 | +For an online demo, visit: |
| 24 | + |
| 25 | ++ http://mozilla.github.com/pdf.js/web/viewer.html |
| 26 | + |
| 27 | +This demo provides an interactive interface for displaying and browsing PDFs |
| 28 | +using the pdf.js API. |
| 29 | + |
| 30 | +### Extension |
| 31 | + |
| 32 | +A Firefox extension is also available: |
| 33 | + |
| 34 | ++ http://mozilla.github.com/pdf.js/extensions/firefox/pdf.js.xpi |
| 35 | + |
| 36 | +However, note that the extension might not reflect the latest source in our master branch. |
| 37 | + |
| 38 | +### Getting the code |
| 39 | + |
| 40 | +To get a local copy of the current code, clone it using git: |
| 41 | + |
| 42 | + $ git clone git://github.com/mozilla/pdf.js.git pdfjs |
| 43 | + $ cd pdfjs |
| 44 | + |
| 45 | +Next, you need to start a local web server as some browsers don't allow opening |
| 46 | +PDF files for a file:// url: |
| 47 | + |
| 48 | + $ make server |
| 49 | + |
| 50 | +If everything worked out, you can now serve |
| 51 | + |
| 52 | ++ http://localhost:8888/web/viewer.html |
| 53 | + |
| 54 | +You can also view all the test pdf files on the right side serving |
| 55 | + |
| 56 | ++ http://localhost:8888/test/pdfs/?frame |
| 57 | + |
| 58 | +### Building pdf.js |
| 59 | + |
| 60 | +In order to bundle all `src/` files into a final `pdf.js`, issue: |
| 61 | + |
| 62 | + $ make |
| 63 | + |
| 64 | +This will generate the file `build/pdf.js` that can be included in your final project. (WARNING: That's a large file! Consider minifying it). |
| 65 | + |
| 66 | + |
| 67 | +## Learning |
| 68 | + |
| 69 | +Here are some initial pointers to help contributors get off the ground. |
| 70 | +Additional resources are available in a separate section below. |
| 71 | + |
| 72 | +#### Hello world |
| 73 | + |
| 74 | +For a "hello world" example, take a look at: |
| 75 | + |
| 76 | ++ [examples/helloworld/hello.js](https://github.com/mozilla/pdf.js/blob/master/examples/helloworld/hello.js) |
| 77 | + |
| 78 | +This example illustrates the bare minimum ingredients for integrating pdf.js |
| 79 | +in a custom project. |
| 80 | + |
| 81 | +#### Introductory video |
| 82 | + |
| 83 | +Check out the presentation by our contributor Julian Viereck on the inner |
| 84 | +workings of PDF and pdf.js: |
| 85 | + |
| 86 | ++ http://www.youtube.com/watch?v=Iv15UY-4Fg8 |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | +## Contributing |
| 92 | + |
| 93 | +pdf.js is a community-driven project, so contributors are always welcome. |
| 94 | +Simply fork our repo and contribute away. A great place to start is our |
| 95 | +[open issues](https://github.com/mozilla/pdf.js/issues). For better consistency and |
| 96 | +long-term stability, please do look around the code and try to follow our conventions. |
| 97 | +More information about the contributor process can be found on the |
| 98 | +[contributor wiki page](https://github.com/mozilla/pdf.js/wiki/Contributing). |
| 99 | + |
| 100 | +If you don't want to hack on the project or have little spare time, __you still |
| 101 | +can help!__ Just open PDFs in the |
| 102 | +[online demo](http://mozilla.github.com/pdf.js/web/viewer.html) and report |
| 103 | +any breakage in rendering. |
| 104 | + |
| 105 | +Our Github contributors so far: |
| 106 | + |
| 107 | ++ https://github.com/mozilla/pdf.js/contributors |
| 108 | + |
| 109 | +You can add your name to it! :) |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | +## Running the tests |
| 114 | + |
| 115 | +pdf.js comes with browser-level regression tests that allow one to probe |
| 116 | +whether it's able to successfully parse PDFs, as well as compare its output |
| 117 | +against reference images, pixel-by-pixel. |
| 118 | + |
| 119 | +To run the tests, first configure the browser manifest file at: |
| 120 | + |
| 121 | + test/resources/browser_manifests/browser_manifest.json |
| 122 | + |
| 123 | +Sample manifests for different platforms are provided in that directory. |
| 124 | + |
| 125 | +To run all the bundled tests, type: |
| 126 | + |
| 127 | + $ make test |
| 128 | + |
| 129 | +and cross your fingers. Different types of tests are available, see the test |
| 130 | +manifest file at: |
| 131 | + |
| 132 | + test/test_manifest.json |
| 133 | + |
| 134 | +The test type `eq` tests whether the output images are identical to reference |
| 135 | +images. The test type `load` simply tests whether the file loads without |
| 136 | +raising any errors. |
| 137 | + |
| 138 | + |
| 139 | +## Running tests through our bot |
| 140 | + |
| 141 | +If you are a reviewer, you can use our remote bot to issue comprehensive tests |
| 142 | +against reference images before merging pull requests. |
| 143 | + |
| 144 | +See the bot repo for details: |
| 145 | + |
| 146 | ++ https://github.com/mozilla/pdf.js-bot |
| 147 | + |
| 148 | + |
| 149 | +## Additional resources |
| 150 | + |
| 151 | +Our demo site is here: |
| 152 | + |
| 153 | ++ http://mozilla.github.com/pdf.js/web/viewer.html |
| 154 | + |
| 155 | +You can read more about pdf.js here: |
| 156 | + |
| 157 | ++ http://andreasgal.com/2011/06/15/pdf-js/ |
| 158 | ++ http://blog.mozilla.com/cjones/2011/06/15/overview-of-pdf-js-guts/ |
| 159 | + |
| 160 | +Talk to us on IRC: |
| 161 | + |
| 162 | ++ #pdfjs on irc.mozilla.org |
| 163 | + |
| 164 | +Join our mailing list: |
| 165 | + |
| 166 | ++ dev-pdf-js@lists.mozilla.org |
| 167 | + |
| 168 | +Subscribe either using lists.mozilla.org or Google Groups: |
| 169 | + |
| 170 | ++ https://lists.mozilla.org/listinfo/dev-pdf-js |
| 171 | ++ https://groups.google.com/group/mozilla.dev.pdf-js/topics |
| 172 | + |
| 173 | +Follow us on twitter: @pdfjs |
| 174 | + |
| 175 | ++ http://twitter.com/#!/pdfjs |
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | +## PDF-related resources |
| 180 | + |
| 181 | +A really basic overview of PDF is described here: |
| 182 | + |
| 183 | ++ http://partners.adobe.com/public/developer/en/livecycle/lc_pdf_overview_format.pdf |
| 184 | + |
| 185 | +A more detailed file example: |
| 186 | + |
| 187 | ++ http://gnupdf.org/Introduction_to_PDF |
| 188 | + |
| 189 | +The PDF specification itself is an ISO and not freely available. However, there is |
| 190 | +a "PDF Reference" from Adobe: |
| 191 | + |
| 192 | ++ http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf |
| 193 | + |
| 194 | +Recommended chapters to read: "2. Overview", "3.4 File Structure", |
| 195 | +"4.1 Graphics Objects" that lists the PDF commands. |
0 commit comments