Hello,
in some cases, when converting html data to PDF using java, images are split into multiple pages. We tried to add a ‘page-break-inside: avoid’ property to the img element and its container element (directly and inside the @media print, @media all css style sections) but it didn’t help.
I’m attaching the zipped maven project with two reproduced cases. The project has a single ImageBreakTest class that creates two documents but I excluded the license and its loading.
- The image is split if there is a preceding table with a very long cell that does not fit on one page. See the input file long_cell.html and the conversion result long_cell_result.pdf. The split image is at the end of the pdf file
- The second case is not completely clear but it seems that the image is split when there is a preceding table with cells with ‘page-break-inside: avoid’ property and with transformed data. You can see the input file transformed_tables.html, it uses the ‘wideTableContainer’ style with ‘transform-origin’ and ‘transform’ properties set. The output can be seen in the transformed_tables_result.pdf.
Do you have any suggestions on how to achieve the desired result that the image is started on the next page if it is to long to fit on the current page? Is it possible? We are not willing to add a page break before each image.
Thanks
aspose_image.zip (261.2 KB)