Message is:

Adobe Reader could not open "invoice__the company.pdf" because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

Opening as PDF from the website works OK.

Comments

francewhoa’s picture

Opening the PDF file is working from my end.

Could you attached your PDF file here so we can try opening it?

Which OS are your using? Windows, Mac, Ubuntu?

tchurch’s picture

StatusFileSize
new4.41 KB

I attach the PDF file.
The website is running on Linux and we're trying to open the PDF on Windows PCs.

We've tried it from 3 PCs running different versions of Windows and Acrobat Reader.

juliangb’s picture

Confirmed that I can't open the file attached in #2 either.

Is this something that you've had working on that install before?

tchurch’s picture

No.
This is a new storm/drupal install and it's the first time we've looked at using the invoice module.

I downloaded and installed the library tcpdf and now the icons show up to create the PDF invoices.

juliangb’s picture

I've reproduced this on my installation too.

The email sends fine, its just the file that comes out doesn't open.

juliangb’s picture

Version: 6.x-1.31 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new2.56 KB

Here's an initial patch with a few cleanups of the pdf, which may or may not help.

juliangb’s picture

StatusFileSize
new5.32 KB

The patch from #6 shouldn't break anything but I don't think fixes anything.

Here are a few more cleanups.

juliangb’s picture

StatusFileSize
new5.06 KB

That one causes errors.

juliangb’s picture

StatusFileSize
new928 bytes

It is never as complex as it seems.

I believe the project was merely that the filename was too long - meaning that one of the lines of the email header got wrapped.

This patch should solve all. It creates a shorter, more simple filename.

I've taken out all the cleanups - those can go in a different patch.

Please could someone test this to confirm that it is now working.

tchurch’s picture

I will test this later today when I get to my main machine.

tchurch’s picture

Status: Needs review » Needs work

Hi,

I managed to have a look.

The filename of the attachment is OK but it contains ' around the filename in the email.

I think I found the error in the storminvoice.admin.inc file

line 488
$params['body'] .= "Content-Disposition: attachment; filename='$pdffile_name'\n";
should be
$params['body'] .= "Content-Disposition: attachment; filename=$pdffile_name\n";

Then the attachment is seen as a PDF file and opens OK.

juliangb’s picture

Status: Needs work » Needs review
StatusFileSize
new1.89 KB

Patch with that cleanup too.

tchurch’s picture

I've tested the 2 changes mentioned in #12 and the email attachment can now be opened.

Not sure if you want someone else to test it independently too.

juliangb’s picture

Status: Needs review » Fixed

Thanks for the review - should be fine if we're both happy. Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.