Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
The pdfmake npm package is a server-side and client-side library for generating PDF documents from a JSON-based structure. It provides a declarative API that allows developers to layout text, images, vectors, and other elements in a PDF document.
Text and Typography
This feature allows you to add text to your PDF with various typography settings such as font size, style, and weight.
{"content": [{"text": "Hello World", "style": "header"}], "styles": {"header": {"fontSize": 18, "bold": true}}}
Lists
With this feature, you can create ordered and unordered lists within your PDF document.
{"content": [{"ul": ["Item 1", "Item 2", "Item 3"]}]}
Tables
This feature allows you to insert tables into your PDF, with customizable rows, columns, and styling.
{"content": [{"table": {"body": [["Column 1", "Column 2", "Column 3"], ["Value 1", "Value 2", "Value 3"]]}}]}
Images
This feature enables you to embed images in your PDF documents, with support for various formats and base64 encoded sources.
{"content": [{"image": "data:image/jpeg;base64,...", "width": 200}]}
Vector Graphics
With vector graphics, you can draw shapes and paths to create custom illustrations and designs in your PDF.
{"content": [{"canvas": [{"type": "rect", "x": 0, "y": 0, "w": 100, "h": 100, "color": "#E53935"}]}]}
html-pdf is a Node.js package that converts HTML to PDF. It uses PhantomJS as a rendering engine. Unlike pdfmake, which uses a JSON structure, html-pdf allows you to define your PDF layout using HTML and CSS.
pdf-lib is a library for creating and modifying PDF documents in any JavaScript environment. It provides low-level PDF manipulation capabilities and differs from pdfmake by offering more control over the PDF creation process at the expense of a steeper learning curve.
PDF document generation library for server-side and client-side usage in pure JavaScript.
Check out the playground and examples.
Documentation URL: https://pdfmake.github.io/docs/
using npm:
git clone --branch 0.2 https://github.com/bpampuch/pdfmake.git
cd pdfmake
npm install
npm run build
using yarn:
git clone --branch 0.2 https://github.com/bpampuch/pdfmake.git
cd pdfmake
yarn
yarn run build
MIT
pdfmake is based on a truly amazing library pdfkit (credits to @devongovett).
Thanks to all contributors.
FAQs
Client/server side PDF printing in pure JavaScript
The npm package pdfmake receives a total of 749,646 weekly downloads. As such, pdfmake popularity was classified as popular.
We found that pdfmake demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.