Hi Paulo,
Thanks, I want to write a table on the PdfContentByte. Whats the right
way to do.

I am trying two solutions. One is using PdfTemplate, and  other is using
table.writeSelectedRows();
Also how to split large table when page is finished by any of these
methods?



The one with PdfTemplate is failing.

Table table=new  Table(4)
....
....
PdfTemplate template = cb.createTemplate(500, 200);
template.setBoundingBox(table); //not sure if this is correct  way
The above line  throws following exception

java.lang.UnsupportedOperationException: Dimensions of a Table can't be
calculated. See the FAQ.
        at com.lowagie.text.Table.left(Unknown Source)
        at com.lowagie.text.pdf.PdfRectangle.<init>(Unknown Source)
        at com.lowagie.text.pdf.PdfFormXObject.<init>(Unknown Source)
        at com.lowagie.text.pdf.PdfTemplate.getFormXObject(Unknown
Source)
        at com.lowagie.text.pdf.PdfWriter.addSharedObjectsToBody(Unknown
Source)
        at com.lowagie.text.pdf.PdfStamperImp.close(Unknown Source)
        at com.lowagie.text.pdf.PdfStamper.close(Unknown Source)

I noticed from the source code most of the Table.left() etc doesn't have
any implementation and they throw this exception.
I think its not the correct way to add the table.

Thanks
Ashwani


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paulo
Soares
Sent: Tuesday, December 27, 2005 4:42 PM
To: Kalra, Ashwani; [email protected]
Subject: RE: [iText-questions] Getting exception on adding the template

PdfContentByte cb = stamp.getOverContent(1);

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Kalra, Ashwani
> Sent: Tuesday, December 27, 2005 10:41 AM
> To: [email protected]
> Subject: [iText-questions] Getting exception on adding the template
>
>
> Hi,
>
> I am trying to add template after filling the FDF template using
> PDFStamper class. The code snippet is like this
>
> PdfReader reader = new PdfReader("<fdf template file>"); PdfStamper
> stamp = new PdfStamper(reader, new FileOutputStream("<output file
> name>"));
>
> ....
> ....
> //Finish populating the fields and then try to add template
>
> PdfContentByte cb = stamp.getWriter().getDirectContent();
> PdfTemplate template = cb.createTemplate(500, 200);
> template.lineTo(500, 0);  //adding simple line ....
> ....
>
> cb.addTemplate(template, 0, 0);   // I get NullPointerException here
>
>
> Stack Trace:
>
> java.lang.NullPointerException
>         at com.lowagie.text.pdf.PdfContentByte.addTemplate(Unknown
> Source)
>         at com.lowagie.text.pdf.PdfContentByte.addTemplate(Unknown
> Source)
>         at
> com.sony.spe.ifds.core.util.PDFUtil.createDunningWithTemplate(
> PDFUtil.ja
> va:157)
>         at com.sony.spe.ifds.core.util.PDFUtil.main(PDFUtil.java:186)
>
>
>
> I checked in debugger, both template and cb are not null. The same
> thing works when I create a new Document.
>
> Is it not possible with PdfStamper class/ or when I am working with
> form fields.
>
> __________________
> Thanks
> Ashwani
>
>
>
>
>
> This message contains information that may be privileged or
> confidential and is the property of the Capgemini Group. It is
> intended only for the person to whom it is addressed. If you are not
> the intended recipient,  you are not authorized to read, print,
> retain, copy, disseminate,  distribute, or use this message or any
> part thereof. If you receive this message in error, please notify the
> sender immediately and delete all  copies of this message.
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log

> files for problems?  Stop!  Download the new AJAX search engine that
> makes searching your log files as easy as surfing the  web.
> DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files for problems?  Stop!  Download the new AJAX search engine that
makes searching your log files as easy as surfing the  web.  DOWNLOAD
SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to