I have a screen that generates a PDF consisting of user input, and when the user clicks download I want to merge the PDF generated from this screen with another, predefined PDF file that I have stored as a resource. I'm currently using Ultimate PDF to generate the first one and then PDF helper to try and merge the two, but I'm struggling with the merge part as one of the files is a resource.
My current idea is to load the resource onto a screen, and then merge the two screens, but I haven't been very successful in this. Is there anything else I can do?
updated OML attached.
Thanks,
Amit
Thanks, this worked. I also managed to make it work simply by making a server action where I assign an output parameter to the content runtime property of the resource. I then call the server action in my client action and join the generated pdf with the output of the server action (which contains my resource)
Hi Umut,
Are you using the screen url to generate the PDF or screentoPdf block?
Thanks & Regards,
Sudip Pal
Hi Sudip
I'm using the screen url to generate the pdf. I've attached the flow and the contents of the url expression
So, you have two binary files, but you are not able to merge it . Correct?
Both the PDFs are separately you can able to download in the logic. Correct?
Yes I have two separate binary files that I would like to merge into one PDF when the user presses download. However I am unsure how to merge a resource with a screen. Ideally I would like to just load the contents of the resource (my second PDF) onto its own screen, and then just merge the two screens, but I'm not at all sure how to do this
Did you use pdf helper component correctly? You can check the demo of pdf helper.
It manages to add an extra page to my generated PDF, so I would assume so. The problem is that it doesn't display the contents of the PDF, but shows a "missing image" icon instead of the fillable table that is in the actual file. I've included a screenshot of what that looks like, and a screenshot of the fillable table, which is what it should look like. The blue fields in the screenshot are input fields where the user can write directly in their pdf reader
I have one binary file as a resource, and one binary file that gets generated using Ultimate PDF. I am unable to merge the generated file with the resource yes
Hi,
As you want to merge 2 files and challenge appears in getting binary of file which is in resources. If this is the issue then you can use the HttpBinaryGet method to get the binary of file from URL. Then pass this binary to merge method of pdf.
regards
I tried this but I'm still not able to display the content, the second page of my PDF file, which should have included the resource, is just empty
Hi umut
The same case i was able to solve with these steps
1. Create a seperate screen and place all the elements and data that you want to print in pdf. (with user input values and predefined values)
2. after saving the data call that screen with the url and using the printPDF function just give that url and it will print the same.
I hope it will solve your problem. if you want any other help then let me know
Hi I've tried this as well, but the problem is that the predefined PDF has input fields that the user can write in using Adobe Acrobat, and I can't generate a PDF with empty input fields in service studio, which is why I need one of the PDF's to be a resource. I came to the same solution as you when I was generating the first PDF, and this works fine, but sadly I don't think it'll work with my second file
Umut the second pdf have input fields. do you want these inputs after generating the merged pdf.
No the input fields are already there, I made the second PDF as a form in Adobe Acrobat with input fields already defined and everything. The second PDF is completed and ready, I just want to merge it with the one that is generated from user input in my reactive web app
So you are using ultimate pdf for generating the pdf file and this method gives binary of pdf file generated. You can use this binary and binary of file from resources (second pdf) and can pass it to merge method.
I tried this as well, but it seems the resource does not have a data type, so I can't just pass the resource to the merge action and the runtime property of the resource is a URL with the data type Text. I've tried loading the resource onto a screen, then used the PrintToPDF action from Ultimate PDF as it returns binary, and then used the output from that, but that just adds an empty screen to the PDF, as I can't load the contents of the resource onto a screen
I thing data type of resource should not be text. It should be binary type. You can create one client action and set output of client action as binary. In this client action read the resource data and assign to binary output variable.
Doing this is possible as the resource has a runtime property called content, which is binary, and i can access this using "fetch data from other sources" however I'm still not able to display the data, it just shows an empty screen.
Hi @Umut Sahin ,
Can you please try this
Demo Link
First PDF Header : CAM HOME REPORT
Second PDF Header : Javascript code added
Let me know this you want to achieve right?
Will share OML file
AV
It looks like what I'd like to do. I'd like to have a look at the OML if possible thanks
Please install PDF helper before run Demo file.
OML attached.
Let me know if you need any help :)
Hi sorry for the late response. I looked at the OML and it looks like you're using two PDF's from your resources. In my solution only one of the files is in resources, the other is generated using Ultimate PDF, so I can't implement it this way I think
ok will do and revert back to you :)
Thanks