Completed
Last Updated: 03 Nov 2016 09:34 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 05 Sep 2016 06:02
Category: PdfViewer
Type: Bug Report
1
FIX. RadPdfViewer - ArgumentOutOfRange exception when RadPrintDocument.PrinterSettings.FromPage is greater than RadPrintDocument.PrinterSettings.ToPage
To reproduce:

public Form1()
{
    InitializeComponent();

    this.radPdfViewer1.DocumentLoaded += radPdfViewer1_DocumentLoaded;
}

private void radPdfViewer1_DocumentLoaded(object sender, EventArgs e)
{ 
    var pdf = (RadPdfViewerElement)sender;
    var doc = new RadPrintDocument();

    doc.AssociatedObject = pdf.ElementTree.Control as RadPdfViewer; 
    doc.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.SomePages;
    doc.PrinterSettings.FromPage = 2;
    doc.PrinterSettings.ToPage = 1;
    doc.PrinterSettings.PrintFileName = @"..\..\Once upon a time.pdf"; 
    pdf.Print(showPrinterSettings: false, document: doc);
}

Workaround: check FromPage  before printing.
0 comments