locked
Printing Pdf document from windows store apps RRS feed

  • Question

  • I am currently developing a windows 8 metro application Where I need to print a pdf document on click of print Report button. I used the following code.

    StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
    StorageFile reportFile = await localFolder.GetFileAsync("abc.pdf");
    var options = new Windows.System.LauncherOptions();
    options.DisplayApplicationPicker = false;
    bool success = await Windows.System.Launcher.LaunchFileAsync(reportFile, options);

    But it will open the pdf document  then the user manually needs to print it. Is there any way to print the pdf document directly without opening it.?

    Wednesday, January 15, 2014 8:56 AM

All replies

  • There's a sample which shows how to work with the PDF viewer:

    http://code.msdn.microsoft.com/windowsapps/PDF-viewer-showcase-sample-39ced1e8

    See here for more detail:
    http://msdn.microsoft.com/en-us/library/windows/apps/dn263107.aspx

    My belief is that you open the PDF in the app itself, then use standard printing techniques to print the document.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, January 15, 2014 8:42 PM
    Moderator
  • Thanks for the reply Matt, but the suggested options works for only windows 8.1 .Is there any way to do the same with windows 8.
    Thursday, January 16, 2014 6:08 AM
  • No, not as far as I know.  Why aren't you targeting Windows 8.1?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, January 16, 2014 2:06 PM
    Moderator