Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@types/pdfkit
Advanced tools
@types/pdfkit provides TypeScript type definitions for the pdfkit library, which is a powerful tool for creating PDF documents in Node.js.
Create a PDF Document
This feature allows you to create a new PDF document and add text to it. The document is then saved to a file named 'output.pdf'.
const PDFDocument = require('pdfkit');
const doc = new PDFDocument();
doc.pipe(fs.createWriteStream('output.pdf'));
doc.text('Hello, world!');
doc.end();
Add Images
This feature allows you to add images to your PDF document. The image is added with specific dimensions and alignment.
const PDFDocument = require('pdfkit');
const doc = new PDFDocument();
doc.pipe(fs.createWriteStream('output.pdf'));
doc.image('path/to/image.png', { fit: [250, 300], align: 'center', valign: 'center' });
doc.end();
Draw Shapes
This feature allows you to draw shapes, such as rectangles, in your PDF document. The rectangle is drawn with specified dimensions and position.
const PDFDocument = require('pdfkit');
const doc = new PDFDocument();
doc.pipe(fs.createWriteStream('output.pdf'));
doc.rect(100, 100, 200, 200).stroke();
doc.end();
Add Links
This feature allows you to add hyperlinks to your PDF document. The text 'Click here' is linked to 'http://example.com' and is underlined.
const PDFDocument = require('pdfkit');
const doc = new PDFDocument();
doc.pipe(fs.createWriteStream('output.pdf'));
doc.text('Click here', { link: 'http://example.com', underline: true });
doc.end();
pdf-lib is a library for creating and modifying PDF documents in JavaScript. It offers a more modern API and is written in TypeScript, which provides better type safety compared to pdfkit.
jspdf is a popular library for generating PDF documents in JavaScript. It is often used in web applications and has a wide range of features, including support for adding text, images, and shapes. However, it is primarily focused on client-side usage.
pdfmake is a library for creating PDF documents in JavaScript. It provides a declarative syntax for defining the content and layout of the PDF, making it easier to create complex documents. It is similar to pdfkit but offers a different approach to document creation.
npm install --save @types/pdfkit
This package contains type definitions for Pdfkit (http://pdfkit.org).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pdfkit.
PDFKit
These definitions were written by Eric Hillah, Erik Berreßem, Jeroen Vervaeke, Thales Agapito, Evgeny Baram, Benjamin Just, Joanna Gabis, and Robin Guinant.
FAQs
TypeScript definitions for pdfkit
The npm package @types/pdfkit receives a total of 167,343 weekly downloads. As such, @types/pdfkit popularity was classified as popular.
We found that @types/pdfkit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.