pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: [PDFBox 2.0.2] PDFRenderer.renderImageWithDPI throws java.lang.NegativeArraySizeException
Date Wed, 03 Aug 2016 17:42:08 GMT
Am 03.08.2016 um 18:43 schrieb Rafael Pivetta Balbuena:
> Ok. The revision 1754976 should fix the problem in this thread? Because not
> fix.

I just downloaded the latest jar from
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.3-SNAPSHOT/
and then did this:
java -jar pdfbox-app-2.0.3-20160803.162206-130.jar PDFReader 
PDFBOX-3447-Step-99999.pdf
and it works, i.e. the file PDFBOX-3447-Step-99999.pdf ("DOTTUS 
Condominios", attached in the issue) is displayed. If it doesn't work 
for you, then it could be you have several versions in your classpath.


Tilman
>
> 2016-08-03 13:15 GMT-03:00 Tilman Hausherr <THausherr@t-online.de>:
>
>> Am 03.08.2016 um 16:33 schrieb Rafael Pivetta Balbuena:
>>
>>> What jdk version is used to compile PDFBox project (revision: 1754976)?
>>>
>> Don't know about the CI server, but if you build yourself you can use 6, 7
>> or 8. (not 9).
>>
>> Tilman
>>
>>
>>
>>> 2016-08-01 17:50 GMT-03:00 Tilman Hausherr <THausherr@t-online.de>:
>>>
>>> Am 01.08.2016 um 22:18 schrieb Rafael Pivetta Balbuena:
>>>> Ok, And because of this different strategy I need crop the pdf, but if
>>>>> it's
>>>>> not possible convert pdf to image with PDFRenderer (because XStep or
>>>>> YStep
>>>>> 99999), is there any other way using PDFBox?
>>>>>
>>>>> No, not this time, this is really a bug. I've opened an issue.
>>>> https://issues.apache.org/jira/browse/PDFBOX-3447
>>>>
>>>> Tilman
>>>>
>>>>
>>>>
>>>>
>>>> 2016-08-01 16:56 GMT-03:00 Tilman Hausherr <THausherr@t-online.de>:
>>>>> Am 01.08.2016 um 21:50 schrieb Rafael Pivetta Balbuena:
>>>>>
>>>>>> Thanks a lot.
>>>>>>
>>>>>>> For that file extract the barcode, but for this pdf file
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> https://drive.google.com/file/d/0B8GFWmLzuj1QbE1HVENYd3VRems/view?usp=docslist_api
>>>>>>> why don't extract barcode, only four bars (two white and two
black
>>>>>>> bar)?
>>>>>>>
>>>>>>> That is because this file uses a different strategy to display
the
>>>>>>>
>>>>>> barcode. It just repeats the two images you mentioned.
>>>>>>
>>>>>> Tilman
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2016-08-01 16:40 GMT-03:00 Tilman Hausherr <THausherr@t-online.de>:
>>>>>>
>>>>>>> Am 01.08.2016 um 21:28 schrieb Rafael Pivetta Balbuena:
>>>>>>>
>>>>>>> Its possible extract images from that file?
>>>>>>>> Yes, use the ExtractImages command line tool. I just tried
it.
>>>>>>>>> Tilman
>>>>>>>>
>>>>>>>>
>>>>>>>> 2016-08-01 16:00 GMT-03:00 Tilman Hausherr <THausherr@t-online.de>:
>>>>>>>>
>>>>>>>> Am 01.08.2016 um 20:55 schrieb Rafael Pivetta Balbuena:
>>>>>>>>> Same error with original PDF file.
>>>>>>>>>
>>>>>>>>>> Original PDF
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> https://drive.google.com/file/d/0B8GFWmLzuj1QT0daNmRfeU5lUWM/view?usp=docslist_api
>>>>>>>>>>> and the dimensions:
>>>>>>>>>>> page.setCropBox(new PDRectangle((float)51.871-10,
(float)18.876,
>>>>>>>>>>> (float)293.25+20, (float)36.75));
>>>>>>>>>>>
>>>>>>>>>>> That file has another error:
>>>>>>>>>>>
>>>>>>>>>>> Caused by: java.lang.IllegalArgumentException:
Dimensions
>>>>>>>>>>>
>>>>>>>>>> (width=99999
>>>>>>>>>> height=99999) are too large
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.rendering.TilingPaint.getImage(TilingPaint.java:138)
>>>>>>>>>> org.apache.pdfbox.rendering.TilingPaint.<init>(TilingPaint.java:69)
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.rendering.PageDrawer.getPaint(PageDrawer.java:263)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.rendering.PageDrawer.getNonStrokingPaint(PageDrawer.java:599)
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:675)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.contentstream.operator.graphics.FillNonZeroRule.process(FillNonZeroRule.java:36)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:829)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:485)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:453)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:156)
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:196)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:145)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:68)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:238)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:219)
>>>>>>>>>>          java.lang.Thread.run(Thread.java:745)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> The file has three patterns with XStep and YStep
= 99999. That's
>>>>>>>>>> too
>>>>>>>>>> big
>>>>>>>>>> for us.
>>>>>>>>>>
>>>>>>>>>> Tilman
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 2016-08-01 15:41 GMT-03:00 John Hewson <john@jahewson.com>:
>>>>>>>>>>
>>>>>>>>>> On 1 Aug 2016, at 11:37, Rafael Pivetta Balbuena
<
>>>>>>>>>>
>>>>>>>>>>> rafael.pivetta@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>> I "cropped" barcode (
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> https://drive.google.com/file/d/0B8GFWmLzuj1QV0ZNZ3VyaEkxc1E/view?usp=docslist_api
>>>>>>>>>>>> )
>>>>>>>>>>>>
>>>>>>>>>>>> from a PDF file using PDRectangle.
>>>>>>>>>>>>
>>>>>>>>>>>> This might seems like an obvious question,
but do you get the
>>>>>>>>>>>> same
>>>>>>>>>>>>
>>>>>>>>>>>>> error
>>>>>>>>>>>>>
>>>>>>>>>>>> with that PDF file
>>>>>>>>>>>> if you don’t do the cropping?
>>>>>>>>>>>>
>>>>>>>>>>>> Also, what were the original crop box dimensions?
>>>>>>>>>>>>
>>>>>>>>>>>> — John
>>>>>>>>>>>>
>>>>>>>>>>>> ...
>>>>>>>>>>>>
>>>>>>>>>>>>          PDRectangle cropbBox = page.getCropBox();
>>>>>>>>>>>>
>>>>>>>>>>>>          page.setCropBox(new PDRectangle((float)51.871-10,
>>>>>>>>>>>>> (float)18.876,
>>>>>>>>>>>>> (float)293.25+20, (float)36.75));
>>>>>>>>>>>>>          doc.save("/dirXYZ/testcrop.pdf");
>>>>>>>>>>>>>          doc.close();
>>>>>>>>>>>>> ...
>>>>>>>>>>>>> But in line 'pdfRenderer.renderImageWithDPI(i,
200,
>>>>>>>>>>>>> ImageType.RGB)'
>>>>>>>>>>>>> PDFRenderer pdfRenderer = new PDFRenderer(document);
>>>>>>>>>>>>>          for (int i = 0; i < document.getNumberOfPages();
++i)
>>>>>>>>>>>>>          {
>>>>>>>>>>>>>              BufferedImage bim =
>>>>>>>>>>>>> pdfRenderer.renderImageWithDPI(i,
>>>>>>>>>>>>> 200,
>>>>>>>>>>>>> ImageType.RGB);
>>>>>>>>>>>>>
>>>>>>>>>>>>>              // suffix in filename will
be used as the file
>>>>>>>>>>>>> format
>>>>>>>>>>>>>              ImageIOUtil.writeImage(bim,
>>>>>>>>>>>>> "/home/pivetta/desenvolvimento/pdf_to_png/testepdfbox/testecrop"
>>>>>>>>>>>>> +
>>>>>>>>>>>>> "-" +
>>>>>>>>>>>>> (i+1) + ".png", 600);
>>>>>>>>>>>>>          }
>>>>>>>>>>>>> throws NegativeAtiveArraySizeException.
I'm using PDFBOX 2.0.2,
>>>>>>>>>>>>> java
>>>>>>>>>>>>> 8,
>>>>>>>>>>>>> Exception in thread "main" java.lang.NegativeArraySizeException
>>>>>>>>>>>>>          at
>>>>>>>>>>>>> java.awt.image.DataBufferByte.<init>(DataBufferByte.java:76)
>>>>>>>>>>>>>          at
>>>>>>>>>>>>> java.awt.image.Raster.createInterleavedRaster(Raster.java:266)
>>>>>>>>>>>>>          at
>>>>>>>>>>>>> java.awt.image.Raster.createInterleavedRaster(Raster.java:212)
>>>>>>>>>>>>>          at
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>> java.awt.image.ComponentColorModel.createCompatibleWritableRaster(ComponentColorModel.java:2825)
>>>>>>>>>>>>
>>>>>>>>>>>>          at
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> org.apache.pdfbox.rendering.TilingPaint.getImage(TilingPaint.java:134)
>>>>>>>>>>>>>          at
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> org.apache.pdfbox.rendering.TilingPaint.<init>(TilingPaint.java:69)
>>>>>>>>>>>>>          at
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> org.apache.pdfbox.rendering.PageDrawer.getPaint(PageDrawer.java:251)
>>>>>>>>>>>>>
>>>>>>>>>>>>>          at
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> org.apache.pdfbox.rendering.PageDrawer.getNonStrokingPaint(PageDrawer.java:529)
>>>>>>>>>>>>
>>>>>>>>>>>>          at
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:600)
>>>>>>>>>>>>>
>>>>>>>>>>>>>          at
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> org.apache.pdfbox.contentstream.operator.graphics.FillNonZeroRule.process(FillNonZeroRule.java:36)
>>>>>>>>>>>>
>>>>>>>>>>>>          at
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:815)
>>>>>>>>>>>>
>>>>>>>>>>>>          at
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:472)
>>>>>>>>>>>>
>>>>>>>>>>>>          at
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:446)
>>>>>>>>>>>>
>>>>>>>>>>>>          at
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
>>>>>>>>>>>>
>>>>>>>>>>>>          at
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:189)
>>>>>>>>>>>>>
>>>>>>>>>>>>>          at
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:208)
>>>>>>>>>>>>>          at
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:139)
>>>>>>>>>>>>>          at
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>> org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:94)
>>>>>>>>>>>>
>>>>>>>>>>>>          at
>>>>>>>>>>>> ExtractImagesFromPDF.main(ExtractImagesFromPDF.java:67)
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>>>>>>>>>
>>>>>>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message