# gulp-pdftocairo

> A gulp-compatible wrapper for pdftocairo that converts PDF to PNG/JPEG/PS/EPS/SVG

Latest version **0.2.0** (published 2015-07-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-pdftocairo
pnpm add gulp-pdftocairo
yarn add gulp-pdftocairo
bun add gulp-pdftocairo
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2015-07-23 |
| First published | 2015-07-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ricky Reusser |
| Maintainers | rreusser |
| Keywords | gulpplugin, pdftocairo, cairo, png, svg, pdf, jpeg, eps, ps |

## Links

- npm: https://www.npmjs.com/package/gulp-pdftocairo
- Repository: https://github.com/rreusser/gulp-pdftocairo
- Homepage: https://github.com/rreusser/gulp-pdftocairo#readme
- Issues: https://github.com/rreusser/gulp-pdftocairo/issues
- npm.io page: https://npm.io/package/gulp-pdftocairo

## Dependencies (5)

- [tmp](https://npm.io/package/tmp.md) 0.0.26
- [through2](https://npm.io/package/through2.md) ^2.0.0
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.6
- [streamifier](https://npm.io/package/streamifier.md) ^0.1.1
- [util-extend](https://npm.io/package/util-extend.md) ^1.0.1

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2015-07-23
- 0.1.3 — 2015-07-21
- 0.1.2 — 2015-07-20
- 0.1.1 — 2015-07-20
- 0.1.0 — 2015-07-20

## README

# gulp-pdftocairo [![Build Status](https://travis-ci.org/rreusser/gulp-pdftocairo.svg)](https://travis-ci.org/rreusser/gulp-pdftocairo) [![npm version](https://badge.fury.io/js/gulp-pdftocairo.svg)](http://badge.fury.io/js/gulp-pdftocairo) [![Dependency Status](https://david-dm.org/rreusser/gulp-pdftocairo.svg)](https://david-dm.org/rreusser/gulp-pdftocairo)

A gulp-compatible wrapper for pdftocairo that converts PDF to PNG/JPEG/PS/EPS/SVG

## Introduction

A quick wrapper for pdftocairo so that I can convert pdf files to a few different formats. Supports file streams containing either streamed or buffered data ([except no streams for raster formats since pdftocairo is buggy :(](http://stackoverflow.com/questions/17231267/pdf-to-png-in-python-with-pdf2cairo)) and since gulp says [horrible things will happen if I buffer streamed files to cover up for this](https://github.com/gulpjs/gulp/blob/master/docs/writing-a-plugin/guidelines.md).

This is my first gulp plugin. Feedback on the things done wrong is welcome.

## TODO
- Add more command line options or at least just let you pass arbitrary arguments

## Example

This can easily be used in a gulpfile to convert a pdf to various other formats. A simple gulpfile would be:

```javascript
var gulp = require('gulp')
  , pdftocairo = require('gulp-pdftocairo')

gulp.task('to-png', function() {
  return gulp.src('*.pdf')
    .pipe( pdftocairo({format: 'png', resolution: 800}) )
    .pipe( gulp.dest('./') )
})
```


## Install

To use this, you'll need `pdftocairo` installed, which can probably be installed with a package manager. Currently left as an exercise for the reader.

```sh
$ npm install gulp-pdtocairo
```


## API

### `require('gulp-pdftocairo')( options )`
Create a transform stream that operates on file objects.

Options:
  - `format`: Must be one of `svg`, `png`, `ps`, `eps`, `jpg`
  - `resolution`: For raster files, specifies the resolution of the output
  - `transparent`: For raster files supporting alpha (i.e. png), whether background is transparent or not
  - `command`: defaults to `pdftocairo`

**Returns**: a gulp-compatible transform stream


## Testing

Testing is performed using a mocha/chai and a pdftocairo test stub (`test/stubs/pdftocairo.js`) that does just enough to pass the tests as if it were pdftocairo. To test with the real thing, just change the `PDFTOCAIRO` variable in the `test/test.js`

## Credits

(c) 2015 Ricky Reusser. MIT License

---
_Source: https://npm.io/package/gulp-pdftocairo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
