Product: HTML2PDF
Product Version:
- @pdftron/pdfnet-node@9.4.2
- The latest available
HTML2PDF
on Mac M1
MD5 (html2pdf_chromium.dylib) = 3b807f61e9bbf398be298a029ed9eca3
Please give a brief summary of your issue:
convert()
is returning false, but logging no errors.
Please describe your issue and provide steps to reproduce it:
The following test program prints “Conversion failed. HTTP Code: 0”.
require("envkey");
const { PDFNet } = require("@pdftron/pdfnet-node");
const path = require("path");
(async function run() {
try {
await PDFNet.initialize(process.env.PDFTRON_LICENSE_KEY);
await PDFNet.HTML2PDF.setModulePath(path.dirname(require.resolve("@pdftron/pdfnet-node")));
const html2pdf = await PDFNet.HTML2PDF.create();
const doc = await PDFNet.PDFDoc.create();
const html = '<html><body><h1>Heading</h1><p>Paragraph.</p></body></html>';
const outputPath = './test-html2pdf.pdf';
await html2pdf.insertFromHtmlString(html);
if (!(await html2pdf.convert(doc))) {
console.log('Conversion failed. HTTP Code: ' + await html2pdf.getHttpErrorCode());
console.log(await html2pdf.getLog());
} else {
console.log('conversion succeeded, attempting to save')
console.log(doc);
await doc.save(outputPath, PDFNet.SDFDoc.SaveOptions.e_linearized);
}
} catch (e) {
console.error(e);
}
console.log('Test Complete!');
})();
html2pdf_chromium.dylib
module is definitely executable.