Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

PDF name set incorrectly as thread name

SA-66338

 

Summary

On saving a PDF, the file name  is incorrectly set with the thread name instead of the specified file name. This occurs during preview PDF.

 

Error Messages

Not Applicable

 

Steps to Reproduce

  1. Create an activity to generate the PDF.
  2. In the activity, write a Java step and add the below code.

    String LTRFileName = "user_name.pdf";
    HashStringMap aMap = new HashStringMap();
    aMap.put( "ContentDisposition", "inline; filename="+LTRFileName+";");
    tools.sendFile(byteArray, LTRFileName, false,aMap, false);

    This code is to preview the PDF in the browser before downloading it.

 

Root Cause

A third-party product issue: Internet Explorer browser.

 

Resolution

Here’s the explanation for the reported behavior:

To render the document in the Preview mode, inline header in aMap is used. However, inline header has issues in the Internet Explorer browser. 
Use the attachment header to download the document instead of inline header. However, in this case, preview is not possible. Only inline header has the privilage of preview.

aMap.put("ContentDisposition", "attachment;filename=\""+LTRFileName+"\";");

 

To generate PDF, set the Title tag in an HTML section. The pd4ml adds title to the PDF. The title displays instead of the tab name.

Use the following custom HTML section to generate the PDF:
<%
String section = tools.getParamValue("SectionName");
String strTitle = tools.getParamValue("PDFName");
%>
<HTML>
<HEAD>
<pega:include name="GeneratePDFStyles" type="Rule-Obj-HTML" />
<title><%= strTitle %></title>
</HEAD>
<BODY>
<pega:include name="<%= section %>" type="Rule-HTML-Section" />
</BODY>
</HTML>

 

 

 

Published January 30, 2019 - Updated July 20, 2021

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice