GMimeRtfToHtml

GMimeRtfToHtml — Render RTF or extract its encapsulated HTML

Functions

gboolean (*GMimeRtfToHtmlAttachmentPlaceholderCallback) ()
GMimeTextConverter * g_mime_rtf_to_html_new ()
gboolean g_mime_rtf_to_html_get_extract_encapsulated_html ()
void g_mime_rtf_to_html_set_extract_encapsulated_html ()
gboolean g_mime_rtf_to_html_get_output_html_fragment ()
void g_mime_rtf_to_html_set_output_html_fragment ()
GMimeHeaderFooterFormat g_mime_rtf_to_html_get_header_format ()
void g_mime_rtf_to_html_set_header_format ()
GMimeHeaderFooterFormat g_mime_rtf_to_html_get_footer_format ()
void g_mime_rtf_to_html_set_footer_format ()
GMimeHtmlNoScriptHandling g_mime_rtf_to_html_get_no_script_handling ()
void g_mime_rtf_to_html_set_no_script_handling ()
void g_mime_rtf_to_html_set_html_tag_callback ()
GMimeHtmlTagCallback g_mime_rtf_to_html_get_html_tag_callback ()
void g_mime_rtf_to_html_set_attachment_placeholder_callback ()
GMimeRtfToHtmlAttachmentPlaceholderCallback g_mime_rtf_to_html_get_attachment_placeholder_callback ()
guint g_mime_rtf_to_html_get_max_group_depth ()
void g_mime_rtf_to_html_set_max_group_depth ()
guint g_mime_rtf_to_html_get_max_font_table_entries ()
void g_mime_rtf_to_html_set_max_font_table_entries ()
guint g_mime_rtf_to_html_get_max_color_table_entries ()
void g_mime_rtf_to_html_set_max_color_table_entries ()
guint g_mime_rtf_to_html_get_max_element_depth ()
void g_mime_rtf_to_html_set_max_element_depth ()
void g_mime_rtf_to_html_set_compliance_logger ()
GMimeRtfComplianceLogger g_mime_rtf_to_html_get_compliance_logger ()
GMimeRtfComplianceOptions * g_mime_rtf_to_html_get_compliance_options ()
void g_mime_rtf_to_html_set_compliance_options ()

Types and Values

Description

Renders character and paragraph formatting, tables, links and attachment placeholders. Outlook HTML encapsulation is detected before rendering. The extracted text is fed through GMimeHtmlToHtml so filtering, fragment output and noscript handling work as for a standalone HTML document. Neither converter is an HTML sanitizer. Compliance checks apply to RTF, not the embedded HTML. Raw HTML headers and footers bypass callbacks.

Functions

GMimeRtfToHtmlAttachmentPlaceholderCallback ()

gboolean
(*GMimeRtfToHtmlAttachmentPlaceholderCallback)
                               (int index,
                                GMimeHtmlWriter *writer,
                                gpointer user_data,
                                GError **error);

Writes replacement content for an Outlook \objattph mark. Output from this callback is not passed to the tag callback. Hidden marks are skipped; extraction uses the attachment references already present in the HTML.

Parameters

index

zero-based attachment placeholder index, in document order

 

writer

borrowed HTML writer.

[transfer none]

user_data

callback data.

[nullable]

error

return location for a GError, or NULL

 

Returns

TRUE on success, or FALSE to abort conversion.


g_mime_rtf_to_html_new ()

GMimeTextConverter *
g_mime_rtf_to_html_new (void);

Creates a rich text converter. The default ISO-8859-1 input mapping preserves each wire byte; character decoding follows the RTF code page.

Returns

a new GMimeRtfToHtml.

[transfer full]


g_mime_rtf_to_html_get_extract_encapsulated_html ()

gboolean
g_mime_rtf_to_html_get_extract_encapsulated_html
                               (GMimeRtfToHtml *converter);

Parameters

converter

a GMimeRtfToHtml

 

Returns

whether to extract the original HTML when available (default TRUE)


g_mime_rtf_to_html_set_extract_encapsulated_html ()

void
g_mime_rtf_to_html_set_extract_encapsulated_html
                               (GMimeRtfToHtml *converter,
                                gboolean value);

If disabled, renders the RTF representation even in documents declaring \fromhtml1. Extracted HTML is rewritten, not sanitized.

Parameters

converter

a GMimeRtfToHtml

 

value

whether to extract encapsulated HTML

 

g_mime_rtf_to_html_get_output_html_fragment ()

gboolean
g_mime_rtf_to_html_get_output_html_fragment
                               (GMimeRtfToHtml *converter);

Parameters

converter

a GMimeRtfToHtml

 

Returns

whether to produce only a body fragment (default FALSE)


g_mime_rtf_to_html_set_output_html_fragment ()

