label is locked by new API

Label printing integration (NiceWatch middleware and ActiveX programming interface)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
Kalthoff_Support
Valued Contributor
Posts: 23
Joined: Tue Sep 27, 2016 1:54 pm

label is locked by new API

Post by Kalthoff_Support » Fri Mar 01, 2019 11:50 am

Hi,
we are using NL2017 and the new API which now seems to always lock ALL used labels (!),
even when doing a Shutdown before the next printing !

In the SDK there is no ".close" available as it was in the former API, but in fact that the Shutdown does no unlock on the label
it seems that there is an internal OpenFile without closing … label is only available after ending the program,
so all used files are closed by .NET-application.

Can you please check this ?
It is very difficult to stop the complete productional printing for doing a change to any label which is in use …

code example which locks the label "LabelFileName":

NL_PrintEngine.Initialize()
NL_Label = NL_PrintEngine.OpenLabel(LabelFileName)
NL_Label.PrintSettings.PrinterName = "PDFCreator"
NL_Label.Print(1)
NL_Label = Nothing
NL_PrintEngine.Shutdown()

User avatar
dado
NiceLabel Development
NiceLabel Development
Posts: 686
Joined: Tue Sep 12, 2006 12:50 pm
Location: Kranj, Slovenia
Contact:

Re: label is locked by new API

Post by dado » Fri Mar 01, 2019 1:51 pm

Sorry, but I tried this and even without shutting down the PrintEngine during printing the label was not locked. And once I updated the label the new print stream was sent to the printer. And of course, please use the latest SDK for this, I remember we had problems with locking the label.

Did you try this with a simple label (with one barcode) or do you have other elements on the label. My label had a connection to the sql database and a counter.

Code: Select all

PrintEngineFactory.SDKFilesPath = @"c:\Program Files\NiceLabel\NiceLabel 2017\bin.net";
PrintEngineFactory.PrintEngine.Initialize();

for (int i = 0; i < repeat; i++)
{
ILabel label = PrintEngineFactory.PrintEngine.OpenLabel(foo);

label.PrintSettings.OutputFileName = "c:\\tmp\\output2.prn";
label.Print(1);

Thread.Sleep(1000);
}

PrintEngineFactory.PrintEngine.Shutdown();
Regards, Damjan

Kalthoff_Support
Valued Contributor
Posts: 23
Joined: Tue Sep 27, 2016 1:54 pm

Re: label is locked by new API

Post by Kalthoff_Support » Wed Mar 06, 2019 2:59 pm

Problem solved by updating to actual SDK.

Thanks !

User avatar
dado
NiceLabel Development
NiceLabel Development
Posts: 686
Joined: Tue Sep 12, 2006 12:50 pm
Location: Kranj, Slovenia
Contact:

Re: label is locked by new API

Post by dado » Wed Mar 06, 2019 6:56 pm

No problem. I am glad we could help.

Regards, Damjan

Post Reply