开发者

Downloading pdf file and open

开发者 https://www.devze.com 2023-03-24 22:58 出处:网络
In my application there is an option for开发者_运维知识库 downloading PDF. When the user clicks on the download button a file should be downloaded. After downloading is completed the user have an opti

In my application there is an option for开发者_运维知识库 downloading PDF. When the user clicks on the download button a file should be downloaded. After downloading is completed the user have an option to open the file. If the device contain a PDF reader then file should open else pop up a message containing No PDF reader. Also I want a progress bar showing the download status. If anyone knows the solution please help me.


The best I've come up with is to use an embedded WebBrowser control - if you point the WebBrowser to the URL of the PDF, then it will get downloaded and the user will be prompted to open it in the PDF viewer.

The Windows Phone sandbox security model prevents file sharing between apps, except for very limited scenarios (pictures. music, ...)


if you want to display the pdf form web try this

just download and install ComponentOne’s WP7 Controls

and add this code to your xaml

<Grid>
        <c1Pdf:C1PdfViewer x:Name="pdfViewer"
                           ViewMode="FitWidth"
                           Visibility="Collapsed" />
</Grid>

in C#

 private WebClient wc = new WebClient(); 
private void MainPageLoaded(object sender, RoutedEventArgs e) { 
    wc.OpenReadCompleted += WcOpenReadCompleted; 
    wc.OpenReadAsync(new Uri(http://some-url to point pdf)); 
} 
void WcOpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { 
    pdfViewer.LoadDocument(e.Result); 
    pdfViewer.Visibility = Visibility.Visible; 
}

this should display pdf from web , works fine for me :)

hope this will helps you for more reference see this

0

精彩评论

暂无评论...
验证码 换一张
取 消