Print to Non-Default Printer in Code

3 posts, 0 answers
  1. Randy
    Randy avatar
    72 posts
    Member since:
    Jan 2009

    Posted 23 Apr 2015 Link to this post

    Is there a way to print the file from the code behind, but specify the printer to use? I know there is a default printer, but that doesn't work for me. I am using it to print labels. The label printer is rarely the default printer on client machines.

     

    Thanks

    Randy

  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 24 Apr 2015 Link to this post

    Hello Randy,

    Take a look at our Customize Printing SDK example either through the Samples Browser or directly on GitHub here. It demonstrates precisely the scenario that you are trying to achive.

    Hope this helps.

    Regards,
    Petya
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. TheGramix
    TheGramix avatar
    16 posts
    Member since:
    Oct 2007

    Posted 29 Apr 2015 in reply to Petya Link to this post

    Hello Petya,

    many thanks for your example! I did a small change:

    printDialog.PrintQueue = printQueue;
    printDialog.MinPage = 1;
    printDialog.MaxPage = (uint)document.Pages.Count;
    printDialog.PrintTicket = printQueue.DefaultPrintTicket;
    printDialog.PrintTicket.PageMediaSize = new PageMediaSize(PageMediaSizeName.ISODLEnvelope); 

    instead of

    printQueue.DefaultPrintTicket.PageMediaSize = new PageMediaSize(PageMediaSizeName.ISODLEnvelope); printDialog.PrintQueue = printQueue;

    printDialog.MinPage = 1;

    printDialog.MaxPage = (uint)document.Pages.Count;

     

    because you get an error if you don't have the right to change the default settings (restricted users).

     

    Have a nice day!

    Dino

     

Back to Top