Skip to content

Commit

Permalink
File is not output #10
Browse files Browse the repository at this point in the history
  • Loading branch information
yzane committed Feb 5, 2017
1 parent b4bcbad commit c8b8a70
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,17 @@ function exportPdf(data, filename) {
}

try {
htmlpdf.create(data, options).toFile(filename, function(error) {
if (error) {
vscode.window.showErrorMessage('ERROR: htmlpdf.create()');
vscode.window.showErrorMessage(error.message);
return;
}
vscode.window.showInformationMessage('OUTPUT: ' + filename);
vscode.window.setStatusBarMessage('');
});
htmlpdf.create(data, options).toBuffer(function(err, buffer) {
fs.writeFile(filename, buffer, function(err) {
if (err) {
vscode.window.showErrorMessage('ERROR: exportHtml()');
vscode.window.showErrorMessage(err.message);
return;
}
vscode.window.showInformationMessage('OUTPUT: ' + filename);
vscode.window.setStatusBarMessage('');
});
});
} catch (e) {
vscode.window.showErrorMessage('ERROR: htmlpdf.create()');
vscode.window.showErrorMessage(e.message);
Expand Down

0 comments on commit c8b8a70

Please sign in to comment.