void
g_mime_rtf_to_html_set_output_html_fragment
                               (GMimeRtfToHtml *converter,
                                gboolean value);

Fragment extraction also omits the doctype and head contents.

Parameters

converter

a GMimeRtfToHtml

 

value

whether to omit document wrappers

 

g_mime_rtf_to_html_get_header_format ()

GMimeHeaderFooterFormat
g_mime_rtf_to_html_get_header_format (GMimeRtfToHtml *converter);

Parameters

converter

a GMimeRtfToHtml

 

Returns

the header format, initially GMIME_HEADER_FOOTER_FORMAT_TEXT


g_mime_rtf_to_html_set_header_format ()

void
g_mime_rtf_to_html_set_header_format (GMimeRtfToHtml *converter,
                                      GMimeHeaderFooterFormat value);

Determines how to write the configured header. HTML bypasses filtering.

Parameters

converter

a GMimeRtfToHtml

 

value

plain text or raw HTML

 

g_mime_rtf_to_html_get_footer_format ()

GMimeHeaderFooterFormat
g_mime_rtf_to_html_get_footer_format (GMimeRtfToHtml *converter);

Parameters

converter

a GMimeRtfToHtml

 

Returns

the footer format, initially GMIME_HEADER_FOOTER_FORMAT_TEXT


g_mime_rtf_to_html_set_footer_format ()

void
g_mime_rtf_to_html_set_footer_format (GMimeRtfToHtml *converter,
                                      GMimeHeaderFooterFormat value);

Determines how to write the configured footer. HTML bypasses filtering.

Parameters

converter

a GMimeRtfToHtml

 

value

plain text or raw HTML

 

g_mime_rtf_to_html_get_no_script_handling ()

GMimeHtmlNoScriptHandling
g_mime_rtf_to_html_get_no_script_handling
                               (GMimeRtfToHtml *converter);

Parameters

converter

a GMimeRtfToHtml

 

Returns

the noscript mode, initially GMIME_HTML_NO_SCRIPT_HANDLING_UNWRAP


g_mime_rtf_to_html_set_no_script_handling ()

void
g_mime_rtf_to_html_set_no_script_handling
                               (GMimeRtfToHtml *converter,
                                GMimeHtmlNoScriptHandling value);

Unwrap mode parses noscript contents as markup and omits the tags. In the other modes the renderer's scripting setting must match value .

Parameters

converter

a GMimeRtfToHtml

 

value

noscript handling mode for encapsulated HTML

 

g_mime_rtf_to_html_set_html_tag_callback ()

void
g_mime_rtf_to_html_set_html_tag_callback
                               (GMimeRtfToHtml *converter,
                                GMimeHtmlTagCallback callback,
                                gpointer user_data,
                                GDestroyNotify destroy);

The callback must explicitly write each desired tag. It is not invoked for generated document wrappers, configured headers/footers or attachment callback output. Pass NULL to restore normal tag output. The registration is destroyed when replaced or finalized, and cannot change during conversion.

Parameters

converter

a GMimeRtfToHtml

 

callback

tag writer.

[nullable][scope notified][closure user_data][destroy destroy]

user_data

data passed to callback .

[nullable]

destroy

destroy notifier for user_data .

[nullable]

g_mime_rtf_to_html_get_html_tag_callback ()

GMimeHtmlTagCallback
g_mime_rtf_to_html_get_html_tag_callback
                               (GMimeRtfToHtml *converter,
                                gpointer *user_data);

[skip]

Parameters

converter

a GMimeRtfToHtml

 

user_data

receives the borrowed callback data.

[out][optional][nullable][transfer none]

Returns

the HTML tag callback.

[nullable]


g_mime_rtf_to_html_set_attachment_placeholder_callback ()

void
g_mime_rtf_to_html_set_attachment_placeholder_callback
                               (GMimeRtfToHtml *converter,
                                GMimeRtfToHtmlAttachmentPlaceholderCallback callback,
                                gpointer user_data,
                                GDestroyNotify destroy);

Registers a writer for rendered attachment placeholders. If NULL, no replacement is written. Like tag callbacks, this registration cannot change during conversion and is destroyed when replaced or finalized.

Parameters

converter

a GMimeRtfToHtml

 

callback

placeholder writer.

[nullable][scope notified][closure user_data][destroy destroy]

user_data

callback data.

[nullable]

destroy

destroy notifier for user_data .

[nullable]

g_mime_rtf_to_html_get_attachment_placeholder_callback ()

GMimeRtfToHtmlAttachmentPlaceholderCallback
g_mime_rtf_to_html_get_attachment_placeholder_callback
                               (GMimeRtfToHtml *converter,
                                gpointer *user_data);

[skip]

Parameters

converter

a GMimeRtfToHtml

 

user_data

receives the borrowed callback data.

[out][optional][nullable][transfer none]

