You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Serving a PDF file in a particular format

2 replies [Last post]
Guest's picture
Guest

Hello,
I have a requirement as follows:
The user enters data in a page.
I need to use that data to create a pdf file, maybe add a logo based on a specific attribute on a page. The pdf file needs to be served immediately to the user who is outside the firewall. May log from home.

I can use sqr. But then that will not serve the pdf file directly. On needs to go to the process monitor and click the log output. Which is not acceptable to the users. They do not want to click multiple buttons.
Rather, they want the pdf file to be generated and served w/o going through process monitor etc.

Is there a way to do this ?

I understand, XML publisher reports can only be viewed in Report Manager.. -- again not a option.

Is it possible to use application engine to create a PDF file. I am not sure whether this is doable but this was suggested. I am not sure how though. ( the only way I can think of is to use a open source java classes like FOP to generate pdf file.

Have any of you accomplished this?

Danny's picture
Danny (not verified)
Re: Serving a PDF file in a particular format

Hi there,

I am assuming that you are using XML Publisher to generate the report

Please proceed as shown below

- Include a button at the end of the page where the user enters the details

- In order for the report to generate automatically after the user clicks the button, you will need to use this code under FieldChange of the same

&xmlFile = GetFile(&filename, "W", %FilePath_Absolute);
If &xmlFile.IsOpen Then
   If &xmlFile.SetFileLayout(@&Filelayout) Then
      &xmlRowset = &xmlFile.CreateRowset();
      &xmlRowset = GetLevel0();
      &xmlFile.WriteRowset(&xmlRowset, True); /* populates the xml file with the entire rowset*/
   Else
      Error "SetFileLayout " | &Filelayout | " failed";
   End-If;
Else
   Error "OpenFile " | &filename | " failed";
End-If;

&xmlFile.Close();

Local PSXP_RPTDEFNMANAGER:ReportDefn &rptDefn;
&rptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn("Pass the report definition ID here")
&rptDefn.Get();
&rptDefn.SetRuntimeDataRowset(&xmlRowset);

- After this, open the App Package PSXP_RPTDEFNMANAGER and open the peoplecode present under ReportDefn. Under this code, the method ProcessReport has to be modified to include one more parameter "Report Name as string".

- Pass this parameter wherever required in the function to generate the output

Danny

CompShack's picture
User offline. Last seen 6 years 23 weeks ago. Offline
Joined: 12/09/2007
Posts: 167
Re: Serving a PDF file in a particular format

Yes, I agree with Danny that XML Publisher is the "best" approach for your requirement. PeopleSoft already does this on some of its delivered pages. One page is the "Development Document" page (Employee Self Service > Performance Management > My Development Document > Create Documents (or Current Documents). You will find a "Printer" icon on the page and once clicked will transform the data on the current page on to a PDF file.

Take a look at the code behind the page (EP_APPR_BASE1) and component (EP_APPR_BASE).

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog