Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
13 ratings:
 3.53 out of 5     Rate this Document

How Do I Print a Single Control from the Front Panel (for example, a Graph)?



Primary Software: LabVIEW Development Systems>>Full Development System
Primary Software Version: 7.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
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:
  1. Method 1: 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).

  2. Method 2: 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.

  3. 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).
    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.


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

Attachments:


PrintGraph_With_ReportGenerationToolkit.llbPrintGraph_Without_ReportGenerationToolkit.llb


Report Date: 09/21/2000
Last Updated: 09/08/2007
Document ID: 21K6RNLI

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit