PivotGrid Print Error

5 posts, 2 answers
  1. Asuman
    Asuman avatar
    17 posts
    Member since:
    Dec 2014

    Posted 31 Aug 2015 Link to this post

    Hi everybody,

    I've run yor sample pivotgrid printing project and it's showed up the error below.

    What may be the problem?

     Best regards...

  2. Asuman
    Asuman avatar
    17 posts
    Member since:
    Dec 2014

    Posted 31 Aug 2015 Link to this post

    Sorry for sample sending problem.
    I've added the sample link and error snapshot here: http://www.telerik.com/forums/print-and-pdf-export
  3. DevCraft banner
  4. Answer
    Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 02 Sep 2015 Link to this post

    Hello Asuman,

    I can confirm that there is a problem with the printing in this particular case. Fortunately, there is a workaround for this problem. Instead of using RadRichTextBox for printing RadPdfViewer could be used. Attached you can find the solution from the other thread with the required modification.

    Regards,
    Mihail
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Asuman
    Asuman avatar
    17 posts
    Member since:
    Dec 2014

    Posted 06 Sep 2015 Link to this post

    Hi Mihail,

    Thanks for the solution. It's fixed out my problem for now. However I would be waiting for the solution with radrichtextbo.

     

    Best regards...
  6. Answer
    Polya
    Admin
    Polya avatar
    199 posts

    Posted 08 Sep 2015 Link to this post

    Hi Asuman,

    The InvalidOperationException is thrown because the window is closed before the printing had finished. For that reason in the example the window is closed in a Dispatcher. However, when the data to be printed is not minimal the closing still occurs before the printing had finished.
    So instead of calling this.Close() in the PrintButton_Click() handler I suggest closing the window when the print operation ends, by adding handler to the RadRichTextBox.PrintCompleted event:
    public partial class PrintPreview : RadWindow
    {
        PrintDocument pd;
     
        public PrintPreview(RadDocument document)
        {
            InitializeComponent();
     
            this.RichTextBox.Document = document;
            this.RichTextBox.PrintCompleted += RichTextBox_PrintCompleted;
        }
     
        void RichTextBox_PrintCompleted(object sender, PrintCompletedEventArgs e)
        {
            this.Close();
        }
     
        private void PrintButton_Click(object sender, RoutedEventArgs e)
        {
            this.RichTextBox.Print("Test", PrintMode.Native);
        }
     
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }

    Hope this helps and is suitable for your scenario.

    Regards,
    Polya
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner