C
C-man
Hi all,
I have a pdf file on disk and I would like to print it using java. I
am using jasper print manager.
Here is the piece of code where it fails.
Object obj = null;
InputStream fis = null;
ObjectInputStream ois = null;
File file = new File( pdf.getpath() );
try {
fis = new FileInputStream( file);
ois = new ObjectInputStream( fis );
obj = ois.readObject();
} catch ( IOException e ) {
throw new DBException( "Error loading object from file : "
+ file, e );
}
pdf.getpath() will return something like d:\documents\report
\20080930.pdf.
readObject is failing and giving me a
"java.io.StreamCorruptedException: invalid stream header" error.
I am using jdk 1.4.
Anyway to fix that?
Thanks.
I have a pdf file on disk and I would like to print it using java. I
am using jasper print manager.
Here is the piece of code where it fails.
Object obj = null;
InputStream fis = null;
ObjectInputStream ois = null;
File file = new File( pdf.getpath() );
try {
fis = new FileInputStream( file);
ois = new ObjectInputStream( fis );
obj = ois.readObject();
} catch ( IOException e ) {
throw new DBException( "Error loading object from file : "
+ file, e );
}
pdf.getpath() will return something like d:\documents\report
\20080930.pdf.
readObject is failing and giving me a
"java.io.StreamCorruptedException: invalid stream header" error.
I am using jdk 1.4.
Anyway to fix that?
Thanks.