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

Free Support Forum - aspose.com

Extracting field positioning

Hello
I am extracting field information (type, rect coordinates etc) so that I can make an online signing form.

However, with many documents, I always seem to get at least one document where the field height or width is way off (it is huge)

I tried extracting the same PDF from another tool and it was correct. But my preference is Aspose, as we have been using your product for hears

I have attached the original PDF (2-17 w-4.pdf)

I write out all the coordinates in an XML
(below). You will see that some of the fields have very large heights etc.
But it is not that way when you open the PDF.
What am I doing wrong? Is there a known bug?

Here is a snippet of code use (formField being my aspose field object)

writer.WriteStartElement(“Height”) : writer.WriteString(formField.Rect.Height.ToString) : writer.WriteEndElement()
writer.WriteStartElement(“Width”) : writer.WriteString(formField.Rect.Width.ToString) : writer.WriteEndElement()
writer.WriteStartElement(“URX”) : writer.WriteString(formField.Rect.URX.ToString) : writer.WriteEndElement()
writer.WriteStartElement(“URY”) : writer.WriteString(formField.Rect.URY.ToString) : writer.WriteEndElement()
writer.WriteStartElement(“LLX”) : writer.WriteString(formField.Rect.LLX.ToString) : writer.WriteEndElement()
writer.WriteStartElement(“LLY”) : writer.WriteString(formField.Rect.LLY.ToString) : writer.WriteEndElement()


Here is the output xml from I create.
<?xml version="1.0" encoding="utf-8" standalone="yes"?>


<Build_Version>1.0.0</Build_Version>
<PDF_Source_File>C:\wwwroot\pdf-sign\PDF\PDF\2017 W-4.pdf</PDF_Source_File>
<Extraction_Directory>C:\wwwroot\pdf-sign\PDF\PDF\2017 W-4</Extraction_Directory>
<Page_Count>2</Page_Count>
<DPI_Resolution>96</DPI_Resolution>



1
A
A
TextBoxField
1
9.72000000000003
25.9200000000001

9.72000000000003
25.9200000000001
573.657
538.303
547.737
528.583



Left
False
False


2
B
B
TextBoxField
1
9.71999999999997
25.9200000000001

9.71999999999997
25.9200000000001
573.657
515.183
547.737
505.463



Left
False
False


3
C
C
TextBoxField
1
9.71999999999997
25.9200000000001

9.71999999999997
25.9200000000001
573.657
478.503
547.737
468.783



Left
False
False


4
D
D
TextBoxField
1
9.71999999999997
25.9200000000001

9.71999999999997
25.9200000000001
573.657
466.943
547.737
457.223



Left
False
False


5
E
E
TextBoxField
1
9.71999999999997
25.9200000000001

9.71999999999997
25.9200000000001
573.657
454.383
547.737
444.663



Left
False
False


6
F
F
TextBoxField
1
9.71999999999997
25.9200000000001

9.71999999999997
25.9200000000001
573.657
442.823
547.737
433.103



Left
False
False


7
G 1
G 1
TextBoxField
1
9.72000000000003
25.9200000000001

9.72000000000003
25.9200000000001
573.657
382.023
547.737
372.303



Left
False
False


8
G 2
G 2
TextBoxField
1
9.71999999999997
25.9200000000001

9.71999999999997
25.9200000000001
573.657
369.623
547.737
359.903



Left
False
False


9
1 Your first name and middle initial
1 Your first name and middle initial
TextBoxField
1
14.88
157.6799

14.88
157.6799
210.658
232.193
52.9781
217.313



Left
True
False


10
Last name
Last name
TextBoxField
1
14.88
195.12

14.88
195.12
420.098
232.193
224.978
217.313



Left
True
False


11
2 Your social security number
2 Your social security number
TextBoxField
1
14.88
119.64

14.88
119.64
562.058
232.193
442.418
217.313



Left
True
False


12
Home address number and street or rural route
Home address number and street or rural route
TextBoxField
1
14.88
239.9999

14.88
239.9999
292.978
208.073
52.9781
193.193



Left
True
False


