You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Holger Prause <h....@gmx.net> on 2002/03/01 13:58:53 UTC

output PDF via java.io.Writer

Hello,

I am using Fop-0.20.2

Is it generally possible to output a pdf stream via a java.io.Writer object
? 

I know its better to use OutputStreams objects to output binary streams as
pdf,but i want to use a JSPWriter(in a TagLibrary Class) to output a Pdf
Stream so that i can use it as embedded pdf.

The following sourcode should do the the job


InputSource foInputSource = getInputSource();
//buffer fo outputStream
ByteArrayOutputStream foBufferStream = new ByteArrayOutputStream();
Driver driver = new Driver(foInputSource,foBufferStream);
driver.setRenderer(driver.RENDER_PDF);
//perform the fo rendering process
driver.run();

String foOutString = new String(foBufferStream.toByteArray());
//the writer reference is as reference to the JSPWriter which was passed as
Argument
writer.write(foOutString);
writer.flush();

The problem is that when i convert a ByteArrayOutputStream to a String ,
some characters are converted wrong.

For Example , the HEX 8d will be converted to HEX 3f , how can i avoid this
? What encoding do i have to use to avoid this ?

Thank you in advance,

Holger



-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org