# Utilities

*TOOLS/PRINTHTML | Output Formatted Text from HTML

## Invocation

CALL "*tools/printhtml", html$, outputchannel, [left], [top], [right], [bottom]

Where:

html$ | HTML to convert to formatted text output.
outputchannel | Open channel to print the formatted text output to.
left | Left-most point of the area to print to. If not specified, use the current position.
top | Top-most point of the area to print to. If not specified, use the current position.
right | Right-most point of the area to print to. If not specified, use the maximum right point.
bottom | Bottom-most point of the area to print to. If not specified, use the maximum bottom point.

## Description

Convert HTML input into formatted text output on the given open channel. This allows you to use a TinyMCE control for users to input formatted text and then allows you to output it to a PDF or other channel. To define a TinyMCE control, see Using the TinyMCE® HTML Editor.

Only the most common HTML elements that are used to format text are supported with this tool:

HTML Element | Description
<h1> to <h6> | Defines headings
<b> <strong> | Defines bold
<i> <em> | Defines italics
<p> | Defines paragraphs
<span> | Defines spans
<br> | Defines line breaks
<hr> | Defines horizontal lines
<ul> <ol> <li> | Defines lists
Style attributes | Defines: Font Font size Text color Underlined text Horizontal text alignment

(The PrintHTML utility was added in PxPlus 2021.)

## Example

This example code is for printing TinyMCE formatted text as a PDF:

> open (hfn)"*PDF*;file=output_pdf$"
> pdfChan=lfo
> call "*tools/printHTML",tinyMCE.ctl'value$,pdfChan,1,1
> close (pdfChan)

## See Also

*TOOLS/ConvertHTMLColor
FIN CurFont and CurColor (CurColour)