Hello all! I have an interesting problem. I have a screen that has a table and some user infor and I would like to have my app, on button click, send an email of a picture of the current screen. I would like it to be saved as a PDF as well. Can anyone point me in the right direction?
I have an option where I can download the screen into a PDF, upload the PDF to the app then email that, but that's a bit teduis..... I'm looking to hav a a button that would allow a user to send the screen via email as a pdf
Hi @Ide Fatsha, Look at this component. To use this wrap everting that you want to be a part of your PDF in a container, place the two blocks from the component above that container and pass the container's ID in the main block (the main block is a button). It will return the binary data of the PDF, which you can send as an attachment in your email template.ThanksGitansh Anand
Where can I find the container ID
I was able to able to make the button download a pdf of the screen.. Now I want to send the pdf screen as an email....... Does the file get saved to some sort of database? I want to be able to send the file in an email without have to upload it first.... I want to do that with a button
Hi, First of all, in the screenshot, I can see you are using the main block twice; you need to replace one with the exec block if you have not done so already.Now the exce block will have an event called "ReturnBinary, Create a handler for that event, and it will provide you the binary data without any need to upload it anywhere.
i fixed, It seems to be working now.... The button downloads a pdf of the current screen
Now I want to send the pdf screen as an email....... Does the file get saved to some sort of database? I want to be able to send the file in an email without have to upload it first.... I want to do that with a button
Hi, Please look at the OML attached, What you need to do is set the inputs of the Exce block as in the below image and add an event handler. You can find the logic of the handler in the OML.
My block doesn't have the input parameters in your block.... Do I add them on the module for the block? also what data types are they?
Hi, just remove the options paramter that you have correctly assigned, and then you will find a plus button beside the "Options" (refer to the image below), or you can assign the values to that option variable in the OnInitialize event of the screen.If you still have any issue, may be you could upload your OML and I will modify it for you.
From what I can see, the OML you have attached should work fine. Are you getting some sort of error somewhere?
The email part doesn't seem to work at all.... The file would just be downloaded when I click on the button..... I after I made the changes you suggested... I'm getting the below error when the button is done loading
Hi, try with this modified OML.I have changed 2 input values (refer to the below image).
In case this does not work, try adding a message "Html2Pdf_Js_ExecBlockReturnBinary" so that it can be identified if the problem is in generating the PDF or sending an email (refer to the image below).
It displayed the message before giving the same error message
This is the error log message
It is clear that the component is working fine, the problem is in sending email.I have a few suggestions.1. The problem might be that the file size is large and because of that, it is taking a long time to download. For that reason, disable the email call and download the file generated with the new settings, then look at the size of the file. If it is too large, reduce the quality.2. Trigger the email separately, once without attachment and once with attachment, and look what is happening.3. Increase the request timeout value.4. I am not sure if it will solve the issue, but add some UI to the email template.
The problem is most definitely because of the file size. As I observed on your page, the pdf being generated is 3.7 MB or more, and it may be because of that that you are getting a connection timeout. Please apply the settings I mentioned earlier (set type to ".jpeg" and quality to 0.5; refer to the image and OML shared before) and check again.
i have just downloaded the oml you shared eariler where you made the changes and it gave me the same error it did before ("Connection timed out")
Hi, I made a small mistake. In the type input, there is no need to add a dot before the type (look at the image below).I am adding updated OML; please try once again with some different values for quality that work for you (from my previous experience, 0.95 with jpeg would be just fine).
I have just made the correction.... Its working now. Thank you
Glad to be of help 😄.
Hi Ide,
Take a look at the Ultimate PDF Forge asset. It can create a PDF from the current screen, which should be what you want.