in reply to Download PDF

just wanted to comment on this (which i'm sure was just overlooked cause it's not really the issue at hand):
print 'Content-Type: ', 'application/pdf' || 'application/force-downlo +ad', "\n";
At this point, you can just make it:
print 'Content-Type: ', 'application/pdf', "\n";
Since 'application/pdf' is a true value, the || will always evaluate to that value, and never look at the right hand side (RHS). The RHS was there originally because the LHS was a method call which could potentially fail, so the RHS was a backup/default. But now that the LHS is a string literal, the backup is unnecessary.

As for the root issue, are you using the code from the parent node you referenced or from this reponse: Re: Need help with downloading ?