> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of [EMAIL PROTECTED]
> Sent: Wednesday, October 17, 2007 8:21 PM
> To: Post all your questions about iText here
> Subject: [iText-questions] template.showTextAligned vs
> template.showText
>
> hi
>
> Can someone help me for the below code.
>
> When I use template.showText("abcd"); It is displaying where as
It's being placed at (0,0).
> when I use template.showTextAligned (...). It never shows the
It's being placed at (500,620).
> content. What am I doing wrong?
Your are writting in the wrong place. The template only has a -20 to 60
range.
Paulo
>
> Below is the sample code:
>
>
> public void onEndPage(PdfWriter writer, Document document) {
> try {
>
> PdfContentByte cb = writer.getDirectContent();
> helv = BaseFont.createFont("Helvetica-Bold",
> BaseFont.CP1252,
> BaseFont.NOT_EMBEDDED);
>
> if (didPgEnd) {
>
> tpl.beginText();
> tpl.setFontAndSize(helv, 10);
> tpl.showText("$12.00");
> //tpl.showTextAligned(PdfContentByte.ALIGN_RIGHT,
> "$12.00", 500, 620, 0);
> tpl.endText();
> currPgNo = 1;
> }
> cb.setFontAndSize(helv, 10);
> cb.addTemplate(tpl, 500, 620);
> } catch(Exception e) {
> throw new ExceptionConverter(e);
> }
> }
>
> public void onStartPage(PdfWriter wr, Document document) {
> if (currPgNo == 1) {
> tpl = wr.getDirectContent().createTemplate(500, 200);
> }
> tpl.setBoundingBox(new Rectangle(-20, -20, 60, 60));
> }
>
>
> Task is i am generating a invoice for different customers
> into one pdf file
> and
> each customer may have more than one page.
>
> Hence the tot invoice amt needs to be reset for each customer
> which i do by
> setting didPgEnd == true.
>
> currPgNo is incremented when new page starts for a new customer.
> didPgEnd is set to true if its the end of the page.
>
> //Declaration of variables are as below
> public class billing extends PdfPageEventHelper {
> static PdfTemplate tpl;
> static BaseFont helv;
> static int currPgNo = 1;
> static boolean didPgEnd = false;
> public static void main(String[] args) {
> ......
> }
> }
>
> Despratly, need help on this...
>
> Thanks in-advance
> suri
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/