InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IXMLExportUtils Class Referenceabstract

#include <IXMLExportUtils.h>

Inheritance diagram for IXMLExportUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IXMLEXPORTUTILS }
 
enum  ExportImageOption { kCopyOriginal, kOptimizeOriginal, kFormatOriginal }
 

Public Member Functions

virtual ErrorCode GenerateOptimizedImage (const IPMUnknown *pageItem, IPMStream *outStream, const IXMLExportOptions *options, const PMReal &desiredWidth=0)=0
 
virtual ErrorCode GenerateFormattedImage (const IPMUnknown *pageItem, IPMStream *outStream, const IXMLExportOptions *options, bool32 includeFrameInRendering=kTrue, bool16 bItemBackgroundExportAsPng=kFalse, bool16 bDrawNonPrintingObjects=kTrue, PMReal greekBelowPtSize=0.0)=0
 
virtual
IXMLExportOptions::ImageType 
GetBestOptimizedImageType (const IPMUnknown *pageItem) const =0
 
virtual
IXMLExportOptions::ImageType 
GetBestFormattedImageType (const IPMUnknown *pageItem, bool16 shouldKeepSVGAsEmbededSVGImage=kFalse) const =0
 
virtual void CopyOriginal (IXMLOutStream *stream, const IDFile &imagesFolder, ILinkObject *iLinkObject, ExportSessionToken sessionToken, const PMString *linkName=nil) const =0
 
virtual void CopyOriginal (IXMLOutStream *stream, const IDFile &imagesFolder, const IDFile &sourceFile, ExportSessionToken sessionToken) const =0
 
virtual void OptimizeOriginal (IXMLOutStream *stream, IXMLExportOptions *exportOptions, const IDFile &imagesFolder, ILinkObject *iLinkObject, ExportSessionToken sessionToken, const PMReal &desiredWidth=0) const =0
 
virtual void FormatOriginal (IXMLOutStream *stream, IXMLExportOptions *exportOptions, const IDFile &imagesFolder, ILinkObject *iLinkObject, const XMLReference *element, ExportSessionToken sessionToken, bool32 includeFrameInRendering=kTrue) const =0
 
virtual bool16 HasTransparency (const IPMUnknown *pageItem) const =0
 
virtual PMString GetDestinationImageName (ExportImageOption exportImageOption, const IDFile &imagesFolder, ILinkObject *iLinkObject, const IXMLExportOptions *exportOptions, bool16 overwriteDestination=kFalse) const =0
 
virtual void WriteDocumentHeader (IXMLOutStream *xmlStream, IXMLExportOptions *exportOptions, const PMString &rootName) const =0
 
virtual void OpenFileInApp (const IDFile &appFile, const PMString &fileURL) const =0
 
virtual bool32 NeedsRasterizationOrSVG (const IPMUnknown *imageItem, bool32 checkForRotationOrSkew=kTrue, bool32 checkForTransparency=kTrue, bool32 checkForImageClipping=kTrue, bool32 checkForFrameCropping=kTrue, bool32 checkForVectorGraphic=kTrue) const =0
 
virtual bool16 isSVGItem (const IPMUnknown *imageItem) const =0
 
virtual void OptimizeOriginal2 (IXMLOutStream *stream, IXMLExportOptions *exportOptions, const IDFile &imagesFolder, bool32 useOriginalImageNameOnly, ILinkObject *iLinkObject, ExportSessionToken sessionToken, const PMReal &desiredWidth=0) const =0
 
virtual void FormatOriginal2 (IXMLOutStream *stream, IXMLExportOptions *exportOptions, const IDFile &imagesFolder, bool32 useOriginalImageNameOnly, ILinkObject *iLinkObject, const XMLReference *element, ExportSessionToken sessionToken, bool32 includeFrameInRendering=kTrue) const =0
 
virtual ErrorCode GenerateFormattedImageForText (const IPMUnknown *pageItem, IPMStream *outStream, const IXMLExportOptions *options, bool32 includeFrameInRendering=kTrue, bool16 bItemBackgroundExportAsPng=kTrue, bool16 excludeText=kFalse)=0
 
virtual PMRect GetPrintedBBoxForTextFrame (const UIDRef &textFrameRef, const PMMatrix &theMatrix, const Transform::CoordinateSpace &coordinateSpace, bool32 includeAdornments=kTrue)=0
 
virtual ErrorCode GenerateFormattedImage2 (const IPMUnknown *pageItem, IPMStream *outStream, const IXMLExportOptions *options, bool32 includeFrameInRendering=kTrue, bool16 bItemBackgroundExportAsPng=kFalse, bool16 bDrawNonPrintingObjects=kTrue, PMReal greekBelowPtSize=0.0, bool16 includeOtherBackgroundObjects=kFalse)=0
 
virtual ErrorCode GenerateFormattedImageForText2 (const IPMUnknown *pageItem, IPMStream *outStream, const IXMLExportOptions *options, bool32 includeFrameInRendering=kTrue, bool16 bItemBackgroundExportAsPng=kTrue, bool16 excludeText=kFalse, bool16 includeOtherBackgroundObjects=kFalse)=0
 
virtual void CopyOriginal (IXMLOutStream *stream, const IDFile &imagesFolder, ILinkResource *iLinkResource, ExportSessionToken sessionToken, const PMString *linkName=nil) const =0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

Export related utility interface; used by the current XML export provider.

Member Enumeration Documentation

ExportImageOption are required as a parameter in GetDestinationImageName()
Enumerator
kCopyOriginal 

Copies the original image. See CopyOriginal().

kOptimizeOriginal 

Optimizes the image. See OptimizeOriginal().

kFormatOriginal 

Generates a formatted image. See FormatOriginal().

Member Function Documentation

virtual void IXMLExportUtils::CopyOriginal (IXMLOutStreamstream,
const IDFileimagesFolder,
ILinkObjectiLinkObject,
ExportSessionToken sessionToken,
const PMStringlinkName = nil 
) const
pure virtual

There are three graphics related XML export options (Copy Original, Optimize Original, and FormatOriginal). This option copies the original image. Managed source images are supported.

Parameters
streamspecifies the XML output stream with IID_XMLCOPYMAP, which is being used to avoid copying images twice.
imagesFolderspecifies the target folder where the original image will be copied to
iLinkObjectspecifies the pageitem of the original image.
sessionTokenidentifies the export session that owns the resulting file
linkNamespecifies the name of the link in links panel
virtual void IXMLExportUtils::CopyOriginal (IXMLOutStreamstream,
const IDFileimagesFolder,
const IDFilesourceFile,
ExportSessionToken sessionToken 
) const
pure virtual

Given the original image file, copies it to imagesFolder. Managed source images are supported.

Parameters
streamspecifies the XML output stream with IID_XMLCOPYMAP, which is being used to avoid copying the same image twice.
imagesFolderspecifies the target folder where the original image will be copied to
sourceFilespecifies the original image.
sessionTokenidentifies the export session that owns the resulting file
virtual void IXMLExportUtils::CopyOriginal (IXMLOutStreamstream,
const IDFileimagesFolder,
ILinkResourceiLinkResource,
ExportSessionToken sessionToken,
const PMStringlinkName = nil 
) const
pure virtual

Given the original image file, copies it to imagesFolder. Managed source images are supported.

Parameters
streamspecifies the XML output stream with IID_XMLCOPYMAP, which is being used to avoid copying the same image twice.
imagesFolderspecifies the target folder where the original image will be copied to
linkResourcespecifies the link resource abstraction over original image.
sessionTokenidentifies the export session that owns the resulting file
linkNamespecifies the name of the link in links panel
virtual void IXMLExportUtils::FormatOriginal (IXMLOutStreamstream,
IXMLExportOptionsexportOptions,
const IDFileimagesFolder,
ILinkObjectiLinkObject,
const XMLReferenceelement,
ExportSessionToken sessionToken,
bool32 includeFrameInRendering = kTrue 
) const
pure virtual

