Discussion

Setting Header and Footer in PDF Html2PDF activity

Hi, 
We have requirement to generate a PDF document with headers and footers on each page. We are using OOTB activity HtmltoPDF. But there are no parameters in activity HtmltoPDF to set header and footer. Any idea how to add header and footer using HtmltoPDF ?

 

**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.

Comments

Keep up to date on this post and subscribe to comments

October 31, 2013 - 9:01am

Hi,

We also have same requirement.Can anyone post a solution for this?

November 1, 2013 - 2:02am

add a java step and place the code in that

tools.putParamValue("footer", "page ${page} " + new Date()); this to generate page numbers in the footer along with the date....

December 2, 2013 - 2:33am

Thank you SANTOSHKUMAR .

The code is working for only for footer. For header what we have to write.

If we will write like this "tools.putParamValue("header","XXX Technologies ");" its not working.

Thanks in advance.

 

February 26, 2014 - 10:25am

n/a

Pega
January 31, 2014 - 12:22pm

Was anyone able to figure out how to get the header? Thanks.

February 17, 2014 - 9:18am

Hi Santosh,

We are able to generating pdf with footer but we need to apply styles to footer as ARIAL,Bold.

Could you please help me. It is really urgent for me.

Thanks in advance

February 17, 2014 - 9:18am

Hi Santosh,

We are able to generating pdf with footer but we need to apply styles to footer as ARIAL,Bold.

Could you please help me. It is really urgent for me.

Thanks in advance

June 19, 2014 - 4:53am

Was this ever resolved? I am currently facing the same issue. Would like to maintain the PRPC styles to the PDF

August 26, 2014 - 11:14pm

maybe you got wrong font

February 12, 2015 - 4:25am

Can anyone help in getting the total number of pages in the PDF?

For Example:

for displaying like

Page 1 of 10 where 10 is the total number of pages.

February 26, 2015 - 8:15am

Any one got solutions for above all queries?

Adding header?

Applying styles for header and footer?

Number of pages in the footer?

 

 

March 25, 2015 - 4:08pm

Hi All,

Yes, we can add custom header and footer and apply styles on the same.

Try referring to pyGeneratePDF Activity, where we set the custom header and footer and can add styles to the same.

In the activity try to modify the pyHeaderPageForPDF HTML stream to modify the header style, Similarly for the footer.

Also, please note that any styles applied via Dynamic Layouts wont be applicable while printing the PDF as this is an issue with the PD4ML library.

Regards

May 24, 2015 - 6:08pm

OOTB activity HTMLToPDF has parameters for header and footer.

Using Property-Set-HTML or Property-Set-Stream methods, set the streams for Header and Footer to the parameters (pyPDFHeaderHTMLTemplate and pyPDFFooterHTMLTemplate)  which are used by the HTMLToPDF activity 

 

August 21, 2015 - 9:09am

Hello,

 

Any clue on:

1)  How to get the count of pdf pages?

2) Can anyone help in getting the total number of pages in the PDF?

    For Example: For displaying like

    Page 1 of 10 where 10 is the total number of pages.

 

Any help is appreciated.

 

Thank you.

August 27, 2015 - 10:21am

Try this:

 

tools.putParamValue("pyPDFFooterHTMLTemplate", "page ${page} of ${total}" );

August 27, 2015 - 10:36am

Thank you. I found the solution. Missed to update the thread.

One should be mindful that this {total} tag can be used in footer/header for sure. Not sure  if it would work for the body of the pdf.

 

August 27, 2015 - 10:43am

Good to know. 

I am currently facing a requirement where I need to display a different header for a purticular page. Is there any way that I can use the ${Page} variable to do that? I am not sure what language this is. How can I run it through a condition? 

August 27, 2015 - 10:51am

I'm right there are the crux of same problem to have seperate header & footers for different pages in the PDF.

 

After multiple trials with OOB pega/ JDK API, the option i see is, generate two different pdfs and merge them back to one.

 

AFAIK, JDK dont have default api to merge pdfs(you may still want to verify this). We can use PDFMergerUtilities api from pdfbox.apache or iText open source libraries .