Form filled PDF (using pdftk and forge_fdf)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
seatoskyhk
Forum Newbie
Posts: 1
Joined: Fri Jan 16, 2009 1:59 am

Form filled PDF (using pdftk and forge_fdf)

Post by seatoskyhk »

My problem is regarding the PHP generated PDF.
I have a page with HTML form field that will popup a PDF when user click a button on the HTML page. I have the PDF template with Form fields there. So, what I do is to get the data from HTML, put into forge_fdf, then use pdftk to read the PDF template & fill in the form values. Then generate the pdf as standard output. I don't have problem here.. I can succesfully create the pdf form with the form data. However, the problem is that the generated PDF is no longer editable, unlike the template which people can type when open by Adobe.

I have tried:

$fields_readonly = false;
$fdf= forge_fdf( '',
$fdf_data_strings,
$fdf_data_names,
$fields_hidden,
$fields_readonly );
// try to make it now readonly

and this:
passthru( 'pdftk my_application.pdf fill_form '. $fdf_fn. ' output - flatten allow modifycontents' );
passthru( 'pdftk my_application.pdf fill_form '. $fdf_fn. ' output - flatten allow allfeatures' );

anyone has any idea how to make the output form editable?
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

Re: Form filled PDF (using pdftk and forge_fdf)

Post by inosent1 »

hi

can u give me a link to your site to show me how you are doing this?

i went to this site http://accesspdf.com/html_pdf_form/

and saw that it worked great

so i downloaded their code, and uploaded it to my site (php friendly) and it gives me an error that the pdf file is corrrupted

http://inovasphere.com/pdf/pdf_form_interface.php

can u tell me what i am doing wrong? i made no changes to their code, just uploaded as is

thanks!
Post Reply