Hi Jaap,
Here's the code that saves the attachment:
if ($code =~ /quoted-printable/i)
{
print "printing $num to c:\\$filename\n";
open(K, ">c:\\$filename");
binmode(K); #not sure when to use this, seems to be necessary for pd
+f attachments
print K MIME::QuotedPrint::decode_qp(join "", @{ $message->{body}->{
+data} });
close K;
}
The error when trying to open the bad pdf is:
"The file is damaged and cannot be repaired."
Here's a snippet of a good one (note that in Notepad the line-endings are little squares - \r I presume):
%PDF-1.2
%ßÜÂÞ - Business Objects
1 0 obj
<<
/Type /Pages
/Count 1
/Kids [ 4 0 R ]
>>
endobj
2 0 obj
<<
/CreationDate (D:20030206205259Z)
/ModDate (D:20030206205259Z)
And here's a bad one:
%PDF-1.2
%ßÜÂÞ - Business Objects
1 0 obj
<<
/Type /Pages
/Count 17
/Kids [ 4 0 R 5 0 R 6 0 R 7 0 R 8 0 R 9 0 R 10 0 R 11 0 R 12 0 R 13 0
+R 14 0 R 15 0 R 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R ]
>>
endobj
2 0 obj
<<
/CreationDate (D:20030206205456Z)
/ModDate (D:20030206205456Z)
Any advice would be great! |