HTML to PDF creation issue

Hi,

I am converting from HTML to PDF. It is working fine but in some scenarios it causing some issues. Let me add a screenshot below. I have uploaded HTML and PDF in a Zip Folder. Please let me know why I have these issues. I have following settings for PDF generation.


Margin = new Syncfusion.Pdf.Graphics.PdfMargins { Top = 0, Left = 30, Right = 30, Bottom = 0 },

                    SplitTextLines = false,

                    SplitImages = true,

                    EnableToc = true,

                    EnableRepeatTableHeader = true,

                    EnableRepeatTableFooter = true





Attachment: 26Jul2021_9676f09b.zip

9 Replies

PV Prakash Viswanathan Syncfusion Team July 27, 2021 09:56 AM UTC

Hi Sheeban, 

Thank you for contacting Syncfusion support. 

We have tried to reproduce the reported issue with provided HTML string and settings, but it is working fine in our side. We have attached the sample which we have tried in our side. Please check the sample and let us know the result.  


If still you are facing the same issue, kindly share us the complete code snippet, complete HTML file with images, styles, scripts etc., so that it will be helpful for us to analyze and assist you further on this.  

Regards, 
Prakash V 



SA Sheeban Ahmed July 27, 2021 10:57 AM UTC

Thanks Prakash, I noticed that you have change a code of header and footer and I did implement same in my application and it starts working for me. I was also facing same issue extra spaces after image this one also get resolved with that change. So far it is working good for me.



PV Prakash Viswanathan Syncfusion Team July 27, 2021 11:01 AM UTC

Hi Sheeban 

Thank you for the update. Please let us know if you need any further assistance on this.   

Regards, 
Prakash V 



SA Sheeban Ahmed July 28, 2021 07:47 AM UTC

Hi Prakash,


I did tried to generate PDF through your code but it is generating extra page in the PDF. I am attaching code please try and let me know why I am having this issue?


Attachment: htmltopdfcore953387620_6f53b678.zip


PV Prakash Viswanathan Syncfusion Team July 29, 2021 03:31 PM UTC

Hi Sheeban, 

We have tried to reproduce the reported issue in our side with provided sample, but the extra page is not added in our side. We suspect the issue may occurs with images and styles, could you please share us the complete HTML file with (images, styles etc.,). So that it will be helpful for us to analyze further on this. We have attached the output PDF document, which is generated in our side with provided sample.  


However, please try the conversion with our Blink rendering engine and let us know the result. Please refer below link for more information about Blink rendering engine.  

 

Regards, 
Prakash V 



SA Sheeban Ahmed July 30, 2021 02:15 PM UTC

Thanks Prakash,


I did tried with Blink Engine but still generates extra page while creating PDF. I am attaching a Project and Image inside the project which I have used in this Project. Let me know if that helps you.


Attachment: htmltopdfcore953387620_d381629f.zip


GK Gowthamraj Kumar Syncfusion Team August 2, 2021 12:32 PM UTC

Hi Sheeban, 
 
We have checked the reported extra page issue with provided sample, the content is height in the PDF document exceeds the page height. So it is adding another page, but there is no content to draw in that page. To resolve this issue, we can adjust the content size in PDF document using ViewPortSize property. Kindly try the conversion with below settings and update us the details.  
 
//Set viewport size to adjust content size.  
settings.ViewPortSize = new Size(1280, 0); 
 
Please let us know if you need any further assistance on this.  
 
Regards, 
Gowthamraj K 



SA Sheeban Ahmed replied to Gowthamraj Kumar August 2, 2021 02:14 PM UTC

Hi  Gowthamraj,

Is there any standard to set the ViewPort Size. As I have seen on few forms that somewhere you are suggesting (1500, 0) and  (800, 0). When I increased x it's PDF size get shrink. So can you please guide what is the standard to follow this size?



PV Prakash Viswanathan Syncfusion Team August 3, 2021 04:19 PM UTC

Hi Sheeban, 

We internally using QtWebKit rendering engine for converting HTML to PDF. The viewport size will be set to the QtWebKit browser windows size. Based on that size, the content will be scaled in the output PDF document. Also it is depends on the input HTML file content width, so we need to set the viewport size based on our requirement. You can check the same behavior in chrome print preview with custom scale option. 

Please refer below link for more information about viewport size.  

Regards, 
Prakash V 


Loader.
Up arrow icon