How do you know that the image is "under" the content if it can't be seen?

Tilman

Am 10.06.2021 um 23:38 schrieb Alberto Malvido:
Hi everyone,

I am editing existing PDFs created by unknown third applications. The
edition consists in inserting one image in all of the pages and it works
perfect for all the PDF documents but one. For this PDF, the image gets
under the existing content and it cannot be seen.

I would like to know the reason why this happens, and to find out a way to
insert the image always above the existing content.

For privacy reasons I cannot share the problematic PDF and I don't know how
to create a similar one.

The code for inserting the image in one of the pages is:

// Get the contentStream in append mode
    PDPageContentStream contentStream = new PDPageContentStream(
                         document,
                         document.getPage(numPage),
                         PDPageContentStream.AppendMode.APPEND,
                         true,
                         true))

// Create the PDImageXObject
PDImageXObject pdimage = JPEGFactory.createFromImage(document, buffImg,
0.9f, IMAGE_RESOLUTION);

// Draw the image
contentStream.drawImage(
         pdimage,
         Math.max((int) 0, imgCoordinates.getCoordinates().x),
         Math.max((int) 0, imgCoordinates.getCoordinates().y),
         (float) imgSize.getFinalWidth(),
         (float) imgSize.getFinalHeight());

// Close the contentStream
contentStream.close();

Thank you so much



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to