I have a very annoying issue, that I have not been able to solve yet. I am trying to download a PDF-file from the web. The file was created by OpenOffice.org using the excellent JODConverter web-service. I have working Ruby code that allows me to download the file and save it to disk. When I open the file it works just as intended.
The issue comes from trying to re-implement this feature in ActionScript for use in my AIR application. There are some FlateDecode blocks in the PDF-file, and those blocks appear to be damaged when they pass through ActionScript. I try to save the PDF-file using a FileStream object, but only the meta-data is saved correctly. All the contents of the file (which is in the FlateDecode blocks) is not displayed.
I am no expert on character encoding, but this seems to be a character encoding issue. Both Ruby and ActionScript consider the source of the PDF-file to be a string. They also both seem to agree that it is a UTF-8 encoded string. However, the strings representing the FlateDecode blocks look different in ActionScript than they do in Ruby. Any help on this issue will be greatly appreciated.