Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

For some HTML documents, the HTML content appears as truncated at the right side of the PDF page. How can I make the whole HTML content to fit the PDF page width?

0
Posted

For some HTML documents, the HTML content appears as truncated at the right side of the PDF page. How can I make the whole HTML content to fit the PDF page width?

0

If the PdfConverter.FitWidth property value is true as it is by default (or the HtmlToPdfElement.FitWidth property is true in the case of the PDF Creator), then it means that the HTML document cannot be completely displayed in 1024 pixels which is the default value for the width of the internal browser display. To solve this issue you have to increase the PdfConverter.PageWidth property (or HtmlToPdfElement.HtmlViewerWidth for PDF Creator) to a value in pixels enough to allow the full display of the HTML document. If you don’t know the optimal width of the browser for displaying the whole content then you can try to set PdfConverter.PageWidth=0 and allow the converter to automatically determine the width of the web page based on the size of the HTML elements inside the HTML document. If you set the PdfConverter.FitWidth property on false in your code (or HtmlToPdfElement.FitWidth property for PDF Creator) then most probably the rendered HTML content width is larger than PDF page width

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123