Re: [iText-questions] Tables and FormFields: Is this a bug?

2011-01-04 Thread 1T3XT BVBA
Op 4/01/2011 18:59, Johannes Becker schreef:
> Hi,
>
> thanks again for the quick reply.
>
>   >  so whatever problem there was: it's already fixed ;-)
> Good job.
>
> Since I'm stuck to an old version, might there be a
> workaround (i.e. wrapping my tables in some other object)?
Not that I know of. I didn't test with iText 5.0.5, but it would 
surprise me if the fix was introduced recently.
I vaguely remember that this was fixed longer ago, but I don't remember 
how it was fixed.

Why are you stuck with the old version?
If it's because you want to avoid paying a license: I'm sorry, then 
you're out of luck.
If it's because you still need to run the application in JDK 1.4, then 
you could contact consultancy and ask them to make an offer to make a 
custom fix for you: http://www.itextpdf.com/contact.php#consultancy

--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php


Re: [iText-questions] Tables and FormFields: Is this a bug?

2011-01-04 Thread Johannes Becker
Hi,

thanks again for the quick reply.

 > so whatever problem there was: it's already fixed ;-)
Good job.

Since I'm stuck to an old version, might there be a
workaround (i.e. wrapping my tables in some other object)?

Thanks
Jonny


Am 04.01.2011 18:10, schrieb 1T3XT BVBA:
> /* in_action/chapter15/SenderReceiver.java */
> import java.io.FileOutputStream;
> import java.io.IOException;
> import java.util.Random;
>
> import com.itextpdf.text.Document;
> import com.itextpdf.text.DocumentException;
> import com.itextpdf.text.ExceptionConverter;
> import com.itextpdf.text.Paragraph;
> import com.itextpdf.text.Rectangle;
> import com.itextpdf.text.pdf.PdfContentByte;
> import com.itextpdf.text.pdf.PdfFormField;
> import com.itextpdf.text.pdf.PdfPCell;
> import com.itextpdf.text.pdf.PdfPCellEvent;
> import com.itextpdf.text.pdf.PdfPTable;
> import com.itextpdf.text.pdf.PdfWriter;
> import com.itextpdf.text.pdf.TextField;
>
> /**
>   * This example was written by Bruno Lowagie. It is part of the book 'iText 
> in
>   * Action' by Manning Publications.
>   * ISBN: 1932394796
>   *http://www.1t3xt.com/docs/book.php
>   *http://www.manning.com/lowagie/
>   */
>
> public class SenderReceiver implements PdfPCellEvent {
>


--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php


Re: [iText-questions] Tables and FormFields: Is this a bug?

2011-01-04 Thread 1T3XT BVBA

Op 4/01/2011 17:51, Johannes Becker schreef:

Hi,

thanks for the quick reply.


  Does the problem also exist in the most recent iText version?

Yes it does (iText 5.0.5).

It doesn't in the SNAPSHOT version of iText 5.0.6.
See attached code sample as well as the resulting PDF,
so whatever problem there was: it's already fixed ;-)


senderreceiver_1766675841.pdf
Description: Adobe PDF document
/* in_action/chapter15/SenderReceiver.java */
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Random;

import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.ExceptionConverter;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfFormField;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPCellEvent;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.text.pdf.TextField;
 
/**
 * This example was written by Bruno Lowagie. It is part of the book 'iText in
 * Action' by Manning Publications. 
 * ISBN: 1932394796
 * http://www.1t3xt.com/docs/book.php 
 * http://www.manning.com/lowagie/
 */
 
public class SenderReceiver implements PdfPCellEvent {
 
protected PdfFormField parent;
 
protected String partialFieldName;
 
protected PdfWriter writer;
 
protected boolean required;
 
public SenderReceiver(PdfWriter writer, PdfFormField parent, String 
name,
boolean required) {
this.writer = writer;
this.parent = parent;
this.partialFieldName = name;
this.required = required;
}
 
/**
 * @see 
com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell,
 *  com.lowagie.text.Rectangle, 
com.lowagie.text.pdf.PdfContentByte[])
 */
public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] 
cb) {
TextField tf = new TextField(writer, new 
Rectangle(rect.getLeft(2), rect
.getBottom(2), rect.getRight(2), 
rect.getTop(2)), partialFieldName);
if (required)
tf.setOptions(TextField.REQUIRED);
tf.setFontSize(12);
try {
parent.addKid(tf.getTextField());
} catch (Exception e) {
throw new ExceptionConverter(e);
}
}
 
