Text field in PDF form is not positioned the same for different pages

Hi Aspose.PDF Team,

- I have a PDF which 2 pages, 1st page has portrait orientation, 2nd page came from a PDF with landscape orientation but I already used Aspose.PDF to change to portrait A4.
- I then insert 2 text fields into 2 pages at the same position but they end up in 2 different places and text field on page 1 is placed horizontally when text field on page 2 is placed vertically.
- Here is the code I used to add text field:
Aspose.Pdf.Facades.FormEditor formEditor = new Aspose.Pdf.Facades.FormEditor();
formEditor.BindPdf(helloWorldFilePath);
formEditor.AddField(Aspose.Pdf.Facades.FieldType.Text, “textfield”, 1, 100, 100, 200, 150);
formEditor.AddField(Aspose.Pdf.Facades.FieldType.Text, “textfield”, 2, 100, 100, 200, 150);
formEditor.Save(helloWorldFilePath);
- Here is the code I used to convert 2nd page from portrait to landscape A4:
//resize landscape to portrait
PdfPageEditor pageEditor = new PdfPageEditor();
using (Aspose.Pdf.Document document = new Aspose.Pdf.Document(inputPath))
{
pageEditor.BindPdf(document);
Aspose.Pdf.Rectangle r = document.Pages[1].Rect;
pageEditor.Zoom = (float)(r.Width / r.Height);
pageEditor.Save(outputPath);
}
//change to portrait A4
PdfPageEditor pEdit = new PdfPageEditor();
PdfFileEditor fileEditor = new PdfFileEditor();
using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document(originalFilePath))
{
pEdit.BindPdf(doc);
pEdit.PageSize = Aspose.Pdf.PageSize.A4;

for (int i = 1; i <= numOfPages; i++)
{
var pageSize = pEdit.GetPageSize(i);
PdfFileEditor.ContentsResizeParameters par = new
PdfFileEditor.ContentsResizeParameters(
PdfFileEditor.ContentsResizeValue.Percents(0)
PdfFileEditor.ContentsResizeValue.Percents(Aspose.Pdf.PageSize.A4.Width * 100 / pageSize.Width),
PdfFileEditor.ContentsResizeValue.Percents(0),
PdfFileEditor.ContentsResizeValue.Percents(0),
PdfFileEditor.ContentsResizeValue.Percents(Aspose.Pdf.PageSize.A4.Height * 100 / pageSize.Height),
PdfFileEditor.ContentsResizeValue.Percents(0));

fileEditor.ResizeContents(doc, new int[] { i }, par);
}

pEdit.Save(outputDocumentPath);
}

- How can I make text field on page 2 displayed on the same position and horizontally as text field in page 1? Thanks.

Hi Tan,


Thanks for your inquiry. After initial investigation we have logged a ticket PDFNEWNET-38087 in our issue tracking system for further investigate and resolution. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan