hi

Can someone help me for the below code.

When I use template.showText("abcd"); It is displaying where as
when I use template.showTextAligned (...). It never shows the
content. What am I doing wrong?

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
This message contains information from Equifax Inc. which may be
confidential and privileged.  If you are not an intended recipient, please
refrain from any disclosure, copying, distribution or use of this
information and note that such actions are prohibited.  If you have
received this transmission in error, please notify by e-mail
[EMAIL PROTECTED]



-------------------------------------------------------------------------
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/

Reply via email to