output PDF via java.io.Writer

2002-03-01 Thread Holger Prause

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: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




AW: output PDF via java.io.Writer

2002-03-01 Thread Beer, Christian

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

Well a java.io.Writer is used for character output. A PDF is binary output,
especialy if you use filters (Flate, ...)

I think it could be possible, but no good idea! The problem is, that a
writer
handles character data (2 bytes) and it can convert the data (for example
\n\r
to \r or something) and then the offsets in the PDF don't fit any more.

The more I think about it, I'd say let it be, also because a JSP is
constructed
to return character data, not binary. We tried to implement a
download-JSP, but
implemented that in a servlet, because there were many errors and caveats.

Greetings

Christian Beer

 -Ursprüngliche Nachricht-
 Von: Holger Prause [mailto:[EMAIL PROTECTED]]
 Gesendet: Freitag, 1. März 2002 13:59
 An: [EMAIL PROTECTED]
 Betreff: 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: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]
 

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