Image split into multiple pages


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.

  1. 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
  2. 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 (261.2 KB)


We have reproduced the issue in our environment and logged it as PDFJAVA-39878 in our issue tracking system. We will further investigate it in details and try to determine the reasons behind it. We will be able to share some workaround or fix of this issue as soon as its analysis is complete. Please be patient and spare us some time.

We apologize for the inconvenience caused.

Could you please let us know the fix for this.


Regretfully, the ticket could not get resolved due to other pending issues in the queue logged prior to it. Nevertheless, we have recorded your concerns and will surely inform you once we make some progress towards its resolution. Please spare us some time.

We are sorry for the inconvenience.