Generate pdf from email and attach it
Application Type
Traditional Web, Reactive

Hello,


I am using an reactive web application that holds the value of some entities and triggers an action to send emails from an traditional web app. The emails in the web app have some input variables to be filled in an html.


I now need to create an pdf document that looks like the finished email with all blocks and variables already added and attach it to the very same email, before sening.


Could anybody help me with that, please?


Cheers

Hi Lars,

if you can rebuilt that email as html you can use this component to convert html to pdf.

https://www.outsystems.com/forge/component-overview/7918/open-html-to-pdf

If you need another way to do it, there's still a lot of options to convert to pdf in the forge:

https://www.outsystems.com/forge/list?q=pdf&t=web&o=&tr=False&oss=False&c=%20&a=&v=&hd=False&tn=&scat=forge

Regards

Thank you for your fast reply.


My problem is, that I don't know how to call an action from an email to generate the pdf. Is there a way to do that, because the creation of the finished html is happening in the email itself.

You need to generate the pdf and attach in the email before sending it, building the html manually in a text variable.

Sorry that I have to ask again, but I am using input variables to create different html everytime. How can I use those inputs, when I build it in the text var? Because when I try to add the html to the var, I am getting an error because I am not only using a String ("a" + input var + "b").


Still your answer have been of great value to me, so thank you very much so far.

You can convert any type to a text string. If that input var is an integer convert to text (IntegerToText).

There are a few topics about how to create an email with html:

https://www.outsystems.com/forums/discussion/76132/how-to-template-a-html-email-using-service-studio-then-pass-that-as-an-email-bo/


What is going to happen is you call call the email with some input variables and  then inside call, through the process that builds the PDF page, a screen with the same inputs variables to get the binary that contains the PDF page. 

You'll have the same variables being used twice. 


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.