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,
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");
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
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,
Hi again.
Any progress on this.
It has made the tool unusable for us.
Thanks
LJ
Hi Morris,
jmorris78:It has made the tool unusable for us.
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,
jmorris78:It seems like a very critical part of the program. Please let me know when we can expect a fix.
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");
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,