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.

Example Code

Configuring a Printer Through the Windows Dialog using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
The attached program lets you print the front panel of a VI using printer settings configured from the Windows Print Dialog.


Description
There are many times you would like to customize the way documents are printed in LabVIEW, but you have to create your own dialog for display to configure these options.  The attached program lets you print the front panel of a VI using printer settings configured from the Windows Print Dialog.

Print Front Panel.vi uses calls to the Microsoft .NET framework to display the Print Dialog window and retrieve settings made in the dialog to configure how the front panel of a VI is printed.  VIs from the Report Generation palette are used to capture the front panel and set the report for the desired orientation, margin size, printer used and number of copies, however you do not need the Report Generation Toolkit installed to use this example.

 

 Requirements

LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Run the application as subvi.

 

Additional Information or References
VI Snippet

Print Front Panel.pngGetPrinterSettings.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Donovan

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Snamprogetti
Active Participant
Active Participant
on

"Find Window.vi" does not work for me (LV 2009 on Win XP sp3), unless i specify a custom Window title in VI Properties. When window title is default, it is something like "filename.vi Front Panel rev. X" but it searches for "filename.vi" so i get a "No Window found with the specified name" error.

If i set a custom Window title it goes on, but... printed page is blank!