Skip to content

New module api#11

Merged
marcbachmann merged 9 commits intomasterfrom
new-api
Jan 25, 2015
Merged

New module api#11
marcbachmann merged 9 commits intomasterfrom
new-api

Conversation

@marcbachmann
Copy link
Copy Markdown
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