How to attach a file

You’ve already installed and activated the Contact Form 7 and PDF Forms Filler for CF7 plugins. You also have a PDF file with a form which you are going to attach to your CF7 form.

To attach a file, open a CF7 form for editing, access the Form tab find and click the PDF Form button.

In the tag generator thickbox that opens, click the Attach a PDF File button. This will bring up WordPress Media Library browser thickbox. Select your already uploaded PDF file or upload one and click Select.

Once your PDF is attached, you will see it in the list of attached files. There are two buttons near each file. Clicking the Options button will open a list of options for the file. The Delete button will detach the file.

Each attached file has a unique attachment [ID] specified in front of the file name. This information can be useful when mapping fields.

File Options

Skip when empty

Sometimes it makes sense to ignore the PDF file when none of its fields are filled and no image is embedded into it. In other words, if the user has submitted a form with empty fields, then there is no point in attaching the file to an email or generating a file to download it. If this option is enabled then the file is not attached to any email message, no download link is provided to the user and the PDF is not saved in the wp-content/uploads folder.

Attach to primary email message

If this option is enabled then the filled PDF file will be attached to the CF7’s primary email message.

Attach to secondary email message

If this option is enabled then the filled PDF file will be attached to the CF7’s secondary email message.

Flatten

This option allows the flattening of the PDF form after it is filled. This removes the form from the generated PDF file and ensures that the user is not able to change the form data using their PDF viewer.

This option is useful if you need to let the user download the PDF after submitting the form. A link to download the filled PDF file will be provided to the user on form submission.

The download link is valid for 1 hour by default. The file will be deleted from the server after the timeout. The timeout can be changed by defining the WPCF7_PDF_FORMS_DOWNLOADS_TIMEOUT_SECONDS constant in your wp-config.php.

Filename

Sometimes it is useful to specify a custom filename for your filled PDF file that will be attached to the email messages, downloaded by the user and/or saved in the wp-content/uploads directory. If you leave this field blank, the original attachment filename will be used. Mail-tags can be used as part of the filename. Mail-tag content will be sanitized before being used in the filename.

Save PDF file on the server

In some situations you want to save the filled PDF files on the web server. This option allows you to save your filled PDF files somewhere in the wp-content/uploads directory. Mail-tags can be used as part of the path. You have to make sure to use mail-tags that provide a unique path and/or filename. For example, if you use my-pdfs/[_serial_number] (requires Flamingo) then your filled PDF files will be uploaded to wp-content/uploads/my-pdfs/#####/ (where ##### would be a unique number).