Create a PDF from simple HTML text elements

Usage no npm install needed!

<script type="module">
  import shipperPdfkitHtmlSimple from 'https://cdn.skypack.dev/@shipper/pdfkit-html-simple';


PDFKit HTML Simple

Create a PDF from simple HTML text elements


const PDFKitHTML = require('@shipper/pdfkit-html-simple'),
    html = ```
          <style type="text/css">
            .underline * {
              text-decoration: underline;
          <strong>This is bold</strong>
          <span class="underline">
            <strong>This is bold and underlined</strong>
          <em>This is italic</em>
          <span style="text-decoration: underline;">This is underlined</span>
          <span class="underline">This is also underlined</span>
    .then(function(transformations) {
      // We now have an array of functions to invoke with a document

The result of the promise being an array of functions, each of which expect one parameter, document, and will return a promise resolving with that document

To apply the transformations to the document you can do something like this:

const promise = transformations.reduce(function(promise, transformation) {
  return promise.then(transformation);
}, Promise.resolve(document));

Once the promise is resolved all transformations will be complete and you will have your document.

See examples/simple for example usage