kean has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to extract the filled Data from a pdf form? I have multiple filled out pdf form files and want to access the data filled in. I tried with CAM::PDF :
use strict; use warnings; use CAM::PDF; my $pdf = CAM::PDF->new('file.pdf'); my @formfields = $pdf->getFormFieldList(); foreach (@formfields) { print $_."\n"; } exit;
But i can't filter the form fields or get there content. Is there a way to do this?

Replies are listed 'Best First'.
Re: Get data from pdf form
by poj (Abbot) on Mar 24, 2016 at 18:41 UTC

    If you data dump the objects you might be able to find the data. Try

    use strict; use warnings; use Data::Dump 'pp'; use CAM::PDF; my $pdf = CAM::PDF->new('file.pdf'); my @formfields = $pdf->getFormFieldList(); foreach (@formfields){ my $obj = $pdf->getFormField($_); #pp $obj; printf "%s = %s\n",$_,$obj->{value}{value}{V}{value}; }
    poj
Re: Get data from pdf form
by ww (Archbishop) on Mar 24, 2016 at 18:48 UTC

    Read the fine documentation which includes the note,
    "Many example programs are included in this distribution to do useful tasks. See the bin subdirectory."


    Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
    1. code
    2. verbatim error and/or warning messages
    3. a coherent explanation of what "doesn't work actually means.