Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF Rendering #2

Closed
knowtheory opened this issue May 16, 2019 · 1 comment
Closed

PDF Rendering #2

knowtheory opened this issue May 16, 2019 · 1 comment

Comments

@knowtheory
Copy link
Collaborator

In browser access to PDF internals should be possible through pdf.js. Firefox relies on pdf.js as it's main PDF display toolkit, and so we can rely on the repo being battle hardened enough to reliably access and render PDF internals.

pdf.js renders pdf pages to an HTML Canvas element, which is a requirement for our fallback layout analysis strategy.

pdf.js isn't trivial to integrate unfortunately, but this is ground that's trod well enough that there are other examples we can follow. By default pdf.js isn't set up to be used as an es6 import. Regretfully, Mozilla's instructions aren't super clear on how to integrate it, and it appears that pdf.js is set up to use CommonJS modules. There's a ticket about this.

There's a react-pdf library which wraps pdf.js and explains how they integrate pdf.js's workers.

We're importing the pdf.js core directly into the main app bundle to provide our ability to manipulate PDFs from the app.

@knowtheory
Copy link
Collaborator Author

After fighting with PDF.js and Rollup for while, I have the pdf.js worker in a deployable state, and a rendering demo set up.

@knowtheory knowtheory mentioned this issue May 16, 2019
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant