cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying PDF files created with BLS in xMII 12

Former Member
0 Kudos

Hi all,

we are creating dynamic PDF Reports and store them in an xMII Web folder like "/Project/WEB/PDFFiles/".

The problem is that I cannot display the PDF File after creation to the user, because when I use the URL it says an error like "file cannot be found". Only after I open the Workbench and "publish" the file, the URL works and the PDF is opened.

Can I execute the "publish" command from the web page via JavaScript? Or from the BLS after it has created the PDF?

Regards

Michael

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Michael, you can also stream the PDF files directly from the BLS transaction to the browser, without the need for temporary storage. This is a better approach if these PDF files are "single use", whereas the "publishing" approach is best if many users will want to view the same PDF file(s).

Former Member
0 Kudos

Rick,

I may need both solutions (file and stream), as I am not sure if I should save the PDF because it takes some time to create it.

However, I am not sure how to stream the data to the browser so automatically a browser window pops up. I will try some ideas.

Regards

Michael

Former Member
0 Kudos

Hi, Michael.

The rendered PDF document is stored in a "string" parameter. Create a transaction output parameter of type string, and name it "PDFContent". Now, to stream the data back, create a hyperlink of the format:

http://<yourserver:yourport>/<this depends on your version>/Runner?Transaction=YourFolder/YourTransaction&OutputParameter=PDFContent&OutputContentType=application/pdf

When the user clicks on this link, the PDF will be generated and sent to the browser and should automatically open the Adobe PDF Reader. Note that this technique can be used with all kinds of different content (I've done the same for BLS-created HTML, SVG, PDF, CSV, and even Minitab statistical files).

In some cases, you may need to "trick" IE into forcing an open of the PDF viewer, in which case you might want to tweak the URL as follows:

http://<yourserver:yourport>/<this depends on your version>/Runner?Transaction=YourFolder/YourTransaction&OutputParameter=PDFContent&OutputContentType=application/pdf&PDFContent.pdf

Sometimes IE uses the ".pdf" at the end, sometimes it uses the content type/mime type. Seems inconsistent.

Best regards,

Rick

jcgood25
Active Contributor
0 Kudos

Use the web:// format I mentioned in this thread:

It should be published automatically.

Regards,

Jeremy

Former Member
0 Kudos

Jeremy,

thanks for the hint! The "web://" prefix was exactly what I was looking for! Works perfect, the PDF is now displayed after creation.

Regards

Michael