|| 3.53 out of 5
How Do I Print a Single Control from the Front Panel (for example, a Graph)?
LabVIEW Development Systems>>Full Development System
Primary Software Version:
Primary Software Fixed Version:
How Do I Print a Front Panel Control or Indicator (Such as a Graph, Chart, or Slider) in LabVIEW?
There are several ways to programmatically print a front panel control. Listed below are a few good methods:
Related Links: Developer Zone Example: Printing Front Panel Objects (Graphs, Charts, etc.) in LabVIEW (6.1) KnowledgeBase 2PP7CM7Y: How Can I Save a Front Panel Control to a JPEG, PNG, or BMP File?KnowledgeBase 239AKK6L: Printing Front Panels with 3D Controls
- Method 1: Use the Report Generation VIs to generate and print a report.
- From the Report Generation palette, place the New Report.vi on the block diagram.
- Next, place the Append Control Image to Report.vi on the block diagram.
- 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.
- Place the Print Report.vi on the block diagram.
- Place the Dispose Report.vi on the block diagram.
- 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).
- Method 2: Write image to a file and print.
- From the block diagram, right-click on the control and select Create»Invoke Node. Select the "Get Image" method.
- 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).
- 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.
- Method 3: Pass a control to a subVI and print the subVI. This method will print the control along with a front panel image. (These directions assume that you are using a graph, but other controls may also be used).
- Create a subVI with a graph on its front panel.
- Change the graph from an indicator to a control.
- Open the subVI and select Operate»Print at Completion.
- 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.