LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

NIReport Samples fails with -4 (NIR_ERR_UnknownAutomationError)

When I create a NIReport and try to execute the NIReport_Print command I get an error -4 NIR_ERR_UnknownAutomationError.  I have tried the NIReport Samples and get the same error.  The NIReport_GetPrinters command finds the default printer without any problem.  I can print to the printer via notepad, so the printer is working.

 

      NIReport_New(&iReportHandle);
      NIReport_SetTextAttribute(iReportHandle, NIR_TEXT_ATTR_FONT_SIZE, 12.0);
      NIReport_SetTextAttribute(iReportHandle, NIR_TEXT_ATTR_FONT_NAME, "Courier New");
     
      NIReport_AppendLine(iReportHandle, caTestTitle);
      NIReport_AppendLine(iReportHandle, caTestMessage);
    
      NIReport_Print(iReportHandle, NULL, 1);

0 Kudos
Message 1 of 7
(3,889 Views)

Paul,

 

Have you seen this forum post? http://forums.ni.com/ni/board/message?board.id=180&message.id=4548&requireLogin=False  are you using an HP printer by any chance? If not does the problem persist on different computers? If you can reproduce the problem on different systems, would it be possible for you to post a super simple app that demonstrates the problem, so we can look at the error in action? 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 2 of 7
(3,865 Views)

Richard,

 

I have seen the link that you provide and I am not using an HP.  I have discovered the issue is the paper size attribute for the printer.  I am using a Star SP712 receipt printer, which has a 3 in roll of paper.  NIReport appears to be setup for normal printers.

 

 

The code works if I send it to a network printer, but not to the SP712.  I have tried all the paper size attributes in NIReport.

 

Paul

0 Kudos
Message 3 of 7
(3,855 Views)

Paul,

 

Will CVI let you try to print without setting the size attribute? If so can you try to remove the size attribute from your program, and see if you get the same problem? There are some known issues with certain printers requiring certain options to be set inorder to allow printing. I'll talk to our R&D to see if there is any further documentation about this issue, and if not I will create a corrective action request for this issue. Though the interim solution would be to use the network printer if possible. 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 4 of 7
(3,837 Views)

Richard

 

I get the same error if I only have these three commands when printing to the SP712.

 

NIReport_New(&iReportHandle);
NIReport_AppendLine(iReportHandle, caTestMessage);
NIReport_Print(iReportHandle, NULL, 1);

 

Paul

0 Kudos
Message 5 of 7
(3,833 Views)

Paul,

 

Are you able to use any of the other CVI print functions such as PrintFile, PrintPanel, or PrintCtrl with the printer?

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 6 of 7
(3,822 Views)

Richard,

 

I have not tried those functions yet.  I will try when I can get back on the machine.

 

Paul

0 Kudos
Message 7 of 7
(3,816 Views)