On some occasions, I have been having trouble opening pdf's as email attachments (When downloading the pdf directly from the webform edit section, the file opens just fine). I cannot determine the conditions that cause this, but it has been happening with the webforms that I have created under the webform version 6.x-3.11. Perhaps webforms created under previous versions are immune to this. The bug also happens on different server environments (I was able to download a pdf attachment when it was sent from my local site as opposed to my online sites for any webform regardless of what version it was created under). I was able to find a fix to my problem based on the following article:
http://drupal.org/node/741466#comment-2752160 where the fix was to simply remove the quotes around the filename variable on the Content-Disposition: parameter during the creation of the pdf email attachment.
My solution was to change the following in line 772 in webform2pdf.module
$message['body'] .= "Content-Disposition: attachment; filename=\"" . $filename . "\"\n\n";
to
$message['body'] .= "Content-Disposition: attachment; filename=" . $filename . "\n\n";
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | webform2pdf-email-attachment-remove-quotes_1486448_1.patch | 1.04 KB | bao truong |
| #1 | email-attachment-remove-quotes_1486448_1.patch | 1.05 KB | bao truong |
Comments
Comment #1
bao truong commentedComment #2
bao truong commentedPlease use this latest patch, it allows the filename of the pdf to be seen in the email attachment. The previous patch did not allow this because their was an extra quote that should have been removed in the Content-Disposition: attachment; filename parameter declaration" I updated the code in my previous comment to reflect this
Comment #2.0
bao truong commentedadjusting for the latest version of webfrom2pdf module 6.x-2.x-dev for the 2011-11-18, mine was for the 2010-08 release abnd it was changed since when I downloaded today
Comment #3
mr.york commentedComment #3.0
mr.york commentedUpdate the code to reflect latest patch adjustment