There are three graphics related XML export options (Copy Original, Optimize Original, and FormatOriginal). This option generates a new image based on the formatting and transformation that is being used. This util method is currently used by XMLExportProvider and PackageDoc4GLCmd. It uses GenerateOptimizedImage() and GetBestOptimizedImageType().

Parameters
streamspecifies the XML output stream with IID_IXMLFORMATTEDMAPDATA, which is being used to retrieve the converted file name. An image is always converted because the transformation may be different from image to image.
exportOptionsprovides the chosen image type for the image conversion. See IXMLExportOptions::GetImageType().
imagesFolderspecifies the target folder where the original image will be copied to.
iLinkObjectspecifies the pageitem of the original image.
elementspecifies XMLReference that will be updated with the URL of the new formatted image.
sessionTokenidentifies the export session that owns the resulting file
includeFrameInRendering[IN] For graphics, determines whether the parent frame is included in the generated raster.
virtual void IXMLExportUtils::FormatOriginal2 (IXMLOutStreamstream,
IXMLExportOptionsexportOptions,
const IDFileimagesFolder,
bool32 useOriginalImageNameOnly,
ILinkObjectiLinkObject,
const XMLReferenceelement,
ExportSessionToken sessionToken,
bool32 includeFrameInRendering = kTrue 
) const
pure virtual

There are three graphics related XML export options (Copy Original, Optimize Original, and FormatOriginal). This option generates a new image based on the formatting and transformation that is being used. This util method is currently used by XMLExportProvider and PackageDoc4GLCmd. It uses GenerateOptimizedImage() and GetBestOptimizedImageType().

Parameters
streamspecifies the XML output stream with IID_IXMLFORMATTEDMAPDATA, which is being used to retrieve the converted file name. An image is always converted because the transformation may be different from image to image.
exportOptionsprovides the chosen image type for the image conversion. See IXMLExportOptions::GetImageType().
imagesFolderspecifies the target folder where the original image will be copied to.
iLinkObjectspecifies the pageitem of the original image.
elementspecifies XMLReference that will be updated with the URL of the new formatted image.
sessionTokenidentifies the export session that owns the resulting file
useOriginalImageNameOnly[IN] whether to add any prefix or suffix to original image name (eg "_fmt").
includeFrameInRendering[IN] For graphics, determines whether the parent frame is included in the generated raster.
virtual ErrorCode IXMLExportUtils::GenerateFormattedImage (const IPMUnknownpageItem,
IPMStreamoutStream,
const IXMLExportOptionsoptions,
bool32 includeFrameInRendering = kTrue,
bool16 bItemBackgroundExportAsPng = kFalse,
bool16 bDrawNonPrintingObjects = kTrue,
PMReal greekBelowPtSize = 0.0 
)
pure virtual

Creates an RGB snapshot of the pageItem as it appears in the pub. That is, if the pageItem is rotated in the pub, then an image will be generated containing the rotated pageItem. In addition, if the pageitem has a containing frame, the frame will also be part of the image thus preserving clipping.

Parameters
pageItemspecifies page item to be rasterised
outStreamwhere to write the pixels
optionsinterface (IXMLExportOptions) storing options for the image generation process
Returns
ErrorCode kSuccess if operation completed successfully, kFailure otherwise
Parameters
includeFrameInRendering[IN] For graphics, determines whether the parent frame is included in the generated raster.
bItemBackgroundExportAsPng[IN]used to explicitly set PNG as export format
bDrawNonPrintingObjects[IN]used to explicitly draw non-printing objects
greekBelowPtSize- IN - Point size at which text will be greeked if its points size multiplied by the scaling is less than the greek below value.
virtual ErrorCode IXMLExportUtils::GenerateFormattedImage2 (const IPMUnknownpageItem,
IPMStreamoutStream,
const IXMLExportOptionsoptions,
bool32 includeFrameInRendering = kTrue,
bool16 bItemBackgroundExportAsPng = kFalse,
bool16 bDrawNonPrintingObjects = kTrue,
PMReal greekBelowPtSize = 0.0,
bool16 includeOtherBackgroundObjects = kFalse 
)
pure virtual
Creates an RGB snapshot of the pageItem as it appears in the pub.  That is, if the pageItem is rotated in the pub, then

