Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Sunday, August 2, 2020 9:03:48 AM(UTC)
Aryan123

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);
}
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, August 2, 2020 2:57:58 PM(UTC)

Hadi  
Hadi

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.html

Since 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.

LEAD Logo
thanks 1 user thanked Hadi for this useful post.
Aryan123 on 8/4/2020(UTC)
 
#3 Posted : Tuesday, August 4, 2020 1:25:59 AM(UTC)
Aryan123

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)

Hadi  
Hadi

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.

File Attachment(s):
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
thanks 1 user thanked Hadi for this useful post.
Aryan123 on 8/4/2020(UTC)
 
#5 Posted : Tuesday, August 4, 2020 9:27:59 AM(UTC)
Aryan123

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)

Hadi  
Hadi

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.

LEAD Logo
 
#7 Posted : Tuesday, August 4, 2020 9:30:30 AM(UTC)
Aryan123

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)
Aryan123

Groups: Registered
Posts: 7

Thanks: 2 times

error_VP.jpg
 
#9 Posted : Tuesday, August 4, 2020 9:37:43 AM(UTC)

Hadi  
Hadi

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.

LEAD Logo
 
#10 Posted : Tuesday, August 4, 2020 9:46:34 AM(UTC)
Aryan123

Groups: Registered
Posts: 7

Thanks: 2 times

error_VP-creating printer.jpgerror_VP-after creating printer.jpgerror_VP-first run.jpg

Tried that too but no success, I am running VS as admin, you can see that on the top right "ADMIN"
 
#11 Posted : Tuesday, August 4, 2020 9:48:41 AM(UTC)
Aryan123

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)

Hadi  
Hadi

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.

LEAD Logo
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.159 seconds.