npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-pdftocairo

v0.2.0

Published

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

Downloads

67

Readme

gulp-pdftocairo Build Status npm version Dependency Status

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 :() and since gulp says horrible things will happen if I buffer streamed files to cover up for this.

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:

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.

$ 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