NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Label Printing

Solved!
Go to solution

 

My TestStand application can print on 1 inch labels but not on ½ inch labels. Our manufacturing group requires 1/2 inch labels.

 

We are using a call to “PrintTextBuffer” from C:\Windows\System32\cvirte.dll and that works fine for 1 inch labels but not for ½ inch labels.  The failure shows up in a Run-Time Error dialog with an Error Code of “-17502; System Level Exception.”  The printer settings were adjusted to match the two label sizes when changing cartridges.  Also, we can print out either size labels from Word with no errors.

 

Any help would be appreciated.

 

Using: Windows 7, TestStand 2013, C#, Brother PT-9800PCN label printer

0 Kudos
Message 1 of 8
(4,618 Views)

Hi CC57,

 

That does seem like strange behavior. Are you able to print to the half inch lables from the LabWindows/CVI development environment using PrintTextBuffer (so taking TestStand out of the picture)?

 

Where exactly do you specify the new half inch size for the lable? 

 

As I'm sure you've seen unfortunately  “-17502; System Level Exception.” seems to show up all over the place and so far I haven't found any instances that seem similar to what you're doing. Are you able to use some debugging tools to see exactly where this error gets generated?

 

Hope this is somewhat helpful, let me know though and I can look into this some more!

Selene
0 Kudos
Message 2 of 8
(4,580 Views)

Selene

 

In general, we are not using LabWindows/CVI or LabView, we use C# for our code modules that are called by TestStand. In this case, we don’t use any C# code for label printing, just the one call to “PrintTextBuffer” from C:\Windows\System32\cvirte.dll with no formatting control.  I don’t know how to do any formatting or what options may be available for printing.

 

We specify the label size starting from Control Panel\Hardware and Sound\Devices and Printers with the label printer selected as the default printer. Further, selecting Printing Preferences sets the Paper Size to ½” or 1” in the label printer dialog box. 

 

We have no debugging tools to further define this problem.

Again, this works fine for 1” but for ½” labels.

 

Thank you

0 Kudos
Message 3 of 8
(4,553 Views)

Ah okay I see, I just saw that "PrintTextBuffer" was a CVI function so I assumed you were using CVI code modules and suggested that as a way to narrow down if this was a limitation of the function itself or something to do with how TestStand was calling it.

 

That's definitely interesting that you're just changing the paper size through the control panel and this is what's causing the error in TestStand. I'm wondering if there's maybe some default size setting of that function that's conflicting with the print settings, but I'm currently not aware of anything like this that would generate that particular error. I can look into it this further though and see if I come across anything.

 

Are you able to upload the sequence in which you make the call to "PrintTextBuffer"?

Selene
0 Kudos
Message 4 of 8
(4,500 Views)

Here is a screen shot of the sequence step where the error occurs.

Some updates: I can also print with a 3/4” label in addition to the 1” label but not the required ½” label.

I don’t have any text formatting information that I can find with C:\Windows\System32\cvirte.dll, PrintTextBuffer. Maybe I could solve this problem if I had the text formatting commands. 

Could it be that I’m using the wrong dll? Is there a better one to use? 

Thanks again.

TestStand Screenshot1.jpg

 

0 Kudos
Message 5 of 8
(4,490 Views)
Solution
Accepted by topic author CC57

Hi,

Thanks for that additional information! So after discussing this with some colleagues we think this likely some sort of error originating from the printer, just sending it a text string at that label size is causing some sort of problem. The fact that it works from Word with half inch labels is definitely interesting but I think this is likely due to the fact that Word automatically handles a lot more formatting than "printtextbuffer" does. Unfortunately, the fact that you are calling directly into the CVI run time engine is limiting. There are ways to set printer attributes in CVI, as explained here:

 

http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/uiref/cvisetprintattribute/

 

but these rely on a consistent instance of the CVI run time engine, and so if you were to just call these sequentially from TestStand I don't think it would work. As such, I think the best way forward might be to write a code module in CVI and then call this from TestStand. That way in that code module you can set the page size etc. appropriately. You can also look for any other existing module that provides this functionality. 

 

It may also be an idea to post this question to the CVI forums, I'm not sure if they'll be able to shed any more light on the function itself, especially if you see the same behavior if you just call this dll outside of TestStand. 

 

Thanks, I hope this is helpful!

Selene
0 Kudos
Message 6 of 8
(4,457 Views)

This answers the question.  We will likely create a code module to handle the print formatting that "PrintTestBuffer" does not.

 

Thanks!

 

Chuck

0 Kudos
Message 7 of 8
(4,444 Views)

Sounds great! Have a great weekend 🙂

Selene
0 Kudos
Message 8 of 8
(4,432 Views)