Results 1 to 2 of 2

Thread: Need to extract information from pdf fields from large document

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2025
    Posts
    1

    Need to extract information from pdf fields from large document

    I have a 320 page document. Each page has one fillable field on it that I need to extract the data from and input into an Excel sheet. My initial stab shows me the field name, but not the content of the field, and it also does not keep the fields in their order. Each field is labeled "undefined_" and then a sequential number. When I echo the field name using a For/Next loop, it sorts by the number's first integer, then the second, then the third.

    For instance,

    undefined_1
    undefined_10
    undefined_11
    ...
    undefined_2

    It is imperative that I keep the order that it is on the document. I can handle the export to excel myself, but this has just got me baffled.

    Code:
    Set wShell=CreateObject("WScript.Shell")
    Set oExec=wShell.Exec("mshta.exe ""about:<input type=file id=FILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
    sFileName = oExec.StdOut.ReadLine
    			Set gApp = CreateObject("AcroExch.app")
    			Set avDoc = CreateObject("AcroExch.AVDoc")
    			If avDoc.Open(strFileName, "") Then
    				Set PDFForm = CreateObject("AFormAut.App") 
    				set x=PDFForm.Fields
    				For Each myField In x
    					wscript.echo myField.Name
            			Next
    			End If
    avDoc.Close (True) 
    
    Set gApp = Nothing
    Set avDoc = Nothing
    Set PDFForm = Nothing
    Help is welcomed.

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,460

    Re: Need to extract information from pdf fields from large document

    How many "undefined_" fields will there be (maximum)? If you can control this, one method is to use leading zeros ling the following example:

    Code:
    undefined_001
    undefined_002
    undefined_003
    undefined_004
    undefined_005
    undefined_006
    undefined_007
    undefined_008
    undefined_009
    undefined_010
    undefined_011

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width