[Html2PdfConverter] [Html2PdfConverter] not generating header and footer

Forge Component
(70)
Published on 2 Jun by Guilherme Pereira
70 votes
Published on 2 Jun by Guilherme Pereira

Hi there,

I am using the 1.1.18 version of 

Html2PdfConverter for generating pdf from webpage. However, after several try, I couldn't able to generate the header.  

I am using the following Otherargs

"--encoding utf8 --page-size A4 -L 10 -R 10 --header-html "+Site.EnvironmentUrl+"Header.aspx --footer-html "+Site.EnvironmentUrl+"Footer.aspx"


Any help would be appreciated!


Thanks in advance

Amrita

Hi Amrita,

the argumment you are passing in OtherArgs may incorrect.

please check service center log once.

Check this site- https://wkhtmltopdf.org/usage/wkhtmltopdf.txt

to define proper format header and footer


Regards

Rahul Sahu

Hi Rahul,


Thanks for your reply. I was able to generate header with a html file(header html)  with the above mentioned command. However, when I was trying to generate the same with an aspx it just simply showing nothing. 


Thanks

Amrita




Hi Amrita,

As of i know aspx is not able to generate header and footer .

you need to create html page with .html extention and you can bind with header and footer in same way.


Regards

Rahul Sahu

The html in your experience is similar to the aspx ?

The normal aspx pages generated by the platform has a heavy CSS. In traditional web a UI Flow with "Email" theme can be used to build the header and footer pages to avoid the addition of not used CSS.

Regards 

Graça  

Hi Grace,


Thanks for you suggestion. I tried with the below mentioned layout. Still no luck. It just generates blank space at the top.


Regards

Amrita


Rahul Sahu wrote:

Hi Amrita,

As of i know aspx is not able to generate header and footer .

you need to create html page with .html extention and you can bind with header and footer in same way.


Regards

Rahul Sahu

--header-html option works with the .aspx page as well. At the end it generates the html which is being rendered by the component. 

Make sure the aspx page which you want to consume as header is lightweight. If it is computing and logic then I would advise to add the delay option

--javascript-delay <msec> 


Maria da Graça Peixoto wrote:

The html in your experience is similar to the aspx ?

The normal aspx pages generated by the platform has a heavy CSS. In traditional web a UI Flow with "Email" theme can be used to build the header and footer pages to avoid the addition of not used CSS.

Regards 

Graça  

Indeed, the page generated by the platform is CSS overloaded. To use as pdf header/footer, a light theme should be used.


Amrita Basu wrote:

Hi Grace,


Thanks for you suggestion. I tried with the below mentioned layout. Still no luck. It just generates blank space at the top.


Regards

Amrita


Amrita,

Did you check if the header web screen has Anonymous role enabled?

You may also checkout PDF Header and Footer component, which is fairly easy to use, but the options are limited compared to Html2PdfConverter.

--

Swatantra

Hi Swatantra,


Thanks for your reply. I checked the component "
PDF Header and Footer" which comes with old version of Html2PdfConverter(16.x).

However, I found a solution with a little bit trick ofcourse. I used html file to generate header and footer html with querystring parameters which I wanted as dynamic value. Then by using javascript I fetched the value to the appropriate div element. That solves my purpose. 


Thanks and Regards

Amrita



 

That's indeed a nice workaround. 

This also makes it clear that the header was dynamic with some operation being performed on the aspx page as indicated above.

Solution

You must set the BinariesDirectory site property path based on the installation. In the OutSystems cloud it should be D:\User 

--

Swatantra


Solution

Hi Swatantra,


Thanks for the solution. You made my day! Yes it's actually that settings worked at the end.

Thanks

Amrita