13
City or town state and ZIP code
City or town state and ZIP code
TextBoxField
1
14.88
239.9999

14.88
239.9999
292.978
183.953
52.9781
169.073



Left
True
False


14
Group1
Group1
RadioButtonField
1
15.182
102.128

15.182
102.128
425.244
217.331
323.116
202.149



Left
False
False


15
check here You must call 18007721213 for a replacement card a
check here You must call 18007721213 for a replacement card a
CheckboxField
1
7.44
7.55999999999995

7.44
7.55999999999995
571.458
177.833
563.898
170.393



Left
False
False


16
5
5
TextBoxField
1
9.72
47.995

9.72
47.995
568.178
167.233
520.183
157.513



Left
False
False


17
7
7
TextBoxField
1
9.7197
107.28

9.7197
107.28
572.178
106.433
464.898
96.7133



Left
False
False


18
Date
Date
TextBoxField
1
22
93.367

22
93.367
567.085
84.1085
473.718
62.1085



Left
True
False


19
signhere
signhere
SignatureField
1
21.0389
235.863

21.0389
235.863
430.679
82.8905
194.816
61.8516



Left
False
False


20
undefined_2
undefined_2
TextBoxField
2
8.88
52.92

8.88
52.92
564.497
682.044
511.577
673.164



Left
False
False


21
undefined_4
undefined_4
TextBoxField
2
8.88
52.92

8.88
52.92
564.497
658.924
511.577
650.044



Left
False
False


22
undefined_5
undefined_5
TextBoxField
2
8.88
52.92

8.88
52.92
564.497
634.804
511.577
625.924



Left
False
False


23
undefined_6
undefined_6
TextBoxField
2
8.88
52.92

8.88
52.92
564.497
622.245
511.577
613.365



Left
False
False


24
undefined_7
undefined_7
TextBoxField
2
8.88
52.92

8.88
52.92
564.497
597.734
511.577
588.854



Left
False
False


25
undefined_8
undefined_8
TextBoxField
2
8.88
52.92

8.88
52.92
564.497
585.173
511.577
576.293



Left
False
False


26
undefined_9
undefined_9
TextBoxField
2
8.88
52.92

8.88
52.92
564.497
574.614
511.577
565.734



Left
False
False


27
8
8
TextBoxField
2
8.88
57.6

8.88
57.6
564.497
561.053
506.897
552.173



Left
False
False


28
9
9
TextBoxField
2
8.88
57.6

8.88
57.6
564.497
550.494
506.897
541.614



Left
False
False


29
1
1
TextBoxField
2
8.88
57.6

8.88
57.6
564.497
491.084
506.897
482.204



Left
False
False


30
2
2
TextBoxField
2
8.88
57.6

8.88
57.6
564.497
454.404
506.897
445.524



Left
False
False


31
3_2
3_2
TextBoxField
2
8.88
57.6

8.88
57.6
564.497
431.284
506.897
422.404



Left
False
False


32
4
4
TextBoxField
2
8.88
57.6

8.88
57.6
464.157
392.43
406.557
383.55



Left
False
False


33
5_2
5_2
TextBoxField
2
8.88
57.6

8.88
57.6
464.157
381.87
406.557
372.99



Left
False
False


34
6
6
TextBoxField
1
225.597
62.1779999999999

225.597
62.1779999999999
568.415
370.31
506.237
144.713



Left
False
False


35
undefined_13
undefined_13
TextBoxField
2
8.88
52.92

8.88
52.92
563.837
357.75
510.917
348.87



Left
False
False


36
undefined_14
undefined_14
TextBoxField
2
8.88
52.92

8.88
52.92
563.837
346.19
510.917
337.31



Left
False
False



Hi There,


Thanks for contacting support and sharing details with us. I am looking into the details which you have shared and will get back to you shortly.

Best Regards,

Hi Morris,


Thanks for your patience.

I have tested the scenario by extracting information of the form fields from the document which you have shared and observed that the height of one form field is showing incorrect. I have also tried to change the height of the field by following code snippet then save the document.

Document
doc =
new Document(dataDir + “2017+W-42.pdf”);<o:p></o:p>

foreach (Field formField in doc.Form.Fields)

