I am developing a system where the User need to download a PDF file that was generated by phantomJS and saved on the server. This is the code that generates the file and saved to the server:
var pdf = Meteor.require('phantomjs-pdf');
var options = {'html': data};
pdf.convert(options, function(result) {
/* Using a buffer and callback */
result.toBuffer(function(returnedBuffer) {});
/* Using a readable stream */
var stream = result.toStream();
/* Using the temp file path */
var tmpPath = result.getTmpPath();
/* Using the file writer and callback */
result.toFile("/tmp/file.pdf", function() {});
});
It appears that at phantomJS can not download then how can I download the file?