
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
pdfmake-html-renderer
Advanced tools
JavaScript/HTML renderer for [pdfmake](http://pdfmake.org) PDF document definition objects.
JavaScript/HTML renderer for pdfmake PDF document definition objects.
Playground: https://kryops.github.io/pdfmake-html-renderer/
absolutePosition
are positioned in reference to the topX
linkToPage
properties are ignoredpageBreak
are rendered as a horizontal linepageBreakBefore
is not implementedmode: 'fluid'
is set)*
and auto
widthsalignment
propertypdfmake
aligns them to the leftpdfmake
, and may be larger for some values of fit
Currently, only evergreen browsers are supported explicitly (see .browserslistrc
).
If you need to support older browsers with your application, you should be able to run this library through Babel as part of your build process and polyfill newer APIs through core-js.
On old browsers that do not support CSS variables, some styles may be broken.
npm install pdfmake-html-renderer
import 'pdfmake-html-renderer/dist/index.css'
NOTE: For this to work, make sure your tooling/bundler supports importing CSS files. Otherwise, you can always use a
<link rel="stylesheet">
in your HTML file.
Any fonts used in your PDF document definitions, including the default Roboto font, should be imported using CSS @font-face
rules.
To use the version provided by Google Fonts, add the following HTML to your <head>
:
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400;1,700&display=swap"
rel="stylesheet"
/>
Otherwise, the renderer may use a fallback font depending on the fonts installed on the machine.
style-src 'unsafe-inline'
as computed styles are set inlineimage-src data:
for images passed as data URLimport PdfmakeHtmlRenderer from 'pdfmake-html-renderer'
This library was built using the Svelte framework, which should allow integrating it into pretty much any web application:
svelte-adapter
Check out the /examples
folder for some example projects.
TIP: If you don't need QR Code support, you can try and ignore the
qrcode
package in your build process / bundler. This will roughly cut this package's bundle size in half.
This package provides TypeScript typings. They depend on the typings for svelte
and pdfmake
, which are not included as dependencies and need to be added manually:
npm install -D svelte @types/pdfmake
This library also provides an experimental server build that renders static HTML and CSS:
const { PdfmakeHtmlRenderer } = require('pdfmake-html-renderer/server')
const { html, css } = PdfmakeHtmlRenderer.render({
document: { content: ['Hello, world!'] },
})
// html contains the HTML code
// css.code contains the CSS code
Check out /examples/nodejs
for an exmaple.
Rendering on the server comes with some additional limitations:
document: TDocumentDefinitions
The pdfmake document definition
pageShadow?: boolean
Whether or not to display a shadow around the page.
Defaults to true
mode?: 'shrinkToFit' | 'zoomToFit' | 'natural' | 'fluid'
Rendering / sizing mode
shrinkToFit
(default): Shrinks the document to fit in its container,
but does not grow beyond the document's natural sizezoomToFit
: Shrinks or grows the document to fit in its containernatural
: Renders the document in its exact natural sizefluid
: Ignores the document's pageSize
and uses the space available in the containerWhen the document
definition does not specify a pageSize
property,
the standard size 'A4'
is assumed.
v0.3.1 - 2024-08-25
FAQs
JavaScript/HTML renderer for [pdfmake](http://pdfmake.org) PDF document definition objects.
The npm package pdfmake-html-renderer receives a total of 150 weekly downloads. As such, pdfmake-html-renderer popularity was classified as not popular.
We found that pdfmake-html-renderer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.