Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
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
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.