8 Export Functions

This chapter outlines the basic functions used to initiate the conversion of documents using the product API.

This chapter covers the following types of functions:

8.1 General Functions

The following functions are general functions used in most products:

8.1.1 EXOpenExport

This function is used to initiate the export process for a file that has been opened by DAOpenDocument. If EXOpenExport succeeds, EXCloseExport must be called regardless of any other API calls.

Note:

SCCOPT_GRAPHIC_TYPE = FI_NONE must be set (via DASetOption) before the call to EXOpenExport. Otherwise, the SCCUT_FILTEROPTIMIZEDFORTEXT speed enhancement for the PDF filter is not set. This will result in slower exports of PDFs when graphic output is not required.

Prototype

SCCERR EXOpenExport(
   VTHDOC       hDoc,
   VTDWORD      dwOutputId,
   VTDWORD      dwSpecType,
   VTLPVOID     pSpec,
   VTDWORD      dwFlags,
   VTSYSPARAM   dwReserved,
   VTLPVOID     pCallbackFunc,
   VTSYSPARAM   dwCallbackData,
   VTLPHEXPORT  phExport);

phExport is not a file handle.

Parameters

  • hDoc: A handle that identifies the source file, created by DAOpenDocument. HTML Export does this internally (when exporting graphics). Knowledge of this should only affect OEMs under the most unusual of circumstances.

  • dwOutputId: File ID of the desired format of the output file. This value must be set to FI_HTML, FI_MHTML or FI_XHTML.

  • dwSpecType: Describes the contents of pSpec. Together, dwSpecType and pSpec describe the location of the initial output file. Must be one of the following values:

    • IOTYPE_ANSIPATH: Windows only. The pSpec points to a NULL-terminated full path name using the ANSI character set and FAT 8.3 (Win16) or NTFS (Win32 and Win64) file name conventions.

    • IOTYPE_UNICODEPATH: Windows only. The pSpec points to a NULL-terminated full path name using the Unicode character set and NTFS file name conventions.

      Note:

      If you are using IOTYPE_UNICODEPATH as a file spec type, if the calling application is providing an export callback function, you should set the option SCCOPT_EX_UNICODECALLBACKSTR to TRUE. Refer to the documentation on callbacks such as EX_CALLBACK_ID_CREATENEWFILE and the EXURLFILEIOCALLBACKDATAW structure for details.

    • IOTYPE_UNIXPATH: UNIX platforms only. The pSpec points to a NULL-terminated full path name using the system default character set and UNIX path conventions. Unicode paths can be accessed on UNIX platforms by using a UTF-8 encoded path with IOTYPE_UNIXPATH.

    • IOTYPE_REDIRECT: All platforms. The pSpec may be NULL, and all file information specified in the callback routine. This allows the developer to redirect the IO routines used to write the files. For more information, see Redirected IO.

  • pSpec: Initial output file location specification. This is either a pointer to a buffer or NULL.

    • If the pointer is not NULL, the file referred to by the pSpec is assumed to be already open and the buffer's contents are based on the value of the dwSpecType parameter. See the descriptions for individual dwSpecType values in the preceding list.

    • Passing NULL indicates the developer will use the EX_CALLBACK_ID_CREATENEWFILE callback to specify the initial output file instead of specifying it here. When this parameter is NULL, the developer must handle the EX_CALLBACK_ID_CREATENEWFILE callback or EXOpenExport returns an error.

  • dwFlags: Must be set by developer to 0.

  • dwReserved: Reserved. Must be set by developer to 0.

  • pCallbackFunc: Pointer to a function of the type EXCALLBACKPROC. This function is used to give the developer control of certain aspects of the export process as they occur. For more information, see the definition for EXCALLBACKPROC in EXCALLBACKPROC. This parameter may be set to NULL if the developer does not wish to handle callbacks.

  • dwCallbackData: This parameter ispassed transparently to the function specified by pCallbackFunc. The developer may use this value for any purpose, including passing context information into the callback function.

  • phExport: Pointer to a handle that receives a value uniquely identifying the document to the product routines. If the function fails, this value is set to VTHDOC_INVALID.

