I want a way to send a PDF via email without having to first upload it... All the components I have used first download the screen and then allow me to send upload it and send it as an attached PDF... Is there a way to also save the PDF to the database when its downloading so that I can be able to send it in an email without having to ulpload it again?
Hi Ide,
Good question and the answer is yes!
If your application is generating the PDF on the server, then you can both store it to the database and send it in an email.
To store it in the database create an entity with a BinaryData attribute. Best practice is to store the file metadata in a separate entity than the file content. However, if you are only using this for temporary storage for the purpose of sending email, you may consider breaking that rule and using a single entity.
It looks like emails in React Web can now send attachments (there was a time when they didn't).
I am not sure what modules you mean that only allow downloading PDFs. You may need to clone and modify their code. Otherwise, try more forge components until you find one that only generates a PDF on the server that fits with your scenario.
There are also many PDF libraries, and some are better than others; you have to try them out before you commit.
I hope this helps
Kind regards,
Stuart
I used the ReactiveHTML2PDF forge component to turn the current screen into a pdf then download it....
I am not sure how to get the file to be downloaded and save it to the database I created
Hi,
You don't need to save the PDF to send it via email. You can generate de PDF in the flow that is connected with the email sending action. You can do it with UltimatePDF, p.e..
You call the UltimatePDF action, give the URL input of the screen that you want to generate the PDF an then use the output of the UltimatePDF to fill the email attachment data.
You can get UltimatePDF here:
https://www.outsystems.com/forge/component-overview/5641/ultimate-pdf
Hope this can help you.
Best regards,
Ricardo Pereira
Hello Ide Fatsha
Yes, you can generate a PDF document dynamically and then send it as an attachment in an email without having to upload it first. You can also save the generated PDF to a database table so that it can be accessed later if needed
Use the OutSystems PDF generator component (available in the Forge) to generate the PDF document dynamically.
After generating the PDF, use the "Binary Data" data type to store the PDF document in a local variable.
Use the "CreateOrUpdate" action of the database entity to store the PDF document in the database. Map the binary data variable to the "Content" attribute of the database entity.
Use the OutSystems email component to send the email with the PDF attachment. Set the attachment's name, MIME type, and content by mapping the attributes from the database entity where you stored the PDF.
For anyone looking for a solution to this post, the solution is available here; please check that out.ThanksGitansh Anand