7 Export Functions

This chapter outlines the basic functions used to initiate the conversion of documents using the XML Export SDK.

This chapter describes the following functions:

7.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. XML 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 should be set to FI_XML_FLEXIONDOC_LATEST.

  • 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. 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. 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. 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. A pointer to a BASEIO structure filled in by your application. This must not be set to NULL or conversion fails.

  • pSpec: Initial output file location specification. The form of this data depends on the value of the dwSpecType parameter (see above). This is either a pointer to a buffer or NULL.

  • 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. See the definition for EXCALLBACKPROC in "EXCALLBACKPROC" for more details. 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.

7.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. See Callbacks for information about supported callbacks.

  • pCommandOrInfoData: Data associated with dwCommandOrInfoId. See Callbacks for information about supported 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.

7.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.

7.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.

7.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 EXSTATUSVERSION12      */
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 flag does not apply to XML Export */
VTBOOL bInvalidAnnotationNotApplied;  /* This flag does not apply to XML 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.