locked
App page not printing using button RRS feed

  • Question

  • Hi I have tried to print an app screen using button but it is throwing an exception like 

    WinRT information: Windows.Graphics.Printing.PrintManager is not supported on the view provided.

    This is my code..

    XAML

    <Button x:Name="invokePrintingButton" Content="Print" Margin="0,0,10,0" Click="InvokePrintButtonClick"/>

    C#

      private async void InvokePrintButtonClick(object sender, RoutedEventArgs e)
            {
                if (this.ActualWidth >= 768)
                {
                    await Windows.Graphics.Printing.PrintManager.ShowPrintUIAsync();
                }
            }

    I am not getting why it is throwing exception..

    Can any one please help me on this ?

    Thank you in advance..

    Wednesday, October 23, 2013 12:04 PM

Answers

  • Note that Nigel is writing a DirectX app and so doesn't have access to the Xaml helpers which handle printing and pagination. The basic concept is the same, but the way the app handles the document itself is quite different in DX and in Xaml.

    --Rob

    • Marked as answer by Anne Jing Wednesday, October 30, 2013 5:38 AM
    Monday, October 28, 2013 8:28 PM
    Moderator

All replies

  • Have you registered the page with the PrintManager? The page needs to support printing before it can bring up thru printing UI. See Quickstart: Printing from your app
    Wednesday, October 23, 2013 2:10 PM
    Moderator
  • No but I have actually tried this step

    How to print using an in-app print button (Windows Store apps using C#/VB/C++ and XAML)

    Thursday, October 24, 2013 9:01 AM
  • You need to register the page. The Quickstart starts with a sample that already supports printing.

    --Rob

    Thursday, October 24, 2013 3:12 PM
    Moderator
  • ok


    Akash rao

    Friday, October 25, 2013 4:46 AM
  • If only printing was that simple.

    You need to get into the sample printing example.

    Its quite involved.

    I found I had to do it in two steps.

    1/ Set up printer job from parameters like area to print etc.

    2/ Actual print which is linked into sample printer code.

    It should keep you out of mischief for a while working out which bits of code to use etc.


    n.Wright

    Sunday, October 27, 2013 9:58 PM
  • Note that Nigel is writing a DirectX app and so doesn't have access to the Xaml helpers which handle printing and pagination. The basic concept is the same, but the way the app handles the document itself is quite different in DX and in Xaml.

    --Rob

    • Marked as answer by Anne Jing Wednesday, October 30, 2013 5:38 AM
    Monday, October 28, 2013 8:28 PM
    Moderator
  • oh ok. Thanks for the information.

    Akash rao

    Tuesday, October 29, 2013 3:43 AM