[Html2PdfConverter] Generated PDF content not scale to full A4 page size

[Html2PdfConverter] Generated PDF content not scale to full A4 page size

  
Forge Component
(49)
Published on 21 Mar by Guilherme Pereira
49 votes
Published on 21 Mar by Guilherme Pereira

Dears,

I am able to generate PDF using htmltoPdfconverter, the Page is created from SimpleReports as shown below,

After Generating the PDF, using the HTMLtoPDFconverter method GeneratePDF, the pdf generated is shown below,


I have tried all the optional arguments,

SyntaxEditor Code Snippet

"-T 0 -R 0 -B 0 -L 0 -s A4 --print-media-type --disable-smart-shrinking --no-background "


Still getting the same response.


Please help in fixing this issue.


Hi Sathish,

Three questions.

1. The output PDF has an A4 page and is the content that is shrinking or the page itself has a bigger format?

2. What are the orientation? Landscape or Portrait?

3. Does your page have any CSS style applyed that can be impacting the PDF output?

By default, the page size is already A4, so you shouldn't need to set it.

Hi Eduardo,

Please find the answers below,

1) The output PDF is A4 page and the content is shrinking

2) Portrait

3) I am calling GeneratePDF inside Preparation and passing to Download, please find the screenshots below,


Any ideas/suggestions in fixing this.

Thanks.


Eduardo Jauch wrote:

Hi Sathish,

Three questions.

1. The output PDF has an A4 page and is the content that is shrinking or the page itself has a bigger format?

2. What are the orientation? Landscape or Portrait?

3. Does your page have any CSS style applyed that can be impacting the PDF output?

By default, the page size is already A4, so you shouldn't need to set it.



Hello Sathish,

As you are already setting

--disable-smart-shrinking

And the page IS A4, I would try to identify any style being applied through CSS that can be causing this.

A search in the web also tells that sometimes, beside the above, you also need to set the DPI to it to work as expected.

Cheers.