|
VS 2005 |
Top Previous Next |
|
[DllImport("Winspool.drv")] private static extern bool SetDefaultPrinter(string printerName);
private void Form1_Load(object sender, EventArgs e) { //Define a printer name for your application string PrinterName = "Application Name"; int err = 0;
/* * If your application requires to create the printer at runtime, Use * * axPaperlessPrinterAxJPGX1.JPGDriverInitialize(PrinterName, out err); * * The above statement requires admin priviledges * It is recommended to use this statement in your setup and install the printer before hand * * Also, the above statment must be followed by, * axPaperlessPrinterAxJPGX1.DriverInitialize(PrinterName, out err); * This will ensure that the printer is not deleted when your application is terminated. * * However, if you do not want the printer to be availble after your application has done with it, * Do not use, axPaperlessPrinterAxJPGX1.DriverInitialize(PrinterName, out err); * */
/* * If the printer is already installed and you want to use it in your application * a call to axPaperlessPrinterAxJPGX1.DriverInitialize(PrinterName, out err); * must be done to initialize the driver. * */
//Assuming that the printer was installed during the setup axPaperlessPrinterAxJPGX1.DriverInitialize(PrinterName, out err);
//axPaperlessPrinterAxJPGX1.SetAsDefault();
SetDefaultPrinter(PrinterName); // WinApi to set the printer as default
//Enable the printer by using your License Key axPaperlessPrinterAxJPGX1.SetActivationKey("EMA20-U6XV5-B4Y7A-2253Z-DY63C");
bool isEn = axPaperlessPrinterAxJPGX1.IsPrinterEnabled;
//Check whether the printer is ready to accept and save the document settings if (axPaperlessPrinterAxJPGX1.IsPrinterReady(PrinterName)) {
axPaperlessPrinterAxJPGX1.FileName = "E:\\Data\\1.jpg"; axPaperlessPrinterAxJPGX1.CreateNewFolder = false;
//axPaperlessPrinterAxJPGX1.ShowConverionProgress = false; //axPaperlessPrinterAxJPGX1.ShowPropertiesDialog = true; //axPaperlessPrinterAxJPGX1.ShowSpoolProgress = false; //axPaperlessPrinterAxJPGX1.PromptForOverWrite = false;
//This function has to be called to save the current assigned properties. //A fail to this call, will take the default settings axPaperlessPrinterAxJPGX1.SaveSettings();
}
//webBrowser1.Navigate("HTTP_URL"); }
|