You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Daniel Egea Almagro <de...@plq.es> on 2014/11/14 14:00:12 UTC
Page printing without barcode
I have tryed this code:
try {
PDDocument doc = PDDocument.load(f);
PDPage page = (PDPage)
doc.getDocumentCatalog().getAllPages().get(0);
BufferedImage image;
image = page.convertToImage();
File outputfile = new File("/home/daniel/image.png");
ImageIO.write(image, "png", outputfile);
} catch (IOException ex) {
Logger.getLogger(Impresora.class.getName()).log(Level.SEVERE,
null, ex);
}
Using the PDF attached
And get the PNG attached
In the rendering process I get the following error... in the
'convertToImage()' call
2014-11-14 13:56:12,592 WARN [org.apache.pdfbox.util.PDFStreamEngine] -
<java.lang.ArrayIndexOutOfBoundsException>
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at
org.apache.pdfbox.pdmodel.graphics.xobject.PDInlinedImage.createImage(PDInlinedImage.java:218)
at
org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage.process(BeginInlineImage.java:69)
at
org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:557)
at
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:268)
at
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:235)
at
org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:215)
at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:139)
at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:801)
at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:732)
One for each of the 4 barcodes in PDF file
As you can see, te page is rendered OK but without any barcode
How could I render completily OK?
Re: Page printing without barcode
Posted by John Hewson <jo...@jahewson.com>.
Also you might want to try the 2.0 snapshot - most files render correctly with that.
-- John
> On 14 Nov 2014, at 07:32, Tilman Hausherr <TH...@t-online.de> wrote:
>
> Hi,
>
> Please retry it with the latest 1.8.8 snapshot
> https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox/1.8.8-SNAPSHOT/
>
> If it doesn't work, please open an issue in JIRA and attach the PDF file. (can't attach it here)
> https://issues.apache.org/jira/browse/PDFBOX
>
> Good luck
>
> Tilman
>
> Am 14.11.2014 um 14:00 schrieb Daniel Egea Almagro:
>> I have tryed this code:
>>
>> try {
>> PDDocument doc = PDDocument.load(f);
>> PDPage page = (PDPage) doc.getDocumentCatalog().getAllPages().get(0);
>> BufferedImage image;
>> image = page.convertToImage();
>> File outputfile = new File("/home/daniel/image.png");
>> ImageIO.write(image, "png", outputfile);
>> } catch (IOException ex) {
>> Logger.getLogger(Impresora.class.getName()).log(Level.SEVERE, null, ex);
>> }
>>
>> Using the PDF attached
>>
>> And get the PNG attached
>>
>> In the rendering process I get the following error... in the 'convertToImage()' call
>>
>> 2014-11-14 13:56:12,592 WARN [org.apache.pdfbox.util.PDFStreamEngine] - <java.lang.ArrayIndexOutOfBoundsException>
>> java.lang.ArrayIndexOutOfBoundsException
>> at java.lang.System.arraycopy(Native Method)
>> at org.apache.pdfbox.pdmodel.graphics.xobject.PDInlinedImage.createImage(PDInlinedImage.java:218)
>> at org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage.process(BeginInlineImage.java:69)
>> at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:557)
>> at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:268)
>> at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:235)
>> at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:215)
>> at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:139)
>> at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:801)
>> at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:732)
>>
>> One for each of the 4 barcodes in PDF file
>>
>> As you can see, te page is rendered OK but without any barcode
>>
>> How could I render completily OK?
>>
>>
>
Re: Page printing without barcode
Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,
Please retry it with the latest 1.8.8 snapshot
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox/1.8.8-SNAPSHOT/
If it doesn't work, please open an issue in JIRA and attach the PDF
file. (can't attach it here)
https://issues.apache.org/jira/browse/PDFBOX
Good luck
Tilman
Am 14.11.2014 um 14:00 schrieb Daniel Egea Almagro:
> I have tryed this code:
>
> try {
> PDDocument doc = PDDocument.load(f);
> PDPage page = (PDPage)
> doc.getDocumentCatalog().getAllPages().get(0);
> BufferedImage image;
> image = page.convertToImage();
> File outputfile = new File("/home/daniel/image.png");
> ImageIO.write(image, "png", outputfile);
> } catch (IOException ex) {
> Logger.getLogger(Impresora.class.getName()).log(Level.SEVERE, null, ex);
> }
>
> Using the PDF attached
>
> And get the PNG attached
>
> In the rendering process I get the following error... in the
> 'convertToImage()' call
>
> 2014-11-14 13:56:12,592 WARN [org.apache.pdfbox.util.PDFStreamEngine]
> - <java.lang.ArrayIndexOutOfBoundsException>
> java.lang.ArrayIndexOutOfBoundsException
> at java.lang.System.arraycopy(Native Method)
> at
> org.apache.pdfbox.pdmodel.graphics.xobject.PDInlinedImage.createImage(PDInlinedImage.java:218)
> at
> org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage.process(BeginInlineImage.java:69)
> at
> org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:557)
> at
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:268)
> at
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:235)
> at
> org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:215)
> at
> org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:139)
> at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:801)
> at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:732)
>
> One for each of the 4 barcodes in PDF file
>
> As you can see, te page is rendered OK but without any barcode
>
> How could I render completily OK?
>
>