0.1.4 • Published 5 years ago

pdf-element v0.1.4

Weekly downloads
1
License
BSD-3-Clause
Repository
github
Last release
5 years ago

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

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago