Hi
PDF is a binary format. Don't convert it to a String and don't use
FileWriters. Your code should probably look approximately like this:
FileInputStream file = new FileInputStream( new File( e:\\border.fo ));
OutputStream out = new FileOutputStream(e:\\my.pdf);
try {
Driver driver = new Driver( new InputSource( file ), out );
driver.setRenderer( Driver.RENDER_PDF );
driver.setupDefaultMappings();
driver.run();
} finally {
out.close();
}
On Wed, 12 Sep 2001 15:10:26 +0200 Harry.Grueneis wrote:
Hello,
i have download the newest version of FOP ( 0_20_1_bin ) and could
not perform a pdf creation. I embedded this code:
FileInputStream file = new FileInputStream( new File( e:\\border.fo ) );
Driver driver = new Driver( new InputSource( file ), out );
driver.setRenderer( Driver.RENDER_PDF );
driver.setupDefaultMappings();
driver.run();
FileWriter file = new FileWriter( e:\\my.pdf );
file.write( new String( out.toByteArray() );
file.flush();
file.close();
in my application. I tried to render 'border.fo' from example directory.
The result is very strange. I got a pdf file that contains only a blank
page.
If i run the 'runtests.bat', all pdf documents will be build correct (
including
border.pdf )
The only difference i see between 'my.pdf' and 'border.pdf' is in pdf
source:
'Border.pdf':
/Producer (FOP 0.20.1)
endobj
5 0 obj
/Length 1330 /Filter [ /ASCII85Decode /FlateDecode ]
stream
Gat=,9lC\:A@sBoRTAk2FW*qIiJOn.BCEQ1'eHF6a@T8Ohuj\%4M7JlC%)9E9ru..
...
'My.pdf':
/Producer (null)
endobj
5 0 obj
/Length 1062 /Filter /FlateDecode
stream
xÅ?XMoI½ûWô?C?6EU)«Ã
@2ÃC²²âÃâ µ(ÿžêâ¢Ã®Ã¹pìâ¢2Ã!뽞W¯ª»«ü¼Z..
...
It seems to be the stream is not correct.
My System:
JDK 1.3 with JBuilder4
Win NT 4.0 and Win98
All Jar-Files included from \\lib
Hope, somebody can help me, because i spended much time to find this error.
greetings harry
Elaxy AG
Harry Grüneis
Gutenbergstr. 5
D- 82178 Puchheim bei München
Tel. +49 (89) 890 130 81 Fax +49 (89) 890 130 89
e-Mail: [EMAIL PROTECTED], Web: http://www.turck.de
Freundliche Grüsse
OUTLINE AG
Jeremias Märki
mailto:[EMAIL PROTECTED]
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029
Internet http://www.outline.ch
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]