Return Values

  • SCCERR_OK: If the open was successful. Otherwise, one of the other SCCERR_ values in sccerr.h is returned.

8.1.2 EXCALLBACKPROC

Type definition for the developer's callback function.

Prototype

DAERR (DA_ENTRYMODPTR EXCALLBACKPROC)(
   VTHEXPORT    hExport,
   VTSYSPARAM   dwCallbackData,
   VTDWORD      dwCommandOrInfoId,
   VTLPVOID     pCommandOrInfoData);

Parameters

  • hExport: Export handle for the document. Must be a handle returned by the EXOpenExport function.

  • dwCallbackData: This value is passed to EXOpenExport in the dwCallbackData parameter.

  • dwCommandOrInfoId: Indicates the type of callback. For information about supported callbacks, see Callbacks.

  • pCommandOrInfoData: Data associated with dwCommandOrInfoId. For information about supported callbacks, see Callbacks.

Return Values

  • SCCERR_OK: Command was handled by the callback function.

  • SCCERR_BADPARAM: One of the function parameters was invalid.

  • SCCERR_NOTHANDLED: Callback function did not handle the command. This return value must be the default for all values of dwCommandOrInfoId the developer does not handle.

8.1.3 EXCloseExport

This function is called to terminate the export process for a file.

Prototype

SCCERR EXCloseExport(
   VTHEXPORT   hExport);

Parameters

  • hExport: Export handle for the document. Must be a handle returned by the EXOpenExport function.

Return Values

  • SCCERR_OK: Returned if the close was successful. Otherwise, one of the other SCCERR_ values in sccerr.h is returned.

8.1.4 EXRunExport

This function is called to run the export process.

Prototype

SCCERR EXRunExport(
   VTHEXPORT   hExport);

Parameters

  • hExport: Export handle for the document. Must be a handle returned by the EXOpenExport function.

Return Values

  • SCCERR_OK: Returned if the export was successful. Otherwise, one of the other SCCERR_ values in sccerr.h is returned.

8.1.5 EXExportStatus

This function is used to determine if there were conversion problems during an export. It returns a structure that describes areas of a conversion that may not have high fidelity with the original document.

Prototype

SCCERR EXExportStatus(VTHEXPORT hExport, VTDWORD dwStatusType, VTLPVOID pStatus)

Parameters

  • hExport: Export handle for the document.

  • dwStatusType: Specifies which status information should be filled in pStatus.

    • EXSTATUS_SUBDOC – fills in the EXSUBDOCSTATUS structure (only implemented in Search Export and XML Export)

    • EXSTATUS_INFORMATION - fills in the EXSTATUSINFORMATION structure.

  • pStatus: Either a pointer to a EXSUBDOCSTATUS or EXSTATUSINFORMATION data structure depending on the value of dwStatusType.

Return Values

SCCERR_OK: Returned if there were no problems. Otherwise, one of the other SCCERR_ values in sccerr.h is returned.

EXSUBDOCSTATUS Structure

The EXSUBDOCSTATUS structure is defined as follows:

typedef struct EXSUBDOCSTATUStag
{
VTDWORD dwSize;      /* size of this structure */
VTDWORD dwSucceeded; /* number of sub documents that were converted */
VTDWORD dwFailed;    /* number of sub documents that were not converted */
} EXSUBDOCSTATUS;

EXSTATUSINFORMATION Structure

The EXSTATUSINFORMATION structure is defined as follows:

typedef struct EXSTATUSINFORMATIONtag
{
  VTDWORD dwVersion;              /* version of this structure, currently EXSTATUSVERSION1      */
  VTBOOL bMissingMap;             /* a PDF text run was missing the toUnicode table */
  VTBOOL bVerticalText;           /* a vertical text run was present */
  VTBOOL bTextEffects;            /* unsupported text effects applied (i.e.Word Art)*/
  VTBOOL bUnsupportedCompression; /* a graphic had an unsupported compression */
  VTBOOL bUnsupportedColorSpace;  /* a graphic had an unsupported color space */
  VTBOOL bForms;                  /* a sub documents had forms */
  VTBOOL bRightToLeftTables;      /* a table had right to left columns */
  VTBOOL bEquations;              /* a file had equations*/
  VTBOOL bAliasedFont;            /* A font was missing, but a font alias was used */
  VTBOOL bMissingFont;            /* The desired font wasn't present on the system */
  VTBOOL bSubDocFailed;           /* a sub document was not converted */
  VTBOOL bTypeThreeFont;               /* a Type 3 Font was encountered */
  VTBOOL bUnsupportedShading;        /* an unsupported shading pattern was encountered */
  VTBOOL bInvalidHTML;                  /* An HTML parse error, as defined by the W3C, was encountered. */
  VTBOOL bVectorObjectLimit;            /* This does not apply to HTML Export */
  VTBOOL bInvalidAnnotationNotApplied;  /* This does not apply to HTML Export */
} EXSTATUSINFORMATION;

#define EXSTATUSVERSION2 0X0002

Note:

When processing the main document, Search Export, HTML Export, and XML Export never use fonts, so bAliasedFont and bMissingFont will never report TRUE; however, when doing graphics conversions XML Export and HTML Export may use fonts, so bAliasedFont and bMissingFont may report TRUE.

bVectorObjectLimit applies only to WebView Export, and bInvalidAnnotationNotApplied applies only to Image Export, PDF Export, and Web View Export.

8.2 Annotation Functions

Annotations are a way to highlight, insert, or delete text in product output, without modifying the original document.

The follow functions are described in this section:

Examples of ways annotations can be used by developers include:

  • highlighting search hits

  • inserting notes to comment on text in the original document

  • deleting sensitive information not intended for viewing

Other Outside In products are required to ascertain the proper character positions where the developer wishes to make annotations. Currently, only Content Access and the SearchML output format (available in Search Export) can be used to get these positions. Although the Content Access module is included with the product, license to use the Content Access API is not automatically granted with the purchase of the Export software.

A separate license for Content Access or Search Export is required to enable use of any of the annotation features that are supported by HTML Export. Contact your Outside In sales representative for more information.

The following notes should be considered when using annotations:

  • Processing annotations slow down the conversion process to some extent.

  • While other products in the Outside In family support annotations, not all products support all types of annotations.

  • The ACC acronym (Actual Character Count) is used in the following function descriptions. ACCs represent the location of text in the source document data stream. They represent a marker just before the location of text, and this marker is zero-based.

    This is why startACC parameters should be set to an ACC value that represents the position just prior to the first character and endACC parameters should be set to an ACC value that represents the position just past the last character in the range. For this reason, users should make sure endACC values are 1 greater than the ACC of the last character in the desired range of annotation.

  • Calling EXCloseExport causes all annotations set so far to be cleared.

8.2.1 EXHiliteText

This function allows the developer to change select text attributes on a range of characters from the input document. For more information, see HTML Export Usage Notes.

The colors set by this option can be overridden by the equivalent settings in the ExInsertText function.

Prototype

DAERR EXHiliteText(
      VTHEXPORT           hExport,
      PEXANNOHILITETEXT   pHiliteText);

Parameters

  • hExport: Export handle for the document. Must be the handle returned by the EXOpenExport() function.

  • pHiliteText: Pointer to a structure containing the information on what to highlight and how to highlight it.

Structure

A C data structure defined in sccex.h as follows:

