PDF Download not working first time

I want to download PDF file with @baseclass pyViewAsPDF Activity.

I attached the setting of Activity(see cap1.JPG, cap2.JPG).
I have set Open URL in Window as button click Action(see cap3.JPG).

I expected I can download PDF when I click the button. But after I restarted Pega Application, I downloaded 0 byte PDF file first time and I colud download PDF file second time successfully.

How can I download PDF file first time successfully ?

@kobat

Can you please try passing “_self” against the parameter Window name when you are doing Open URL in window?

@Tanay Kumar Bal Thank you for your reply.

I tried passing “_self” against the parameter Window name when you are doing Open URL in window. But I downloaded 0 byte PDF file first time.

And, Pega Platform version is 8.6.0.

@kobat

Can you try passing the parameter SectionName as well. Check the HTML rule you have referred. It is looking for a section as well.

tools.getStepPage().putString(“pyTransientText”,tools.getParamValue(“SectionName”));

Having said that, I tried doing the same and even if I don’t pass SectionName, for me it downloads a 19KB file and after I pass the section name it downloads the section as is. Both on first click.

BTW what is the actual need here?

Thank you for your reply.
I hear that this behavior is bug in 3rd party library.
And, workaround is below:

  1. add a refresh harness before the PDF generation
  2. open UseCompactStylesforPDF DSS setting and mark it as true
  3. add param.pyClearCache as true without “”

@kobat I tried the above steps, but didn’t work for me. A question I have here:

what is the significance of pyclearcache parameter? I could not find it used anywhere.

I am facing issue like, sometimes which i am clicking on generate PDF button, its giving the blank window without downloading the pdf.I guess you also faced the same issue?