none
Unable to print the Xaml files using PrintDocument class in silver light, All of a sudden it started printing some of the pages Blank. RRS feed

  • Question

  • Hi All,

    We have silver light app which is having a print functionality.

    Print functionality is implemented  System.Windows.Printing.PrintDocument class provided to implement the printing in silver Light applications.

    We are having a around 100 pages that gets printed based on selection. All the xaml pages are derived from Usercontrols having the formatted text content or a png image as the content.

    This is a good working code. All of a sudden it's stopped working. It's printing the pages with some blank pages. We are not getting any exception. But when we are trying to print the pages to PDF. We are not getting the save option.

    Below are the print settings that we are using.

                        

                PrinterFallbackSettings settings = new PrinterFallbackSettings();
                settings.ForceVector = true;
                settings.OpacityThreshold = 0.5;

                    pd.Print("My Map");

         

     public void PD_PrintPage(object sender, PrintPageEventArgs e)
            {

                if (printCount < this.printObjects.Count)
                {
                    if (this.printObjects != null && this.printObjects[printCount].PrintPages.Count > 0)
                    {
                        e.PageVisual = (StackPanel)(VisualTreeHelper.GetParent((UserControl)this.printObjects[printCount].PrintPages[0]));
                        e.HasMorePages = true;
                    }
                    else
                    {
                        e.HasMorePages = false;
                    }
                }
            printCount++;
            }

    Someone please share your inputs. As we are clueless on where we are going wrong. 

    Thanks in advance 

    Pratap G

    Wednesday, July 10, 2019 7:58 AM

All replies


  • Hi   Pratap G  

    As we know, the silver light is no longer supported.  

    >>This is a good working code. All of a sudden it's stopped working. It's printing the pages with some blank pages. We are not getting any exception. But when we are trying to print the pages to PDF. We are not getting the save option.

    Did you make any changes before this code not work?

    I suggest you can visit the Silver Light forum and search some question about PrintDocument.

    Thank you for your understanding.


    Best regards

    Yong Lu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 11, 2019 5:42 AM
  • Hi Lu,

    Thanks for you response.

    We haven't modified any Code.

    It seems the silverlight forum is stopped. I Don't see silver light as part of forum selection when we ask a question. That's the reason I have posted it under WPF.

    Please share if there is any specific link.

    Thanks and Regards

    Pratap Gottumukkala


    • Edited by Pratap G Thursday, July 11, 2019 8:51 AM
    Thursday, July 11, 2019 8:44 AM