Program is trivial  ( see below ) -  

  I have tried several .PDF files - all with same result, so I think any .pdf 
will have the problem

public static void main(String[] args) {
                try {
                        File inpFile = new 
File("C://Temp/MPDReversionJAN2016/MPDToWP01ReversionNotes.pdf");
                        File outFile = new 
File("C://Temp/MPDReversionJAN2016/MPDToWP01ReversionNotes.jpg");
                        FileInputStream inpStream = new 
FileInputStream(inpFile);
                        PDFParser parser = new PDFParser(inpStream);
                        parser.parse();
                        PDDocument pdfDoc = parser.getPDDocument();
                        PDStream pdStream = new PDStream(pdfDoc);
                        PDJpeg jpeg = new PDJpeg(pdStream);
                        System.out.println("Attempt To Write JPEG To ->" + 
outFile.getAbsolutePath());
                        jpeg.write2file(outFile);
                        System.out.println("Normal exit");
                } catch(Throwable tr) {
                        System.err.println(tr.toString());
                        tr.printStackTrace();
                }
                System.exit(0);
        }

-----Original Message-----
From: Tilman Hausherr [mailto:[email protected]] 
Sent: Tuesday, January 19, 2016 10:59 AM
To: [email protected]
Subject: Re: PDFBox Problem

None of the attachments went through, please upload them somewhere. What 
version are you using?
Tilman

Am 19.01.2016 um 17:39 schrieb Brown Paul T:
>
> Originally sent to '[email protected]' - which was found at top of 
> source code
>
> I'm trying to save a .PDF as a .JPG - and getting null pointer.   See 
> attached Java Program and .PDF file
>
> Console Output at bottom
>
> Has anyone used this feature before ?
>
> Thanks -  Paul
>
> Attempt To Write JPEG To
> ->C:\Temp\MPDReversionJAN2016\FernandoPDF\328693422.jpg
>
> _java.lang.NullPointerException_
>
>       at
> org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg.write2OutputStream(_
> PDJpeg.java:295_)
>
>       at
> org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage.write2file(_
> PDXObjectImage.java:284_)
>
> at com.pdfbox.PDFBoxDemoMain.main(_PDFBoxDemoMain.java:27_)
>
> *Paul T Brown*
>
> *Manufacturing Planning  Systems*
>
> *A & T Division - Deere & Company*
>
> *[email protected] <mailto:[email protected]>***
>
> *309-748-1387*
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to