0

I'm developing a Windows Phone 8.1 (non silverlight) project and i'm very new to the platform.

I'm having a really hard time trying to access a pdf file from the web and saving it to the phone. First, i searched for how to display the pdf file inside the app without saving it, and learned that it can't be done.

Then i searched for a way to download the file and save it localy. Every example i found ended it up in a dead end; i tried with WebClient, and found out that i must switch to HttpClient, i tried with IsolateStorageFile and found that i must use ApplicationDataContainer.

It's becoming really frustrating searching for simple things for hours and hours without any result.

Can someone point me to an example, or anything else ?

Macaret
  • 797
  • 9
  • 33

1 Answers1

0

Downloading a file for the user means that you have to take care of a variety of things:

1) The app must stay responsive while the user waits for the download to complete.

2) You have to provide some kind of status information.

3) The download should continue if your app gets suspended (e.g.: the user hits the home button).

That's why big /unknown size or slow file downloads should be load off to a background task.

This article will provide you with a working example:

http://www.informit.com/articles/article.aspx?p=2229233&seqNum=6

Fred
  • 3,324
  • 1
  • 19
  • 29
  • I tried your example in the link but download = downloader.CreateDownload(source, destinationFile); has invalid arguments – Macaret Feb 10 '15 at 20:30
  • Could you be more specific? What is the error message? – Fred Feb 10 '15 at 20:36
  • var downloader = new BackgroundDownloader(); downloader = downloader.CreateDownload(source, destinationFile); // CreateDownload has invalid arguments – Macaret Feb 11 '15 at 08:51
  • Did you provide a String both for the source and destination file path? – Fred Feb 11 '15 at 11:25