The PDF page should not have a bottom left corner at (0, 0) . It can be anywhere in the coordinate system. Thus, an A4 page can be (0, 0, 595, 842) , but it can also be (1000, 2000, 1595, 2842) .
You position the image at (0, 0) :
img.setAbsolutePosition(0, 0);
But the page of this document is defined as (0, 15366, 469, 15728) . The image is actually added to the output document, but outside the visible area of the page.
You need to get the page coordinates to place the image. Inside the loop do the following:
img.setAbsolutePosition(reader.getPageSize(i).getLeft(), reader.getPageSize(i).getBottom());
source share