You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2014/08/06 22:10:13 UTC

[jira] [Closed] (PDFBOX-2260) Null Pointer Exception when writing an image

     [ https://issues.apache.org/jira/browse/PDFBOX-2260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr closed PDFBOX-2260.
-----------------------------------

    Resolution: Not a Problem

Glad it is working.

Yes, I looked at the "cookbook" and there isn't :-( I can't remember where I got my first code a few years ago, probably from stackoverflow. Anyway, good luck, and if you have "how to" questions that you can't find  a good answer, ask on the user mailing list or on stackoverflow :-)

> Null Pointer Exception when writing an image
> --------------------------------------------
>
>                 Key: PDFBOX-2260
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2260
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.6
>         Environment: Windows 7 64-bit
>            Reporter: Michael Deck
>
> java.lang.NullPointerException 
> at org.apache.pdfbox.pdmodel.pddocument.getdocumentcatalog(pddocument.java:764) 
> at org.apache.pdfbox.util.pdfimagewriter.writeimage(pdfimagewriter.java:125)
> at myfile(26)
> My File:
> 21: File f = new File(file);
> 22: InputStream in = new FileInputStream(f);
> 23: BaseParser bp = new PDFParser(in);
> 24: PDDocument pdf = new PDDocument(new COSDocument(), bp);
> 25: PDFImageWriter writer = new PDFImageWriter();
> 26: writer.writeImage(pdf, "png", "", 1, 1, ".pdf", BufferedImage.TYPE_INT_RGB, 300);
> I am not sure why I am getting a null pointer exception. The pdf I am getting the image from has data in it.



--
This message was sent by Atlassian JIRA
(v6.2#6252)