Closed andrea-teom closed 7 years ago
Hi there, how exactly have you done this?
I render a page with mustaches inside a post request (with express)
html = ...;
var option = {
...
'paperSize': {format: 'A4', orientation: 'landscape'}
}
pdf.convert(options, function(err, result) {
/* Using the file writer and callback */
result.toFile("/path/to/file.pdf", function() {});
});
Hi @andrea-teom
I did it like this, and it worked:
'use strict';
var pdf = require('phantom-html2pdf');
var pdfOptions = {
html: '<!DOCTYPE html><html lang="en"><body><h1>Hello</h1><p>World</p></body></html>',
paperSize: {
format: 'A4',
orientation: 'landscape',
border: '1cm'
}
};
pdf.convert(pdfOptions, function(err, result) {
result.toFile("./file.pdf", function() {
console.log('Done');
});
});
set options 'paperSize': {format: 'A4', orientation: 'landscape'} orientation result is portrait