We have followed the instructions showing how to use the driver using this method, but when we call PDFDriverInit we get the error "Printer Installation Failed". At no point has the printer been manually installed. I also have no way of knowing if there are any other errors as I cannot get past the "PDFDriverInit" line.
The code we are using is shown here, and "mySheet" is a Microsoft Excel Worksheet...
Code: Select all
try
{
Guid printerLock = new Guid();
printerLock = Guid.NewGuid();
CDIntfEx.CDIntfExClass pdfPrinter = new CDIntfExClass();
pdfPrinter.PDFDriverInit("TempAmyuniPDFPrinter");
pdfPrinter.Lock(printerLock.ToString());
pdfPrinter.EnablePrinter(_licenceName, _licenseCode);
pdfPrinter.SetDefaultConfig();
pdfPrinter.FileNameOptions = 3;
pdfPrinter.DefaultFileName = fileName;
pdfPrinter.SetDefaultPrinter();
mySheet.PrintOutEx(Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing);
if (pdfPrinter.TestLock(printerLock.ToString()) == 0)
{
pdfPrinter.Unlock(printerLock.ToString(), 0);
}
pdfPrinter.RestoreDefaultPrinter();
pdfPrinter.DriverEnd();
}
catch (Exception ex)
{
WriteEvent(ex.Message);
MessageBox.Show(ex.Message);
}
Can someone confirm that the printer does NOT need to be manually installed prior to using it in this way?
Also, if someone has this method of working with this printer, and wouldn't mind sharing some sample code I would be very grateful.
Karl