Nav view search

Navigation

Search

The Exchange

The place to download pre-configured tickets, code snippets, and solutions

Back

Printing From a Button on a Form

Use the PrintObject() MetaScript function behind a button's Click Action script to print forms.

Note: This solution is optimized for Virtual Ticket Developer.

If you are using Workgroups DaVinci and are planning to use a Toolbox snippet not marked as DaVinci-compatible, please check with Support for possible compatibility issues before using.


Details

Printing can be automated using the PrintObject MetaScript command. The PrintObject command uses the form name and the ID of the record you would like to print to automate the printing process. This functionality can save time in situations where users have separate entry and printing forms or wish to print multiple forms at the same time. The following example shows how a user can print a record with a button acting as a printing trigger on a Virtual Ticket or Digital Storage Manager form. 

Example

  1. Open the desired form in the Forms Editor.
  2. Draw a button using the Button Creation Tool and label it "Print".
  3. Type PrintExample(); in the button's Click Action field in the Control Palette.
  4. Draw a new field on the form using the Field Creation Tool.
  5. Associate this field with the folder type's ID field using the Field assignment control in the Control Palette.
  6. Open the Global MetaScript Editor for the form and copy and paste the following MetaScript into it:
    //@version "2.0" 
    function PrintExample()
    { 
    var myRecordID = Field( 'TS_Num' ); //The field that displays the current record's unique ID number 
    PrintObject("TS_534", myRecordID); //"TS_534" is the name of the form that will be printed 
    } 
  7. In the code above: change TS_Num' to the name of your folder type's unique ID field.
  8. In the code above: change 'TS_534' to the name of the form you want to print when the button is pressed.
  9. Save the form.
  10. Result: When a user clicks the "Print" button, the operating system print dialog will open, allowing the user to print the specified form.

Resources

  • Download and install a sample form illustrating this Toolbox Snippet (see below).
  • See Knowledge Base Article 16111 - MetaScript Example - Printing From a Button for additional information.


Last Modified:

2011-09-29

by

Chris True