This is a migrated thread and some comments may be shown as answers.

Printing a PDF-File without print preview

1 Answer 681 Views
PdfViewer and PdfViewerNavigator
This is a migrated thread and some comments may be shown as answers.
Gerhard
Top achievements
Rank 1
Gerhard asked on 19 Dec 2016, 01:05 PM

Hello,

my goal is to print a PDF-File directly to a printer without showing the print preview.

 

This is what I tried:

 

rpd = new RadPrintDocument();

rpd.PrinterSettings.PrinterName = "printer";

rViewer = new RadPdfViewer();
rViewer.LoadDocument(sFileName);                
rViewer.DocumentLoaded += rViewer_DocumentLoaded;       

 

static void rViewer_DocumentLoaded(object sender, EventArgs e)

{
    //rViewer.PrintPreview(rpd);
      rViewer.Print(false, rpd);

}

 

When I send it directly to the printer ( rViewer.Print(false, rpd); ) it always prints it in portrait-format.

When I use rViewer.PrintPreview(rpd); and then press the Print-Button, it works. 

 

Does anybody have an idea? Thank you!

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 20 Dec 2016, 11:15 AM
Hi Gerhard,

Thank you for writing.

You have two alternative options:
  • set the PrintOrientation of your RadPdfViewer instance to LandScape 
    this.radPdfViewer1.PrintOrientation = PrintOrientation.Landscape;
  • Set the Landscape property of the RadPrintDocument to true.
    RadPrintDocument rpd = new RadPrintDocument();
    rpd.AssociatedObject = this.radPdfViewer1;
    rpd.Landscape = true;
    this.radPdfViewer1.Print(false, rpd);

I hope this helps. Please let me know if you need further assistance.

Regards,
Hristo
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
PdfViewer and PdfViewerNavigator
Asked by
Gerhard
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or