an image will be generated containing the rotated pageItem. In addition, if the pageitem has a containing frame, the frame will also be part of the image thus preserving clipping.

Parameters
pageItemspecifies page item to be rasterised
outStreamwhere to write the pixels
optionsinterface (IXMLExportOptions) storing options for the image generation process
includeFrameInRendering[IN] For graphics, determines whether the parent frame is included in the generated raster.
bItemBackgroundExportAsPng[IN]used to explicitly set PNG as export format
bDrawNonPrintingObjects[IN]used to explicitly draw non-printing objects
greekBelowPtSize- IN - Point size at which text will be greeked if its points size multiplied by the scaling is less than the greek below value.
includeOtherBackgroundObjects- IN - determines whether page items behind input page item is included in the generated raster.
Returns
ErrorCode kSuccess if operation completed successfully, kFailure otherwise
virtual ErrorCode IXMLExportUtils::GenerateFormattedImageForText (const IPMUnknownpageItem,
IPMStreamoutStream,
const IXMLExportOptionsoptions,
bool32 includeFrameInRendering = kTrue,
bool16 bItemBackgroundExportAsPng = kTrue,
bool16 excludeText = kFalse 
)
pure virtual

Creates an RGB snapshot of the pageItem as it appears in the pub. That is, if the pageItem is rotated in the pub, then an image will be generated containing the rotated pageItem. In addition, if the pageitem has a containing frame, the frame will also be part of the image thus preserving clipping.

Parameters
pageItemspecifies page item to be rasterised
outStreamwhere to write the pixels
optionsinterface (IXMLExportOptions) storing options for the image generation process
includeFrameInRendering[IN] For graphics, determines whether the parent frame is included in the generated raster.
bItemBackgroundExportAsPng[IN]used to explicitly set PNG as export format
excludeText[IN]determines whether to exclude text in the exported image
Returns
ErrorCode kSuccess if operation completed successfully, kFailure otherwise
virtual ErrorCode IXMLExportUtils::GenerateFormattedImageForText2 (const IPMUnknownpageItem,
IPMStreamoutStream,
const IXMLExportOptionsoptions,
bool32 includeFrameInRendering = kTrue,
bool16 bItemBackgroundExportAsPng = kTrue,
bool16 excludeText = kFalse,
bool16 includeOtherBackgroundObjects = kFalse 
)
pure virtual
Creates an RGB snapshot of the pageItem as it appears in the pub.  That is, if the pageItem is rotated in the pub, then

an image will be generated containing the rotated pageItem. In addition, if the pageitem has a containing frame, the frame will also be part of the image thus preserving clipping.

Parameters
pageItemspecifies page item to be rasterised
outStreamwhere to write the pixels
optionsinterface (IXMLExportOptions) storing options for the image generation process
includeFrameInRendering[IN] For graphics, determines whether the parent frame is included in the generated raster.
bItemBackgroundExportAsPng[IN]used to explicitly set PNG as export format
excludeText[IN]determines whether to exclude text in the exported image
includeOtherBackgroundObjects[IN]- determines whether page items behind input page item is included in the generated raster.
Returns
ErrorCode kSuccess if operation completed successfully, kFailure otherwise
virtual ErrorCode IXMLExportUtils::GenerateOptimizedImage (const IPMUnknownpageItem,
IPMStreamoutStream,
const IXMLExportOptionsoptions,
const PMRealdesiredWidth = 0 
)
pure virtual

Creates an RGB version of the image at a resolution equal to the smaller of 72 dpi and the native image resolution. Geometrical transformations, clipping, and any containing frames will not be included in the resulting image.

Parameters
pageItemspecifies page item to be rasterised
outStreamwhere to write the pixels
optionsinterface (IXMLExportOptions) storing options for the image generation process
Returns
ErrorCode kSuccess if operation completed successfully, kFailure otherwise
Parameters
desiredWidth[IN] if non-zero and less than or equal to the original image width, resample the image uniformly such that its target width matches this given width.
virtual IXMLExportOptions::ImageType IXMLExportUtils::GetBestFormattedImageType (const IPMUnknownpageItem,
bool16 shouldKeepSVGAsEmbededSVGImage = kFalse 
) const
pure virtual

The user has a choice at export time of selecting GIF, JPEG or Automatic as the image type. GetBestFormattedImageType() can be used to detect which type will be used when exporting a formatted image of the given pageItem.

Parameters
pageItemspecifies page item to be rasterised
shouldKeepSVGAsEmbededSVGImagespecifies if best format for SVG is embeded SVG Image
Returns
IXMLExportOptions::ImageType calculated to be most appropriate for this given page item
virtual IXMLExportOptions::ImageType IXMLExportUtils::GetBestOptimizedImageType (const IPMUnknownpageItem) const
pure virtual

The user has a choice at export time of selecting GIF, JPEG or Automatic as the image type. GetBestOptimizedImageType() can be used to detect which type will be used when exporting an optimized image of the given pageItem.

Parameters
pageItemspecifies page item to be rasterised
Returns
IXMLExportOptions::ImageType indicating a calculated best type for this image
virtual PMString IXMLExportUtils::GetDestinationImageName (ExportImageOption exportImageOption,
const IDFileimagesFolder,
ILinkObjectiLinkObject,
const IXMLExportOptionsexportOptions,
bool16 overwriteDestination = kFalse 
) const
pure virtual

There are three graphics related XML export options (Copy Original, Optimize Original, and FormatOriginal). This option generates the file name of the destination image based on export image option (copy, optimized, or formatted).

Parameters
exportImageOptionspecifies whether the destination name should be generated for CopyOriginal(), OptimizeOriginal, or FormatOriginal().
exportOptionsprovides the chosen image type for the image conversion. See IXMLExportOptions::GetImageType().
iLinkObjectspecifies the pageitem of the original image.
overwriteDestinationspecifies whether the destination file can be overwritten or whether a file with a unique name should be used instead. Defaulted to kFalse.
Returns
file name string of the destination image or empty string on errors.
virtual PMRect IXMLExportUtils::GetPrintedBBoxForTextFrame (const UIDReftextFrameRef,
const PMMatrixtheMatrix,
const Transform::CoordinateSpacecoordinateSpace,
bool32 includeAdornments = kTrue 
)
pure virtual

Get the bounds around what will actually print. This includes the stroke bounds plus whatever adornments are set to print and also the optical alignment margins. Compute the bounds in pasteboard coords and then transform by theMatrix.

Parameters
theMatrixthe matrix to transform the bounds based on pasteboard coordinates.
includeAdornments[IN] Whether or not printing adornments are included in the resulting bounding box
Returns
PMRect the bounds for printing.
virtual bool16 IXMLExportUtils::HasTransparency (const IPMUnknownpageItem) const
pure virtual

Returns true if the pageitem or any of its ancestors has transparency applied to it.

Parameters
pageItem[IN] pointer to an interface on a page item.
virtual bool16 IXMLExportUtils::isSVGItem (const IPMUnknownimageItem) const
pure virtual

Does this graphic is a SVG?

Parameters
imageItem[IN] pointer to an interface on the image or graphic
virtual bool32 IXMLExportUtils::NeedsRasterizationOrSVG (const IPMUnknownimageItem,
bool32 checkForRotationOrSkew = kTrue,
bool32 checkForTransparency = kTrue,
bool32 checkForImageClipping = kTrue,
bool32 checkForFrameCropping = kTrue,
bool32 checkForVectorGraphic = kTrue 
) const
pure virtual

