How Do I Print a Single Front Panel Control in LabVIEW?

Updated Jun 6, 2018

Reported In

Software

  • LabVIEW
  • LabVIEW 2012 Full

Issue Details

How Do I Print a Front Panel Control or Indicator (Such as a Graph, Chart, or Slider) in LabVIEW?

Solution

There are several ways to programmatically print a front panel control. Listed below are a few good methods:
 

Use the Report Generation VIs to generate and print a report

  1. From the Report Generation palette, place the New Report.vi on the block diagram.
  2. Next, place the Append Control Image to Report.vi on the block diagram.
  3. From the block diagram, right click on your control and select Create»Reference. Attach this reference to the "Ctrl Reference" input of the Append Control Image to Report.vi.
  4. Place the Print Report.vi on the block diagram.
  5. Place the Dispose Report.vi on the block diagram.
  6. Connect the VIs as indicated in the PrintGraph.llb attached below (Note: Open the respective PrintGraph.llb depending on whether or not you have the Report Generation Toolkit installed).

Write image to a file and print

  1. From the block diagram, right-click on the control and select Create»Invoke Node. Select the "Get Image" method.
  2. Place the Write JPEG File.vi on the block diagram and wire the "image data" output of the Invoke Node to the "image data" input of the Write JPEG File.vi (Note that other file formats, such as Bitmap and PNG, would also work here).
  3. Place the System Exec.vi from the Communications palette on the block diagram, and wire in a command to print the file. (Sending the string "mspaint.exe /p [jpeg file path]" will open the file in mspaint and print it). See the Printing Front Panel Objects in LabVIEW (6.1) example program (linked below) for an illustration of how this works.

Pass a control to a subVI and print the subVI. This method will print the control along with a front panel image

  1. Create a subVI with a graph on its front panel.
  2. Change the graph from an indicator to a control.
  3. Open the subVI and select Operate»Print at Completion.
  4. Assign the subVI a connector and pass the data from the graph on the main VI to the graph on the subVI. Every time your main VI calls the subVI, the subVI automatically prints the graph.
Note: These directions assume that you are using a graph, but other controls may also be used.

WAS THIS ARTICLE HELPFUL?

Not Helpful