Skip to content

sashee/pdf-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF to image loader for Webpack

This loader gets a PDF file, converts it to images, and emit those files. It also returns the dimensions for each page.

Prerequisites

It calls the pdftocairo command which must be installed prior to using this plugin. It is included in Poppler.

Installation

npm install pdf-loader

Usage

Load the PDF using import:

import pdf from "pdf-loader!./my.pdf";

The pdf variable holds the paths to the images and the dimensions:

[
  {image: "/my-page0-hash.png", size: {width: 595, height: 842}},
  {image: "/my-page1-hash.png", size: {width: 595, height: 842}},
  ...
]

If you use React, you can insert the pages directly to the DOM:

<img src={pdf[0].image}/>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published