From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I command my printer to print a test page?

Solved!
Go to solution

Hello list,

 

I've got an application that is used on the shop floor that tests a product and then prints a certification sheet at the end of the test that ships with the product.  They only run this test cell about once a month and invariably there is something wrong with the printer...no paper, dried up ink cartridge, etc.

 

The operator has no keyboard or mouse and the Labview application starts from the Startup folder.

 

I would like Labview command the printer to print a test page when when the test application starts.  I couldn't find anything in the Windows API or on the Labview pallets that would do that.

 

Any ideas would be helpful.

 

Using Windows 7 & LV11

 

Thanks,
Mike 

0 Kudos
Message 1 of 7
(16,429 Views)

A couple of possible options:

 

  1. If the problems really are with the printer, then print your own page, just like you do when the test ends. I never looked at them closely, but I don't think the test pages actually include any info on the printer state, so it doesn't really matter what you print.
  2. For functionality which you can't find in the Win32 API, you should usually also try searching for .NET code. Searching for ".net print test page" yields multiple results which look decent at a very quick glance (and some of them do actually appear to use the Win32 API).

___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(16,416 Views)

You already have an application that can run this?  Is it possible to use the System Exec vi to call that application?

0 Kudos
Message 3 of 7
(16,396 Views)

Thanks to both of you.  I was looking for an easy way to do this. I think alll they want is a way to make sure the printer has paper & ink.

 

The app is on the shop floor computer where there is no LV Development System, and the development system on my desk doesn't have the printer drivers, and HP won't let them install without the printer connected.

 

Looks like I'll have to build my own Print Test Page and use my app to send it on startup.

 

Thanks again,

Mike

 

0 Kudos
Message 4 of 7
(16,376 Views)

Maybe the easiest way is to create a test document with WordPad (rtf) and print the file via command line call (System Exec).

This will print document.rtf to the default printer: write /p document.rtf

0 Kudos
Message 5 of 7
(16,361 Views)
Solution
Accepted by topic author wd8ivl

I found something else here:Rundll32 printui.dll,PrintUIEnt

 

I don't have a real printer right now connected on my PC, but this command line prints the default test page on Adobe PDF

rundll32 printui.dll,PrintUIEntry /k /n"Adobe PDF"

 

You just need to replace the printer name after the /n parameter and call it via System Exec

 

0 Kudos
Message 6 of 7
(16,353 Views)

Chembo,

 

Thanks!

 

I think this is what I was looking for.  I'll try it and let you now.

 

Mike

0 Kudos
Message 7 of 7
(16,284 Views)