Git Product home page Git Product logo

pdf.js's Introduction

PDF.JS

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

Online demo

For an online demo, visit:

This demo provides an interactive interface for displaying and browsing PDFs using the pdf.js API.

Extension

A Firefox extension is also available:

Note that this extension is self-updating, and by default Firefox will auto-update extensions on a daily basis (you can change this through the extensions.update.interval option in about:config).

For an experimental Chrome extension, get the code as explained below and issue make extension. Then open Chrome with the flag --enable-experimental-extension-apis, go to Tools > Extension and load the (unpackaged) extension from the directory extensions/chrome.

Getting the code

To get a local copy of the current code, clone it using git:

$ git clone git://github.com/mozilla/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:

$ make server

If everything worked out, you can now serve

You can also view all the test pdf files on the right side serving

Building pdf.js

In order to bundle all src/ files into a final pdf.js, issue:

$ make

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).

Learning

Here are some initial pointers to help contributors get off the ground. Additional resources are available in a separate section below.

Hello world

For a "hello world" example, take a look at:

This example illustrates the bare minimum ingredients for integrating pdf.js in a custom project.

Introductory video

Check out the presentation by our contributor Julian Viereck on the inner workings of PDF and pdf.js:

Contributing

pdf.js is a community-driven project, so contributors are always welcome. Simply fork our repo and contribute away. Good starting places for picking a bug are the top error messages and TODOs in our corpus report:

and of course our open Github issues:

For better consistency and long-term stability, please do look around the code and try to follow our conventions. More information about the contributor process can be found on the contributor wiki page.

If you don't want to hack on the project or have little spare time, you still can help! Just open PDFs in the online demo and report any breakage in rendering.

Our Github contributors so far:

You can add your name to it! :)

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.

Running tests through our bot

If you are a reviewer, you can use our remote bot to issue comprehensive tests against reference images before merging pull requests.

See the bot repo for details:

Additional resources

Gallery of user projects and modifications:

You can read more about pdf.js here:

Talk to us on IRC:

  • #pdfjs on irc.mozilla.org

Join our mailing list:

Subscribe either using lists.mozilla.org or Google Groups:

Follow us on twitter: @pdfjs

PDF-related resources

A really basic overview of PDF is described here:

A more detailed file example:

The PDF specification itself is an ISO and not freely available. However, there is a "PDF Reference" from Adobe:

Recommended chapters to read: "2. Overview", "3.4 File Structure", "4.1 Graphics Objects" that lists the PDF commands.

pdf.js's People

Contributors

vingtetun avatar andreasgal avatar notmasteryet avatar joneschrisg avatar arturadib avatar jviereck avatar brendandahl avatar sayrer avatar kkujala avatar justindarc avatar saebekassebil avatar igstan avatar merkste avatar swznd avatar cpeterso avatar aeosynth avatar jwagner79 avatar debloper avatar gigaherz avatar acornejo avatar legneato avatar devongovett avatar

Stargazers

Putu Robhi Sanjaya avatar  avatar Marina avatar RivDesign avatar AP avatar  avatar  avatar  avatar Victor Åström avatar Nathan avatar Donald John avatar Greida Mendoza avatar Kapiveer avatar Emma avatar Christophe avatar Demyan Moy avatar Ronan Farrell avatar Ника Московцева avatar Maksim Titiaiev avatar DeepSea avatar Javier Zapata avatar lichin-lin avatar  avatar Harold Hersey avatar Chamuth Chamandana avatar Gaurav Tyagi avatar see~see avatar UncleMiKi avatar JooHyung Kim avatar Lucas Gallindo avatar Yew Kwok Chung avatar RosApr avatar Robert Muhlig avatar  avatar Frank Wong avatar  avatar acidburn avatar Robin Tang avatar Alison O. Gaby avatar Brady avatar  avatar Stephen Ohimor avatar Ali Houssein avatar 夏明星 avatar  avatar Worth Lutz avatar Genkagaku.GPT avatar Jason Davis avatar Sergio Barriel avatar ykl avatar FangLiang avatar Eze Olea Figueroa avatar Angus H. avatar cnxzcxy avatar Morgan Paki avatar Сёмка Гавриленко avatar Bruno avatar Felix Leupold avatar Benoit Ricaud avatar apryk avatar Weixing Sun avatar  avatar Pantelis Koukousoulas avatar Yang avatar gn0st1c avatar  avatar Jose Mª Fonseca avatar  avatar Karel Wintersky avatar zcoding avatar jonplaca avatar atkVktr avatar yingbo cheng avatar Kyle Summers avatar Khaidir Hasan avatar 进击的皇虫 avatar antlk avatar Daniel Taveras avatar javayhu avatar Steven Samuel Cole avatar  avatar vincode avatar adslyw avatar  avatar Michael Morgan (Mícheál) avatar Yassine Chabli avatar Geoff Maddock avatar Liam Chapman avatar Maxim Degtyarev avatar Gerónimo Ortiz avatar xuewu avatar Shion avatar  avatar  avatar Edgar de Oliveira Maciel avatar davylin avatar Colby Ludwig avatar Vjatseslav Gedrovits avatar Steve Rad avatar Alexander Tsvetkov avatar

Watchers

Maciej Grajcarek avatar transtone avatar Henry Huang avatar Roderic Page avatar  avatar Rodrigo Lima avatar Andrii Raikov avatar Peter Teoh avatar tom zhou avatar Tully Pettigrew avatar  avatar nickon avatar roadlabs avatar  avatar luk avatar Stephen Ohimor avatar kai avatar  avatar Web Architect avatar Davinir Fabretti de Campos Junior avatar  avatar James Cloos avatar Eriksson avatar wuqiong avatar Christopher Thomson avatar Pedro avatar Terry Brown, Jr. avatar David A Gibson avatar Andre Krug avatar Bohdan Leseiko avatar Adrien Constant avatar  avatar apryk avatar Joshua avatar Huang Tianlai avatar Weixing Sun avatar  avatar  avatar  avatar  avatar SKIE.su avatar enidlareG avatar  avatar  avatar Melissa kuen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.