Skip to content

Extract Data from PDF form Undefined Functions #45

Open
@dman271828

Description

@dman271828

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions