All Projects â†’ CodeDaraW â†’ node-pdftocairo

CodeDaraW / node-pdftocairo

Licence: MIT license
📃 Node.js wrapper for pdftocairo - PDF to PNG/JPEG/TIFF/PDF/PS/EPS/SVG using cairo

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to node-pdftocairo

Markdown Themeable Pdf
ARCHIVED. NOT MAINTAINED. Themeable Markdown Converter (Print to PDF, HTML, JPEG or PNG)
Stars: ✭ 130 (+664.71%)
Mutual labels:  png, jpeg, convert
HEIF
Mac OS X: Convert any image to HEIF/HEIC format
Stars: ✭ 58 (+241.18%)
Mutual labels:  png, jpeg, convert
HEIF-converter
Converter for High Efficiency Image Format(HEIF)
Stars: ✭ 24 (+41.18%)
Mutual labels:  png, jpeg, convert
Grunt Image
Optimize PNG, JPEG, GIF, SVG images with grunt task.
Stars: ✭ 201 (+1082.35%)
Mutual labels:  png, jpeg
Gulp Image
Optimize PNG, JPEG, GIF, SVG images with gulp task.
Stars: ✭ 213 (+1152.94%)
Mutual labels:  png, jpeg
Doctron
Docker-powered html convert to pdf(html2pdf), html to image(html2image like jpeg,png),which using chrome(golang) kernel, add watermarks to pdf, convert pdf to images etc.
Stars: ✭ 141 (+729.41%)
Mutual labels:  png, jpeg
Pappl
PAPPL - Printer Application Framework
Stars: ✭ 192 (+1029.41%)
Mutual labels:  png, jpeg
Metadata Extractor
Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Stars: ✭ 1,972 (+11500%)
Mutual labels:  png, jpeg
Image Optimizer
Easily optimize images using PHP
Stars: ✭ 2,127 (+12411.76%)
Mutual labels:  png, jpeg
Azpainter
Full color painting software for Unix-like systems for illustration drawing. This is un-official little fixed repository for package maintainers of image editor AzPainter (based on "mlib" toolkit). Official repository - http://azsky2.html.xdomain.jp/arc/download.html
Stars: ✭ 179 (+952.94%)
Mutual labels:  png, jpeg
Omxiv
OpenMax image viewer for the Raspberry Pi
Stars: ✭ 175 (+929.41%)
Mutual labels:  png, jpeg
alfred-imagemin
Alfred workflow - Minify images with Imagemin
Stars: ✭ 29 (+70.59%)
Mutual labels:  png, jpeg
Imageprocessor
📷 A fluent wrapper around System.Drawing for the processing of image files.
Stars: ✭ 2,452 (+14323.53%)
Mutual labels:  png, jpeg
Pyecharts Snapshot
renders the output of pyecharts as png, jpeg, gif, svg, eps, pdf and raw base64
Stars: ✭ 142 (+735.29%)
Mutual labels:  png, jpeg
Next Img
A Next.js plugin for embedding optimized images.
Stars: ✭ 149 (+776.47%)
Mutual labels:  png, jpeg
Convert Svg
Node.js packages for converting SVG into other formats using headless Chromium
Stars: ✭ 133 (+682.35%)
Mutual labels:  png, jpeg
Caesium Clt
Caesium Command Line Tools - Lossy/lossless image compression tool using mozjpeg and zopflipng
Stars: ✭ 149 (+776.47%)
Mutual labels:  png, jpeg
Lilliput
Resize images and animated GIFs in Go
Stars: ✭ 1,690 (+9841.18%)
Mutual labels:  png, jpeg
Bbwebimage
A high performance Swift library for downloading, caching and editing web images asynchronously.
Stars: ✭ 128 (+652.94%)
Mutual labels:  png, jpeg
Essential Image Optimization
Essential Image Optimization - an eBook
Stars: ✭ 1,950 (+11370.59%)
Mutual labels:  png, jpeg

node-pdftocairo

Build Status Codecov npm MIT

Node.js wrapper for pdftocairo - PDF to PNG/JPEG/TIFF/PDF/PS/EPS/SVG using cairo
Inspired by jjwilly16/node-pdftk

Requirements

