We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Modifying Tab ordere in PDF

Hi All,

We are currently modifying a PDF form with ASPOSE PDF API's,

Wa are able to add and update textbox and check-box controls in it, but we are not able to set the tab-order of the controls. (ie. we can specify where the cursor will move from one control to next)

Can you redirect me to some URL or jolt down steps as to how can we impliment this feature.

Thanks & regards,

Rohan

Hello Rohan,


Thanks for using our products.

I am afraid the requested feature is
currently not supported but for the sake of implementation, I have logged this
requirement in our issue tracking system under New Features list as
PDFNEWNET-33470. We will investigate this issue in details
and will keep you updated on the status of a correction.

Hi Rohan,


Thanks for your patience.

I am pleased to share that your requested feature has been implemented and it will be available in our upcoming release version of Aspose.Pdf for .NET 7.0.0. Please note that in order to accomplish this requirement, following new properties are introduced.

Page.TabOrder - gets or sets tab order for the page:
TabOrder.Row = Fields will be visited in rows running horizontally across the page
TabOrder.Column = Fields will be visited in columns running vertically up and down the page
TabOrder.Default = Fields will be visited accordign field order
TabRoder.Manual = Fields will be visited according annotation order on the page.

To change Annotation Order, property AnnotationIndex was added.
Field.AnnotationIndex is used to get or set index of the annotation on the page. (Started from 1). When this property is set the annotation will be swapped with annotation on the specified position.

For example:

field.AnnotationIndex = 5;

Annotation which was on the 5th position on the page will be moved to position of the field, and field will have new position 5.

Example:

//10th field of the document will be 1st annotation on the //page (and first field in tab order because Page.TabOrder is set to TabOrder.Manual)

[C#]

Document doc1 = new Document(“33470.pdf”);
(doc1.Form[10] as Field).AnnoationIndex = 1;
doc1.Pages[1].TabOrder = TabOrder.Manual;
doc1.Save(“33470-1.pdf”);

The issues you have found earlier (filed as PDFNEWNET-33470) have been fixed in Aspose.Pdf for .NET 7.0.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi,

Can we setup tab order for controls from left to right and top to bottom.Thanks in advance!!

Regards,
Vidya

@Vidya.Salimath

Thanks for contacting support.

We have already logged an investigation ticket for modifying tab order of existing form fields inside PDF document. It would be helpful if you can please share a sample PDF document with a bit more details of your requirements. We will log an investigation ticket and share the ID with you.

Thanks for the response Asad.PFA sample documentSampleFile.pdf (829.3 KB)

In the sample file we have many controls and when User uses ‘tab’ key to navigate controls and user expects tab order to go left to right, top to bottom which is not happening currently

@Vidya.Salimath

Thanks for sharing sample PDF document.

Field.TabOrder Property can be used to get/set the tab order. We have tried to change the tab order of form fields in shared PDF document but, we faced exception. We have tried following code snippet in order to do that:

Document doc = new Document(dataDir + "SampleFile.pdf");
int tabOrder = 0;
foreach (Field field in doc.Form.Fields)
{
 Console.WriteLine(field.PartialName + " => Tab Order was: => " + field.TabOrder);
 field.TabOrder = tabOrder++;
 Console.WriteLine(field.PartialName + " => Tab Order is: => " + field.TabOrder);
}
doc.Save(dataDir + "SampleFile_out.pdf");

We have logged an issue as PDFNET-45417 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.

Thanks Asad. I have tried to check the collection of Form. Fields and it will not display in the same order as inserted in the order (as in row by row fields). We need to consider this as well.

@Vidya.Salimath

Please use following code snippet in order to retrieve form fields according to their tab orders set:

foreach (Field field in doc.Pages[1].FieldsInTabOrder)
{
 Console.WriteLine(field.PartialName);
} 

FieldsInTabOrder returns a collection which contains Form Fields in sequence according to TabOrder.

Currently there is no tab order and i have to assign tab order as mentioned earlier. Hope you got my requirement
Could you please provide me sample of Taborder.Manual and more details of Field.AnnotationIndex which is used in TabOrder.Manual

@Vidya.Salimath

Thanks for clarifying.

We have updated the details about your requirements under the logged ticket ID.

We have logged an investigation ticket as PDFNET-45443 in our issue tracking system. We will prepare an example for your convenience regarding the information your require and share with you. Please spare us little time.

We are sorry for the inconvenience.