Incorrect Behavior While Printing Labels Using Labwindows/CVI

Updated Jun 12, 2023

Reported In

Software

  • LabWindows/CVI

Issue Details

I have a label printer and want to print 4 lines of text on a single sheet using LabWindows/CVI and report generation control. However, I can't get it to print everything on one label.

Solution

The problem is that the default margins selected in LabWindows/CVI are not valid for every paper size. Different printers have different acceptable print margins. Decreasing the print area height and width in LabWindows/CVI will result in proper label printing.

In order to resolve the problem, you have to programmatically change the margins used by the NIReport functions, by adding the following lines of code to your application:

NIReport_SetReportAttribute (reportHandle, NIR_ATTR_LEFT_MARGIN, 1);
NIReport_SetReportAttribute (reportHandle, NIR_ATTR_RIGHT_MARGIN, 1);
NIReport_SetReportAttribute (reportHandle, NIR_ATTR_TOP_MARGIN, 1);
NIReport_SetReportAttribute (reportHandle, NIR_ATTR_BOTTOM_MARGIN, 1);