{

if (formField.Rect.Height == 225.597)

{

formField.Height = 8.88;

break;

}

}

doc.Save(dataDir + "2017+W-42.pdf");



The height of the form field was updated in the output generated by above code. But apparently form field did not seem to be modified at all. I have attached the output for reference. However it seems particular file related issue which I have logged as PDFNET-42314 in our issue tracking system. We will further investigate it and keep you updated on its rectification status. Please be patient and spare us a little time.

We are sorry for the inconvenience.

Best Regards,

Thank you.
We have been working on this for weeks, and I assumed it was my fault :slight_smile:


Looking forward to a fix.

LJ Morris

Hello
Checking on the status of this issue.

Seeing as this product is a PDF tool, I am assuming this issue is high priority?
Being able to pull the field data out properly from a PDF is a critical element of the tool.

Thank you

LJ Morris

Hi Morris,


Thanks for contacting support.

I have checked the status of the logged issue and I am sorry it is still pending for review. Please note that there are also other reported issue (with higher priorities) in the queue as well and product team is busy in investigating them. I am sure they will soon plan a fix for this issue as per their development scheme. Your patience will really be appreciated in this regard. Please spare us a little time. We will keep you informed about the status of resolution process within this thread.

We are sorry for the inconvenience.


Best Regards,

Hi again.
Any progress on this.
It has made the tool unusable for us.
Thanks

LJ

Hi Morris,


Thanks for your patience. I have checked the status of logged issue and I am sorry that it is not resolved yet.

jmorris78:
It has made the tool unusable for us.

We do realize the severity of the issue and for this I have intimated the relevant team about your concerns. I am sure they will soon start an initial investigation for the issue. Your patience and cooperation is really appreciated in this process. We will definitely keep you informed about the updates as soon as we have some. Please give us a little time.

We are sorry for the inconvenience.


Best Regards,

hi
Is there any way to get an estimate of when it might be fixed. We spent several months writing code to work with this, and it is all useless until this is fixed.

It seems like a very critical part of the program. Please let me know when we can expect a fix.

Thank you

LJ

Hi Morris,


Thanks for contacting support.

jmorris78:
It seems like a very critical part of the program. Please let me know when we can expect a fix.

As shared earlier, we do realize that your project is at critical stage. We humbly apologize for the delay in progress but I would also like to share with you that there are other reported issues in the queue as well which were logged/reported prior to your issue and development team has been busy in resolving them. Please note that issue have been resolved on first come first serve basis which, we believe, is the fairest policy.

Nevertheless, I have recorded your concerns with the logged issue and I hope that relevant team will provide some ETA soon. We really appreciate your cooperation in this process. We will keep you updated with the updates as soon as we have some. Please spare us a little time.

We are sorry for the inconvenience.


Best Regards,

Hi Morris,


Thanks for your patience.

I would like to share that the development team has investigated earlier logged issue and shared their findings. The issue was related with the FormField in the input document. The FormField of type TextBox, which was returning irregular height, basically had two annotations. The count of annotations can be checked like following.

Document doc = new Document(dataDir + “2017+W-4.pdf”);<o:p></o:p>

Field field = doc.Form["6"] as Field;

if (field.Count > 0)

{

Console.WriteLine(field.Count.ToString());

}


The scenario of having two annotations was the actual reason that FormField's height was unusual. In order to get the height of FormField annotations and modify it (if required), you may use the following code snippet.


Document doc = new Document(dataDir + "2017+W-4.pdf");

Field field = doc.Form["6"] as Field;

if (field.Count > 0)

{

Aspose.Pdf.Annotations.Annotation annot1 = (doc.Form["6"] as Field)[1];

Aspose.Pdf.Annotations.Annotation annot2 = (doc.Form["6"] as Field)[2];

Console.WriteLine(annot1.Rect.Height);

Console.WriteLine(annot2.Rect.Height);

annot1.Height = 15;

annot2.Height = 15;

}

doc.Save(dataDir + "2017+W-42.pdf");


Please keep using our API and in case of any further assistance, please feel free to contact us. We will be more than happy to extend our support.


Best Regards,