Print Issue

Thread is closed for posting
2 posts, 0 answers
  1. Ram
    Ram avatar
    2 posts
    Member since:
    Mar 2016

    Posted 27 May 2016 Link to this post

    Hi Everyone 


    What i am trying to do i just want to print the grid.

    here is my code .

    public static void Print(object parameter, List<FilterList> lst, PrinterSettingViewModels Printer)         {             RadGridView grid = (RadGridView)parameter;             RadRichTextBox rtb = new RadRichTextBox() { Height = 0 };             rtb.Name = "RadRichTextBox1";             Grid parent = grid.ParentOfType<Grid>();             if (parent != null && parent.FindName(rtb.Name) == null)             {                 parent.Children.Add(rtb);                 rtb.ApplyTemplate();             }             rtb.Dispatcher.BeginInvoke((Action)(() =>             {                 rtb.Document = CreateDocument(grid, lst);             }));             rtb.Document.MeasureAndArrangeInDefaultSize();             PrintSettings pSettings = new PrintSettings();             PrintDialog printDialog = new PrintDialog();             if (rtb.Document.Sections != null)             {                 if (Printer != null)                 {                     //PrintQueue printQueue = FindPrintQueueByName(Printer.PrinterName);                     pSettings.DocumentName = "My document";                     pSettings.PrintMode = PrintMode.Native;                     pSettings.PrintScaling = Telerik.Windows.Documents.UI.PrintScaling.None;                     pSettings.UseDefaultPrinter = true;                                                    rtb.Print(pSettings);                                    }                 else                 {                     rtb.Print(pSettings);                    // rtb.Print("Document", PrintMode.Native);                 }             }         }


    it works great untill i use "pSettings.UseDefaultPrinter = true; ".After using this it always print a blank page. i am not sure about this.can Anyone help me on this.



  2. Stefan
    Stefan avatar
    1058 posts

    Posted 01 Jun 2016 Link to this post

    Hello Ram,

    The recommended approach for printing RadGridView is to use RadSpreadSheet. The approach is demonstrated in the Print and Print Preview online example or its WPF equivalent.

    I have also attached a sample application in which the UseDefaultPrinter of the PrintSettings is set to true and everything works as expected. Can you please check it out?

    Best Regards,
    Stefan X1
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top