<doc>
  <legacy_id>2414</legacy_id>
  <name>revPrintText</name>
  <type>command</type>
  <syntax>
    <example>revPrintText <i>textToPrint</i>[,<i>headerText</i>[,<i>footerText</i>[,<i>fieldTemplate</i>]]]</example>
  </syntax>
  <library>Printing library</library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Printing</category>
    <category>Standalone Applications</category>
  </classification>
  <references>
    <command tag="answer printer">answer printer Command</command>
    <command tag="revPrintReport">revPrintReport Command</command>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
    <changed version="2.0"></changed>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
  </platforms>
  <classes>
    <desktop/>
    <web/>
  </classes>
  <security>
    <printing/>
  </security>
  <summary>Prints formatted or unformatted text.</summary>
  <examples>
    <example>revPrintText "Hello world"</example>
    <example>revPrintText myCollectedData,"Confidential" <code><i>-- header with no footer</i></code></example>
    <example>revPrintText (the htmlText of field "Info"),"Info",the time &amp;&amp; the date</example>
    <example>revPrintText field 1,,"prepared by John Smith" <code><i>-- footer, no header</i></code></example>
    <example>revPrintText it,tab &amp; myTitle <code><i>-- centered header</i></code></example>
    <example>revPrintText thisText,,,the long name of field "Text"</example>
  </examples>
  <description>
    <p>Use the <b>revPrintText</b> <glossary tag="command">command</glossary> to print any text from within a <glossary tag="handler">handler</glossary>.</p><p/><p><b>Parameters:</b></p><p>The <i>textToPrint</i> is an <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to a <keyword tag="string">string</keyword>.</p><p/><p>The <i>headerText</i> is an <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to a <keyword tag="string">string</keyword>. If the <i>headerText</i> is empty, no page header is printed.</p><p/><p>The <i>footerText</i> is an <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to a <keyword tag="string">string</keyword>. If the <i>footerText</i> is empty, no page footer is printed.</p><p/><p>The <i>fieldTemplate</i> is any <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to a <href tag="reference/object_reference.rev">field reference</href>.</p><p/><p><code/><img src="202653"/> <b>Important!</b><code/> The <b>revPrintText</b> <glossary tag="command">command</glossary> does not accept direct <href tag="reference/object_reference.rev">field references</href> for the <i>fieldTemplate</i> <glossary tag="parameter">parameter</glossary>. For example, the following <glossary tag="statement">statement</glossary> causes an error message:</p><p/><p><code>  revPrintText myText,,,field "Text" </code>-- <code/><b>CAN'T USE THIS FORM</b><code/></p><p/><p>Instead, use a form that evaluates to a field reference, like this:</p><p/><p><code>  revPrintText myText,,,the name of field "Text" </code><code><i>-- use this form</i></code></p><p><code>  revPrintText myText,,,("field" &amp;&amp; quote &amp; "Text" &amp; quote) </code><code><i>-- or this</i></code></p><p/><p><b>Comments:</b></p><p>The <b>revPrintText</b> <glossary tag="command">command</glossary> can be used to print either formatted text (via the <property tag="HTMLText">htmlText</property> <glossary tag="property">property's</glossary> format) or plain text. If you are generating formatted text, see the <property tag="HTMLText">htmlText</property> <glossary tag="property">property</glossary> for a description of the differences between the <property tag="HTMLText">htmlText</property> <glossary tag="property">property's</glossary> formatting and standard <glossary tag="HTML">HTML</glossary>.</p><p/><p>If the <i>textToPrint</i>, <i>headerText</i>, or <i>footerText</i> contains<code> &lt;p&gt; </code>or a start/end tag pair, the <b>revPrintText</b> <glossary tag="command">command</glossary> assumes the text is in the same format as the <property tag="HTMLText">htmlText</property> <glossary tag="property">property</glossary>. Otherwise, the <b>revPrintText</b> <glossary tag="command">command</glossary> assumes the text is plain text.</p><p/><p>If the text being printed is plain text, and a <i>fieldTemplate</i> is specified, the text is printed with that <glossary tag="field">field's</glossary> <property tag="textFont">textFont</property>, <property tag="textSize">textSize</property>, and <property tag="textStyle">textStyle</property>. Otherwise, the text is printed in plain 12-point, with the default font of the <function tag="platform">platform</function> being used. (The <keyword tag="field">field</keyword> specified in the <i>fieldTemplate</i> does not need to contain any text; only its appearance <property tag="properties">properties</property> are used, not its contents. If you want to print the contents of the <keyword tag="field">field</keyword>, use the <command tag="revPrintField">revPrintField</command> <glossary tag="command">command</glossary> instead.)</p><p/><p>If the <i>textToPrint</i>, <i>headerText</i>, or <i>footerText</i> contains any <glossary tag="expression">expressions</glossary> of the form<code> &lt;%<i>expression</i>%&gt;</code>, the <i>expression</i> is <glossary tag="evaluate">evaluated</glossary> and replaced with the value before the text is printed. For example, if the <i>textToPrint</i> contains the text</p><p><b>	Today's date is &lt;%the long date%&gt;</b></p><p>the printed text reads</p><p><b>	Today's date is Friday, February 15, 2002</b></p><p>(assuming, of course, that the <b>revPrintText</b> <glossary tag="command">command</glossary> is <glossary tag="execute">executed</glossary> on that date).</p><p/><p>You can also use the special values<code> &lt;%pageNumber%&gt;</code> and<code> &lt;%numPages%&gt; </code>in the <i>textToPrint</i>, <i>headerText</i>, or <i>footerText</i>. These expressions are replaced with the current page number or total number of pages respectively.</p><p/><p>The <i>headerText</i> and <i>footerText</i> can contain up to two tab characters:</p><p>* Everything up to the first tab character is left-aligned.</p><p>* Everything between the first and second tab characters is centered.</p><p>* Everything after the second tab character is right-aligned.</p><p>If the <i>headerText</i> or <i>footerText</i> contain more than two tab characters, everything after the third tab is ignored.</p><p/><p>To show the standard print dialog box, use the <b>revShowPrintDialog</b> <glossary tag="command">command</glossary> before the <b>revPrintText</b> <glossary tag="command">command</glossary>.</p><p/><p><code/><img src="202651"/> <b>Tip:</b><code/> If the <i>textToPrint</i> contains tags, the tags are interpreted as text style information. To print tags literally, set the <keyword tag="text">text</keyword> of a <keyword tag="field">field</keyword> to the text you want to print, then use the <property tag="HTMLText">htmlText</property> of that <keyword tag="field">field</keyword> as the <i>textToPrint</i>. Converting to the <property tag="HTMLText">htmlText</property> escapes the tags and allows them to be printed.</p><p/><p><code/><img src="202653"/> <b>Important!</b><code/> The <b>revPrintText</b> <glossary tag="command">command</glossary> is part of the <glossary tag="Printing library">Printing library</glossary>. To ensure that the <glossary tag="command">command</glossary> works in a <glossary tag="standalone application">standalone application</glossary>, you must include this <glossary tag="LiveCode custom library">custom library</glossary> when you create your <glossary tag="standalone application">standalone</glossary>. In the Inclusions section on the General screen of the <glossary tag="Standalone Application Settings">Standalone Application Settings</glossary> window, make sure that "Printing" is selected in the list of script libraries.</p><p/><p><code/><b>Note:</b><code/> When included in a <glossary tag="standalone application">standalone application</glossary>, the <glossary tag="Printing library">Printing library</glossary> is implemented as a hidden <command tag="group">group</command> and made available when the <command tag="group">group</command> receives its first <message tag="openBackground">openBackground</message> message. During the first part of the <glossary tag="application">application's</glossary> startup process, before this <keyword tag="message box">message</keyword> is sent, the <b>revPrintText</b> <glossary tag="command">command</glossary> is not yet available. This may affect attempts to use this <glossary tag="command">command</glossary> in <message tag="startup">startup</message>, <message tag="preOpenStack">preOpenStack</message>, <message tag="openStack">openStack</message>, or <message tag="preOpenCard">preOpenCard</message> <glossary tag="handler">handlers</glossary> in the <glossary tag="main stack">main stack</glossary>. Once the <glossary tag="application">application</glossary> has finished starting up, the <command tag="start using">library</command> is available and the <b>revPrintText</b> <glossary tag="command">command</glossary> can be used in any <glossary tag="handler">handler</glossary>.</p><p/><p><b>Changes:</b></p><p>The <i>fieldTemplate</i> <glossary tag="parameter">parameter</glossary> was added in version 2.0.</p>
  </description>
</doc>