HTML Elements in PDF Output
Effective with Release 5.0.0, a variety of html elements are now available for use in formatting text within individual data fields in PDF reports created by APPX output processes.
When designing an APPX output process, the APPX image editor allows for the specification of GUI attributes for each field. These GUI attributes apply to the entire field. However, occasionally, it is desirable to provide a finer level of control over the formatting of the contents of a field. For example, it might be desirable to print an individual word or phrase within a field with a bold typeface. HTML tags provide the capability to format individual words or phrases within a field.
HTML tags may be embedded within an ALPHA field or a TEXT field to specify how the field value is to be formatted when printed.
The field must be added to the image with a widget type of LABEL or TEXT AREA.
The field value must begin with an HTML tag, e.g. <HTML>. The entire contents of the field will then be considered to be HTML text. HTML tags embedded within the field will supplement the GUI attributes that are defined at the field level.
HTML tags are not case sensitive. They may be entered as upper case or lower case.
If no widget is specified or if a RAW TEXT widget type is specified, the contents of the field will be printed without formatting. A RAW TEXT widget type can be used to print the unformatted field value including any html tags.
The label value of a LABEL widget may contain HTML tags as a way of formatting the label value when printed.
Standard APPX text formatting within a TEXT field is compatible with html formatting as follows:
- An APPX end-of-paragraph character ("¶" - xB6/182) has the same effect as a <br> element.
- An APPX required space character ("_" - x5F/95) has the same effect as a (no break space).
When an ALPHA field that contains end-of-paragraph characters ("¶") or underline characters ("_") is printed, these characters are not interpreted as text formatting characters and are instead printed like any other characters regardless of whether the field contains HTML elements.
Supported Elements:
Top Level Elements:
HTML - HTML document
<HTML>...</HTML>
The HTML element contains the entire html document. A field whose content is to be formatted by embedded html tags must begin with an HTML element starting in position 1. The end tag of an HTML element is optional.
Generic Block Level Elements:
Block level elements print a leading line break before the block and a trailing line break after the block. This results in double line spacing between block level elements. However, a block level element which is the first element after the HTML element does not print a leading line break. Another exception is that a CENTER element never prints a leading line break resulting in single line spacing between a CENTER element and the preceding block level element. A block level element may not be nested within another block level element. If a block level element is not terminated by an ending tag and another block level element is encountered, then the termination of the first block level element is implied and a trailing line break is printed.
CENTER - Centered block
<CENTER>...</CENTER>
Text within a CENTER block is formatted and then centered horizontally within the width of the output widget. If the centered text block contains line breaks, then each line of text is centered within the width of the output widget.
H1 - Level-one heading
<H1>...</H1>
The H1 element defines a level-one heading. The level-one heading is the highest level heading and has the largest and boldest font size of the six possible heading levels. A document generally has a single level-one heading representing the most important heading level. An H1 heading is equivalent to <FONT SIZE=21><B>...</B></FONT>
H2 - Level-two heading
<H2>...</H2>
The H2 element defines a level-two heading. A level-two heading is less important than a level-one heading and more important than a level-three heading. The font size of a level-two heading is smaller than a level-one heading and larger than a level-three heading. An H2 heading is equivalent to <FONT SIZE=20><B>...</B></FONT>
H3 - Level-three heading
<H3>...</H3>
The H3 element defines a level-three heading. A level-three heading is less important than a level-two heading and more important than a level-four heading. The font size of a level-three heading is smaller than a level-two heading and larger than a level-four heading. An H3 heading is equivalent to <FONT SIZE=19><B>...</B></FONT>
H4 - Level-four heading
<H4>...</H4>
The H4 element defines a level-four heading. A level-four heading is less important than a level-three heading and more important than a level-five heading. The font size of a level-four heading is smaller than a level-three heading and larger than a level-five heading. An H4 heading is equivalent to <FONT SIZE=18><B>...</B></FONT>
H5 - Level-five heading
<H5>...</H5>
The H5 element defines a level-five heading. A level-five heading is less important than a level-four heading and more important than a level-six heading. The font size of a level-five heading is smaller than a level-four heading and larger than a level-six heading. An H5 heading is equivalent to <FONT SIZE=17><B>...</B></FONT>
H6 - Level-six heading
<H6>...</H6>
The H6 element defines a level-six heading. A level-six heading is less important than a level-five heading. A level-six heading is the least important of the six headings. An H6 heading is equivalent to <FONT SIZE=16><B>...</B></FONT>
P - Paragraph
<P>...</P>
The P element defines a paragraph. Extra white space is compressed out of the text and a word that does not fit on the end of a line is wrapped to the beginning of the next line.
PRE - Preformatted text
<PRE>...</PRE>
The PRE element is used to print preformatted text. Preformatted text is printed with a fixed space font. White space is not compressed out and long lines are not wrapped.
Special Inline Elements:
A - Anchor
<A HREF=uri>...</A>
The A element is an anchor for a hypertext link that is to be embedded in the pdf document. The HREF attribute specifies a hypertext link to a web page, an image, or other types of files.
Example: <A HREF="http://www.appx.com">the APPX web site</A>
BR - Line break
<BR>
The BR element forces a break in the current line. Printing of text continues on the next line.
FONT - Font change
<FONT SIZE=n>...</FONT>
<FONT SIZE="+n">...</FONT>
<FONT SIZE="-n">...</FONT>
<FONT COLOR=#xxxxxx>...</FONT>
The FONT element allows for the font size to be adjusted thru the use of the SIZE attribute and allows for the font color to be specified thru the use of the COLOR attribute. For more information on the use of this element, please refer to the section on font size below.
SUB - Subscript
<SUB>...</SUB>
The SUB element prints the text within the block as a subscript.
SUP - Superscript
<SUP>...</SUP>
The SUP element prints the text within the block as a superscript.
Phrase Elements:
EM - Emphasis
<EM>...</EM>
The EM element is used to print emphasized text. The APPX implementation of EM is the same as using the I tag for italics.
STRONG - Strong emphasis
<STRONG>...</STRONG>
The STRONG element is used to print text with strong emphasis. The APPX implementation of STRONG is the same as using the B tag for bold.
Font Style Elements:
B - Bold text
<B>...</B>
The BOLD element is used to print text in a bold typeface.
BIG - Big text
<BIG>...</BIG>
The BIG element is used to print text in the next larger font size relative to the font size of the preceding text. If there is no larger font size, then BIG is ignored. BIG is the same as specifying a relative font size of +1, i.e. <FONT SIZE="+1">...</FONT>.
I - Italic text
<I>...</I>
The I element is used to print text in italics.
SMALL - Small text
<SMALL>...</SMALL>
The SMALL element is used to print text in the next smaller font size relative to the font size of the preceding text. If there is no smaller font size, then SMALL is ignored. SMALL is the same as specifying a relative font size of -1, i.e. <FONT SIZE="-1">...<.FONT>
TT - Teletype text
<TT>...</TT>
The TT element is used to print text in a teletype (monospaced) font.
U - Underlined text
<U>...</U>
The U element is used to print underlined text.
More Details:
Font Size
The base font size for a report is determined at runtime from the FORM record specified for the report. The base font size is specified as a point size in the FORM record in APPX System Administration or, if not specified, is calculated based on the various page layout specifications in the FORM record.
The report's base font size is applied to each field printed on the report. However, individual fields on a report may be scaled up or down relative to the report's base font size by specifying a font scale at design time. The base font size equates to a font scale of 100% or <font size=10>. APPX output processes support 28 font sizes (scale values). All 28 font sizes are relative to the base font size of the report.
HTML tags can be used to vary the size of text within an individual field. There are a variety of ways that HTML tags can be used to increase or decrease the font size of all text or a portion of the text within an individual field.
"Absolute" font sizes are also supported thru the use of the FONT tag with the SIZE attribute, i.e.<FONT SIZE=n> where n=1 to 28.
"Relative" font sizes are supported thru the use of the FONT tag with the SIZE attribute, i.e.<FONT SIZE="+n"> or <FONT SIZE="-n">
Relative font sizes can also be specified by using a BIG tag to specify that the enclosed text should be printed one size larger than the current font size. <BIG>...</BIG> is the same as <FONT SIZE="+1">...</FONT>. BIG tags can be nested in which case the inner text is one size larger than the outer text.
Relative font sizes can also be specified by using a SMALL tag to specify that the enclosed text should be printed one size smaller than the current font size. <SMALL>...</SMALL> is the same as <FONT SIZE="-1">...</FONT>. SMALL tags can be nested in which case the inner text is one size smaller than the outer text.
The H1 thru H6 tags correspond to font sizes 21 thru 16 and are rendered with a bold attribute.
Font Size Table
The following table shows the font indexes and their associated font scale factor that are available for use in output processes:
Font Color
font color=#nnnnnn where #nnnnnn is a RGB hex value.
font color=name is not supported.
The following table is a quick reference of the 16 basic colors. A more complete
list of standard colors can be found at the W3 Schools web site.
Color |
RGB Specification |
aqua |
#00FFFF |
black |
#000000 |
blue |
#0000FF |
fuchsia |
#FF00FF |
gray |
#808080 |
green |
#008000 |
lime |
#00FF00 |
maroon |
#800000 |
navy |
#000080 |
olive |
#808000 |
purple |
#800080 |
red |
#FF0000 |
silver |
#C0C0C0 |
teal |
#008080 |
white |
#FFFFFF |
yellow |
#FFFF00 |
Issues:
- OPEN - A block level element (H1-H6, CENTER, P, PRE) which immediately follows the <HTML> tag should not print a leading line break.
- OPEN - A CENTER element should only perform a leading line break if the position of the CENTER element is not at the left margin of the field. In other words, if a CENTER element is preceded by a BR tag or a closing tag of any other block level element (such as </P>) which forces a line break, the CENTER element should not perform a leading line break since the previous block was explicitly terminated resulting in a line break.
Comments:
Read what other users have said about this page or add your own comments.
--
Steve Frizzell - 04 Apr 2008