Donate Share

TCPDF - PHP class for PDF

Subscribe

Submit PDF via Email file name

  1. 2009-11-08 01:53:25 UTC

    I have a PDF form which is Emailed to our customers created dynamically with TCPDF / MySQL. Everything was working well when I tested with Thunderbird as an Email client. But we have a problem with Outlook. The problem is that outlook blocks files with a .tmp extension. This can be fixed by editing the registry, which we can't expect out customers to do.

    So my question is can we instruct Adobe Acrobat Reader to use a different extension name. using .txt would be the most suitable.

    Here is a sample of the code I use for the 'click to submit' button.

                $pdf->Button('submit', 60, 10, 'Press to Email', array('S'=>'SubmitForm', 'F'=>'mailto:someone@somewhere.com?subject=Returned PDF Form', 'Flags'=>array('ExportFormat')), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64)));
    

    Thanks for your help.

  2. 2009-11-16 06:20:26 UTC

    After playing around with Acrobat Professional I found that it's possible to send the completed PDF form via XML

    Question is how do we achieve this with TCPDF ?

  3. 2009-11-16 09:22:36 UTC

    form_enctype is set by default to 'application/x-www-form-urlencoded' but can be also set to 'FDF'.

  4. 2009-11-16 09:45:14 UTC

    Is that set on the submit button itself ?

    How would I change the following code.

    $pdf->Button('submit', 60, 10, 'Press to Email completed form', array('S'=>'SubmitForm', 'F'=>'mailto:someone@somewhere.com', 'Flags'=>array('ExportFormat')), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64)));
    

    Thanks for your help.

  5. 2009-11-16 09:59:42 UTC

    You can also directly send the vars to a remote PHP code:

    $pdf->Button('bsubmit', 30, 10, 'Submit2', array('S'=>'SubmitForm', 'F'=>'http://your-remote-site/printvars.php', 'Flags'=>array('ExportFormat')), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64)));

    Please note that if you use the FDF mode you have to unset the ExportFormat option.

  6. 2009-11-16 10:01:25 UTC

    You can also achieve the same result via Javascript:

    $pdf->Button('submit',20,8,'Submit','Submit()',array('textColor'=>'yellow','fillColor'=>'#FF5050'));
    
    $pdf->IncludeJS("
    function Submit() {
        this.submitForm('http://your-remote-site/print_submitted_vars.php', false);
    }
    ");
    
  7. 2009-11-16 10:31:52 UTC

    I need to use Email as some of the people filling in the forms are offline. As they work at sea. So how do I get a mailto: working to send XML file attachment

  8. 2009-11-16 10:57:52 UTC

    You can send the date in FDF format using the following syntax:

    $pdf->Button('submit', 30, 10, 'Submit', array('S'=>'SubmitForm', 'F'=>'mailto:info@example.com', 'Flags'=>array()), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64)));

  9. 2009-11-16 11:02:36 UTC

    To send XML via email:

    $pdf->Button('submit', 30, 10, 'Submit', array('S'=>'SubmitForm', 'F'=>'mailto:info@example.com', 'Flags'=>array('XFDF')), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64)));
    
  10. 2009-11-16 11:14:58 UTC

    Thank you very much that's fantastic.

    I can open the Emailed file with Simple XML.

    :-)

< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.