Question

We are using iText for merging of some already dynamically created PDFs. The final PDF after merging does not show the pictures which were dynamically added while creating the original PDFs.

Here is how it works:

  1. A SAP WebDynpro Java application generates PDFs. Some images are bound like this in the XDP:

    <field access="readOnly" w="42mm" h="51.86mm" name="pmPicture" x="1mm" y="1.1mm">
       <ui>
          <imageEdit data="embed" />
       </ui>
       <value>
          <image aspect="none" />
       </value>
       <bind match="dataRef" ref="$.pmPicture" />
       <border>
          <edge presence="hidden" />
          <corner presence="hidden" />
       </border>
       <desc>
          <text name="embeddedHref">Unknown Embedded URI</text>
       </desc>
    </field>
    
  2. Application shows preview PDFs. PDFs show the bound images correctly!

  3. We use iText based on this example code to merge PDF files.

  4. Final PDF does not show bound images. Bound text are shown correctly.

I have tried to find out what happens while iText "reads" the PDF. I could find out that the images were loaded succesfully in the reader objects with the following code:

System.out.println(pdfReader.getAcroFields().getField("pmPicture"))

So now I try to find out what happens while merging the PDFs in to a final PDF. But I couldn't find anything wrong with the code. Should I do something extra for the images?

// Create a new page in the target for each source page.
while (pageOfCurrentReaderPDF < pdfReader.getNumberOfPages()) {
   document.newPage();
   pageOfCurrentReaderPDF++;
   page = writer.getImportedPage(pdfReader,
   pageOfCurrentReaderPDF);
   cb.addTemplate(page, 0, 0);
}

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top