Since pdftocairo is included in Poppler, you should install Poppler before using this library.

Installation

yarn add node-pdftocairo
import { input } from 'node-pdftocairo';

API

Simple Usage

The first argument of input can be a file path or buffer.
If you pass a output file path to output, it will generate files and returns Promise<null>; otherwise return buffers without generating files.

Generate file buffer(s) from a PDF file

const inputPath = path.join(__dirname, '../test/files/sample.pdf');
const options = { format: 'png' };
const outputBuffer = await input(inputPath, options).output();

Generate file buffer(s) from the buffer

const inputPath = path.join(__dirname, '../test/files/sample.pdf');
const buffer = fs.readFileSync(inputPath);
const options = { format: 'png' };
const outputBuffer = await input(buffer, options).output();

Generate file(s) on the specified output path

const inputPath = path.join(__dirname, '../test/files/sample.pdf');
const outputPath = path.join(__dirname, '../test/files/sample-img');
const options = { format: 'png' };
await input(inputPath, options).output(outputPath);

Options

Reference: Ubuntu Manpage: pdftocairo

Property Description Type Default
bin specify the path of pdftocairo string -
format output file format, should be one of png jpeg tiff ps eps pdf svg string -
antialias Set the cairo antialias option used for text and drawing in image files (or rasterized regions in vector output), should be one of default none gray subpixel fast good best string -
range Specifies the first/last page to convert. { f?: number, l?: number } -
filter Generates only the odd or even numbered pages. string -
singlefile Writes only the first page and does not add digits. boolean false
resolution Specifies the X and Y resolution, in pixels per inch of image files (or rasterized regions in vector output). The default is 150 PPI. number | { x: number, y: number } -
scale Scales the long side of each page (width for landscape pages, height for portrait pages) to fit in scale-to pixels. The size of the short side will be determined by the aspect ratio of the page (PNG/JPEG/TIFF only). number | { x: number, y: number } -
crop Specifies the x-coordinate/y-coordinate of the crop area top left corner in pixels (image output) or points (vector output) and Specifies the width/height/size of crop area in pixels (image output) or points (vector output) (default is 0) { x?: number, y?: number, W?: number, H?: number, sz?: number } -
cropbox Uses the crop box rather than media box when generating the files (PNG/JPEG/TIFF only) boolean false
mono Generate a monochrome file (PNG and TIFF only). boolean false
gray Generate a grayscale file (PNG, JPEG, and TIFF only). boolean false
transparent Use a transparent page color instead of white (PNG and TIFF only). boolean false
level2 Generate Level 2 PostScript (PS only). boolean false
level3 Generate Level 3 PostScript (PS only). This enables all Level 2 features plus shading patterns and masked images. This is the default setting. boolean false
originPageSizes This option is the same as "-paper match". boolean false
icc Use the specified ICC file as the output profile (PNG only). The profile will be embedded in the PNG file. string -
jpegopt When used with -jpeg, takes a list of options to control the jpeg compression. See JPEG OPTIONS for the available options. string -
paper Set the paper size to one of "letter", "legal", "A4", or "A3" (PS,PDF,SVG only). This can also be set to "match", which will set the paper size of each page to match the size specified in the PDF file. If none the -paper, -paperw, or -paperh options are specified the default is to match the paper size. string | { w: number, h: number } -
nocrop By default, printing output is cropped to the CropBox specified in the PDF file. This option disables cropping (PS,PDF,SVG only). boolean false
expand Expand PDF pages smaller than the paper to fill the paper (PS,PDF,SVG only). By default, these pages are not scaled. boolean false
noshrink Don't scale PDF pages which are larger than the paper (PS,PDF,SVG only). By default, pages larger than the paper are shrunk to fit. boolean false
nocenter By default, PDF pages smaller than the paper (after any scaling) are centered on the paper. This option causes them to be aligned to the lower-left corner of the paper instead (PS,PDF,SVG only). boolean false
duplex Adds the %%IncludeFeature: *Duplex DuplexNoTumble DSC comment to the PostScript file (PS only). This tells the print manager to enable duplexing. boolean false
ownerPassword Specify the owner password for the PDF file. Providing this will bypass all security restrictions. string -
userPassword Specify the user password for the PDF file. string -
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].