----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 16, 2002 1:31 AM
Subject: iText-questions digest, Vol 1 #394 - 10 msgs


> Send iText-questions mailing list submissions to
> [EMAIL PROTECTED]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> or, via email, send a message with subject or body 'help' to
> [EMAIL PROTECTED]
>
> You can reach the person managing the list at
> [EMAIL PROTECTED]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of iText-questions digest..."
>
>
> Today's Topics:
>
>    1. Re: Image -> Cell and nested Tables via XML - is it possible ?
(Serge S. Vasiljev)
>    2. PDF Chapter  - simple question (Serge S. Vasiljev)
>    3. re: PDF Chapter - simple question (Serge S. Vasiljev)
>    4. I am Having Problems with Crating  PDF Documents on the fly (Chamath
Nanayakkara)
>    5. Re: PDF Chapter - simple question ([EMAIL PROTECTED])
>    6. Re: I am Having Problems with Crating PDF Documents on the fly
([EMAIL PROTECTED])
>    7. Set Character Spacing Question ([EMAIL PROTECTED])
>    8. Examples with JSP and iText ([EMAIL PROTECTED])
>    9. Error using JSP to create a PDF ([EMAIL PROTECTED])
>   10. Set Character Spacing Question ([EMAIL PROTECTED])
>
> --__--__--
>
> Message: 1
> From: "Serge S. Vasiljev" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: "iText" <[EMAIL PROTECTED]>
> Date: Fri, 15 Feb 2002 11:52:51 +0100
> Subject: [iText-questions] Re: Image -> Cell and nested Tables via XML -
is it possible ?
>
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0085_01C1B617.4BA76850
> Content-Type: text/plain;
> charset="koi8-r"
> Content-Transfer-Encoding: quoted-printable
>
> > All this functionality (links etc.) is not yet supported in
> > the XML package. I should really update this.=20
> =20
>  :-)
> Well - I think that XML give your lib. more flexebility and power :-)
>
> > For the other image-XML question, please compare:
> > the iText DTD, with the constructor of the Image object.
>
>  Ok - you wona to say - that I just can put underlying=3D"true"  to =
> params via XML ?
> =20
> > Nested tables were not supported yet at the moment I wrote the XML 2 =
> PDF functionality. It's on my (very large) todo list.=20
>
> Ok - it's clear - so I have to find some solution - will try to =
> implement it - based on your sources.
>
> The logic should be:
>
>     is TableTag  ->=20
>           if prevous is Cell tag - >=20
>                    remove CellTag from stack ->=20
>                    define Cell location in table and define ParentTable  =
> - >=20
>                    ParentTable.insertTable(table,location )
>
>  right ?
>
> ------=_NextPart_000_0085_01C1B617.4BA76850
> Content-Type: text/html;
> charset="koi8-r"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
> <META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff background=3D"">
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>&gt; All this =
> functionality=20
> (links etc.) is not yet supported in<BR>&gt; the XML package. I should =
> really=20
> update this. </FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2>&nbsp;</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2>&nbsp;:-)</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>Well - I =
> think that XML=20
> give your lib. more flexebility and power :-)<BR><BR>&gt; For the other=20
> image-XML question, please compare:<BR>&gt; the iText DTD, with the =
> constructor=20
> of the Image object.</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>&nbsp;Ok - =
> you wona to say=20
> - that I just can put underlying=3D"true"&nbsp; to params via XML =
> ?</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2>&nbsp;</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>&gt; Nested =
> tables were not=20
> supported yet at the moment I wrote the XML 2 PDF functionality. It's on =
> my=20
> (very large) todo list. </FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>Ok - it's =
> clear - so I have=20
> to find some solution - will try to implement it - based on your=20
> sources.</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>The logic =
> should=20
> be:</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2>&nbsp;&nbsp;&nbsp; is=20
> TableTag&nbsp; -&gt;&nbsp;</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS"><FONT color=3D#000080=20
> size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if prevous is =
> Cell tag=20
> - &gt; </FONT></FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS"><FONT color=3D#000080=20
> size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
> p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
> remove CellTag from stack -&gt; </FONT></FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS"><FONT color=3D#000080=20
> size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
> p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
> define Cell location in table&nbsp;and define ParentTable&nbsp; - &gt;=20
> </FONT></FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS"><FONT color=3D#000080=20
> size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
> p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
> ParentTable.insertTable(table,location )</FONT></FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>&nbsp;right=20
> ?</FONT></DIV></BODY></HTML>
>
> ------=_NextPart_000_0085_01C1B617.4BA76850--
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>
> --__--__--
>
> Message: 2
> From: "Serge S. Vasiljev" <[EMAIL PROTECTED]>
> To: "iText" <[EMAIL PROTECTED]>
> Date: Fri, 15 Feb 2002 11:56:44 +0100
> Subject: [iText-questions] PDF Chapter  - simple question
>
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0094_01C1B617.D6B25900
> Content-Type: text/plain;
> charset="koi8-r"
> Content-Transfer-Encoding: quoted-printable
>
> Sorry I'm not guru in PDF object model
>
> How can I change the first  numeration chapter number - for example I =
> wona that the first chapter in document starts from 10 - next 11, e.t.c.
>
> numberdepth is just display rules  -  right ?
>
> sv
>
>
> ------=_NextPart_000_0094_01C1B617.D6B25900
> Content-Type: text/html;
> charset="koi8-r"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
> <META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>Sorry I'm not =
> guru in PDF=20
> object model</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>How can I =
> change=20
> the&nbsp;first &nbsp;numeration chapter number - for example I wona that =
> the=20
> first chapter in document starts from 10 - next 11, e.t.c.</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>numberdepth =
> is just display=20
> rules&nbsp; -&nbsp; right ?</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2>sv</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080=20
> size=3D2></FONT>&nbsp;</DIV></BODY></HTML>
>
> ------=_NextPart_000_0094_01C1B617.D6B25900--
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>
> --__--__--
>
> Message: 3
> From: "Serge S. Vasiljev" <[EMAIL PROTECTED]>
> To: "iText" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Date: Fri, 15 Feb 2002 12:40:13 +0100
> Subject: [iText-questions] re: PDF Chapter - simple question
>
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_00B9_01C1B61D.E9D016C0
> Content-Type: text/plain;
> charset="koi8-r"
> Content-Transfer-Encoding: quoted-printable
>
> Ok - I found  solution for  XML defined document :-) - with chapter =
> numbers:
>
>  change code in:
>
> SAXiTextHandler class
>
> public void handleStartingTags(String name, Properties attributes) {
>   ....................................................
>
>           // chapters
>         if (Chapter.isTag(name)) {
>             String depth;
>             if ((depth =3D attributes.getProperty(ElementTags.DEPTH)) =
> !=3D null){
>                  chapters =3D Integer.parseInt(depth);
>              }
>             else {
>                chapters++;
>             }
>             Chapter chapter =3D new Chapter(attributes,chapters);
>             stack.push(chapter);
>             return;
>         }
>  ......................................................
> }
>
> Now is you define "depth" attribtue in XML for your chapter it can fetch =
> it
>  easy ;-)
>
> Strange that you define "depth" in elements tag - but did't catch it in =
> parser
> Anyway - lib. is great ;-)
>
>
> ------=_NextPart_000_00B9_01C1B61D.E9D016C0
> Content-Type: text/html;
> charset="koi8-r"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
> <META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>Ok - I =
> found&nbsp; solution=20
> for&nbsp; XML defined document :-) - with chapter numbers:</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>&nbsp;change =
> code=20
> in:</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080=20
> size=3D2>SAXiTextHandler&nbsp;class</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>public void=20
> handleStartingTags(String name, Properties attributes) {</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>&nbsp;=20
> ....................................................</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS"><FONT color=3D#000080 size=3D2>&nbsp;=20
> </FONT></FONT><FONT face=3D"Comic Sans MS" color=3D#000080=20
> size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //=20
> chapters<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if =
> (Chapter.isTag(name))=20
> {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> String=20
> depth;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
> sp; if=20
> ((depth =3D attributes.getProperty(ElementTags.DEPTH)) !=3D=20
> null){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
> sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
> chapters =3D=20
> Integer.parseInt(depth);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
> sp;&nbsp;&nbsp;&nbsp;&nbsp;=20
> }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> else=20
> {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
> bsp;&nbsp;&nbsp;=20
> chapters++;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
> p;&nbsp;=20
> }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> Chapter=20
> chapter =3D new=20
> Chapter(attributes,chapters);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
> p;&nbsp;&nbsp;&nbsp;&nbsp;=20
> stack.push(chapter);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
> nbsp;&nbsp;&nbsp;=20
> return;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080=20
> size=3D2>&nbsp;......................................................</FO=
> NT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2>}</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS"><FONT color=3D#000080 size=3D2>Now is =
> you define=20
> "depth" attribtue in XML for your chapter it can&nbsp;fetch=20
> it</FONT></FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS"><FONT color=3D#000080 =
> size=3D2>&nbsp;easy=20
> ;-)</FONT></FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 =
> size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>Strange that =
> you define=20
> "depth" in elements tag - but did't catch it in parser</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080 size=3D2>Anyway - lib. =
> is great=20
> ;-)</FONT></DIV>
> <DIV><FONT face=3D"Comic Sans MS" color=3D#000080=20
> size=3D2></FONT>&nbsp;</DIV></BODY></HTML>
>
> ------=_NextPart_000_00B9_01C1B61D.E9D016C0--
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>
> --__--__--
>
> Message: 4
> Date: Fri, 15 Feb 2002 04:32:54 -0800
> From: "Chamath Nanayakkara" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] I am Having Problems with Crating  PDF
Documents on the fly
>
> hi
>
> I am Having Problems with Crating a PDF Document on the fly by using
sevlets, My final object is to create dynamically create PDF documents using
sevelts, when the servlet is requested
>
> regards
>
> chamath
>
>
>
> ------------------------------------------------------------
> WWW.COM - Where the Web Begins! http://www.www.com
>
>
> ---------------------------------------------------------------------
> Express yourself with a super cool email address from BigMailBox.com.
> Hundreds of choices. It's free!
> http://www.bigmailbox.com
> ---------------------------------------------------------------------
>
>
> --__--__--
>
> Message: 5
> From: [EMAIL PROTECTED]
> To: "Serge S. Vasiljev" <[EMAIL PROTECTED]>
> Cc: "iText" <[EMAIL PROTECTED]>
> Date: Fri, 15 Feb 2002 16:48:24 GMT
> Subject: [iText-questions] Re: PDF Chapter - simple question
>
> Serge S. Vasiljev writes:
>
> > Strange that you define "depth" in elements tag - but
> > did't catch it in parser
>
> As I said earlier, the XML functionality is far
> from finished (that's also why it is packaged
> separately).
>
> > Anyway - lib. is great ;-)
>
> Thanks. I think that if you study the code, you will
> notice the XML package is very straightforward and easy
> to enhance. All we need is time.
>
> In the past I promised some people that I would
> continue working on the XML stuff, but what I do
> depends also from my employer... So I stopped
> making promises.
>
>
> --__--__--
>
> Message: 6
> From: [EMAIL PROTECTED]
> To: "Chamath Nanayakkara" <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Date: Fri, 15 Feb 2002 16:57:17 GMT
> Subject: [iText-questions] Re: I am Having Problems with Crating PDF
Documents on the fly
>
> Chamath Nanayakkara writes:
>
> > hi
> >
> > I am Having Problems with Crating a PDF Document on the fly by using
sevlets, My final object is to create dynamically create PDF documents using
sevelts, when the servlet is requested
>
> There is a very simple example here:
> http://www.lowagie.com/iText/examples/OutSimplePDF.java
> If you want to see it working try this:
> http://www.lowagie.com/servlets/OutSimplePDF
> You can also add a message:
> http://www.lowagie.com/servlets/OutSimplePDF?msg=Hello%20Chamath
>
> I assure you this Servlet works.
> If you don't get any result, you have a browser problem.
> Read the FAQ about some bugs in MSIE:
> http://www.lowagie.com/iText/faq.html#msie
>
>
> --__--__--
>
> Message: 7
> To: [EMAIL PROTECTED]
> From: [EMAIL PROTECTED]
> Date: Fri, 15 Feb 2002 11:31:17 -0700
> Subject: [iText-questions] Set Character Spacing Question
>
>
> Greetings.
>
> I am trying to create a text string in a content byte object which has a
> specific length.  Since iText does not support user supplied
> font width tables I am trying to adjust the character spacing to
compensate
> for the difference in the measured length using the basefont and the
> desired length.  The desired length is based on a printstream font which
> does not exist in the pdf environment.  I tried the following code:
>
>  // txt is an incoming text token that is being rendered in the PDF page
> // c is the content byte object
>
> BaseFont font =
>
BaseFont.createFont(BaseFont.HELVETICA,BaseFont.WINANSI,BaseFont.NOT_EMBEDDE
D);
> float fs = txt.ps/10f;   // font pontsize
> float x = getX(txt.x,txt.units);
> float y = getY(txt.y,txt.units);
> float l  = getPoints(txt.l,txt.units);  // desired length of string in
> points
> float r = 0;
> if (txt.iDir != 0)
>     r = 360-txt.iDir;
> float tw = font.getWidthPoint(text,fs);  // width of string using the
> basefont
> c.setFontAndSize(font,fs);
> c.setCharacterSpacing(l/tw);
> c.beginText();
> c.showTextAligned(c.ALIGN_LEFT,text,x,y,r);
> c.endText();
>
>
> The result is not what i hoped for . . . the resulting length of the token
> in the PDF does not match the length in the printstream as I expected.
>
> Does anyone out there know how I can solve this problem? . . . I need to
> get a PDF string length to match a specific
> value.
>
> With the Adobe library it was easy because you could set the width table
> for a font to match any font you like . . . however that
> lib is C only and has its own set of problems.
> Is there some way to accomplish this with iText . . . building zillions of
> custom
> fonts in a font library is not an option.  Could I subclass a font object
> and provide widths? . . . Would they end up in the PDF
> as a width table object associated with the font?  Other ideas?
>
> I am open to suggestions.
>
> Thanks in advance,
> Jerold Sampson
>
>
>
> --__--__--
>
> Message: 8
> Date: Fri, 15 Feb 2002 13:00:53 -0600
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] Examples with JSP and iText
>
> Hi,
>
> Could you share examples in which from one JSP page is create a pdf file
> using the iText.
>
> I need to create a PDF file, after get some data.
>
> Thanks!
>
> Carlos
>
>
>
> __________________________________________________________
> Accesa a tu mail desde cualquier lugar del mundo:
> http://terramail.terra.com.mx/TerraMail/Mails
>
>
>
>
>
> --__--__--
>
> Message: 9
> Date: Fri, 15 Feb 2002 13:22:30 -0600
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] Error using JSP to create a PDF
>
> Hi,
>
> I get the following JSP CODE, but I receive the following error:
>
> I'm using JRUN 3.1 and Netscape Entrerprise Server 3.6
>
> Please help me!
> Carlos.
>
> ****************************Error****************************************=
> *
> null
> java.lang.ArrayIndexOutOfBoundsException
> at jrun__webkit_ui__pdf_view2ejsp17._jspService(jrun__webkit_ui__pdf_vie=
> w2ejsp17.java,
> Compiled Code)
> at allaire.jrun.jsp.HttpJSPServlet.service(HttpJSPServlet.java, Compiled=
>
> Code)
> at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code)
> at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java, Compiled Code)
> at allaire.jrun.servlet.JRunNamedDispatcher.forward(JRunNamedDispatcher.=
> java,
> Compiled Code)
> at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java, Compiled Code)
> at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code)
> at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java, Compiled Code)
> at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatc=
> her.java,
> Compiled Code)
> at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code)
> at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java, Compiled Co=
> de)
> at allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java, Compiled Code=
> )
> at allaire.jrun.ThreadPool.run(ThreadPool.java, Compiled Code)
> at allaire.jrun.WorkerThread.run(WorkerThread.java, Compiled Code)
>
>
>
> **************************************JSP CODE***************************=
> **
> <%@ page language=3D"java"  import=3D"java.sql.*,java.net.*,java.io.ByteA=
> rrayOutputStream,java.awt.Color,com.lowagie.text.*,com.lowagie.text.pdf.P=
> dfWriter"
> %>
> <html>
> <head>
> <title>PAGINA PDF</title>
> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-885=
> 9-1">
> </head>
>
> <body bgcolor=3D"#FFFFFF" text=3D"#000000">
>
> <%
> Color border =3D new Color(0x00, 0x00, 0x00);
> Font font1 =3D new Font(Font.HELVETICA, 8, Font.BOLD, Color.blue);
> Font font2 =3D new Font(Font.HELVETICA, 9, Font.NORMAL, Color.blue);
> Font font3 =3D new Font(Font.HELVETICA, 8, Font.NORMAL, Color.black);
> Font font4 =3D new Font(Font.HELVETICA, 7, Font.ITALIC, Color.blue);
> Font font5 =3D new Font(Font.HELVETICA, 9, Font.BOLD, Color.red);
>
> Paragraph newLine =3D new Paragraph("\n", font1);
> ByteArrayOutputStream baos =3D new ByteArrayOutputStream();
> Document document =3D new Document(PageSize.A4, 20,10, 25, 25);
> document.addSubject("PDF Generated page");
>
> try {
> PdfWriter.getInstance(document, baos);
> document.open();
> try {
> Image image =3D Image.getInstance("logo.gif");
> image.scaleToFit(600,40);
> image.setAlignment(Image.LEFT);
> document.add(image);
>     }
> catch(Exception e) {
> document.add(new Paragraph(e.getMessage()));
> }
>
> com.lowagie.text.Table table =3D new com.lowagie.text.Table(3,2);
> table.setWidth(100);
> table.setBorderWidth(0);
> table.setAlignment(Element.ALIGN_LEFT);
> table.setBorderColor(new Color(255,255, 255));
> table.setCellpadding(2);
> table.setCellspacing(1);
> table.setBackgroundColor(new Color(255, 255, 255));
> String tableArr[] =3D {"Name","Lowagie","Phone Num","1234567890","Locati=
> on","Minniapolis"};
>
> Font fonts[] =3D {font2,font3,font2,font3,font2,font3,font2,font3,font2,=
> font3};
> for(int i=3D0;i<=3D9;i++)
> {
>   Cell cell =3D new Cell(new Chunk(tableArr[i],fonts[i]));
>   cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>   cell.setBorderWidth(1);
>   cell.setBorderColor(new Color(255, 255, 255));
>   cell.setBackgroundColor(new Color(255, 255, 255));
>   table.addCell(cell);
> }
>
> document.add(table);
> document.close();
> response.reset();
> response.setContentType("application/pdf");
> response.setHeader("Content-Disposition", "attachment;filename=3D" + "fi=
> rst.pdf");
> response.setContentLength(baos.size());
> ServletOutputStream out1=3D response.getOutputStream();
> baos.writeTo(out1);
> out1.flush();
> }
> catch(DocumentException de) {
> System.err.println(de.getMessage());
> de.printStackTrace();
> }
> %>
>
>
> </body>
> </html>
>
>
>
solution:

Becase of  length of the TableArr is only 7 but u constructed the loop upto
9
that is why u r getting problem o.k

> __________________________________________________________
> Accesa a tu mail desde cualquier lugar del mundo:
> http://terramail.terra.com.mx/TerraMail/Mails
>
>
>
>
>
> --__--__--
>
> Message: 10
> To: [EMAIL PROTECTED]
> From: [EMAIL PROTECTED]
> Date: Fri, 15 Feb 2002 12:59:33 -0700
> Subject: [iText-questions] Set Character Spacing Question
>
>
> Greetings.
>
> I am trying to create a text string in a content byte object which has a
> specific length.  Since iText does not support user supplied
> font width tables I am trying to adjust the character spacing to
compensate
> for the difference in the measured length using the basefont and the
> desired length.  The desired length is based on a printstream font which
> does not exist in the pdf environment.  I tried the following code:
>
>  // txt is an incoming text token that is being rendered in the PDF page
> // c is the content byte object
>
> BaseFont font =
>
BaseFont.createFont(BaseFont.HELVETICA,BaseFont.WINANSI,BaseFont.NOT_EMBEDDE
D);
> float fs = txt.ps/10f;   // font pontsize
> float x = getX(txt.x,txt.units);
> float y = getY(txt.y,txt.units);
> float l  = getPoints(txt.l,txt.units);  // desired length of string in
> points
> float r = 0;
> if (txt.iDir != 0)
>     r = 360-txt.iDir;
> float tw = font.getWidthPoint(text,fs);  // width of string using the
> basefont
> c.setFontAndSize(font,fs);
> c.setCharacterSpacing(l/tw);
> c.beginText();
> c.showTextAligned(c.ALIGN_LEFT,text,x,y,r);
> c.endText();
>
>
> The result is not what i hoped for . . . the resulting length of the token
> in the PDF does not match the length in the printstream as I expected.
>
> Does anyone out there know how I can solve this problem? . . . I need to
> get a PDF string length to match a specific
> value.
>
> With the Adobe library it was easy because you could set the width table
> for a font to match any font you like . . . however that
> lib is C only and has its own set of problems.
> Is there some way to accomplish this with iText . . . building zillions of
> custom
> fonts in a font library is not an option.  Could I subclass a font object
> and provide widths? . . . Would they end up in the PDF
> as a width table object associated with the font?  Other ideas?
>
> I am open to suggestions.
>
> Thanks in advance,
> Jerold Sampson
>
>
>
>
> --__--__--
>
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
> End of iText-questions Digest
>
>



_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to