Showing posts with label Read Pdf without Acrobat. Show all posts
Showing posts with label Read Pdf without Acrobat. Show all posts

Monday, July 6, 2020

Read Pdf without Acrobat

Enable Microsoft Scripting Runtime reference

Option Explicit

Const form_filename As String = "C:\Users\allso\Desktop\New Customer Registration Form.pdf"

Sub read_pdf_form_vals()

Dim fso As New FileSystemObject
Dim tStream As TextStream
Dim vLine As String, vKey As String, fieldlist() As Variant, arrIndx As Integer
Dim i As Integer


vKey = ") Tj"


Set tStream = fso.OpenTextFile(form_filename, ForReading, False)
Do While Not tStream.AtEndOfStream
vLine = tStream.ReadLine
If InStr(vLine, vKey) > 0 Then
vLine = Replace(Right(vLine, Len(vLine) - 1), vKey, "", 1)
ReDim Preserve fieldlist(0 To arrIndx)
fieldlist(arrIndx) = vLine

Debug.Print vLine

arrIndx = arrIndx + 1

End If

'Debug.Print vLine
Loop
For i = UBound(fieldlist) To LBound(fieldlist) Step -1
Debug.Print fieldlist(i)
Next i

Set tStream = Nothing
Set fso = Nothing


End Sub