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

Print to Non-Default Printer in Code

2 Answers 506 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 23 Apr 2015, 06:47 PM

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 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 24 Apr 2015, 04:50 PM
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.

 
0
TheGramix
Top achievements
Rank 2
answered on 29 Apr 2015, 09:05 AM

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

 

Tags
PDFViewer
Asked by
Randy
Top achievements
Rank 1
Answers by
Petya
Telerik team
TheGramix
Top achievements
Rank 2
Share this question
or