Always keep the list on correspondences. I would think the problem lies in your usage of the PdfContentByte, and not to pass the buck, but I'll bet Paulo knows. :)
-Matt --- Uwe Kristmann <[EMAIL PROTECTED]> wrote: > hi matt, > > it works, i get the pdfstream with the text > HELLO StreamTest3!! (document.add) > but not the text i tried to add with > PdfContentbyte. > both in MSIE 6.0.26 > and > Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; > rv:1.0.2) Gecko/20021120 Netscape/7.01 > don't understand why > thanks for the reply > > uwe > > Matt Benson <[EMAIL PROTECTED]> schrieb am > 20.06.03 19:02:15: > > > > What happens when you invoke the servlet through > the > > browser? Also, does it happen to work properly > using > > a different browser? > > > > -Matt > > > > --- Uwe Kristmann <[EMAIL PROTECTED]> wrote: > > > > > > hi, > > > > > > first to say, i'm not a great java expert and > new > > > to itext . > > > > > > I'm trying to write pdfcontent direct to the > > > browser (MSIE 6.026) . > > > It works fine for <document.add>, but using > > > <PdfContentbyte> has > > > no effect. > > > Writing to the servers filesystem and > redirecting > > > the generated file > > > to the client is ok, but i would prefer to > write > > > to a ByteArrayOutputStream. > > > > > > has anyone an idea what's wrong with this > code? > > > > > > thanks a lot > > > > > > uwe > > > > > > serverlog: > > > with PdfContentByte > > > [20/06/2003 19:43:44:290 GMT+02:00] > StreamTest3: > > > init > > > [20/06/2003 19:43:46:793 GMT+02:00] > StreamTest3: > > > BAOS.size()= 2074 > > > [20/06/2003 19:43:46:893 GMT+02:00] > StreamTest3: > > > BAOS.size()= 2074 > > > [20/06/2003 19:45:53:115 GMT+02:00] > StreamTest3: > > > destroy > > > without > > > [20/06/2003 19:45:53:165 GMT+02:00] > StreamTest3: > > > init > > > [20/06/2003 19:45:55:518 GMT+02:00] > StreamTest3: > > > BAOS.size()= 1916 > > > [20/06/2003 19:45:55:619 GMT+02:00] > StreamTest3: > > > BAOS.size()= 1916 > > > > > > //package pdfservlet; > > > > > > //////////////////////////////////////////////////////////////////////////////// > > > import java.io.ByteArrayOutputStream; > > > import java.io.FileOutputStream; > > > import java.io.IOException; > > > import java.net.URL; > > > > > > import javax.servlet.http.*; > > > import javax.servlet.*; > > > > > > import com.lowagie.text.*; > > > import com.lowagie.text.pdf.BaseFont; > > > import com.lowagie.text.pdf.PdfContentByte; > > > import com.lowagie.text.pdf.PdfWriter; > > > > > > //////////////////////////////////////////////////////////////////////////////// > > > public class StreamTest3 extends HttpServlet { > > > > > > //////////////////////////////////////////////////////////////////////////////// > > > > > > public void init(ServletConfig config) > > > throws ServletException { > > > super.init(config); > > > } > > > > > > //////////////////////////////////////////////////////////////////////////////// > > > > > > public void doGet > > > ( > > > HttpServletRequest req, > > > HttpServletResponse res > > > ) > > > throws > > > ServletException, > > > IOException > > > { doPost(req,res); } > > > > > > //////////////////////////////////////////////////////////////////////////////// > > > > > > public void doPost(HttpServletRequest request, > > > HttpServletResponse response) > > > throws IOException, ServletException { > > > > > > Document document = new Document(PageSize.A4, > 50, > > > 50, 50, 50); > > > ByteArrayOutputStream baos = new > > > ByteArrayOutputStream(); > > > try { > > > PdfWriter writer = > > > PdfWriter.getInstance(document,baos); > > > writer.getInstance(document,baos); > > > document.open(); > > > /* > > > PdfContentByte cb = > writer.getDirectContent(); > > > > > > cb.beginText(); > > > > > > BaseFont bf = > > > BaseFont.createFont(BaseFont.HELVETICA, > > > BaseFont.CP1252, BaseFont.NOT_EMBEDDED); > > > > > > cb.setFontAndSize(bf, 12); > > > String text = "Sample text for > > > alignment"; > > > // we show some text starting on > some > > > absolute position with a given alignment > > > > > > cb.showTextAligned(PdfContentByte.ALIGN_CENTER, > text > > > + " Center", 250, 700, 0); > > > > > > cb.showTextAligned(PdfContentByte.ALIGN_RIGHT, > text > > > + " Right", 250, 650, 0); > > > > > > cb.showTextAligned(PdfContentByte.ALIGN_LEFT, > text + > > > " Left", 250, 600, 0); > > > > > > // we draw some text on a certain > > > position > > > cb.setTextMatrix(100, 400); > > > cb.showText("Text at position > > > 100,400."); > > > > > > // we draw some rotated text on a > > > certain position > > > cb.setTextMatrix(0, 1, -1, 0, 100, > 300); > > > cb.showText("Text at position > 100,300, > > > rotated 90 degrees."); > > > > > > // we draw some mirrored, rotated > text > > > on a certain position > > > cb.setTextMatrix(0, 1, 1, 0, 200, > 200); > > > cb.showText("Text at position > 200,200, > > > mirrored and rotated 90 degrees."); > > > > > > // we tell the contentByte, we've > > > finished drawing text > > > cb.endText(); > > > */ > > > document.add(new Chunk("HELLO STREAMTEST > > > 3!!")); > > > document.close(); > > > > > > } > > > catch (DocumentException de) > > > {log(de.getMessage());} > > > > === message truncated === __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com ------------------------------------------------------- This SF.Net email is sponsored by: INetU Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions