https://github.com/bburdette/pdf-element
pdf.js custom element for elm
https://github.com/bburdette/pdf-element
Last synced: about 1 month ago
JSON representation
pdf.js custom element for elm
- Host: GitHub
- URL: https://github.com/bburdette/pdf-element
- Owner: bburdette
- License: bsd-3-clause
- Created: 2019-10-22T17:52:31.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-05-11T21:26:00.000Z (about 3 years ago)
- Last Synced: 2025-04-01T21:01:50.768Z (about 2 months ago)
- Language: Elm
- Homepage:
- Size: 43.9 KB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bburdette/pdf-element
This elm package has an associated 'pdf-element' npm package; together they provide a
custom element for rendering PDFs in elm, using mozilla's pdf.js library. Using a tool like
parcel (which is very nice) to build the project is pretty much a requirement as of now.
There's a parcel project in the example folder.Pdf documents live in javascript; you open and close them using Elm Cmds. If an open Cmd is
successful, you should receive a Loaded msg in return; otherwise you'll get an Error.When you open a pdf, you give it a name - just an arbitrary string. You can use this name
to make one or more custom elements that refer to the same document, with the pdfPage function.
Each custom element is identified by its document name, page number, and sizing. Its up to you
to close the pdf when you're done with it, with a Cmd.To make everything work you'll need to set up two ports on the Elm side - the PdfElement docs
has some sample code. On the javascript side you'll need to wire up the sendPdfCommand port.
See example/index.js for that.[Documentation](http://package.elm-lang.org/packages/bburdette/pdf-element/latest)