Style your documents deterministically.
This project isn't meant to be used out of the box; instead, this project provides an infrastructure for compiling custom data and pre-defined designs into HTML/PDF conveniently. The idea is that you define the designs and data formats and utilise the conversion structure provided by this project.
nix develop
within this project's directory to install our build dependencies.npm install
to install our package dependencies.src/*/data.nix.example
to src/*/data.nix
and populate it with the necessary information.just
to see the available command options.build <design>
: Build the PDF choosing a design.watch <design>
: Watch the build. As you change files, the PDF will regenerate automatically.dist/output.pdf
.Note To use TailwindCSS, set
USE_TAILWINDCSS
to1
. To use a different file location, setINPUT_FILE_PATH
.
npm run dev
for local hosting and npm run start
for production hosting.POST <url>/pdf?target=<design>
:design
must match the exact folder name that you have stored for your design.{
"options": { "tailwindcss": true },
"data": {}
}
POST <url>/html?target=<design>
: The rules are the same as the PDF endpoint.Setup the project? Good. Here's what you need to know to kick-start developing your own designs:
The directory where you will be creating your design(s) is src/<design>
.
Within this directory, you must create a page.svelte
file. This is the entry point of your design. From here, you can either expand to multiple .svelte
files via imports or stick to one, it's up to you.
page.svelte
file, export a variable named data
(see other designs for reference)Once you've created your design, you have 2 options to feed it data.
I recommend that you use option 1 for non-automated use cases, and option 2 for automated ones.
Thanks to @maan2003 for sharing his experience with building PDFs out of plaintext which helped kick-start this project!