pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Qingchao Kong <kqingc...@gmail.com>
Subject Re: How to define regions in PDFTextStripperByArea?
Date Wed, 30 Apr 2014 06:57:34 GMT
Paul,
>
>                 int width = 612;
>                 int height = 792;
>
>                 int hX = 320, tX = 340, cX = 100;
>                 int hY = 0, tY = 580, cY = 200;
>                 int hW = width - hX, tW = width - tX, cW = 100;
>                 int hH = 80, tH = height - tY, cH = 60;
>
>                 Rectangle header = new Rectangle();
>                 header.setBounds(hX, hY, hW, hH);
>                 Rectangle totals = new Rectangle();
>                 totals.setBounds(tX, tY, tW, tH);
>                 Rectangle customer = new Rectangle();
>                 customer.setBounds(cX, cY, cW, cH);
>
>                 PDFTextStripperByArea stripper = new PDFTextStripperByArea();
>                 stripper.addRegion("header", header);
>                 stripper.addRegion("totals", totals);
>                 stripper.addRegion("customer", customer);
>                 stripper.setSortByPosition(true);
>

So it means that you have set the bounds emperically, like header,
totals and customer, is that correct? The problem is PDF files may be
of various sizes and you only know the header/footer are at the
front/end of a PDF page, you would never know the exact locations.

Btw, which version of PDFBox do you use? You never encounter the
"Exception in thread "main" java.lang.IllegalArgumentException:" ?

Regards,

Mime
View raw message