Last active
March 17, 2017 17:02
-
-
Save roycrxtw/e9de860d3f79c7010ae343a3aa7412e8 to your computer and use it in GitHub Desktop.
html-pdf簡易範例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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