All Projects → yakovmeister → Pdf2image

yakovmeister / Pdf2image

Licence: mit
A utility for converting pdf to image and base64 format.

Programming Languages

typescript
32286 projects

Labels

Projects that are alternatives of or similar to Pdf2image

Gpnd
Generative Probabilistic Novelty Detection with Adversarial Autoencoders
Stars: ✭ 112 (-8.2%)
Mutual labels:  pdf
Cheatsheet
Pretty cheat sheets, or ``reference cards'', obtainable from Org files.
Stars: ✭ 116 (-4.92%)
Mutual labels:  pdf
Pdf2img
convert pdf to img,使用JS将PDF转换为图片,压缩成.zip下载,可直接在线查看demo!如有疑问,可通过个人主页邮箱联系。
Stars: ✭ 121 (-0.82%)
Mutual labels:  pdf
Qpdf
PDF viewer widget for Qt
Stars: ✭ 111 (-9.02%)
Mutual labels:  pdf
Technology books
Premium eBook free for Geeks
Stars: ✭ 115 (-5.74%)
Mutual labels:  pdf
React Antd Admin
后台前端管理系统,基于react、typescript、antd、dva及一些特别优秀的开源库实现
Stars: ✭ 117 (-4.1%)
Mutual labels:  pdf
Bepasty Server
binary pastebin server
Stars: ✭ 111 (-9.02%)
Mutual labels:  pdf
Pdfboxing
Nice wrapper of PDFBox in Clojure
Stars: ✭ 122 (+0%)
Mutual labels:  pdf
Hypertag
Knowledge Management for Humans using Machine Learning & Tags
Stars: ✭ 116 (-4.92%)
Mutual labels:  pdf
Py Pdf Parser
A Python tool to help extracting information from structured PDFs.
Stars: ✭ 120 (-1.64%)
Mutual labels:  pdf
Terraform Docs As Pdf
Complete Terraform documentation (core + all official providers) as PDF files. Updating nightly.
Stars: ✭ 113 (-7.38%)
Mutual labels:  pdf
Vue Pdf
vue.js pdf viewer
Stars: ✭ 1,700 (+1293.44%)
Mutual labels:  pdf
Labelmake
Declarative style JavaScript PDF generator library. Works on Node and the browser 🖨︎
Stars: ✭ 112 (-8.2%)
Mutual labels:  pdf
Studybook
Study E-Book(ComputerVision DeepLearning MachineLearning Math NLP Python ReinforcementLearning)
Stars: ✭ 1,457 (+1094.26%)
Mutual labels:  pdf
Markdownslides
MarkdownSlides is a Reveal.js and PDF slides generator from MARKDOWN files, that also generate HTML, EPUB and DOCX documents. The idea is that from a same MARKDOWN file we can get slides and books without worrying about style, just worrying about content.
Stars: ✭ 121 (-0.82%)
Mutual labels:  pdf
Prawn Rails
Prawn Handler for Rails. Handles and registers pdf formats.
Stars: ✭ 111 (-9.02%)
Mutual labels:  pdf
Kramdown
kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax definition and supporting several common extensions.
Stars: ✭ 1,546 (+1167.21%)
Mutual labels:  pdf
Endesive
en-crypt, de-crypt, si-gn, ve-rify - smime, pdf, xades and plain files in pure python
Stars: ✭ 122 (+0%)
Mutual labels:  pdf
Chromehtmltopdf
Convert HTML to PDF with Chrome
Stars: ✭ 122 (+0%)
Mutual labels:  pdf
Moodle Downloader 2
A Moodle downloader that downloads course content fast from Moodle (eg. lecture pdfs)
Stars: ✭ 118 (-3.28%)
Mutual labels:  pdf

PDF2Pic

Donate Build Status CodeFactor Maintainability Test Coverage install size NPM Version License Known Vulnerabilities Downloads Stats

A utility for converting pdf to image and base64 format.

IMPORTANT NOTE: Please support this library by donating via PayPal, your help is much appreciated. Contributors are also welcome!

