Open local docx, pptx and pdf in Windows Phone 7 - c#

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.

Related

How can I open in the Adobe Reader application("AcroRd32.exe"), a PDF online with url?

So my problem is I'm trying to open a PDF file to sign the document, but the document only exists online. To sign the PDF I would like to click in a Button and it would open the PDF that i want, but in the Adobe Reader application. So that the user could do whatever he wants in the PDF.
Need some help on the part of open a pdf that only exists online, but in the application od the adobe Reader.
Thanks any help!!
EDIT1:
So the problem is that my boss do not want the PDF to be download. He wants to click the button and open in the Adobe Reader Application...
In order to open the file from AdobeReader locally, you are going to have to copy at minimum a temp file locally. Otherwise, you would have to either create or use a web application that is capable of accessing these files. Either way whatever is accessing the PDF is going to need a copy to display whether it's on your local machine or on a server somewhere.
Any PDF that exists online can be downloaded. Once downloaded, you can open it in any PDF reader like AdobeReader. Are you sure you are not able to download it?

C#/ASP.NET - Get thumbnail from PDF/DOC files

I have an ASP.NET WebForms application (written in C#) that allows users to upload files using the FileUpload control.
What'd be great is if I could automatically generate thumbnails from files. Images such as JPG/PNG are trivial of course, but users will often upload .DOC and .PDF files - is there a way I can essentially convert .DOC and .PDF files to images so I can get a thumbnail?
Thanks!
You can use GhostScriptWrapper for generating image thumbnails directly from pdf.You can get ghostScriptWrapper from GitHub or you can include ghostscript.dll from nuget package manager solution.
On paper the most hopeful approach would be to do so server side. So, if the file were uploaded, the server could generate a preview image.
On Windows, there would be a few options.
a) Windows Shell has a way to do it. The path is dangerous though.
b) https://filepreviews.io/ Is a service that does it, but they charge.
c) box is another service that does it.
Now on Linux, or even, perhaps, a Linux in a Windows subsystem, could do it with some command line utilities.
a) Convert the doc to pdf:
Convert DOC to PDF
b) Then, get a bitmap of the first page of the pdf, use ghostscript. ghostscript also exists for .NET and Windows.
Bitmap of PDF First Page
For PDf you can try ABCPDF from websupergoo. With that you should be able to generate a thumbnail,
Documentation link for creating a PNG from a PDF. http://www.websupergoo.com/helppdf8net/source/4-examples/19-rendering.htm
also for Doc, it is a little more complex, you are going to have to install the office application on the server that host the apps and from there manipulate the image.
Look at this article. It lets you extract the thumbnail image that Windows Explorer uses for Office documents and regular images.
http://msdn.microsoft.com/en-us/library/aa289172.aspx

Save PDF file to isolated storage then launch - Windows phone

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.

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