# Html2pdf.convert not functioning in lambda

**URL:** <https://community.apryse.com/t/html2pdf-convert-not-functioning-in-lambda/4499>\
**Category:** Apryse SDK\
**Tags:** linux, html, mac, convert, api\
**Created:** [September 1, 2021, 6:34pm UTC](https://community.apryse.com/t/html2pdf-convert-not-functioning-in-lambda/4499 "2021-09-01T18:34:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timbercakes](https://community.apryse.com/letter_avatar_proxy/v4/letter/t/8c91f0/32.png) [@timbercakes](https://community.apryse.com/u/timbercakes)\
**Post date:** [September 1, 2021, 6:34pm UTC](https://community.apryse.com/t/html2pdf-convert-not-functioning-in-lambda/4499/1 "2021-09-01T18:34:59Z")

</div>

Product: pdftron/pdfnet-node

Product Version: 9.0.0-3

Lmabda ENV: Node JS 14 - 2.880.0 JS SDK - Amazon Linux 2 OS  
Linux kernel – 4.14.165-102.205.amzn2.x86\_64

Please give a brief summary of your issue: The HTML to PDF conversion works locally in demo mode. It is not working in lambda in demo mode or with a license.

Please describe your issue and provide steps to reproduce it:  
The following code block takes data from a microsoft graph api email and converts email data to a PDF document. Locally on MAC OS 10.15.7 it works in demo mode. In my lambda environment it simply does not work. There are no errors thrown. The code is parsed but the const emailBodyDoc ends up with a 0 page count after conversion. I have tired this with the license and in demo mode in lambda and have gotten the same results.

try {  
const html = `

padding

**From:** ${parsed.from?.html}

**To:** ${parsed.to?.html}

**Subject:** ${parsed.subject}

  
${parsed.html}`;

const html2pdfSettings = await PDFNet.HTML2PDF.WebPageSettings.create();  
const html2pdf = await PDFNet.HTML2PDF.create();  
const emailBodyDoc = await PDFNet.PDFDoc.create();

html2pdfSettings.setAllowJavaScript(false);  
html2pdfSettings.setAllowPlugins(false);

await html2pdf.insertFromHtmlString2(html, html2pdfSettings);  
await html2pdf.convert(emailBodyDoc);  
pageCount = await emailBodyDoc.getPageCount();  
await resultDoc.insertPages(1, emailBodyDoc, 1, pageCount, PDFNet.PDFDoc.InsertFlag.e\_none);  
} catch (err) {  
logger.error(JSON.stringify(  
err,  
null,  
2,  
));  
}

---

<div class="post-metadata">

**Author:** ![system](https://community.apryse.com/uploads/default/original/2X/3/3f9668f121fd55acf05a2c6e06c1f927d332653a.png) [@system](https://community.apryse.com/u/system)\
**Post date:** [September 1, 2021, 6:35pm UTC](https://community.apryse.com/t/html2pdf-convert-not-functioning-in-lambda/4499/2 "2021-09-01T18:35:05Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:
- [Convert HTML to PDF on Cross-Platform (Core)](https://www.pdftron.com/documentation/core/guides/features/conversion/convert-html)
- [Document conversion library for Cross-Platform (Core)](https://www.pdftron.com/documentation/core/guides/features/conversion)
- [Adding a license key - Common questions](https://www.pdftron.com/documentation/core/info/license#common-questions)
- [API for Document Generation via Template on Cross-Platform (Core)](https://www.pdftron.com/documentation/core/guides/generate-via-template/apis)

APIs:
- [HTML2PDF.WebPageSettings - public void setExternalLinks (boolean convert)](https://www.pdftron.com/api/PDFTronSDK/java/com/pdftron/pdf/HTML2PDF.WebPageSettings.html#public%20void%20setExternalLinks%20(boolean%20convert))
- [HTML2PDF - public static boolean convert (Doc doc, String url, HTML2PDF.WebPageSettings settings)](https://www.pdftron.com/api/PDFTronSDK/java/com/pdftron/pdf/HTML2PDF.html#public%20static%20boolean%20convert%20(Doc%20doc,%20String%20url,%20HTML2PDF.WebPageSettings%20settings))
- [HTML2PDF.Proxy - public void setHost (String host)](https://www.pdftron.com/api/PDFTronSDK/java/com/pdftron/pdf/HTML2PDF.Proxy.html#public%20void%20setHost%20(String%20host))

Forums:
- [System.AccessViolationException when Converting MSG to PDF](https://community.pdftron.com/t/system-accessviolationexception-when-converting-msg-to-pdf/4412/4)
- [How to set the value of an existing radio button](https://community.pdftron.com/t/how-to-set-the-value-of-an-existing-radio-button/74/1)
- [Saving/Reading PDF/A into memory buffer](https://community.pdftron.com/t/saving-reading-pdf-a-into-memory-buffer/3955/2)

---

<div class="post-metadata">

**Author:** ![Ryan](https://community.apryse.com/user_avatar/community.apryse.com/ryan/32/314_2.png) [@Ryan](https://community.apryse.com/u/Ryan)\
**Post date:** [September 3, 2021, 6:58pm UTC](https://community.apryse.com/t/html2pdf-convert-not-functioning-in-lambda/4499/3 "2021-09-03T18:58:19Z")

</div>

Thank you for the detailed report. Most likely a dependency is missing.

Please try this version of the module specifically build to Amazon Linux 2.

[https://pdftron.s3.amazonaws.com/custom/ID-zJWLuhTffd3c/support/html2pdf/0.12.6/HTML2PDF-Amazon2.tar.gz](https://pdftron.s3.amazonaws.com/custom/ID-zJWLuhTffd3c/support/html2pdf/0.12.6/HTML2PDF-Amazon2.tar.gz)
