It will never work (just by chance) using a PrintWriter. PDF is always a
binary format even if sometimes look as text.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: RAUL283 [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, February 18, 2003 17:21
> To:   [EMAIL PROTECTED]
> Subject:      [iText-questions] load pdf in browser
> 
> HI,
> I would like how I can load a pdf generated with i-text in the ie.
> I�m using an java agent of lotus notes for it,
> and I have a problem for catching the bytes of the pdf file.
> In lotus I have a method called getAgentOutput() that returns a 
> PrintWriter, This PrintWriter is the stream used to load the pdf file.
> But it doesn�t work because methods of PrintWriter doesn�t write 
> bytes, only text format.
> How I can solve this without use a servlet.?
> I must to use Lotus obligatory, because I am using an agent of notes.
> 
> the code is:
> import java.io.*;
> import java.awt.Color;
> import java.awt.Toolkit;
> import java.net.MalformedURLException;
> import java.net.URL;
> 
> import com.lowagie.text.*;
> import com.lowagie.text.pdf.*;
> 
> 
> public class GeneraPDF extends AgentBase {
>       
> 
>       public void NotesMain() {
> 
>               PrintWriter output = this.getAgentOutput();
>               output.print("Content-Type:application/pdf");
>               
>               ByteArrayOutputStream baos = new ByteArrayOutputStream
> ();
>               
>               // step 1: creation of a document-object
>               com.lowagie.text.Document document = new 
> com.lowagie.text.Document(PageSize.A4,50,50,50,50);
>               try {
>            // we create a writer that listens to the document
>            // and directs a PDF-stream to a file
>               PdfWriter writer = PdfWriter.getInstance(document, 
> baos);
> ...
> generatePDF with i-text
> ...
> 
>       output.print( baos );
>       output.flush();
>       output.close();
>               
>       }
> catch Exceptions 
> 
> }
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to