typedef struct EXANNOHILITETEXTtag
{
   VTDWORD         dwSize;
   VTDWORD         dwStartACC;
   VTDWORD         dwEndACC;     /* Last char to highlight +1 */
   VTLPBYTE        pBookmark;    /* HTML Export Only */
   VTLPBYTE        pHyperlink;   /* HTML Export Only */
   VTDWORD         dwOptions;
   SCCVWCOLORREF   sForeground;
   SCCVWCOLORREF   sBackground;
   VTWORD          wCharAttr;
   VTWORD          wCharAttrMask;
} EXANNOHILITETEXT;
  • dwSize: Must be set by the developer to sizeof(EXANNOHILITETEXT).

  • dwStartACC: The ACC of the first character to be highlighted.

  • dwEndACC: ACC of the last character to be highlighted +1. Ranges for annotations have their end point set one past the ACC of the last character in the range. For example, to highlight a single character at ACC position 5, dwStartACC would be set to 5, and dwEndACC would be set to 5+1=6.

  • pBookmark: (HTML Export only): The URL for an optional bookmark to be included before the highlighted text. Specified as a URL encoded byte string. If set to NULL, no bookmark is created.

  • pHyperlink: (HTML Export only): The URL for an optional hyperlink to be created on the highlighted text. Specified as a URL encoded byte string. If set to NULL, no hyperlink is created.

  • dwOptions: Flags that provide highlight options. The default is all flags set to off. The valid flags are:

    • SCCVW_USEFOREGROUND: Indicates that sForeground defines the foreground text color to apply to highlights.

    • SCCVW_USEBACKGROUND: Indicates that sBackground defines the background text color to apply to highlights.

    • SCCVW_USECHARATTR: Indicates that wCharAttr defines the character attributes to apply to highlights.

    • sForeground: Defines the foreground text color to be used if the SCCVW_USEFOREGROUND flag is set in dwOptions. Set this value with the SCCANNORGB(red, green, blue) macro. The red, green and blue values are percentages of the color from 0-255 (with 255 being 100%). There is no default value for this parameter -- if it is set, the color must be specified.

    • sBackground: Defines the background text color to be used if the SCCVW_USEBACKGROUND flag is set in dwOptions. Set this value with the SCCANNORGB(red, green, blue) macro. The red, green and blue values are percentages of the color from 0-255 (with 255 being 100%). There is no default value for this parameter. If it is set, the color must be specified.

    • wCharAttr: Defines the character attributes to use if SCCVW_USECHARATTR is set in dwOptions. Only bits with the corresponding bits set in wCharAttrMask are affected. To turn off all character attributes, set this to SCCVW_CHARATTR_NORMAL (the default) and set wCharAttrMask to -1. Otherwise, set this to any of the following character attributes OR-ed together:

      • SCCVW_CHARATTR_UNDERLINE

      • SCCVW_CHARATTR_ITALIC

      • SCCVW_CHARATTR_BOLD

      • SCCVW_CHARATTR_STRIKEOUT

      • SCCVW_CHARATTR_SMALLCAPS: Not supported in HTML Export unless a CSS flavor is selected.

      • SCCVW_CHARATTR_OUTLINE: Not currently supported.

      • SCCVW_CHARATTR_SHADOW: Not currently supported.

      • SCCVW_CHARATTR_CAPS: Not currently supported.

      • SCCVW_CHARATTR_SUBSCRIPT

      • SCCVW_CHARATTR_SUPERSCRIPT

      • SCCVW_CHARATTR_DUNDERLINE: Currently supported as single underline in HTML Export.

      • SCCVW_CHARATTR_WORDUNDERLINE

      • SCCVW_CHARATTR_DOTUNDERLINE: Currently supported as single underline.

  • wCharAttrMask: Defines which character attributes to change based on the settings of the bits in wCharAttr. Uses the same bit flags defined above for wCharAttr. Only attributes whose flag is set in this mask are modified to match the state specified by wCharAttr. This mask provides a way to distinguish between bits being set in wCharAttr because the developer wants to force a change to the character attributes and bits in wCharAttr that the developer would rather set to "inherit from the source document."

    The following are real-world examples of these interactions (all examples assume that SCCVW_USECHARATTR is set in dwOptions):

    • Example 1: wCharAttr is set to SCCVW_CHARATTR_BOLD and wCharAttrMask is set to SCCVW_CHARATTR_BOLD. This results in bold being forced on in the annotation.

    • Example 2: wCharAttr is set to SCCVW_CHARATTR_BOLD and wCharAttrMask is set to 0. This results in bold being left the way it was in the source document in the annotation.

    • Example 3: wCharAttr is set to 0 and wCharAttrMask is set to SCCVW_CHARATTR_BOLD. This results in bold being forced off in the annotation.

      The default value for this is 0, meaning that all the flags in wCharAttr are ignored.

Return Values

  • DAERR_OK: Returned if the annotation was successfully added. Otherwise, one of the other DAERR_ values in sccda.h or one of the SCCERR_ values in sccerr.h is returned.

