Search code examples
asp.netprintingprintdocument

How to set default printer in asp.net?


I want to set a default printer to print the docs from my web application. I don't know how to set it. As all the users using this application should have a specific printter accttached to their PC. Please help me. Thanks in advance.


Solution

  • Description

    You can't set the default printer of a user who visits your site.

    If you want to set your own default printer programmatically you can use the following function.

    [DllImport("winspool.drv", CharSet=CharSet.Auto, SetLastError=true)]
    public static extern bool SetDefaultPrinter(string Name);
    

    More Information