I recently asked my web host to install "pdftk" on my our web server. pdftk is 
a GNU 
program for performing various manipulations on PDFs. In my case, I'm trying to 
use an 
online form to fill in a job application, which will then be mailed to Human 
Resources on 
our company.

The code I used is in the O'Reilly book "PDF Hacks," pg 200.

Is anyone familiar with using pdftk in this way? I'm trying to flatten the FDF 
data 
permanently onto a new PDF file. Here's my code:

First, a simple form:

<html>
        <head>
                <meta http-equiv="content-type" 
content="text/html;charset=iso-8859-1">
                <meta name="generator" content="Adobe GoLive">
                <title>agl:pagetitle</title>
        </head>
        <body>
                <form id="FormName" action="http://www.ourbiz.com/forms/jobs/
jobsPDF_FDF.php#FDF" method="post" name="FormName">
                        Name: <input type="text" name="name" size="24"><br>
                        Address: <input type="text" name="address" 
size="50"><br>
                        Phone: <input type="text" name="phone" size="24"><br>
                        <input type="submit" name="Submit" 
value="SUBMIT"><input 
type="reset" value="RESET">
                </form>
        </body>
</html>


Then, the PHP file referred to in the form:

<?php
session_start();
header("Cache-control: private");
require_once('../forge_fdf.php');

// Get the user's input from the form 
   $name = $_POST['name'];
   $address = $_POST['address'];
   $phone = $_POST['phone'];

// Register session key with the value 
   $_SESSION['name'] = $name;
   $_SESSION['address'] = $address;
   $_SESSION['phone'] = $phone;


// session_fdf is your function for converting
// the user's session state into an FDF string
$fdf_ss= session_fdf( $_GET['id'] );

$temp_fn= tempnam( '/tmp', 'tempfdf' );
$temp_fp= fopen( $temp_fn, 'wb' );
if( $temp_fp )  {
        fwrite( $temp_fp, $fdf_ss );
        fclose( $temp_fp );
        
        header( 'Content-type: application:pdf' );
        passthru( '/usr/pdftk/bin/pdftk jobsPDF_FDF.pdf fill_form '.$temp_fn.' 
output - 
flatten' );  // output to stdout (-)
        unlink( $temp_fn );
}

?>

Does anyone know what I might be doing wrong? I'm getting a message that a file 
I/O 
error has occurred.

Thanks,
Dale




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/CefplB/TM
--------------------------------------------------------------------~-> 

The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to