PDF Generation - on form on the client side, for download
Hello, has anyone worked with a 3rd party tool for generation of a PDF on the client-side which the user can have downloaded onto their machine. I do know about the eFormHelper function "getFormAsPDF", but it is not quite what we need, we need some more control over how the PDF is formatted.
Is there any tool that allows us to dynamically generate a PDF file based on the current values of the form? We used to use Aspose DLL for this in our old applications, but I'm not sure exactly how that worked, might have been on the server-side.
Thanks
-
Hi Victor,
There is a built-in Activity for that - Microsoft Word.
Using it you can create a word template which will you can format as needed, both in style and data wise. During runtime, this template can be used to generate, either a word or pdf file, which will embed all app data included in the template.
Check out the Microsoft Word demo video.
Note that this would be done on process/server side and not client side, as you're looking for, though, generally speaking, sever side is better approach:
- Safer and better access to template.
- Can store the generated file in doc repository.
- Avoid client side issue, related with JS and local file system access.
- etc.
Once file is generated, you can sent it as an attachment (or link) to your end user, using email.
If you still want to do this on client side and do not want to use getFormAsPDF, as you'd like to control your own template, there are few options you can consider:
- There are plenty of JS libraries you can leverage. I've used jspdf in the past, to open a pdf file and display it in the form, but it can also be used to generate of PDF for what I remember.
- You can create a process/subprocess utilising the Microsoft Word activity above, which you can trigger, and then pick the generated file (you'll need to consider the monitoring for when the process is done and access to the file, which will not be on client side).
- If the pdf layout you're looking for is suitable for the ReportView, than you can open the ReportView as a modal layout and have the user "Save to PDF" button on it, just like a print dialog... More tricks can be done using that concept...
Hope this helps.
Good luck,
Yaniv.
-
If you want it Client Side, you can set up a separate process or sub-process which uses the "Microsoft Word" Activity, then trigger that process client-side using the "CreateProcInst" api method. You can monitor this process to see when the file is generated using the "GetProcInst" method, using the PIID returned by the create method. Once the returned Status is set to "Completed", the pdf should be generated, and you can link the client-side user to it.
请先登录再写评论。
评论
3 条评论