locked
PRINT MEDIA SIZE

    Question

  • Ref. Printing in Windows Store. I would like to setup the print options programmatically like in the simplified example below, where I set the Media Size to A3.

            void PrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs e)
            {
                PrintTask printTask = null;
                printTask = e.Request.CreatePrintTask("MyApp", sourceRequested =>
                {
                    PrintTaskOptions printTaskOptions = printTask.Options;
                    IList<string> displayedOptions = printTask.Options.DisplayedOptions;

                    // Choose the printer options to be shown.
                    // The order in which the options are appended determines the order in which they appear in the UI
                    displayedOptions.Clear();
                    displayedOptions.Add(Windows.Graphics.Printing.StandardPrintTaskOptions.MediaSize);
                    displayedOptions.Add(Windows.Graphics.Printing.StandardPrintTaskOptions.Orientation);

                    // Preset the default value of the printer option
                    printTask.Options.MediaSize = PrintMediaSize.IsoA3;
                    printTask.Options.Orientation = PrintOrientation.Portrait;

                    ...
                    sourceRequested.SetSource(printDocumentSource);
                });
            }

    When I choose to 'print' to XPS there is no problem: it accepts any media size. However, when I choose my printer, which does not support A3, the size is automatically changed to A4.
    Granted that the user can see this change in the MediaSize field in Print Manager, I would like to also prompt him with a message. I experimented the following:

            void CreatePrintPreviewPages(object sender, PaginateEventArgs e)
            {
                printPreviewPages.Clear();      // Clear the cache of preview pages

                if (((PrintTaskOptions)e.PrintTaskOptions).MediaSize != PrintMediaSize.IsoA3)
                {
                    Flyout flyout = new Flyout();
                    TextBlock tb = new TextBlock();
                    tb.Text = "Media size changed";
                    flyout.Content = tb;
                    flyout.ShowAt(Window.Current.Content as FrameworkElement);
                }
                ...

    However, this flyout belongs to the page requesting the print, and happens to be hidden by the Print Manager charm; whereas ideally it should be contained in the charm, e.g. next to the 'Print' button.

    Any suggestion?

    Tuesday, October 28, 2014 9:24 PM

Answers

  • Okey, I know, however we could not modify the print charm, system manage it we cannot change its layout.

    But if we simply want to send a notification, why not follow the instruction: Quickstart: Sending a toast notification

    Or we would like suggest Microsoft make things more flexible: https://wpdev.uservoice.com/forums/110705-dev-platform

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by GiorgioITA Thursday, October 30, 2014 8:05 AM
    Wednesday, October 29, 2014 8:25 AM
    Moderator

All replies

  • Hi GiorgioITA,

    Is that possible promote the message to user by your print page instead of showing on the print manager charm.

    For instance you make one public function on the current page to display the MessageDialog and call it from your print charm.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, October 29, 2014 5:07 AM
    Moderator
  • the flyout that I experiment (see my second snippet) works in fact to that effect - but it is partially hidden by the print manager charm. A message box would perhaps stay on top of everything but it is not appropriate because the message I want to convey is just a notification.


    • Edited by GiorgioITA Wednesday, October 29, 2014 8:16 AM
    Wednesday, October 29, 2014 8:15 AM
  • Okey, I know, however we could not modify the print charm, system manage it we cannot change its layout.

    But if we simply want to send a notification, why not follow the instruction: Quickstart: Sending a toast notification

    Or we would like suggest Microsoft make things more flexible: https://wpdev.uservoice.com/forums/110705-dev-platform

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by GiorgioITA Thursday, October 30, 2014 8:05 AM
    Wednesday, October 29, 2014 8:25 AM
    Moderator
  • The idea of using a toast notification is interesting - I had not thought of it and will experiment.

    Besides, it is apparent that the print manager charm does not offer any alternative.

    Thank you for your comments.

    Thursday, October 30, 2014 8:07 AM