Skip to content

Instantly share code, notes, and snippets.

@roycrxtw
Last active March 17, 2017 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roycrxtw/e9de860d3f79c7010ae343a3aa7412e8 to your computer and use it in GitHub Desktop.
Save roycrxtw/e9de860d3f79c7010ae343a3aa7412e8 to your computer and use it in GitHub Desktop.
html-pdf簡易範例
// source: html格式之變數,來源可以是從檔案輸入(fs.readFileSync)
// 或是儲存html tags的string變數
var source;
var pdfOptions = {}; // 設定pdf轉換之選項
// 將source檔輸出至filePath指定之位置
pdf.create(source, pdfOptions).toFile(filePath, function(err, result){
if(err){
console.log('error in pdf.create(), err=', err);
}
console.log('result=', result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment