Hi,

While using iText to create interactive forms, I noticed that adding the various fieldtype to a page will also insert a "moveTo(0, 0)" in the page stream.

Normally that isn't noticeable unless the page stream is in text mode as shown in the example below. I uses a checkbox in the example, but all the field type add a "moveTo(0, 0)".

The workaround is obvious: just don't do that; but does the "moveTo(0, 0)" serve any purpose at all?

regards,
finn


import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;

public class tst01 {
public static void main(String[] args) throws Exception {
Document doc = new Document();
PdfWriter writer = PdfWriter.getInstance(doc,
new FileOutputStream("tst01.pdf"));

PdfAcroForm acroForm = writer.getAcroForm();
doc.open();
doc.add(new Paragraph("Hello World"));
PdfContentByte cb = writer.getDirectContent();
cb.beginText();
acroForm.addCheckBox("CB1", "Food", true, 180, 685, 190, 695);
cb.endText();
doc.close();
}
}

Attachment: tst01.pdf
Description: Adobe PDF document

Reply via email to