public static void main(String[] args) {
System.out.println("Chapter 15: example Sender Receiver");
System.out.println("-> Creates a PDF file with an AcroForm");
System.out.println("-> jars needed: iText.jar");
System.out.println("-> files generated in /results 
subdirectory:");
System.out.println("   sender_receiver.pdf");
// step 1
Document document = new Document();
try {
// step 2
PdfWriter writer = PdfWriter.getInstance(document,
new FileOutputStream("senderreceiver_" 
+ new Random().nextInt() + ".pdf"));
// step 3
document.open();
// step 4
document.add(new Paragraph("Sender"));
PdfFormField sender = PdfFormField.createEmpty(writer);
sender.setFieldName("sender");
document.add(createTable(writer, sender));
writer.addAnnotation(sender);

document.add(new Paragraph("Sender1"));
PdfFormField sender1 = PdfFormField.createEmpty(writer);
sender1.setFieldName("sender1");
document.add(createTable(writer, sender1));
writer.addAnnotation(sender1);

document.add(new Paragraph("Sender2"));
PdfFormField sender2 = PdfFormField.createEmpty(writer);
sender2.setFieldName("sender2");
document.add(createTable(writer, sender2));
writer.addAnnotation(sender2);

document.add(new Paragraph("Sender3"));
PdfFormField sender3 = PdfFormField.createEmpty(writer);
sender3.setFieldName("sender3");
document.add(createTable(writer, sender3));
writer.addAnnotation(sender3);

document.add(new Paragraph("Sender4"));
PdfFormField sender4 = PdfFormField.createEmpty(writer);
sender4.setF

Re: [iText-questions] Tables and FormFields: Is this a bug?

2011-01-04 Thread 1T3XT BVBA
Op 4/01/2011 17:51, Johannes Becker schreef:
> Hi,
>
> thanks for the quick reply.
>
>>   Does the problem also exist in the most recent iText version?
> Yes it does (iText 5.0.5).
OK, I'll test it to see if you've found a bug.
(It looks like one, but I need to make sure.)

--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php


Re: [iText-questions] Tables and FormFields: Is this a bug?

2011-01-04 Thread Johannes Becker
Hi,

thanks for the quick reply.

>  Does the problem also exist in the most recent iText version?

Yes it does (iText 5.0.5).

Thanks
Jonny


Am 04.01.2011 17:37, schrieb 1T3XT BVBA:
> Op 4/01/2011 14:45, Johannes Becker schreef:
>> Hi all,
>>
>> thanks to help of you (especially 1T3XT BVBA) I'm now able to create
>> tables with PdfFormFields in them.
>>
>> But now I'm having a strange side-effect:
>> The code attached generates the attached pdf. As you can see, the
>> PdfFormFields of the last table
>> are drawn on the second page, not in the table as I would expect.
> You're using a mighty old version of iText.
> I can tell because you're still using com.lowagie classes.
> Does the problem also exist in the most recent iText version?
>
> --
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment, and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> ___
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Many questions posted to this list can (and will) be answered with a 
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples: 
> http://itextpdf.com/themes/keywords.php
>


--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php


Re: [iText-questions] Tables and FormFields: Is this a bug?

2011-01-04 Thread 1T3XT BVBA
Op 4/01/2011 14:45, Johannes Becker schreef:
> Hi all,
>
> thanks to help of you (especially 1T3XT BVBA) I'm now able to create 
> tables with PdfFormFields in them.
>
> But now I'm having a strange side-effect:
> The code attached generates the attached pdf. As you can see, the 
> PdfFormFields of the last table
> are drawn on the second page, not in the table as I would expect.
You're using a mighty old version of iText.
I can tell because you're still using com.lowagie classes.
Does the problem also exist in the most recent iText version?

--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php


[iText-questions] Tables and FormFields: Is this a bug?

2011-01-04 Thread Johannes Becker

Hi all,

thanks to help of you (especially 1T3XT BVBA) I'm now able to create tables 
with PdfFormFields in them.

But now I'm having a strange side-effect:
The code attached generates the attached pdf. As you can see, the PdfFormFields 
of the last table
are drawn on the second page, not in the table as I would expect.

My questions:
- Am I doing this the wrong way? If so, what is my problem here?
- Is this a bug? If so, is there a workaround?

Thanks
Jonny
/* in_action/chapter15/SenderReceiver.java */
package com.foo;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Random;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.ExceptionConverter;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfFormField;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPCellEvent;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.TextField;
 
/**
 * This example was written by Bruno Lowagie. It is part of the book 'iText in
 * Action' by Manning Publications. 
 * ISBN: 1932394796
 * http://www.1t3xt.com/docs/book.php 
 * http://www.manning.com/lowagie/
 */
 
public class SenderReceiver1 implements PdfPCellEvent {
 
protected PdfFormField parent;
 
protected String partialFieldName;
 
protected PdfWriter writer;
 
protected boolean required;
 
public SenderReceiver1(PdfWriter writer, PdfFormField parent, String 
name,
boolean required) {
this.writer = writer;
this.parent = parent;
this.partialFieldName = name;
this.required = required;
}
 
/**
 * @see 
com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell,
 *  com.lowagie.text.Rectangle, 
com.lowagie.text.pdf.PdfContentByte[])
 */
public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] 
cb) {
TextField tf = new TextField(writer, new 
Rectangle(rect.getLeft(2), rect
.getBottom(2), rect.getRight(2), 
rect.getTop(2)), partialFieldName);
if (required)
tf.setOptions(TextField.REQUIRED);
tf.setFontSize(12);
try {
parent.addKid(tf.getTextField());
} catch (Exception e) {
throw new ExceptionConverter(e);
}
}
 
public static void main(String[] args) {
System.out.println("Chapter 15: example Sender Receiver");
System.out.println("-> Creates a PDF file with an AcroForm");
System.out.println("-> jars needed: iText.jar");
System.out.println("-> files generated in /results 
subdirectory:");
System.out.println("   sender_receiver.pdf");
// step 1
Document document = new Document();
try {
// step 2
PdfWriter writer = PdfWriter.getInstance(document,
new 
FileOutputStream("C:/Temp/senderreceiver_" + new Random().nextInt() + ".pdf"));
// step 3
document.open();
// step 4
document.add(new Paragraph("Sender"));
PdfFormField sender = PdfFormField.createEmpty(writer);
sender.setFieldName("sender");
document.add(createTable(writer, sender));
writer.addAnnotation(sender);

document.add(new Paragraph("Sender1"));
PdfFormField sender1 = PdfFormField.createEmpty(writer);
sender1.setFieldName("sender1");
document.add(createTable(writer, sender1));
writer.addAnnotation(sender1);

document.add(new Paragraph("Sender2"));
PdfFormField sender2 = PdfFormField.createEmpty(writer);
sender2.setFieldName("sender2");
document.add(createTable(writer, sender2));
writer.addAnnotation(sender2);

document.add(new Paragraph("Sender3"));
PdfFormField sender3 = PdfFormField.createEmpty(writer);
sender3.setFieldName("sender3");
document.add(createTable(writer, sender3));
writer.addAnnotation(sender3);

document.add(new Paragraph("Sender4"));
PdfFormField