Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spaceninja/eleventy-pdf
Demo of a static website converted to PDF
https://github.com/spaceninja/eleventy-pdf
docraptor eleventy pdf
Last synced: 2 days ago
JSON representation
Demo of a static website converted to PDF
- Host: GitHub
- URL: https://github.com/spaceninja/eleventy-pdf
- Owner: spaceninja
- Created: 2023-08-09T17:54:26.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-02T04:01:38.000Z (6 days ago)
- Last Synced: 2024-11-02T05:16:17.375Z (6 days ago)
- Topics: docraptor, eleventy, pdf
- Language: SCSS
- Homepage: https://eleventy-pdf.netlify.app/
- Size: 3.78 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Eleventy PDF
This repo is an example of how to have a static website that is automatically converted into a PDF using [DocRaptor](https://docraptor.com/). We're using Eleventy, but you could use any static site generator, including hand-maintained HTML files. We're using DocRaptor, which is a friendly and affordable API build on top of the [Prince PDF](https://www.princexml.com/) service, but you could use other HTML-to-PDF services, including [WeasyPrint](https://weasyprint.org/) or the [Adobe PDF Services API](https://developer.adobe.com/document-services/apis/pdf-services/).
## How This Works
The repo will build a standard static site — in this case, a chapter-navigable version of the Sherlock Holmes story, _A Study In Scarlet_ — with some basic CSS.
In addition, it will output a single-page version of the entire book. This HTML file loads the same CSS as the main site, it just keeps everything in a single file, which is needed so DocRaptor can add page numbers.
We then have a node script that will load the contents of the single-page version, inline all the CSS and images, and then submit the resulting HTML to the DocRaptor API, which returns a PDF that we save to the `dist` directory.
For more information, check out [`build-pdf.mjs`](build-pdf.mjs) and this blog post (coming soon).
You can also view the [demo site](https://eleventy-pdf.netlify.app/) and the [demo pdf](https://eleventy-pdf.netlify.app/pdf/a-study-in-scarlet.pdf).