Save PDF file to isolated storage then launch - Windows phone - c#

I have come to the stage in my app where I need to download a pdf file from a certain URL, save it to disk (on the phone that is), and then as soon as it's saved try and open the document in whatever application is installed on the phone to handle PDFs (Adobe reader).
I have a rather limited understanding of how to save to disk and launch a certain file with another application.
Can someone point me in the right direction or give me some tips on how to accomplish this?
My understanding of windows phone is quite limited and I need to quickly add this feature on the app.

In Windows Phone 7, it is not possible to programmatically start the PDF viewer (it's possible in Windows Phone 8 though). So the best I can suggest is using the WebBrowserTask to open the web browser directly at the PDF's URL, then let the user open the file.
It's definitely not a great user experience, but I've been unable to find any other way (even using a WebBrowser control directly in the app doesn't seem to work).
var task = new WebBrowserTask();
task.Uri = new Uri("http://www.education.gov.yk.ca/pdf/pdf-test.pdf");
task.Show();

Where you saved the PDF in Isolated Storage?
You directly opened the Online PDF file in WebBrowser.

Follow these steps:
1) Download the from URI
2) Save to the Isolation Storage
3) Launch it using the launcher.
Note: 1) If you are downloading the pdf file than use .pdf extension while storing in Isolation Storage.
2)Make sure you have the related software installed in your phone like Adobe for PDF etc.

Related

How do I display a PDF Named Destination in Windows Server 2012 or 2016 in default Edge Browser from a .net C# app?

Language: C# .net
I have tried the Adobe method which requires Adobe Reader. Even it does not work well - I want to open the file to a destination, then change the destination as the user clicks on a Context Help icon. I do NOT want multiple new windows to clutter the screen.
I am trying to open a PDF to a named destination using the default PDF reader in Windows 2012 Server. (and same in windows server 2016). I don't want to force users to install Adobe PDF Reader. I want to use the default browser-based reader on a standard install.
WHen I use the Adobe method, if I use the n flag, I get a new window every time - annoying. If I don't use the n flag, I can open ONE window; all subsequent calls to change the topic are ignored.
Open the Windows Setting, click the Apps, select the Default Apps option and choose the "Choose default apps by file type", then find the .pdf file name and choose the Microsoft Edge as default apps to view the file. like this.
Then, using the following code to open the pdf file using Edge browser:
Process.Start("file path. such as: 'file:///C:/Users/XXX/Downloads/pdf.pdf'");
From your description, it seems that the pdf file is located on the remote server, I think you could download to local folder first, then using the above code to display the PDF file.

File saving issue Windows phone 8.1

I am facing the following issue while performing the save operation on a windows 8.1 phone
a. Let us assume there is a a file named test1.doc is downloaded to a default location in the sdcard. SDCARD - Testfolder
b. We try to edit/open the file using the office 365 present in the phone and try to save it. It does not save it in the same location i.e. TestFolder.
c. It prompts the user to save in the file in the default folder present in phone for eg in the above case since it is a .doc it saves in Documents folder.
Based on the file extension, it will try to save them in the respective default location i.e. mp3 will be saved under music, .jpg or png will be in picture, .mp4 under videos and .doc,.xls,.txt, ppt under documents.
Pl. refer to the below link
https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn639127.aspx
d. And during save it also modifies the file name by appending (1) to the file. User is also given the option to modify the file name before saving.
Where on the tab and desktop it is allowing us to do the save on the same location.
I would like to know if it is a know limitation on the windows phone or any thing needs to be done to make the file save in the same location. Any input on this will be of great help.
That is the platform norm (I am not calling it as "limitation"). Every app has access to its own IsolatedStorage and media libraries depending on the access requested in manifest.

Open local docx, pptx and pdf in Windows Phone 7

I'm writing an app which need to support view docx, pptx and pdf in the app. I know the WebBrowserTask can redirect those documents to be opened by approperiate app. However, how can I open those documents if they were downloaded in the isolated storage. It seems that the WebBrowserTask only support http/https protocol, but not local files. Anyways to open those files? Thanks.
Anyways to open those files?
No.
:(
Currently there is no way to do this. The only way to solve this is by having the documents online somewhere and providing the WebBrowserTask with a direct url. Like you already mentioned this does not work with IsolatedStorage.

Open docx in Windows Phone 7 programmatically

I would like to develop an app for printing service in Windows Phone 7. In the app, the users can select file to print out. Is there any way to open docx, xlsx, etc. in WP7 programmatically? I know in iPhone the WebView supports to view many file types. Is there anything similar in WP7?
If you are looking to open the document in Office, try using the WebBrowserTask to navigate to the document. There's a good chance it will open with Office.
If you want to render the document yourself, you are very much out of luck. You could try navigating to the document in a WebBrowser control, but I don't think it's supported.
Besides, there are no printing APIs so there would be no way to print it. If this is an enterprise application (ie. internal to your company), you might consider writing a web service on a local server that can accept DOCX files and print them. You could then call that service from your app to print the docs.
You will not be able to open these types of files from the isolated storage. There is no way for third-party applications to launch the external application required for viewing these file types. All of the files which you have listed in your question are XML-based open source file formats. Depending on how much time you want to spend on this, you could write your own parser or possibly utilize an open-source or commercial one.

WP7 -- finding isolatedStorage files on my computer

I am trying to use the C# class IsolatedStorageFile to write some data to a file in my app. This is using the simulator. I would like to look on my computer to see if it worked (i.e., look at the file in notepad). Where can I find that file?
The Isolated Storage is stored in the emulator, which is a virtual machine, and not directly on your harddrive. You'll have to code your own file viewer (e.g. from within your app, load the file from Isolated Storage and display the text using StreamReader).
I vaguely remember that the Mango toolkit (out in May) features an IsolatedStorage viewer built into the emulator, but I'm not sure what features it has.
You might be interested in this blog post. It explains how to export your file to your desktop.
You can download IsolatedStorageExplorer And use it to download file from IsolatedStorage to Computer.
Check out this Post and Answer given by Matt Lacey

Categories