Does this image, and its parent frame, need to be rasterized due to a 2D transform, transparency, clipping paths or a frame that in some way clips the image.

Parameters
imageItem[IN] pointer to an interface on the image
checkForRotationOrSkew[IN] Should we check for a rotation or skew relative to the spread?
checkForTransparency[IN] Should we check for transparency anywhere in this image's hierarchy?
checkForImageClipping[IN] Should we check for a clipping path on the image?
checkForFrameCropping[IN] Should we check for the frame cropping the image in some way?
checkForVectorGraphic[IN] Should we check whether this image is actually a vector graphic such as an EPS or PDF?
virtual void IXMLExportUtils::OpenFileInApp (const IDFileappFile,
const PMStringfileURL 
) const
pure virtual

OpenFileInApp calls private OpenFileInHelper() in LaunchXMLViewer.cpp. It launches the application specified in appFile and passes the fileURL als parameter for the file or site to open.

Parameters
appFilebrowser or any other application.
fileURLspecifies the URL that appFile should open.
virtual void IXMLExportUtils::OptimizeOriginal (IXMLOutStreamstream,
IXMLExportOptionsexportOptions,
const IDFileimagesFolder,
ILinkObjectiLinkObject,
ExportSessionToken sessionToken,
const PMRealdesiredWidth = 0 
) const
pure virtual

There are three graphics related XML export options (Copy Original, Optimize Original, and FormatOriginal). This option uses image conversion for optimizing images. It uses GenerateOptimizedImage() and GetBestOptimizedImageType().

Parameters
streamspecifies the XML output stream with IID_XMLOPTIMIZEDMAP, which is being used to avoid converting the same image twice.
exportOptionsprovides the chosen image type for the image conversion. See IXMLExportOptions::GetImageType().
imagesFolderspecifies the target folder where the original image will be copied to.
iLinkObjectspecifies the pageitem of the original image.
sessionTokenidentifies the export session that owns the resulting file
desiredWidth[IN] if non-zero and less than or equal to the original image width, resample the image uniformly such that its target width matches this given width.
virtual void IXMLExportUtils::OptimizeOriginal2 (IXMLOutStreamstream,
IXMLExportOptionsexportOptions,
const IDFileimagesFolder,
bool32 useOriginalImageNameOnly,
ILinkObjectiLinkObject,
ExportSessionToken sessionToken,
const PMRealdesiredWidth = 0 
) const
pure virtual

There are three graphics related XML export options (Copy Original, Optimize Original, and FormatOriginal). This option uses image conversion for optimizing images. It uses GenerateOptimizedImage() and GetBestOptimizedImageType().

Parameters
streamspecifies the XML output stream with IID_XMLOPTIMIZEDMAP, which is being used to avoid converting the same image twice.
exportOptionsprovides the chosen image type for the image conversion. See IXMLExportOptions::GetImageType().
imagesFolderspecifies the target folder where the original image will be copied to.
iLinkObjectspecifies the pageitem of the original image.
sessionTokenidentifies the export session that owns the resulting file
useOriginalImageNameOnly[IN] whether to add any prefix or suffix to original image name (eg "_opt").
desiredWidth[IN] if non-zero and less than or equal to the original image width, resample the image uniformly such that its target width matches this given width.
virtual void IXMLExportUtils::WriteDocumentHeader (IXMLOutStreamxmlStream,
IXMLExportOptionsexportOptions,
const PMStringrootName 
) const
pure virtual

WriteDocumentHeader used to be XMLExportProvider::ExportDocumentHeader(). It takes IXMLExportOptions and a rootName and generates a document header using IXMLExportOptions's GetDTD(), GetFPI(), GetStyleSheet(), and GetComments().

Parameters
xmlStreamis the stream the document header will be written out to.
exportOptionsprovides GetDTD(), GetFPI(), GetStyleSheet(), and GetComments() for the document header.
rootNameis being used for root name of the root element (e.g. article) for IXMLOutStream::DocType.