pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Platthaus, Thomas" <thomas.platth...@rhein-ruhr-informatik.de>
Subject Error using icafe4j / (pdfbox/) in SAP PI 7.4
Date Wed, 25 Oct 2017 06:02:13 GMT
Dear dragon66,
Dear pdfbox-Team,

we have a problem (txt file with exception attached) using icafe4j lib
under SAP PI 7.4 (running on Unix-System).

At first I would like to describe our project in a short form:
We have many PI-interfaces getting invoices from different customers all
over the world. Most of the invoices are
sent as xml structure. When we have received the xml the first step is to
convert it to an internal standard format.
This message in standard format is the basic data for building a pdf
invoice using pdfbox (currently v2.0.4).
For some of the interfaces the next step is to create a multi-page tiff
file for archiving the invoice, here we use the
lib from icafe4j (v1.1). It runs fine and we do not have any problems with
the interfaces that are already productive.

We have some interfaces where we get a pdf file as incoming invoice (e.g.
via mail, sftp). We are converting these
pdf files to multi-page tiff, too. A couple of these are running in
production environment for many weeks now.

But one of the interfaces (just in development) now leads to an exception
while transforming incoming pdf to tiff.
The functionality is fine when testing in local environment (eclipse, Java
1.6, Windows 7) but fails in SAP PI.

At the beginning of the project we had a similar behaviour using the
standard ImageIO classes. All fine during
local tests but exceptions in SAP PI: Some font problem and
ImageIO.getImageReadersByFormatName and
ImageIO.scanForPlugins didn't work although we tried many different ways to
implement. As a conclusion we
then decided to use icafe4j and the problem has been solved - till we got
another error now :-(

So back to our current failure. In PI we call the java class
BuildAndSaveTIFFByContainer (excerpts from code):
// Load PDF File to PDDocument.
*pDoc* = PDDocument.load(bPdf);                            //
oTrace.addDebugMessage("BuildAndSaveTIFFByContainer: Write Stream to
pageCounter = pDoc.getNumberOfPages();
"PageCounter", "" + pageCounter);
// Create TIFF from PDF
CreateMultiTIFFFromPDF tiffFromPdf = new CreateMultiTIFFFromPDF();
bTiff = tiffFromPdf.*createMultipageTIFF(pDoc)*;
// Close document

// Method createMultipageTIFF() from class CreateMultiTIFFFromPDF
public byte[]* createMultipageTIFF(PDDocument pddPdf)* throws IOException {
    pdDocument = pddPdf;
    byte[] retByteArray = null;
    int dpi = 300;
    PDFRenderer pdfRenderer = new PDFRenderer(pdDocument);
    BufferedImage[] images = new
    TIFFOptions tiffOptions = new TIFFOptions();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    RandomAccessOutputStream rout = new
    for (int pageIdx = 0; pageIdx < pdDocument.getNumberOfPages();
pageIdx++) {
        try {
            BufferedImage imageG = pdfRenderer.renderImageWithDPI(pageIdx,
dpi, ImageType.GRAY);
            BufferedImage imageBB = new BufferedImage(imageG.getWidth(),
            Graphics2D g2d = imageBB.createGraphics();
            g2d.drawRenderedImage(imageG, null);
            images[pageIdx] = imageBB;
        } catch (IOException e) {
    ImageParam.ImageParamBuilder builder = ImageParam.getBuilder();
    ImageParam[] param = new ImageParam[1];
    param[0] = builder.build();
    *TIFFTweaker.writeMultipageTIFF(rout, param, images);*
    retByteArray = baos.toByteArray();
    // Close Document
    return retByteArray;

The red marked line is getting IndexOutOfBoundsException (details in
attached PDF_TO_TIFF_ERR.txt).

We checked and compared the content of all known pdf files for our invoice
interfaces (incoming or created by pdfbox) and the only difference we see
is the following:

​There are some barcodes coming with pdf files (screenshot below) and in
screenshot above you can see Filter [ /ASCII85Decode /FlateDecode ] ...
this is the first time we got this
ASCII85Decode. But we are not sure if this is the reason for our problem!?
And unfortunately debugging in PI is very difficult ...


Do you have any idea what could be the reason for IndexOutOfBounds here? Or
maybe you know something about similar issues and their solution?

Screenshot TIFFTweaker class from icafe4j 1.1:


I would welcome your response.
Thank you!


*Best regards / Mit freundlichen GrüßenThomas Platthaus*
*EAI & SOA Senior Developer*

Rhein-Ruhr-Informatik GmbH
Alexanderstraße 50
45472 Mülheim an der Ruhr

Tel +49 208 452358-0
Mob +49 173 2928075
Fax +49 208 452358-10
Email thomas.platthaus@rhein-ruhr-informatik.de
Web http://www.rhein-ruhr-informatik.de <http://www.realcore-it.de/>

Rhein-Ruhr-Informatik GmbH
Amtsgericht Essen: HRB 24657
Sitz der Gesellschaft: Essen
Geschäftsführer: Michael Heim

View raw message