We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert email(html/json) to pdf

Hello ,

I am working on a project that uses Azure Logic Apps that read emails from the Outlook 365 and converts it into pdf.

There are multiple logic apps actions available from Muhimbi, Plumsail and Encodian for use in converting the email body to pdf.

Do we have any such action available for logic apps from Aspose?

Our org has license of Aspose.pdf and aspose.image. So if there are no actions available from Aspose for use in logic apps, Can we use any of these in Azure functions or any other object to use in logic apps for converting email (html/eml/json) to pdf?

Please let me know various options that are available.

Thanks

@azamatali

Thanks for contacting support.

Would you kindly share a sample source file with us which you want to convert into PDF. We will test the scenario in our environment and address it accordingly.

image.png (15.9 KB)
This is the kind of logic app that I am trying to build.

Currently I have used the Muhimbi, Plumsail and Encodian app to get the email and convert it to pdf.

Do you have any similar component.

If not, can I use aspose.pdf to convert html in pdf in Azure functions. If yes, let me know.

@azamatali

Thanks for further elaboration.

Aspose offers Aspose.Email API in order to convert an Email message into PDF. However, in case you want to convert HTML to PDF, you can use any of the Aspose.PDF and Aspose.HTML APIs. Since you are working with Azure, you may want to use Cloud API. We would like to share with you that all these APIs are also offered for Cloud environments.

Used a simple code for converting HTML to pdf as given in the examples:

        var pdf = new Aspose.Pdf.Document(dir + "//HTML//MyBasicPage.html");      
        pdf.Save(dir + "//PDF//output.pdf", Aspose.Pdf.SaveFormat.Pdf);

I am getting the error: Aspose.Pdf.InvalidPdfFileFormatException: ‘Incorect file format’

Can you give me the sample code for converting HTML to pdf?

@azamatali

Please load PDF document with HtmlLoadOptions() in order to convert it correctly like following:

var pdf = new Aspose.Pdf.Document(dir + "//HTML//MyBasicPage.html", new HtmlLoadOptions());      
pdf.Save(dir + "//PDF//output.pdf");