Hai all

The following is my code snippet. I want to create a pdf file using fop
output.
But it is not working .i am trying to open that pdf with adobe acrobat 6.0.
It showing some message like this is not a supported file type or the file
has been corrupted.
Please tell me where i made mistake.How can i use the content of byte array
to 
make pdf file

driver.setLogger(logger);     
driver.setRenderer(Driver.RENDER_PDF);
             
//make xml and xsl stream
Source xmlSrc = new StreamSource(new StringReader(xml));

Source xslSrc = new StreamSource(new StringReader(xsl)); 
            
ByteArrayOutputStream outStream = new ByteArrayOutputStream();            
//Setting driver ouput stream
driver.setOutputStream(outStream);            
            
//parsing the xml stream using sax parser            
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer(xslSrc);
Result result = new SAXResult(driver.getContentHandler());
transformer.transform(xmlSrc, result);
            
byte[] content = outStream.toByteArray();
           
String pdfFileContent=content.toString();               
File file=new File("c:/Samp.pdf");
FileWriter writer=new FileWriter(file);
                
BufferedReader br=new BufferedReader(new StringReader(pdfFileContent));
String str="";
while((str=br.readLine())!=null)
{
        writer.write(str);              
}       
writer.close();


Thanks in advance
george


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


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

Reply via email to