pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Dubillot <alexcou...@gmail.com>
Subject Re: Fwd: PDFRenderer : RandomAccessBuffer already closed (PDFBox 2.0)
Date Fri, 26 Jun 2015 08:38:26 GMT
Good news today, it's not a thread problem, not a code problem but a file
problem :

While I split my document into 7 parts (one for each day) : Example
<http://www.cinemas-utopia.org/admin/grilles/toulouse/2015-06-30.pdf>

My document is not well saved. (Worked fine on 1.8.9).
Here's my old code that need to be updated :

  int splits = 0;

for(PDPage unePage: lesPagesDecoupes){

if(splits >= nbOfCrops){

splits =0;

}

PDRectangle cropBox1 = unePage.getCropBox();

PDRectangle rectangle = new PDRectangle();

float croppingHeight = ((cropBox1.getUpperRightY() -
> (unePage.getMediaBox().getLowerLeftY()))/nbOfCrops);

rectangle.setUpperRightY((float) (cropBox1.getUpperRightY() -
> (croppingHeight * (splits))));

rectangle.setLowerLeftY((float) (cropBox1.getUpperRightY() -
> (croppingHeight*(splits + 1))));

rectangle.setUpperRightX(cropBox1.getUpperRightX());

rectangle.setLowerLeftX(cropBox1.getLowerLeftX());

unePage.setCropBox(rectangle);

unePage.setMediaBox(rectangle);


> pdfSplit.importPage(unePage);


> splits++;

}

pagesSplit.close();

try {

pdf.close();

pdf = pdfSplit;

   pdfSplit.close();

} catch (Exception e) {

e.printStackTrace();

}


The problem is at the end, so, how can I transfer the Splitted PDDoc to the
General PDDoc ?
(Output of pdfSplit : http://www.docdroid.net/file/view/14qk1/test3.pdf )

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message