Prerequisite

  • node >= 12.x
  • graphicsmagick
  • ghostscript

Don't have graphicsmagick and ghostscript yet?

Follow this guide to install the required dependencies.

Installation

npm install -S pdf2pic

Usage

Converting specific page of PDF from path, then saving as image file

import { fromPath } from "pdf2pic";

const options = {
  density: 100,
  saveFilename: "untitled",
  savePath: "./images",
  format: "png",
  width: 600,
  height: 600
};
const storeAsImage = fromPath("/path/to/pdf/sample.pdf", options);
const pageToConvertAsImage = 1;

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

  return resolve;
});

Nuff talk, show me how:

More usage example can be found here.

pdf2pic API

fromPath(filePath, options)

Initialize PDF to image conversion by supplying a file path

Functions

Converts specific page of the PDF to Image/Base64 by supplying a file path

fromPath(filePath, options).convert(pageNumber, isBase64)
  • filePath - pdf file's path
  • options - see options.
  • pageNumber - page number to be converted to image
  • isBase64 - if true, convert() will return base64 output instead

Converts PDF to Image/Base64 by supplying a file path

fromPath(filePath, options).bulk(pageNumber, isBase64)
  • filePath - pdf file's path
  • options - see options.
  • pageNumber - page number/s to be converted to images
    • set pageNumber to -1 to select all pages
    • pageNumber also accepts an array indicating the page number e.g. [1,2,3]
    • also accepts number e.g. 1
  • isBase64 - if true, bulk() will return an array of base64 output instead

Set GraphicsMagick's subclass or path

fromPath(filePath, options).setGMClass(subClass)  

NOTE: should be called before calling convert() or bulk().

  • filePath - pdf file's path
  • options - see options.
  • subClass - path to gm binary or set to true to use imagemagick
    • set subClass to true to use imagemagick
    • supply a valid path as subClass to locate gm path specified

fromBuffer(buffer, options)

Initialize PDF to image conversion by supplying a PDF buffer

Functions

Converts specific page of the PDF to Image/Base64 by supplying a buffer

fromBuffer(buffer, options)(pageNumber, isBase64)

Functions same as fromPath(filePath, options)(pageNumber, isBase64) only input is changed


Converts PDF to Image/Base64 by supplying a buffer

fromBuffer(buffer, options).bulk(pageNumber, isBase64)

Functions same as fromPath(filePath, options).bulk(pageNumber, isBase64) only input is changed


Set GraphicsMagick's subclass or path

fromBuffer(buffer, options).setGMClass(subClass)  

Functions same as fromPath(filePath, options).setGMClass(subClass) only input is changed


fromBase64(b64string, options)

Initialize PDF to image conversion by supplying a PDF base64 string

Functions

Converts specific page of the PDF to Image/Base64 by supplying a base64 string

fromBase64(b64string, options)(pageNumber, isBase64)

Functions same as fromPath(filePath, options)(pageNumber, isBase64) only input is changed


Converts PDF to Image/Base64 by supplying a base64 string

fromBase64(b64string, options).bulk(pageNumber, isBase64)

Functions same as fromPath(filePath, options).bulk(pageNumber, isBase64) only input is changed


Set GraphicsMagick's subclass or path

fromBase64(b64string, options).setGMClass(subClass)  

Functions same as fromPath(filePath, options).setGMClass(subClass) only input is changed


options

Following are the options that can be passed on the pdf2pic api:

  • quality - set output's image quality
  • format - set output's file format
  • width - set output's width
  • height - set output's height
  • density - controls output's dpi (i am not so sure)
  • savePath - set output's save path
  • saveFilename - set output's file name
  • compression - set output's compression method

Contributing

  • Fork it (https://github.com/yakovmeister/pdf2image/fork)
  • Create your feature branch (git checkout -b feature/make-maintainer-cry)
  • Commit your changes (git commit -am 'feature: make maintainer cry by running git rm -rf')
  • Push to the branch (git push origin feature/make-maintainer-cry)
  • Create a new PR

License

pdf2pic is MIT licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].