Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract Data from PDF form Undefined Functions #45

Open
dman271828 opened this issue Feb 26, 2022 · 0 comments
Open

Extract Data from PDF form Undefined Functions #45

dman271828 opened this issue Feb 26, 2022 · 0 comments

Comments

@dman271828
Copy link

Overall this is the best PdfToText php code I have found. Great code and good job. There are two errors inside the PdfToText.phpclass when I ran the extract form data from pdf example.

Example:
/PdfToText-master/examples/formdata-extraction/example.php

Error 1:
Undefined function ValidPhpName....

My solution:
The ValidPhpName should be member of PdfObjectBase::. However, everywhere in the program it refers to an incorrect class.

Replace all:
PdfToTextFormDefinition::ValidPhpName

With:
PdfObjectBase::ValidPhpName

Error 2:
The GetFormDataFromPdfObject is private error.
Old:
private function GetFormDataFromPdfObject ( $pdf_data )

Change it to pubic.
public function GetFormDataFromPdfObject ( $pdf_data )

This solution worked for me. Here is a portion of the form data output.

OUTPUT:

Form data extraction using an XML definition file (sample.pdf) :
object(W9)#27 (20) {
["Name":protected]=>
string(6) "ZZNAME"
["BusinessName":protected]=>
string(14) "ZZBUSINESSNAME"
["FederalTaxClassification":protected]=>
string(1) "6"
["LLCClassification":protected]=>
string(1) "C"
["OtherFederalTaxClassification":protected]=>
string(1) "7"
["OtherFederalTaxInfo":protected]=>
string(7) "ZZOTHER"
["ExemptPayeeCode":protected]=>
string(4) "EX01"
["FATCAExemptionCode":protected]=>
string(4) "EX02"
["Address":protected]=>
string(9) "ZZADDRESS"
["City":protected]=>
string(6) "ZZCITY"
["RequesterCoordinates":protected]=>
string(28) "ZZREQUESTERNAME
address
city"

@dman271828 dman271828 changed the title Extract Data from PDF Crash Extract Data from PDF form Undefined Functions Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant