I'm trying to download and save a pdf file using R.
This file displays perfectly in Chrome and Edge: http://www.cpppc.org:8082/efmisweb/ppp/projManage/perview.do?&ftpFileName=20170317105445289.pdf&content=efmisweb&xsg=:8083/
The following R code works without error:
download.file('http://www.cpppc.org:8082/efmisweb/ppp/projManage/perview.do?&ftpFileName=20170317105445289.pdf&content=efmisweb&xsg=:8083/', '20170317105445289.pdf', mode="wb")
R displays
trying URL 'http://www.cpppc.org:8082/efmisweb/ppp/projManage/perview.do?&ftpFileName=20170317105445289.pdf&content=efmisweb&xsg=:8083/'
Content type 'text/html; charset=UTF-8' length 2707 bytes
downloaded 2707 bytes
The only hint is that the file size is much smaller than what I would expect.
Indeed, when I open it using Adobe Acrobat, it gives me an error, saying it is either not a supported file type, or the file is damaged. What causes the error?
I noticed answers to other questions say you should include mode=wb
, so I did that already.