C# .NET - Selecting a printer dynamically and sending a pdf to print in that sel
Asked By Eddy Lino on 15-May-12 10:22 AM
I need to select a printer at runtime and send the pdf to the selected printer
[)ia6l0 iii replied to Eddy Lino on 15-May-12 10:34 PM
C# or .Net does not have native support for this. You need to either invoke commands on Adobe PDF reader or use third party components like Aspose or GSPrint.
Or you could try this technique.
Get the list of installed printers from the PrinterSettings.InstalledPrinters and show them in a dropdown. This is available in the System.Drawing.Printing namespace. And then drop the pdf to the print folder of the chosen printer. For the latter, the code samples can be found at http://geekswithblogs.net/bleepzter/archive/2008/10/09/printing-a-pdf-file-to-a-network-printer-with-c.aspx
Hope this helps.