locked
Printing to a file using XPS document writer RRS feed

  • Question

  • Hi,

    In my App I'm using the PrintManager class to print a document. I'm providing the name "MyReport" for the print job :

    PrintManager manager = PrintManager.GetForCurrentView();
    manager.PrintTaskRequested += PrintManager_PrintTaskRequested;
    ...
    private void PrintManager_PrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs args)
    {
      PrintTask task;
      task = args.Request.CreatePrintTask("MyReport",
      async (taskArgs) =>
      {
        // ... here goes printing code
      }
    }
    

    When I select the Microsoft XPS Document Writer as the report target, a new file is created in the Documents folder - MyReport.oxps. This would be acceptable but when I print the same report again another file is created - MyReport (1).oxps, and then again yet another file - MyReport (2).oxps, MyReport (3).oxps etc.

    I'd like to override the MyReport.oxps file so only one copy would be kept in the Documents folder.

    How to accomplish that?

    Thanks,

    Leszek


    Wiki: wbswiki.com
    Website: www.wisenheimerbrainstorm.com

    Wednesday, November 20, 2013 8:05 PM

Answers

  • dont think you can do this. you dont have access to the location the printer writes to from your windows store app

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    • Proposed as answer by Anne Jing Thursday, November 21, 2013 8:45 AM
    • Marked as answer by Anne Jing Wednesday, November 27, 2013 9:20 AM
    Wednesday, November 20, 2013 10:22 PM