Socket
Book a DemoInstallSign in
Socket

pdf2pic

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdf2pic

A utility for converting pdf to image formats. Supports different outputs: directly to file, base64 or buffer.

3.2.0
latest
Source
npmnpm
Version published
Weekly downloads
173K
-2.77%
Maintainers
1
Weekly downloads
 
Created

What is pdf2pic?

The pdf2pic npm package is a tool that allows you to convert PDF documents into images. It is particularly useful for generating image previews of PDF files, which can be used in web applications, document management systems, or any other scenario where visual representation of PDF content is needed.

What are pdf2pic's main functionalities?

Convert PDF to Image

This feature allows you to convert a specific page of a PDF document into an image. The code sample demonstrates how to convert the first page of a PDF file located at './test.pdf' into a PNG image with specified dimensions and save it to a designated path.

const { fromPath } = require('pdf2pic');

const options = {
  density: 100,
  saveFilename: "test",
  savePath: "./images",
  format: "png",
  width: 600,
  height: 600
};

const storeAsImage = fromPath("./test.pdf", options);

storeAsImage(1).then((resolve) => {
  console.log("Page 1 is now converted as image");
  return resolve;
});

Batch Convert PDF to Images

This feature allows you to convert all pages of a PDF document into images in a batch process. The code sample shows how to convert all pages of a PDF file into PNG images and save them to a specified directory.

const { fromPath } = require('pdf2pic');

const options = {
  density: 100,
  saveFilename: "test",
  savePath: "./images",
  format: "png",
  width: 600,
  height: 600
};

const storeAsImage = fromPath("./test.pdf", options);

storeAsImage.bulk(-1).then((resolve) => {
  console.log("All pages are now converted as images");
  return resolve;
});

Other packages similar to pdf2pic

Keywords

pdf-to-image

FAQs

Package last updated on 27 May 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.