Forum Moderators: coopster
I have figured out how to dynamically populate a PDF with FDF and everything... I would now love to Dynamically SAVE the populated PDF to the server for quick future use and NOT have to populate everytime (for distribution reasons)
So right now I have the pdf and I was thinking of a FOPEN type of function, but I couldn't pass variables into the fopen...
Here is the URL that populates --
<no urls please>
here is my FDF --
<?php
mysql_select_db($database_ControlPanel, $ControlPanel);
$query_createUser = "SELECT * FROM ent_users WHERE email = '".$_GET['email']."'";
$createUser = mysql_query($query_createUser, $ControlPanel) or die(mysql_error());
$row_createUser = mysql_fetch_assoc($createUser);
$totalRows_createUser = mysql_num_rows($createUser);
header("Content-type: application/vnd.fdf");?>%FDF-1.2
1 0 obj
<< /FDF
<< /F(http://www.example.com/pdf/GeneralSDIRABrochure.pdf)
/Fields
[ << /T(topmostSubform[0].Page1[0].CompanyBig[0]) /V(<?php echo $row_createUser['company'];?>) >>
<< /T(topmostSubform[0].Page1[0].CompanySmallWhite[0]) /V(<?php echo $row_createUser['company'];?>) >>
<< /T(topmostSubform[0].Page1[0].CompanySmallBlack[0]) /V(<?php echo $row_createUser['company'];?>) >>
<< /T(topmostSubform[0].Page1[0].Address[0]) /V(<?php echo $row_createUser['addressMail'];?>) >>
<< /T(topmostSubform[0].Page1[0].CityStateZip[0]) /V(<?php echo $row_createUser['cityMail'].", ".$row_createUser['stateMail']." ".$row_createUser['zipMail'];?>) >>
<< /T(topmostSubform[0].Page1[0].PhoneEmail[0]) /V(<?php echo $row_createUser['phone']." ¦ ".$row_createUser['email'];?>) >>
<< /T(topmostSubform[0].Page2[0].CompanySmallWhite2[0]) /V(<?php echo $row_createUser['company'];?>) >>
<< /T(topmostSubform[0].Page2[0].Website[0]) /V(<?php echo $row_createUser['website'];?>) >>
]
>>
>>
endobj
trailer
<</Root 1 0 R>>
%%EOF
Can anyone help me dynamically save this file?
[edited by: coopster at 11:43 pm (utc) on Jan. 17, 2008]
[edit reason] generalized domain [/edit]
How about using PHP output buffering [php.net] instead of pushing your output to the browser? Store the output in a string and write the fdf file to your filesystem using one of the Filesystem Functions [php.net].
I was the visitor to be able to save the file and it keep the populated data.
This is how I have it working right now...
The FDF information is populated and then saved to the ob_start() which is written to the server by the fopen.
But its still a FDF file and when its called it is called as a FDF file.
How do I get the populated PDF to save as a PDF?
Thanks, Hope that makes sense.