Printing a PDF-File without print preview

2 posts, 1 answers
  1. Gerhard
    Gerhard avatar
    2 posts
    Member since:
    Sep 2010

    Posted 19 Dec 2016 Link to this post

    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!

     

     

  2. Answer
    Hristo
    Admin
    Hristo avatar
    1023 posts

    Posted 20 Dec 2016 Link to this post

    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.
Back to Top