Error while printing

Error while printing

Forum member · Jun 24, 2015
Hi! While using following from ASP.Net code, I am getting error as follows: Error initializing print options. Error code:998 This occurs on the following line: PrintJob printJob = new PrintJob(Printer.Default, Server.MapPath(@"pathiknowexists" + filename));

Re: Error while printing

Support · Jun 24, 2015
Hello, In your code, please try and specify the actual printer name in place of Printer.Default. The ASP.NET code runs under the IIS user account and it may not have access to the printer you are trying to print to or may have a different default printer. Thanks, ceTe Software Support Team.

Re: Error while printing

Forum member · Jun 26, 2015
Hi, When I run my code in local mode from VS 2010, it executes and I can see the printer icon in my status bar. PrintJob printJob = new PrintJob(Printer.Default, Server.MapPath(@"~/xxxpath/" + filename)); printJob.Print(); But when I tried the same thing after deploying this code hosted in IIS 7, I get the error: 'The default printer could not be loaded.' Please note that specifying the printer name is not an option for me. Thanks and regards...

Re: Error while printing

Support · Jun 26, 2015
Hello, The printers are typically installed and configured for each account and a default printer might be a different printer for the internet user account or it might not have been configured correctly. Please make sure that the printer is configured correctly so that the application can access it for printing. Also using PrintManager you can read the installed printers installed using Printer.GetLocalPrinter() method and also use the Printer.Default.Name property to retrieve the printer name. Using the GetLocalPrinter() you will be able to see what printers are installed for the internet user account and pick the correct printer to print to. Thanks, ceTe Software Support Team.

Re: Error while printing

Forum member · Jun 13, 2017
hi, I have hosted my application in server,It is getting error like "The default printer could not be loaded",Is there any other settings need to work out to work with user specified location.

Re: Error while printing

Support · Jun 13, 2017
Hello, The DynamicPDF PrintManager is a server side component and can only print to the printers available to the web server where the site is hosted. The ASP.NET code runs on the server so when you specify Printer.Default in your ASP.NET code the PrintManager tries to find the printers that are available on the server side. If a default printer is not available it will throw the error you are seeing. On the server, the printers are typically installed and configured for each account and a default printer might be a different printer for the ASP.NET user account or it might not have been configured correctly. If you want to print on the server side, please make sure that the printer is configured correctly for the ASP.NET account so the application can access it for printing. Also using PrintManager you can read the installed printers installed using Printer.GetLocalPrinter() method and also use the Printer.Default.Name property to retrieve the printer name. Using the GetLocalPrinter() you will be able to see what printers are installed for the internet user account and pick the correct printer to print to. Thanks, ceTe Software Support Team.