Question

Cant find the PDF that is generated through the HTMLToPDF activity

Hi,

I have created an correspondance rule of type 'Mail' and passed that in the 'MarkUp' input parameter for the OOTB HTMLToPDF activity. When the activity is run(stand alone), runs fine. The success message says 'The operation completed successfully, but no content returned'.

But I am not able to find if the PDF was generated properly and the current location of the PDF.

Note: No errors in the tracer.

Regards,

Rashmi

***Updated by moderator: Lochan to update Categories***

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Correct Answer
December 6, 2016 - 4:20am

I solved this issue by using 'Property-Set-HTML' after page new where I set the property to get its value from the Markup parameter. I later tried the same with 'Property-Set-Corr' as I wanted to generate a PDF out of a correspondence rule.

Thanks for all the guidance !!!

Regards,

Rashmi

Comments

Keep up to date on this post and subscribe to comments

Pega
December 5, 2016 - 3:23am

Can you check the file in ServiceExport directory of temp folder?

Please refer pyViewAsPDF OOB activity which "Sends the PDF document to the user as a response to the browser"

December 5, 2016 - 4:02am
Response to Gangababu

Hi Gangababu,

Could you please let me know where I should look for 'ServiceExport directory of temp folder' ?

Im not able to find 'pyViewAsPDF' activity as well by search.

Thanks !!!

Pega
December 5, 2016 - 5:16am

Hi,

You could find the temp folder directory from your server. For ex in tomcat, this setting would present in context.xml. Once you find out the directory you can go to below path and search for PDF files if present or not.

<Environment name="url/initialization/explicittempdir"                  value="<temp_directory>\721oracle" type="java.lang.String>

<temp_directory>\721oracle\StaticContent\global\ServiceExport

Regarding your 2nd query, you can search with old:pyViewAsPDF for the specified rule.

 

Pega
December 5, 2016 - 5:28am

Hi Rashmi,

HTMLTOPDF stores the result in memory (In a Java Byte Array): you can use 'Code-Pega-PDF.View'  to stream the result back to the browser.

Like this; assume your HTML rule to convert it is in the class 'My-Test-Class', create an Activity like this:

  1. Page-New workpage (My-Test-Class)
  2. Page-New contextpage (Code-Pega-PDF)
  3. Call HTMLTOPDF <your-HTML-Rule, other options> [workpage]
  4. Call View [contextpage]

With 'pass in current parameter page' selected for the call to 'View'.

You'll need to supply (at a minimum); the name of the HTML rule to convert, the name of the resultant PDF document ("test.pdf" etc) [see Param Tab for 'Code-Pega-PDF.View' - and HTMLTOPDF will *create* the Object Param needed for 'View').

 

 

 

December 5, 2016 - 6:58am
Response to JOHNPW_GCS

Hi Prij,

Thanks for your pointers. I did up until the last instruction. But in the last step  u say the

"You'll need to supply (at a minimum); the name of the HTML rule to convert, the name of the resultant PDF document ("test.pdf" etc) [see Param Tab for 'Code-Pega-PDF.View' - and HTMLTOPDF will *create* the Object Param needed for 'View')."

When we pass the current parameter page the additional parameters supplied (the name of the HTML rule to convert, the name of the resultant PDF document ("test.pdf" etc) ) will be ignored. So i did not pass the parameter page. But I get the below error (In the tracer) while I try to run my activity in the contect page of my View activity.

Note: My parameters tab is empty. Please find the screen shot attached for your reference.

 ** Java Exception: 	java.lang.ClassCastException: java.lang.String cannot be cast to [B 

 

Your guidance is really aprreciated. Thanks !!!

 ** Java Exception: java.lang.ClassCastException: java.lang.String cannot be cast to [B

Pega
December 5, 2016 - 7:21am
Response to RashmiRaj

Take a look at this Support Video: https://pdn.pega.com/pegatube/support-guide-troubleshooting-cyrillic-script-not-appearing-generated-pdf

It's actually about troubleshooting HTMLTOPDF with regard to Cyrillic characters - but in doing so it references a test Activity which is doing pretty much what you need to do.

If this still doesn't provide enough information - let us know - i'll provide some screenshots showing an example.

Cheers

John

 

Pega
December 5, 2016 - 7:22am
Response to JOHNPW_GCS

Actually - it looks from your screenshots that you just need to use the 'Pass current Parameter Page' into both HTMLTOPDF and VIEW....

December 6, 2016 - 4:08am
Response to JOHNPW_GCS

Thanks a lot John, that worked !!!

I passed the parameter page for both the activities. But now, when I pass an HTML stream for a markup parameter, the PDF gets generated but there is no data. It just displays the value I enter for Markup parameter (Taking this value as a litral and not a rule name). Please find the screen shots attached.

Also, can I pass a correspondence of type 'Mail' or a Paragraph for the Markup parameter to generate a PDF document?

Thanks,

Rashmi

December 6, 2016 - 4:20am
Response to RashmiRaj

I solved this issue by using 'Property-Set-HTML' after page new where I set the property to get its value from the Markup parameter. I later tried the same with 'Property-Set-Corr' as I wanted to generate a PDF out of a correspondence rule.

Thanks for all the guidance !!!

Regards,

Rashmi