Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/pdfkit

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/pdfkit

TypeScript definitions for Pdfkit

  • 0.12.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
181K
decreased by-56.87%
Maintainers
1
Weekly downloads
 
Created

What is @types/pdfkit?

@types/pdfkit provides TypeScript type definitions for the pdfkit library, which is a powerful tool for creating PDF documents in Node.js.

What are @types/pdfkit's main functionalities?

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();

Other packages similar to @types/pdfkit

FAQs

Package last updated on 30 Mar 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc