We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Html to PDF Webkit rendering engine SplitImages Not Working

Hello, I am attempting to convert a web page using the WebKit converter.  However, I am having a problem where depending on where you are in the document, even if you have SplitImages = false, it can still split an image onto the next page, like so in the screenshot below. Is there a way where I can code it so that it does not do this?



7 Replies

PV Prakash Viswanathan Syncfusion Team February 11, 2020 06:40 AM UTC

Hi Michael, 

Thank you for contacting Syncfusion support.  

If the image size is larger than the PDF page height, the reported issue will occurs with image split. This is default behavior of HTML to PDF converter, we could not resize the image to fit inside the page.  
If the image size (height) in your HTML file is not larger than the PDF page height, kindly share us the complete input HTML file with images and code snippet to reproduce the issue in our end. So, that it will be helpful for us to analyze and assist you further on this.  

Regards, 
Prakash V 



MI Michael February 19, 2020 07:26 PM UTC

Prakash, thank you for your reply, but I was actually able to figure out why it wasn't working.


PV Prakash Viswanathan Syncfusion Team February 20, 2020 06:11 AM UTC

Hi Michael, 

Thank you for your update. Please provide the details (HTML file, Code snippet, output PDF document etc.,) if you are facing any issue with HTML to PDF conversion.  

Regards, 
Prakash V 



RS Romana Smejkalova replied to Michael November 2, 2020 10:21 AM UTC

Prakash, thank you for your reply, but I was actually able to figure out why it wasn't working.

Hello Michael, I've encountered the same problem as yours and would like to ask you how did you solve it? What was a solution that helped you?
Thank you!


GK Gowthamraj Kumar Syncfusion Team November 3, 2020 12:10 PM UTC

Hi Romana, 

Thank you for contacting Syncfusion support.     
  
The reported issue will occur due to the image size is larger than the PDF page height, so that the image will split. This is the default behavior of HTML to PDF converter, we could not resize the image to fit inside the page. To overcome this issue, the image size (height) in your HTML file is not larger than the PDF page height. Kindly try the conversion with the above suggestion in the image size on your end and let us know the result.   
  
However, please share with us the complete input HTML file with images and code snippets to reproduce the issue on our end. So, that it will be helpful for us to analyze and assist you further on this.   

Regards, 
Gowthamraj K 



RS Romana Smejkalova November 3, 2020 01:16 PM UTC

Hi, thanks for the quick answer.

So do you suggest to resize the image so it's gonna fit in the PDF page?
Why couldn't you do that? Did you want to leave this decision on a user or it was not possible because any particular reason?

I have found out that the conversion succeeds when I adjust the WebKitViewPort dimensions to the image...


GK Gowthamraj Kumar Syncfusion Team November 4, 2020 12:48 PM UTC

Hi Romana, 
 
Thank you for your update.   
  
As we said earlier, we are suggested you change the size (height) of the image referred to in an HTML file to avoid the image split issue. If the image size (referred to in that HTML page) is larger than the PDF page height, that image will split to the next page. This is the default behavior of HTML to PDF converter, we could not resize the image to fit inside the page So that we could not handle this on our end.   
  
If the HTML page is responsive or adjustable content, we can adjust the HTML content size in the PDF document by using viewport size. We have tried with different viewport size (3072, 0) on our end, the pdf document will generate properly. Based on the provided size, the content will be scaled in the PDF document. Please try the below viewport settings in your sample and let me know the result.    
  
//Set viewport size 
settings.WebKitViewPort = new System.Drawing.Size(3072, 0); 
 
 
Note: If the HTML page is not responsive content, this viewport suggestion will not work in that case. So you have to change the image size (height) in the HTML file itself.  
 
Regards, 
Gowthamraj K 


Loader.
Live Chat Icon For mobile
Up arrow icon