Dear Squeakers,
I have a problem downloading a PDF file using WebClient. I use the following code:
| client resp file |
client := WebClient new.
[resp := client httpGet: '
http://dl.dropbox.com/u/6204244/mcs-ftl.pdf'.
resp isSuccess ifFalse:[^self error: resp status].
"Stream the content from the response"
file := FileStream newFileNamed: 'mcs-ftl.pdf'.
resp streamTo: file size: resp contentLength progress: nil.
file close] ensure: [client close]
I took the code from the WebClient Responses help page and only slightly modified it.
The problem is that I can open the file with Preview but all the pages are blank. The downloaded file has 9.9 MB while the original has 7.2 MB. So clearly something went wrong. Maybe some problem with the encoding?
Any idea how to fix that? I'd be most thankful.
Cheers,
Bernhard