Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New module api #11

Merged
merged 9 commits into from
Jan 25, 2015
Merged

New module api #11

merged 9 commits into from
Jan 25, 2015

Conversation

marcbachmann
Copy link
Owner

API

pdf.create(html [, options]).toBuffer(callback)
pdf.create(html [, options]).toStream(callback)
pdf.create(html [, options]).toFile([filename, ]callback)

// for backwards compatibility
pdf.create(html [, options], callback)

Examples

  pdf = require('html-pdf')
  pdf.create(html).toFile(filepath, function(err, res){
    console.log(res.filename);
  });

  pdf.create(html).toStream(filepath, function(err, stream){
    steam.pipe(fs.createWriteStream('./foo.pdf'));
  });

  pdf.create(html).toBuffer(filepath, function(err, buffer){
    console.log('This is a buffer:', Buffer.isBuffer(buffer));
  });

@marcbachmann marcbachmann merged commit f24bc83 into master Jan 25, 2015
@marcbachmann marcbachmann deleted the new-api branch March 2, 2015 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants