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

Programmatically Print Image from Intensity Graph

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

Description

Introduction

There exist solutions to print an image file (e.g., https://decibel.ni.com/content/docs/DOC-33239), or a front panel object (https://decibel.ni.com/content/docs/DOC-33277).

 

Instead of printing the whole front panel object, the attached Print Image.vi grabs the image from an intensity graph/chart (or an x,y Graph/Chart) and prints it to the default printer. It combines the functionality of the following VIs published elsewhere:

 

  • Acquire and Print Image.vi by unknown, [removed] (using a slightly modified version of the print front panel object image.vi by the same author), and
  • Image to Clipboard 2009.vi by Eric_R, see https://decibel.ni.com/content/docs/DOC-6740)

 

Steps to complete

Implement the VI as shown in the Print Intensity Graph.vi:

Create a "Get Image" invoke node of the front panel object. Set the image depth and wire the image Data to the Print image.vi. The VI prints to the default printer. To print to a different printer, wire up the terminal "input printer name (default)".

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