Returns

the attachment placeholder callback.

[nullable]


g_mime_rtf_to_html_get_max_group_depth ()

guint
g_mime_rtf_to_html_get_max_group_depth
                               (GMimeRtfToHtml *converter);

Parameters

converter

a GMimeRtfToHtml

 

Returns

the maximum number of distinct saved group states (default 4096)


g_mime_rtf_to_html_set_max_group_depth ()

void
g_mime_rtf_to_html_set_max_group_depth
                               (GMimeRtfToHtml *converter,
                                guint value);

Content in groups exceeding this limit is discarded.

Parameters

converter

a GMimeRtfToHtml

 

value

maximum number of distinct group states (at least 1)

 

g_mime_rtf_to_html_get_max_font_table_entries ()

guint
g_mime_rtf_to_html_get_max_font_table_entries
                               (GMimeRtfToHtml *converter);

Parameters

converter

a GMimeRtfToHtml

 

Returns

the maximum number of saved font entries (default 4096)


g_mime_rtf_to_html_set_max_font_table_entries ()

void
g_mime_rtf_to_html_set_max_font_table_entries
                               (GMimeRtfToHtml *converter,
                                guint value);

References to excess entries use the document's default code page.

Parameters

converter

a GMimeRtfToHtml

 

value

maximum number of font entries (at least 1)

 

g_mime_rtf_to_html_get_max_color_table_entries ()

guint
g_mime_rtf_to_html_get_max_color_table_entries
                               (GMimeRtfToHtml *converter);

Parameters

converter

a GMimeRtfToHtml

 

Returns

the maximum number of saved color entries (default 4096)


g_mime_rtf_to_html_set_max_color_table_entries ()

void
g_mime_rtf_to_html_set_max_color_table_entries
                               (GMimeRtfToHtml *converter,
                                guint value);

References to excess entries are rendered using the default color.

Parameters

converter

a GMimeRtfToHtml

 

value

maximum number of color entries (at least 1)

 

g_mime_rtf_to_html_get_max_element_depth ()

guint
g_mime_rtf_to_html_get_max_element_depth
                               (GMimeRtfToHtml *converter);

Parameters

converter

a GMimeRtfToHtml

 

Returns

the saved element depth limit for encapsulated HTML (default 4096)


g_mime_rtf_to_html_set_max_element_depth ()

void
g_mime_rtf_to_html_set_max_element_depth
                               (GMimeRtfToHtml *converter,
                                guint value);

Sets the GMimeHtmlToHtml depth limit for encapsulated HTML. Once it is exceeded the remaining markup is treated as literal text.

Parameters

converter

a GMimeRtfToHtml

 

value

maximum element depth (at least 1)

 

g_mime_rtf_to_html_set_compliance_logger ()

void
g_mime_rtf_to_html_set_compliance_logger
                               (GMimeRtfToHtml *converter,
                                GMimeRtfComplianceLogger logger,
                                gpointer user_data,
                                GDestroyNotify destroy);

Reports RTF diagnostics during conversion. Encapsulated HTML markup is not checked. Pass NULL to disable reporting. The registration cannot change during conversion and is destroyed when replaced or finalized.

Parameters

converter

a GMimeRtfToHtml

 

logger

diagnostic callback.

[nullable][scope notified][closure user_data][destroy destroy]

user_data

logger data.

[nullable]

destroy

destroy notifier for user_data .

[nullable]

g_mime_rtf_to_html_get_compliance_logger ()

GMimeRtfComplianceLogger
g_mime_rtf_to_html_get_compliance_logger
                               (GMimeRtfToHtml *converter,
                                gpointer *user_data);

[skip]

Parameters

converter

a GMimeRtfToHtml

 

user_data

receives the borrowed logger data.

[out][optional][nullable][transfer none]

Returns

the RTF compliance logger.

[nullable]


g_mime_rtf_to_html_get_compliance_options ()

GMimeRtfComplianceOptions *
g_mime_rtf_to_html_get_compliance_options
                               (GMimeRtfToHtml *converter);

Parameters

converter

a GMimeRtfToHtml

 

Returns

the RTF compliance options used by the converter.

[transfer none]


g_mime_rtf_to_html_set_compliance_options ()

void
g_mime_rtf_to_html_set_compliance_options
                               (GMimeRtfToHtml *converter,
                                GMimeRtfComplianceOptions *options);

Retains a reference to options . Diagnostic limits restart for each conversion and do not affect rendering.

Parameters

converter

a GMimeRtfToHtml

 

options

the RTF compliance options.

[transfer none]

Types and Values

GMimeRtfToHtml

typedef struct _GMimeRtfToHtml GMimeRtfToHtml;

Renders rich text as HTML, or rewrites the original HTML of messages declaring \fromhtml1. Extracted HTML is not sanitized.