New variable value not printed

Label printing integration (NiceWatch middleware and ActiveX programming interface)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
ajochems
Newcomer
Posts: 4
Joined: Fri Nov 14, 2008 11:03 am

New variable value not printed

Post by ajochems » Fri Nov 14, 2008 12:25 pm

Hi,
I designed a label with NiceLabel Pro. I placed 6 variables on the label. I exported the label to pocket pc and get a lvx and pnl file. From my windows mobile 6 application i execute the following printBon method but when printed the newly set variable values do not get printed. Do i need to save the object before printing or am i missing something else? While debugging i see that just before executing the print mehtod on the label the variables have their updated values. What am i doing wrong here?

Code: Select all

        private static Int32  btComPort = 5;
        private static Int32  aantal = 1;
        private static string regKey = "MY-REG-KEY";
        private static string regUser = "Redline";
        private static string regComp = "Redora";
        private static string labelName = "testlabel.lvx";
        
        public static void printBon()
        {
            IEngine pneEngine;
            ILabel combibonLabel;
            ILabelVariables pneVariables;
            IOutput pneOutput;
            try
            {
                pneEngine = PocketNiceEngine.EngineClassFactory.CreateEngine();
                pneEngine.Registration(regKey, regUser, regComp);
                pneEngine.Init();
                String appDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                combibonLabel = pneEngine.OpenLabel(appDir + "\\" + labelName);
                pneVariables = combibonLabel.LabelVariables;
                foreach (IVariable pneVar in pneVariables)
                {
                    if (pneVar.Name.Equals("var1"))
                    {
                        pneVar.Value = "value1";
                    }
                    else if (pneVar.Name.Equals("var2"))
                    {
                        pneVar.Value = "value2";
                    }
                    else if (pneVar.Name.Equals("var3"))
                    {
                        pneVar.Value = "value3";
                    }
                    else if (pneVar.Name.Equals("var4"))
                    {
                        pneVar.Value = "value4";
                    }
                    else if (pneVar.Name.Equals("var5"))
                    {
                        pneVar.Value = "value5";
                    }
                    else if (pneVar.Name.Equals("var6"))
                    {
                        pneVar.Value = "value6";
                    }
                }     
                pneOutput = PocketNiceEngine.EngineClassFactory.CreateOutput();
                pneOutput.Kind = PocketNiceEngine.OutputKindType.BlueTooth;
                pneOutput.SetBlueTooth(btComPort);
                combibonLabel.Output = pneOutput;
                combibonLabel.Print(Convert.ToString(aantal));
            }
            catch (ErrorHandler.ErrorException ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Print Error");
            }
        }

Kind Regards,
Andre

primoz
NiceLabel Development
NiceLabel Development
Posts: 22
Joined: Wed Nov 29, 2006 2:10 pm

Post by primoz » Fri Nov 14, 2008 2:16 pm

Hi

The code seems ok so the problem must else ware. Does this code actually produce any printout.
What happens if you print this label (lvx file) from PocketNiceLabel Application are the variable values still missing.

ajochems
Newcomer
Posts: 4
Joined: Fri Nov 14, 2008 11:03 am

Post by ajochems » Fri Nov 14, 2008 3:01 pm

It prints out the actual label, only the variable values are missing. If i try to print it from the PocketNiceLabel application its the same, ie the variable values are still missing. If i print from NiceLabel Pro it asks for the variable values and shows the correct label in print preview (including variables). I did notice that if i open the label in PocketNiceLabel and enter a value for the variable and click outside the textbox where i just entered the value the application crashes with an error. The problem is however that the error is only showed very briefly but it seems like an argument out of range exception. Could it be a problem that i am using Windows Mobile 6?

Thank you,
Andre

primoz
NiceLabel Development
NiceLabel Development
Posts: 22
Joined: Wed Nov 29, 2006 2:10 pm

Post by primoz » Mon Nov 17, 2008 7:36 am

Please check your private mail inbox.

ajochems
Newcomer
Posts: 4
Joined: Fri Nov 14, 2008 11:03 am

Post by ajochems » Mon Nov 17, 2008 2:53 pm

Just to update for other readers of this subject, .... the problem lies in using true type fonts for variables. Only the internal fonts of my Zebra printer are supported for the use of printing variables.

Andre

Post Reply