7 Export Functions
This chapter outlines the basic functions used to initiate the conversion of documents using the product API.
This chapter includes the following sections:
7.1 General Functions
The following functions are general functions used in most export products.
This section includes the following functions:
7.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);
Parameters
-
hDoc: A handle that identifies the source file, created by DAOpenDocument. 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_HTML5.
-
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. 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 Chapter 8, "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 details, see the definition for EXCALLBACKPROC in Section 7.1.2, "EXCALLBACKPROC." This parameter may be set to NULL if the developer does not wish to handle callbacks.
-
dwCallbackData: This parameter is passed 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. phExport is not a file handle.
Return Values
-
SCCERR_OK: If the open was successful. Otherwise, one of the other SCCERR_ values in sccerr.h is returned.
7.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 Chapter 9, "Callbacks."
-
pCommandOrInfoData: Data associated with dwCommandOrInfoId. For information about supported callbacks, see Chapter 9, "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.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.
7.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.
7.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 */ } EXSTATUSINFORMATION;
#define EXSTATUSVERSION1 0X0001
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.7.1.6 EXAddKeyValue Functions
These functions specify key/value pairs for use in the exported document.
SCCERR EXAddKeyValueString( HEXPORT hExport, VTLPCSTR szKeyName, VTLPCSTR szValue ) SCCERR EXAddKeyValueInt( HEXPORT hExport, VTLPCSTR szKeyName, VTDWORD dwValue) SCCERR EXAddKeyValueFloat( HEXPORT hExport, VTLPCSTR szKeyName, VTFLOAT fValue )
These functions are being added to Outside In 8.5.0 for the use of the Web View Export product. They may in the future be used in other SDKs. A given key name cannot have multiple values. Calling this function multiple times with the same value for szKeyName will replace each previous value with the newest one.
Parameters
-
hExport: Export handle for the document. Must be a handle returned by the EXOpenExport function.
-
szKeyName: A name for the data (as a null-terminated UTF8-encoded string).
-
szValue / dwValue / fValue: The value side of the key-value pair - either a null-terminated UTF8-encoded string or a VTDWORD or a VTFLOAT.
Return Values
-
SCCERR_OK or an appropriate error value.
Use in Web View Export Output
The data specified by this method will be made available to scripts that have access to the Web View Export Javascript API. For a script operating within a web view, the data specified will be accessible through an object returned from the API function OIT.document.externalData().
For example, if at export time the export SDK is called like this:
EXAddKeyValueInt( hExport, (VTLPCSTR)"UserId", 42 ); EXAddKeyValueString( hExport, (VTLPCSTR)"UserName", (VTLPCSTR)"Bob" ); EXAddKeyValueFloat( hExport, (VTLPCSTR)"Pie", 3.14159 );
Then from a script that is loaded into the Web View Export output, the following is possible:
var myData = OIT.document.externalData(); alert( myData.UserId ); // displays "42" alert( myData["UserName"] ); // displays "Bob" alert( myData.Pie ); // displays "3.14159"
7.2 Annotation Functions
Annotations are a way to highlight, insert, or delete text in product output, without modifying the original document.
This section covers the following annotation functions:
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 Oracle 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 Web View Export. Contact your sales representative for more information.
The following notes should be considered when using annotations:
-
Processing annotations slows down the conversion process to some extent.
-
While other products in the Oracle 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.
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.
7.2.1 EXHiliteText
This function allows the developer to change foreground and background colors of a range of characters from the input document.
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 */ 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.
-
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 Web View Export.
-
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
-
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.
7.2.2 EXHiliteTextEx
DAERR EXHiliteTextEx( VTHEXPORT hExport, PEXANNOHILITETEXT pHilite, VTLPDWORD pHiliteId )
This function is the same as EXHiliteText, but allows for a highlight id to be obtained, so that highlight properties or a text comment can be attached to this highlight. (This function was called EXHiliteAnchorText in earlier specifications)
-
hExport: Export handle
-
pHilite: Specifies details of the highlight formatting. (Note that not all of these attributes may be presented in Web View Export output.)
-
pHiliteId: An identifier generated by Export. It may be used as a parameter to EXAddComment to associate the comment with this highlight.
7.2.3 EXHiliteArea
DAERR EXHiliteArea( VTHEXPORT hExport, PEXANNOHILITEAREA pHilite, VTLPDWORD pHiliteId)
This function applies an area highlight to the export. The highlight is defined through the following data structure.
-
hExport: Export handle
-
pHilite: Specifies details of the highlight position and formatting.
-
pHiliteId: An identifier generated by Export. It may be used as a parameter to EXAddComment to associate the comment with this highlight.
7.2.3.1 EXANNOHILITEAREA
typedef struct EXANNOHILITEAREA { VTDWORD dwSize; VTDWORD dwSection; // zero based number of (sheet/image/slide) VTDWORD dwTop; // Top coordinate or row VTDWORD dwLeft; // Leftmost coordinate or column VTDWORD dwWidth; // Width of area in coordinates or columns VTDWORD dwHeight; // Height of area in coordinates or columns VTDWORD dwUnits; // SCCANNO_TWIPS, SCCANNO_PIXELS or SCCANNO_CELLS VTDWORD dwUser; // User data SCCVWCOLORREF fillColor; // Fill color VTFLOAT fOpacity; // 0-1.0; 0==invisible; applies to fill color * SCCVWCOLORREF borderTopColor; // Border Colors and thickness in twips * VTDWORD borderTopThickness; SCCVWCOLORREF borderLeftColor; VTDWORD borderLeftThickness; SCCVWCOLORREF borderBottomColor; VTDWORD borderBottomThickness; SCCVWCOLORREF borderRightColor; VTDWORD borderRightThickness; VTDWORD dwBorderStyle; // Currently not supported // (would be SCCVW_BORDER_DOT, SCCVW_BORDER_DASH, or SCCVWBORDER_SOLID) } EXANNOHILITEAREA;
7.2.4 EXAddStampAnnotation
DAERR EXAddStampAnnotation( VTHEXPORT hExport, PEXANNOSTAMP pStamp VTLPDWORD pHiliteId)
This function applies an image stamp to the export output. The stamp is defined through the following data structure.
-
hExport: Export handle
-
pStamp: Specifies details of the image and its position
-
pHiliteId: An identifier generated by Export. It may be used as a parameter to EXAddComment to associate the comment with this highlight.
7.2.4.1 EXANNOSTAMP
typedef struct EXANNOSTAMP * { VTDWORD dwSize; VTDWORD dwUser; // User data VTDWORD dwSection; // zero based number of (page/sheet/image/slide) VTDWORD dwTop; // Top coordinate or row VTDWORD dwLeft; // Leftmost coordinate or column VTDWORD dwWidth; // Width of area in coordinates or columns VTDWORD dwHeight; // Height of area in coordinates or columns VTDWORD dwUnits; // EX_ANNO_TWIPS, EX_ANNO_PIXELS or EX_ANNO_CELLS VTFLOAT fOpacity; // 0-1.0; 0==invisible DWORD dwSizeMode; // EX_ANNO_SIZE_FIT, EX_ANNO_SIZE_STRETCH, // EX_ANNO_SIZE_FROM_SOURCE; VTLPCSTR szStampName; // name of stamp image, specified via one of // the SCCOPT_STAMP_IMAGE_* options } EXANNOSTAMP;
Notes
For word processing files, the dwSection parameter indicates the zero-based index of the page of the output document to which the stamp should be applied. Note that the usual caveats apply to paginated output. Pagination is influenced by how text is wrapped on a page, which is in turn influenced by the fonts that are available to the Outside In rendering code on the system that is generating the output. Exporting the same document on two different systems with different fonts available to them may result in slightly different page boundaries.
About the dwSizeMode parameter:
-
If this is set to EX_ANNO_SIZE_FIT, the source image will be scaled with its aspect ratio preserved, to fit inside the rectangle specified by dwTop, dwLeft, dwWidth, and dwHeight. The top, left corner of the scaled image will align with the top, left corner of the highlight rectangle.
-
If this is set to EX_ANNO_SIZE_STRETCH, the source image will be stretched to fill the highlight rectangle.
-
If this is set to EX_ANNO_SIZE_FROM_SOURCE, the source image will be rendered at its native size. The dwWidth and dwHeight fields will be ignored, and the top, left corner of the stamped image will be aligned with the top, left corner of the destination rectangle.
7.2.5 EXAddComment
DAERR EXAddComment( VTHEXPORT hExport, VTDWORD dwHighlightId, VTLPCWSTR pComment )
-
hExport: Export handle
-
dwHighlightId: Id value provided by EXHighlightTextEx, EXHighlightArea, or EXAddStampAnnotation
-
pComment: Comment text, null-terminated Unicode UCS2 string
This function adds a comment associated with a previously applied highlight annotation. If a comment was previously defined for the highlight, it is replaced by the new comment.
7.2.6 EXAddHiliteProperty
DAERR EXAddHiliteProperty( HEXPORT hExport, DWORD dwAnchorId, VTLPCWSTR wsName, VTLPCWSTR sValue )
Note: This method associates a property with a highlight. The property is specified as a Unicode (UCS2) name/value pair.
7.2.7 EXApplyHilites
DAERR EXApplyHilites(HEXPORT hExport, const VTBYTE * pHilites);
This function applies a set of highlights from a JSON-encoded text stream previously generated from the Web View Export Javascript library. This function may be called multiple times with different sets of highlights.
-
hExport: Export handle
-
pHilites: Buffer containing a stream of highlight (and comment) information that was obtained via the Web View Export Javascript API function OIT.highlights.serialize.