8.2.1.1 HTML Export Usage Notes

Attributes that may be changed include foreground and background text color, as well as various character level text attributes such as bold, italic and underline. The user may also choose to insert a bookmark before the highlighted text. If the highlighted text appears in a graphic created by HTML Export, then the bookmark is place immediately before the <img> tag for that graphic. The highlighted text may also be turned into a hyperlink (this is not supported in HTML Export graphics conversions).

Source document text may appear in more than one place in the converted document, for example in a template-created TOC as well as in the body of the document. Text in the TOCs created by HTML Export's templates is not affected by this option. This is because the TOC text has all text attributes and hyperlinks stripped out as part of the TOC creation. Highlights appear in the document body content however, the same way normal paragraph text is affected.

Highlights are not applied to text from the template.

8.2.2 EXInsertText

This function inserts a text string at a specified point in the document. The developer may also change character attributes or foreground or background colors. These settings override any provided by ExHiliteText.

In HTML Export, the developer may also choose to insert a bookmark before the inserted text. If the inserted text appears in a graphic created by HTML Export, then the bookmark is placed immediately before the <img> tag for that graphic. The inserted text may also be turned into a hyperlink (not supported in HTML Export graphics conversions). Inserted text inherits the text attributes of the text that immediately precedes it.

Prototype

DAERR EXInsertText(
VTHEXPORT           hExport,
PEXANNOINSERTTEXT   pInsertText);

Parameters

  • hExport: Export handle for the document. Must be the handle returned by the EXOpenExport() function.

  • pInsertText: Pointer to a structure containing the information on the text to insert.

Structure

A C data structure defined in sccex.h as follows:

typedef struct EXANNOINSERTTEXTtag
{
   VTDWORD         dwSize;
   VTDWORD         dwTextACC;
   VTLPWORD        pText;
   VTLPBYTE        pBookmark;    /* HTML Export Only */
   VTLPBYTE        pHyperlink;   /* HTML Export Only */
   VTDWORD         dwOptions;
   SCCVWCOLORREF   sForeground;
   SCCVWCOLORREF   sBackground;
   VTWORD          wCharAttr;
   VTWORD          wCharAttrMask;
} EXANNOINSERTTEXT;
  • dwSize: Must be set by the OEM to sizeof(EXANNOINSERTTEXT).

  • dwTextACC: Place to insert the string pointed to by pText. The string is inserted before the character normally at this ACC position. By default, the inserted string inherits the text attributes of the character at this position in the input document.

  • pText: The text to be inserted. Specified as a Unicode string.

  • pBookmark: The URL for an optional bookmark to be included before the inserted text. Specified as a URL-encoded byte string. If set to NULL, no bookmark is created.

  • pHyperlink: The URL for an optional hyperlink to be created on the inserted text. Specified as a URL encoded byte string. If set to NULL, no hyperlink is created.

  • dwOptions: This parameter sets flags that provide highlight options. The default is all flags off. The flags are:

    • SCCVW_USEFOREGROUND: Indicates that sForeground defines the foreground text color to apply to highlights.

    • SCCVW_USEBACKGROUND: Indicates that sBackground defines the background text color to apply to highlights.

    • SCCVW_USECHARATTR: Indicates that wCharAttr defines the character attributes to apply to highlights.

  • sForeground: Defines the foreground text color to be used if the SCCVW_USEFOREGROUND flag is set in dwOptions. Set this value with the SCCANNORGB(red, green, blue) macro. The red, green and blue values are percentages of the color from 0-255 (with 255 being 100%). There is no default value for this parameter -- if it is set, the color must be specified.

  • sBackground: Defines the background text color to be used if the SCCVW_USEBACKGROUND flag is set in dwOptions. Set this value with the SCCANNORGB(red, green, blue) macro. The red, green and blue values are percentages of the color from 0-255 (with 255 being 100%). There is no default value for this parameter. If it is set, the color must be specified.

  • wCharAttr: Defines the character attributes to use if SCCVW_USECHARATTR is set in dwOptions. Only bits with the corresponding bits set in wCharAttrMask are affected. To turn off all character attributes, set this to SCCVW_CHARATTR_NORMAL (the default) and set wCharAttrMask to -1. Otherwise, set this to any of the following character attributes OR-ed together:

    • SCCVW_CHARATTR_UNDERLINE

    • SCCVW_CHARATTR_ITALIC

    • SCCVW_CHARATTR_BOLD

    • SCCVW_CHARATTR_STRIKEOUT

    • SCCVW_CHARATTR_SMALLCAPS: Not currently supported in Image Export or PDF Export. Not supported in HTML Export unless a CSS flavor is selected.

    • SCCVW_CHARATTR_OUTLINE: Not currently supported.

    • SCCVW_CHARATTR_SHADOW: Not currently supported.

    • SCCVW_CHARATTR_CAPS: Not currently supported.

    • SCCVW_CHARATTR_SUBSCRIPT: SCCVW_CHARATTR_SUPERSCRIPT

    • SCCVW_CHARATTR_DUNDERLINE: Currently supported as single underline.

    • SCCVW_CHARATTR_WORDUNDERLINE: SCCVW_CHARATTR_DOTUNDERLINE: Currently supported as single underline in HTML Export due to limitations of HTML.

  • wCharAttrMask: Defines which character attributes to change based on the settings of the bits in wCharAttr. Uses the same bit flags defined above for wCharAttr. Only attributes whose flag is set in this mask are modified to match the state specified by wCharAttr. This mask provides a way to distinguish between bits being set in wCharAttr because the developer wants to force a change to the character attributes, and bits in wCharAttr that the developer would rather set to "inherit from the source document." The following are real-world examples of these interactions (all examples assume that SCCVW_USECHARATTR is set in dwOptions):

    • Example 1: wCharAttr is set to SCCVW_CHARATTR_BOLD and wCharAttrMask is set to SCCVW_CHARATTR_BOLD. This results in bold being forced on in the annotation.

    • Example 2: wCharAttr is set to SCCVW_CHARATTR_BOLD and wCharAttrMask is set to 0. This results in bold being left the way it was in the source document in the annotation.

    • Example 3: wCharAttr is set to 0 and wCharAttrMask is set to SCCVW_CHARATTR_BOLD. This results in bold being forced off in the annotation.

    The default value for this is 0, meaning that all the flags in wCharAttr are ignored.

