Set/Apply vertical alignment to TextBox Field using Aspose.PDF for .NET

We have been using version Apose.PDF.Kit 2.2 and although the left to right alignment issues have been resolved we still have a vertical alignment issue.

Once field data has been set using the API and the PDF is opened, the data is pushed down to the bottom of the textbox. If you click in the textbox the text returns to the proper location. If you leave the textbox then the text returns to the bottom. If you change the data using Adobe Acrobat it stays in the proper position.

Is there an updated version available? Getting released soon? Is there a work around?

We used Adboe Profesional 6.0 to create the document and view the finalized document.

Any help would be greatly appreciated,

- Marc

Please provide the codes which can reprodue the error for our testing.

Hello,
I confirm that this is still an issue in version 7.7
We’ll check the latest version (but I doubt it is fixed there either) and will prepare a script for reproducing.
It would be nice to get this issue revived.

Hi Aspose Team,


We experienced same problem with long text in text box using Aspose PDF 8.0.0.0

And we prepared script how to reproduce this.
In attached file you can find 2 files: one file with comments like text box, another is original file in which comments are imported using the script attached.

It will be nice to get some news about this soon.

Best regards,
Dmitrij

Badum:
I confirm that this is still an issue in version 7.7
We’ll check the latest version (but I doubt it is fixed there either) and will prepare a script for reproducing.
It would be nice to get this issue revived.
Hi Vadim,

Thanks for contacting support.

Can you please share the source PDF file and the code snippet which you are using so that we can test the scenario at our end. We are sorry for this inconvenience.
dmitrij.skaliov:
And we prepared script how to reproduce this.
In attached file you can find 2 files: one file with comments like text box, another is original file in which comments are imported using the script attached.
Hi Dmitrij,

Thanks for contacting support.

I have observed that both PDF files contain information inside text box and during my testing, new information is not being added. Can you please share the blank PDF file so that I can again test the scenario. We are sorry for this inconvenience.

Hi Aspose Team,


I attached 2 files. File “flow-chart commented.pdf” is a file with comments.
And file “flow-chart.pdf” is the original file to which comments should be incorporated using “Attach comments to clean file” button.

Best regards,
Dmitrij

Hi Nayyer,


Any news regarding this issue?

Best regards,
Dmitrij

Hi Dmitrij,


I am working over this query and will get back to you soon. We are sorry for this inconvenience.

Hi Dmitrij,


Thanks for your patience and sorry for the delayed response.

I have thoroughly tested the scenario using Aspose.Pdf for .NET 8.2.0 in Visual Studio 2010 where I have used the same project which you have shared earlier and as per my observations, when I click “Attach Comments to clean file” and provide flow-chart.pdf document, the resultant PDF is opening without any comments. Can you please share some further details, which can help us in replicating this issue at our end.

We are really sorry for this delay and inconvenience.

Hi I am facing the same issue. Is there any solution for it. The text is getting aligned only on clicking the textbox otherwise it is not coming on proper location

@ujain012

Could you kindly share the source PDF document and code snippet you are using to process it. We will test the scenario in our environment and address it accordingly.

@ujain012

We would like to share with you that Acrobat does not support vertical alignment (although horizontal alignment is supported). However, we implemented TextVericalAlignment property which allows to specify vertical alignment for multiline text fields. Please note that this will work only when form is filled via Aspose.PDF for .NET, if contents is updated by other way (not Aspose) vertical alignment will not applied.

Apply vertical alighment to text box

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document();
pdfDocument.Pages.Add();
// Create a field
TextBoxField textBoxField = new TextBoxField(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(100, 200, 400, 400));
textBoxField.PartialName = "textbox1";
textBoxField.Value = "Text Box Line 1" + Environment.NewLine + "Line 2";
// TextBoxField.Border = new Border(
Border border = new Border(textBoxField);
border.Width = 5;
border.Dash = new Dash(1, 1);
textBoxField.Border = border;
textBoxField.Color = Color.Black;
textBoxField.Characteristics.Border = System.Drawing.Color.Black;
textBoxField.Multiline = true;
textBoxField.TextVerticalAlignment = VerticalAlignment.Center;
// Add field to the document
pdfDocument.Form.Add(textBoxField, 1);