I've tried to place an AcroField on a rotated page, which doesn't seem to work. The text field in this case seems to be initially drawn at the right place but if you like to edit the field the text is rendered rotated by 90 degrees. I've attached a PDF document which illustrates the effect plus the JAVA source code.
Best regards, Christian
AcroFormTest.pdf
Description: Adobe PDF document
package ujac.test.itext;
import java.awt.Color;
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Chunk;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfAcroForm;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.TextField;
public class AcroFormTest {
public static void main(String[] args) {
try {
FileOutputStream os = new FileOutputStream("AcroFormTest.pdf");
Document document = new Document(PageSize.A3.rotate(), 25, 25, 25, 25);
PdfWriter documentWriter = PdfWriter.getInstance(document, os);
document.open();
Paragraph p1 = new Paragraph("AcroForm Test");
document.add(p1);
PdfAcroForm acroForm = documentWriter.getAcroForm();
BaseFont bf = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false);
acroForm.addSingleLineTextField(
"test", "test",
bf, 12,
25, 600, 170, 620
);
document.close();
documentWriter.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