Return Values

  • DAERR_OK: The annotation was successfully added. Otherwise, one of the other DAERR_ values in sccda.h or one of the SCCERR_ values in sccerr.h is returned.

8.2.3 EXHideText

This function removes the selected range of characters in the input document from the output. Users may also choose to insert a bookmark before the hidden text. If the hidden text appears in a graphic created by HTML Export, the bookmark is be placed immediately before the <img> tag for that graphic.

The hidden text does not appear in any form in the final converted document.

If all of the text from a paragraph that would normally form an entry in a template-created TOC is deleted, then the entire TOC entry that would have otherwise appeared will be missing from the converted document along with the corresponding body text.

Prototype

SCCERR EXHideText(
VTHEXPORT         hExport,
PEXANNOHIDETEXT   pHideText)

Parameters

  • hExportL Export handle for the document. Must be the handle returned by the EXOpenExport() function.

  • pHideText: Pointer to an EXANNOHIDETEXT structure containing the information on the section of text to hide.

8.2.3.1 EXANNOHIDETEXT Structure

A C data structure defined in sccex.h as follows:

typedef struct EXANNOHIDETEXTtag
{
   VTDWORD    dwSize;
   VTDWORD    dwStartACC;
   VTDWORD    dwEndACC;     /* Last char to hide +1 */
   VTLPCHAR   pBookmark;    /* HTML Export Only */
} EXANNOHIDETEXT;
  • dwSize: Must be set by the OEM to sizeof(EXANNOHIDETEXT).

  • dwStartACC: Position of the first character to be hidden.

  • dwEndACC: Position of the last character to be hidden, plus one.

  • pBookmark: The URL for an optional bookmark to be included before the highlighted text. Specified as a URL encoded byte string. If set to NULL, no bookmark is created.

Return Values

  • SCCERR_OK: Returned if the annotation was successfully added. Otherwise, one of the other SCCERR_* values in sccerr.h is returned.