Dynamic document generation and download

HI All,

 

We have a requirement to generate a PDF document and download on click of a link.  to generate the PDF we use Generate PDF smart service and this needs a process to be executed execute.

The issue we need to generate the document in-flight and download it. 

User is viewing a report and user should be able to download the report data as PDF on click on a link provided on the report.

At the moment I have found any solution other than on click of the link to show another link to download.

  Discussion posts and replies are publicly visible

Parents
  • In 17.2 at least, you can use a!startProcess to launch a process model which will do your PDF generation, and pass back the generated doc ID to your SAIL form.

  • I am not sure you will be able to generate the document and serve it to the user's browser in one click without writing a plugin similar to Excel Tools' download datasubset functionality.

    The normal design pattern here is as you and Mike mentioned, which is to request the document is generated with one click then show a subsequent link to download the document. Another thought is to generate the PDFs ahead of time (i.e. when each row that backs the report is entered rather than viewed later), but that requires extra considerations as load and complexity (data updates, etc.) can easily make this a bad fit for the use case.
  • In my brief live test before writing my prior comment, I quickly created a new process model with one script task node which sets a value to a particular PV, and what I found is that this value is passed back to the SAIL form successfully in the onSuccess() parameter of a!startProcess.

    Assuming this extrapolates out to running the process through some doc generation, it seems like it would work as needed.

  • I understand that you can generate the document in that model and potentially pass the generated doc id back to the interface, but the use case from the post is also to download the document without the user having to make another click. Once you have passed the document id back to the interface, you would have to generate a SAIL link for the user to make another click. Did you have a way to do the document download without another click from the end-user?

  • Oh, yes I agree - I must have misunderstood or overlooked that part of OP's requirement - as you say it would at least take 2 clicks as far as I know.

    However the fact that it CAN be done now in 2 clicks is tremendously better than in older versions (back when my team was asked to provide something like this but it was basically impossible). And I'm hoping the OP's client might find this to be a reasonable compromise.
  • Hi Mike, quick question related to a document creation.  After creating a document using a PDF template, I, as an admin user, am able to get the document id in the OnSuccess event of the process model.  But the users are not able to get to the document id in the same event.  It always returns null.  They are set up as Admins on the folders where the document resides.  The documents are showing up as created by them but yet the docid is null.  Any thoughts? 

Reply
  • Hi Mike, quick question related to a document creation.  After creating a document using a PDF template, I, as an admin user, am able to get the document id in the OnSuccess event of the process model.  But the users are not able to get to the document id in the same event.  It always returns null.  They are set up as Admins on the folders where the document resides.  The documents are showing up as created by them but yet the docid is null.  Any thoughts? 

Children