OL Learn

Dynamically renaming PDFs obtained from HTTP Server Input

I have a simple process which does HTTP SERVER INPUT ==>All In One to Create the PDF which is then returned to the user’s browser.

The MIME Type in the HTTP Server Input is set to Application/PDF

All this works fine, except there is a requirement that when the user clicks on the Save Button the browser should offer a dynamic name for the PDF. At the moment, when the user clicks on the save button, the PDF is saved with the http server input action name and they have to figure out what name the PDF should be saved under.

The name of PDF is dynamic and is included as a field in the http request received by the http server input. How can I used that field to automatically have the browser suggest that dynamic name when the user clicks on that save button?

In your Workflow process, store the name in a JobInfo (say, JobInfo9). Those JobInfos are always passed to the DataMapper and the Content Creation tasks, which means you can obtain their value from inside the data mapping config or from inside the template. In either of the modules, look in the online help for the appropriate scripting command.

For instance, if you wanted to set the default value for an Input field on your template, you’d use something like this:

var result = "Default Name.pdf";

	result = automation.jobInfos.JobInfo9;


Thank you for this, but I don’t see how this automatically enables the browser or forces to save the PDF with a variable name when you click on the Save As button on the browser. The scenario is like this:

  • Users initiate a Post request to the HTTP Server Input by clicking on a submit button from their ERP(which sends the xml data to Workflow)

  • Workflow receives the request and creates a PDF with All In One, then returns or automatically displays the PDF back to the user’s browser.

  • The user can view the PDF directly in their web browser to confirm it as been created correctly, then click on the Save button when their hover over the PDF document in their web browser.

  • The issue is that the browser always suggests the same static name, (which is the HTTP Action name in the HTTP Server Input), in the Save As dialog of the browser.

  • What we need is to force the browser to automatically suggest or show a dynamic name (coming from the XML request) in the Save As dialog in the browser. Otherwise, users have to figure out what the name is supposed to be and manually type it in the Save As dialog.

We are not creating any Web template in Workflow. We only need workflow to return to the user’s web browser the PDF it has created with the All In One. This works fine, but we also want the browser to automatically get a dynamic document name when we click on the Save As button to save the PDF to disk. How can we pass this dynamic name to the user’s browser? Is there anywhere we can pass dynamic meta information in the HTTP header of the HTTP Server or NodeJS Server Input of Workflow?

I hope this is clear? Thank you.

Not sure we can do anything about that, the behavior is browser-dependent.

You could simply try renaming the PDF to its proper name prior to sending it back in Workflow and you should also make sure your HTTP Server Input is set to return a application/pdf content type. This may help the browser “understand” that it is dealing with a PDF file and that the name of that file should be used whenever saving it.

I think we need features to set the request headers in the HTTP Server Input or NodeJS Server Input plugins which will allow users to set the file name, content disposition…etc when we simply want to return a downloadable file (pdf, json, text, xip…etc) back to the browser.

Renaming the PDF in workflow did not help. I thought about setting the Title metadata of the PDF document in the Output preset but for some reason the Output preset fails when I do this. See this post:Which variables are available for the Title metadata field in the Output Preset Wizard?