#1
Posted
:
Sunday, August 2, 2020 9:03:48 AM(UTC)
Groups: Registered
Posts: 7
Thanks: 2 times
I am trying following code based on documentation provided by LeadTools. But getting the error "Printer Driver Locked"
I am running VS 2019 as Administrator and I am Windows 10 64 bit. Is this known issue?
Quote:try
{
string printerName = "Lead Printer";
List<string> installedPrinters = new List<string>();
foreach (string printer in PrinterSettings.InstalledPrinters)
installedPrinters.Add(printer);
if (!installedPrinters.Contains(printerName))
{
const string documentPrinterRegPath = @"SOFTWARE\LEAD Technologies, Inc.\Printer\";
const string printerDriverName = "LEADTOOLS VIRTUAL PRINTER";
var printerInfo= new PrinterInfo()
{
//DriverName = printerDriverName,
PortName = printerName,
MonitorName = printerName,
ProductName = printerName,
PrinterName = printerName,
Password = string.Empty,
RegistryKey = documentPrinterRegPath + printerName,
RootDir = @"C:\LEADTOOLS 20\Bin\Common\PrinterDriver",
Url = "http://www.leadtools.com/support/default.htm",
PrinterExe = Application.ExecutablePath,
AboutString = String.Format("{0} - {1}", printerDriverName, printerName),
};
Printer.Install(printerInfo);
}
_printer = new Printer(printerName);
_printer.EmfEvent += new EventHandler<EmfEventArgs>(_printer_EmfEvent);
_printer.JobEvent += new EventHandler<JobEventArgs>(_printer_JobEvent);
}
catch (Exception ex)
{
MessageBox.Show(this, ex.Message);
}
#2
Posted
:
Sunday, August 2, 2020 2:57:58 PM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
Hello,
In order to use LEADTOOLS Functionality, you need to set a valid evaluation or runtime license as described here:
https://www.leadtools.co...g-a-runtime-license.htmlSince you are using .NET, you can just copy the following into the start of your app:
Code:var lic = "C:\LEADTOOLS 20\Support\Common\License\LEADTOOLS.LIC";
var key = File.ReadAllText("C:\LEADTOOLS 20\Support\Common\License\LEADTOOLS.LIC.KEY");
RasterSupport.SetLicense(lic, key);
Thanks,
Hadi
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
1 user thanked Hadi for this useful post.
#3
Posted
:
Tuesday, August 4, 2020 1:25:59 AM(UTC)
Groups: Registered
Posts: 7
Thanks: 2 times
thanks, I did that, now I am getting following error
"Function not successful"
Same code and licence files are there as well.
#4
Posted
:
Tuesday, August 4, 2020 8:23:16 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
I have created a virtual printer poc for you that I have verified works. Please try using this project and let me know if you have any issues with it.
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
1 user thanked Hadi for this useful post.
#5
Posted
:
Tuesday, August 4, 2020 9:27:59 AM(UTC)
Groups: Registered
Posts: 7
Thanks: 2 times
Thanks for quickly putting the project for me. But still when it calls Install method, VS freezes for sometime, saying debug is taking longer then I get an error "An unhandled exception of type 'Leadtools.RasterException' occurred in Leadtools.Printer.dll"
#6
Posted
:
Tuesday, August 4, 2020 9:29:48 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
Are you still running Visual Studio as an Administrator? What is the RasterException that is thrown? Can you include a screenshot?
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
#7
Posted
:
Tuesday, August 4, 2020 9:30:30 AM(UTC)
Groups: Registered
Posts: 7
Thanks: 2 times
Yes I am, I wrapped with try.. catch, and saw that error message is same "Function not successful"
#8
Posted
:
Tuesday, August 4, 2020 9:35:57 AM(UTC)
Groups: Registered
Posts: 7
Thanks: 2 times
#9
Posted
:
Tuesday, August 4, 2020 9:37:43 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
Do you have the LEADTOOLS SDK installed on this machine? Perhaps the Virtual Printer Driver is not installed. You can check if it is installed by going to
C:\LEADTOOLS 20\Shortcuts\Virtual Printer\.NET Framework Class Libraries\Virtual Printer and running the 64-bit demo. Once there, click on Install new test printer
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
#10
Posted
:
Tuesday, August 4, 2020 9:46:34 AM(UTC)
Groups: Registered
Posts: 7
Thanks: 2 times
#11
Posted
:
Tuesday, August 4, 2020 9:48:41 AM(UTC)
Groups: Registered
Posts: 7
Thanks: 2 times
when you said "Perhaps the Virtual Printer Driver is not installed"
how do i verify that? whether its installed correctly?
#12
Posted
:
Tuesday, August 4, 2020 10:05:21 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
You can open and run the VirtualPrinterDriverDeploymentTool (running VS as admin):
C:\LEADTOOLS 20\Examples\Dotnet\cs\VirtualPrinterDriverDeploymentTool
This utility will let you install the printer driver. See the Readme.html in the same folder as the project for step-by-step instructions.
The other option is to run the LEADTOOLS installer again
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.