I don’t do much with PDF, but I notice you say that the whole file is scrambled unless you disable compression? that sounds like a red flag for text encoding issues. Are you using the module’s own function for reading and writing files? or did you maybe load the file yourself with the wrong binmode or encoding applied? Likewise for saving.
Comment on Re: Troubleshooting PDF::API2 overlaying text on an existing PDF
It looks like the entirety of my difficulty was when I emailed the PDF as an attachment. Using encoding quoted-printable is what scrambled the results. After switching to base64 I haven't had a lick of trouble. PDF::API2 is rock solid!