Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Using CAM::PDF to change a form value

by gwhite (Friar)
on Aug 27, 2007 at 17:09 UTC ( [id://635345]=perlquestion: print w/replies, xml ) Need Help??

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

I have a hidden form field in a PDF file, that contains a default value (a site ID), so when the form is submitted via email the default value is passed. What I need to do is write a little program that will change the default value of the hidden field to a different site ID (of which I have a couple of hundred) and save the PDF file with a new name (so it can be emailed to all the users at that site). CAM::PDF is the only module that I have been succesful with in accessing form values, but the hidden form field is giving me trouble as it won't let me override the default value.

I read the file in successfully, grab the form field object, set the value, and save the PDF file. When I open the newly saved PDF file it is the old default value, not the new value. I can use the same process and set visible form fields and they work OK. Does anyone have any suggestions that might help me get over the hump with this issue?

g_White

Replies are listed 'Best First'.
Re: Using CAM::PDF to change a form value
by starX (Chaplain) on Aug 27, 2007 at 18:05 UTC
    Taking a look at the documentation for CAM::PDF, it looks like a lot of those functions are labeled as being for internal use only. Maybe you could post some code so we could take a look at how you're trying to do this?
      Extremely basic code
      #!/usr/bin/perl use strict; use CAM::PDF; my $pdf = CAM::PDF->new('input-form.pdf'); $pdf->fillFormFields( 'site' => 'newsitename'); $pdf->cleanoutput('changed-form.pdf'); print "Done\n";
      g_White
        Out of curiosity, have you tried calling output() separately?
        g_White, Did you figure out a solution? My form fields are supposed to be visible. I can open the new/modified/updated pdf in Adobe. I have to click on the field for the field data to become visible. I can also print out the form fields via printer options, but printing the whole document the updated/modified fields are always blank. The fields that have not been modified are fine and show up accordingly.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://635345]
Approved by andreas1234567
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2025-12-14 23:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (95 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.