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

pdf-images

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdf-images

The pf-images library aims to simplify pdf-conversion by using poppler / pdfImages & imageMagick to convert pdfs to images.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

pdf-images

Simplify pdf-conversion by using in built methods which use poppler & imageMagick to convert pdfs to images.

pdf-image

pdf2image

Note

linux: Ensure you have imagemagick and pdfImages installed
mac: Ensure you have imagemagick and poppler installed
windows: not supported
Poppler is very fast and shows results in milliseconds, however it's accuracy is low compared to image magick. If your pdf has images like for example images of of cards etc. then using poppler is a good idea, however if you have proper pdfs which are let's say converted from md files, then I would suggest using imagemagick.

Usage: Poppler

const { Poppler } = require('pdf-images');
const result = Poppler.convert('/pdf/path/sample_pdf.pdf', 'output/directory/path', 'outputName');
  • A successfull result will look something like:
{
  pdfPath: '/pdf/path/sample_pdf.pf',
  outputImagesDirectory: '/output/directory/outputName/',
  images: [
    '/output/directory/outputName/outputName-001.png',
    '/output/directory/outputName/outputName-002.png'
  ],
  success: true
}
  • An error response will look something like:
	pdfPath: '/pdf/path/sample_pdf.pf',
	error: <Err object>

Usage: ImageMagick

const { ImageMagick } = require('pdf-images');
const result = ImageMagick.convert('/pdf/path/sample_pdf.pdf', 'output/directory/path', 'outputName');
  • A successfull result will look something like:
{
  pdfPath: '/pdf/path/sample_pdf.pf',
  outputImagesDirectory: '/output/directory/outputName/',
  images: [
    '/output/directory/outputName/outputName-001.png',
    '/output/directory/outputName/outputName-002.png'
  ],
  success: true
}
  • An error response will look something like:
{
	pdfPath: '/pdf/path/sample_pdf.pf',
	error: <Err object>
}
  • To set the density and quality of imagemagick use:
ImageMagick.setQuality(100);
ImageMagick.setDensity(200);
  • Default ImageMagick quality is 100 and density is 200

Keywords

FAQs

Package last updated on 04 May 2021

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