pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brown Paul T <BrownPa...@JohnDeere.com>
Subject RE: PDFBox Problem
Date Tue, 19 Jan 2016 17:04:57 GMT
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:THausherr@t-online.de] 
Sent: Tuesday, January 19, 2016 10:59 AM
To: users@pdfbox.apache.org
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 'ben@benlitchfield.com' - 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*
>
> *BrownPaulT@JohnDeere.com <mailto:BrownPaulT@JohnDeere.com>***
>
> *309-748-1387*
>
>
>
> ---------------------------------------------------------------------
> 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