Created Date: Nov 06, 2020 17:46
Last Modifed Date: Jan 19, 2021 14:05


Introduction

Sometimes it's necessary to cast an object into a related type, to access member variables or methods that would otherwise be unavailable.

This can be useful when you have a list of base types (for example, annotations). In this scenario, the method IAnnotation::getType() will return the type of the annotation. When we know the type, we can cast the annotation instance to that type.

In this example, we know the annotation is a text annotation, and cast it appropriately.

ITextAnnotation annotation = ITextAnnotation.fromRCObject(annotation[i].toRCObject());
if (annotation.getAuthor() == "Page control annotation")
C#
ITextAnnotationPtr annotation = obj2ITextAnnotation(annotations[i]);
if (annotation->getAuthor() == "Page control annotation")
CPP

Casting in C++

Casting in C# should be fairly straightforward; however, for C++ the required header file may not be in scope. You can use the list below to find the cast you need, and the header file that defines it.

Objects with an EDL prefix (edlobj2)

Object

Code

Header file

CColorManager

edlobj2CColorManager()

cmm.cpp

CDOMAnnotationAppearance

edlobj2CDOMAnnotationAppearance()

domannotationappearance.h

CDOMAnnotationAppearanceManager

edlobj2CDOMAnnotationAppearanceManager()

domannotationappearance.h

CDOMCatalog

edlobj2CDOMCatalog()

domcatalog.h

CDOMFixedPage

edlobj2CDOMFixedPage()

dompage.h

CDOMFontOpenType

edlobj2CDOMFontOpenType()

domfontopentype.h

CDOMFontOpenTypeTT

edlobj2CDOMFontOpenTypeTT()

domfonttruetype.h

CDOMFontPCL5

edlobj2CDOMFontPCL5()

domfontpcl.h

CDOMFontPCLXL

edlobj2CDOMFontPCLXL()

domfontpcl.h

CDOMForm

edlobj2CDOMForm()

domform.h

CDOMGlyphs

edlobj2CDOMGlyphs()

domglyphs.h

CDOMJobTk

edlobj2CDOMJobTk()

domjobtk.h

CDOMOutlineEntry

edlobj2CDOMOutlineEntry()

domoutline.h

CDOMOutlineTreeNode

edlobj2CDOMOutlineTreeNode()

domoutline.h

CDOMPageAnnotationManager

edlobj2CDOMPageAnnotationManager()

domannotationmanager.h

CDOMPageManager

edlobj2CDOMPageManager()

dompagemanager.h

CDOMPointsListPathGeometry

edlobj2CDOMPointsListPathGeometry()

dompath.h

CDOMRectPathGeometry

edlobj2CDOMRectPathGeometry()

dompath.h

CEDLOutputFromEncryptedSourceMessage

edlobj2CEDLOutputFromEncryptedSourceMessage()

cedloutputfromencryptedmessage.h

CEDLXPSGetPageEvent

edlobj2CEDLXPSGetPageEvent()

edlxpsgetpageevent.h

CGDCGetMessage

edlobj2CGDCGetMessage()

gdcxpsmessages.h

ChecksummingOutputStream

edlobj2ChecksummingOutputStream()

domfontpcl5.cpp

CInputMemoryStream

edlobj2CInputMemoryStream()

cinputmemorystream.h

CPageContentsSizeAvailableMessage

edlobj2CPageContentsSizeAvailableMessage()

pagecontentssizeavailable.h

CPDFMetadataStorage

edlobj2CPDFMetadataStorage()

pdfmetadata.h

CPSExecStack

edlobj2CPSExecStack()

cpsexec.h

GlyphIDMappingStream

edlobj2GlyphIDMappingStream()

pcl5_glyph.h

IColorManager

edlobj2IColorManager()

icolormanager.h

IDOMActionArray

edlobj2IDOMActionArray()

idomtarget.h

IDOMActionLaunch

edlobj2IDOMActionLaunch()

idomtarget.h

IDOMArcSegment

edlobj2IDOMArcSegment()

idompathgeometry.h

IDOMAudioFile

edlobj2IDOMAudioFile()

idomresources.h

IDOMBrush

edlobj2IDOMBrush()

idombrush.h

IDOMCanvas

edlobj2IDOMCanvas()

idomcanvas.h

IDOMCatalog

edlobj2IDOMCatalog()

idomcatalog.h

IDOMCharPathGroup

edlobj2IDOMCharPathGroup()

idomcharpathgroup.h

IDOMColor

edlobj2IDOMColor()

idomcolor.h

IDOMColorSpace

edlobj2IDOMColorSpace()

idomcolorspace.h

IDOMColorSpaceDeviceCMYK

edlobj2IDOMColorSpaceDeviceCMYK()

idomcolorspace.h

IDOMColorSpaceDeviceGray

edlobj2IDOMColorSpaceDeviceGray()

idomcolorspace.h

IDOMColorSpaceDeviceN

edlobj2IDOMColorSpaceDeviceN()

idomcolorspace.h

IDOMColorSpaceDeviceRGB

edlobj2IDOMColorSpaceDeviceRGB()

idomcolorspace.h

IDOMColorSpaceICCBased

edlobj2IDOMColorSpaceICCBased()

idomcolorspace.h

IDOMColorSpaceIndexed

edlobj2IDOMColorSpaceIndexed()

idomcolorspace.h

IDOMColorSpaceLAB

edlobj2IDOMColorSpaceLAB()

idomcolorspace.h

IDOMColorSpacescRGB

edlobj2IDOMColorSpacescRGB()

idomcolorspace.h

IDOMColorSpacesGray

edlobj2IDOMColorSpacesGray()

idomcolorspace.h

IDOMColorSpacesRGB

edlobj2IDOMColorSpacesRGB()

idomcolorspace.h

IDOMCompositeImage

edlobj2IDOMCompositeImage()

idomimageresource.h

IDOMDePremultiplierFilter

edlobj2IDOMDePremultiplierFilter()

idomimageresource.h

IDOMDeviceNColorant

edlobj2IDOMDeviceNColorant()

idomcolorspace.h

IDOMExponentialFunction

edlobj2IDOMExponentialFunction()

idomfunction.h

IDOMExternalTarget

edlobj2IDOMExternalTarget()

idomtarget.h

IDOMFilteredImage

edlobj2IDOMFilteredImage()

idomimageresource.h

IDOMFixedPage

edlobj2IDOMFixedPage()

idompage.h

IDOMFont

edlobj2IDOMFont()

idomfont.h

IDOMFontOpenType

edlobj2IDOMFontOpenType()

idomfont.h

IDOMFontOpenTypeTT

edlobj2IDOMFontOpenTypeTT()

idomfont.h

IDOMFontPCL5

edlobj2IDOMFontPCL5()

idomfont.h

IDOMFontPCLXL

edlobj2IDOMFontPCLXL()

idomfont.h

IDOMFontSource

edlobj2IDOMFontSource()

idomfont.h

IDOMFontSourceFromStream

edlobj2IDOMFontSourceFromStream()

idomfont.h

IDOMFontSourceObfuscationConverter

edlobj2IDOMFontSourceObfuscationConverter()

idomfont.h

IDOMFontSourceStreamFilter

edlobj2IDOMFontSourceStreamFilter()

idomfont.h

IDOMForm

edlobj2IDOMForm()

idomform.h

IDOMFormInstance

edlobj2IDOMFormInstance()

idomform.h

IDOMFragment

edlobj2IDOMFragment()

domfragment.h

IDOMFunction

edlobj2IDOMFunction()

idomfunction.h

IDOMGlyph

edlobj2IDOMGlyph()

idomglyph.h

IDOMGlyphs

edlobj2IDOMGlyphs()

idomglyphs.h

IDOMGradientBrush

edlobj2IDOMGradientBrush()

idombrush.h

IDOMGradientStop

edlobj2IDOMGradientStop()

idombrush.h

IDOMGroup

edlobj2IDOMGroup()

idomgroup.h

IDOMGroupingFunction

edlobj2IDOMGroupingFunction()

idomfunction.h

IDOMHashable

edlobj2IDOMHashable()

idomhashable.h

IDOMICCProfile

edlobj2IDOMICCProfile()

idomresources.h

IDOMImage

edlobj2IDOMImage()

idomimageresource.h

IDOMImageBitScalerFilter

edlobj2IDOMImageBitScalerFilter()

idomimageresource.h

IDOMImageBleederFilter

edlobj2IDOMImageBleederFilter()

idomimageresource.h

IDOMImageBrush

edlobj2IDOMImageBrush()

idombrush.h

IDOMImageChannelSelectorFilter

edlobj2IDOMImageChannelSelectorFilter()

idomimageresource.h

IDOMImageColorConverterFilter

edlobj2IDOMImageColorConverterFilter()

idomimageresource.h

IDOMImageColorKeyFilter

edlobj2IDOMImageColorKeyFilter()

idomimageresource.h

IDOMImageColorSpaceSubstitutionFilter

edlobj2IDOMImageColorSpaceSubstitutionFilter()

idomimageresource.h

IDOMImageDecodeFilter

edlobj2IDOMImageDecodeFilter()

idomimageresource.h

IDOMImageDeindexerFilter

edlobj2IDOMImageDeindexerFilter()

idomimageresource.h

IDOMImageDeviceNToBaseFilter

edlobj2IDOMImageDeviceNToBaseFilter()

idomimageresource.h

IDOMImageDownsamplerFilter

edlobj2IDOMImageDownsamplerFilter()

idomimageresource.h

IDOMImageFilter

edlobj2IDOMImageFilter()

idomimageresource.h

IDOMImageInverterFilter

edlobj2IDOMImageInverterFilter()

idomimageresource.h

IDOMImageMaskExpanderFilter

edlobj2IDOMImageMaskExpanderFilter()

idomimageresource.h

IDOMImageMatteRemoverFilter

edlobj2IDOMImageMatteRemoverFilter()

idomimageresource.h

IDOMImageProperties

edlobj2IDOMImageProperties()

idomimageresource.h

IDOMInternalTarget

edlobj2IDOMInternalTarget()

idomtarget.h

IDOMJobTk

edlobj2IDOMJobTk()

idomjobtk.h

IDOMJobTkContent

edlobj2IDOMJobTkContent()

idomjobtk.h

IDOMJobTkGenericCharacterData

edlobj2IDOMJobTkGenericCharacterData()

idomjobtk.h

IDOMJobTkGenericNode

edlobj2IDOMJobTkGenericNode()

idomjobtk.h

IDOMJobTkNode

edlobj2IDOMJobTkNode()

idomjobtk.h

IDOMJobTkOwner

edlobj2IDOMJobTkOwner()

idomjobtk.h

IDOMJobTkValue

edlobj2IDOMJobTkValue()

idomjobtk.h

IDOMJPEGImage

edlobj2IDOMJPEGImage()

idomimageresource.h

IDOMLinearGradientBrush

edlobj2IDOMLinearGradientBrush()

idombrush.h

IDOMMaskedBrush

edlobj2IDOMMaskedBrush()

idombrush.h

IDOMMatrix

edlobj2IDOMMatrix()

idomresources.h

IDOMMCElement

edlobj2IDOMMCElement()

idommc.h

IDOMMetadata

edlobj2IDOMMetadata()

idommetadata.h

IDOMNode

edlobj2IDOMNode()

idomnode.h

IDOMNullBrush

edlobj2IDOMNullBrush()

idombrush.h

IDOMOPI

edlobj2IDOMOPI()

idomopi.h

IDOMOPI13

edlobj2IDOMOPI13()

idomopi.h

IDOMOPI20

edlobj2IDOMOPI20()

idomopi.h

IDOMOptionalContent

edlobj2IDOMOptionalContent()

idomopt.h

IDOMOptionalContentGroup

edlobj2IDOMOptionalContentGroup()

idomopt.h

IDOMOptionalContentMembership

edlobj2IDOMOptionalContentMembership()

idomopt.h

IDOMOutline

edlobj2IDOMOutline()

idomoutline.h

IDOMOutlineEntry

edlobj2IDOMOutlineEntry()

idomoutline.h

IDOMOutlineTree

edlobj2IDOMOutlineTree()

idomoutline.h

IDOMOutlineTreeNode

edlobj2IDOMOutlineTreeNode()

idomoutline.h

IDOMPage

edlobj2IDOMPage()

idompage.h

IDOMPageRectTarget

edlobj2IDOMPageRectTarget()

idomtarget.h

IDOMPageTarget

edlobj2IDOMPageTarget()

idomtarget.h

IDOMPathFigure

edlobj2IDOMPathFigure()

idompathgeometry.h

IDOMPathGeometry

edlobj2IDOMPathGeometry()

idompathgeometry.h

IDOMPathNode

edlobj2IDOMPathNode()

idompath.h

IDOMPathSegment

edlobj2IDOMPathSegment()

idompathgeometry.h

IDOMPCLImage

edlobj2IDOMPCLImage()

idomimageresource.h

IDOMPDFImage

edlobj2IDOMPDFImage()

idomimageresource.h

IDOMPDFSecurityInfo

edlobj2IDOMPDFSecurityInfo()

idomsecurity.h

IDOMPNGImage

edlobj2IDOMPNGImage()

idomimageresource.h

IDOMPolyBezierSegment

edlobj2IDOMPolyBezierSegment()

idompathgeometry.h

IDOMPolyLineSegment

edlobj2IDOMPolyLineSegment()

idompathgeometry.h

IDOMPolyQuadraticBezierSegment

edlobj2IDOMPolyQuadraticBezierSegment()

idompathgeometry.h

IDOMPostScriptCalculatorFunction

edlobj2IDOMPostScriptCalculatorFunction()

idomfunction.h

IDOMPrintTicket

edlobj2IDOMPrintTicket()

idomresources.h

IDOMRadialGradientBrush

edlobj2IDOMRadialGradientBrush()

idombrush.h

IDOMRawDataFile

edlobj2IDOMRawDataFile()

idomresources.h

IDOMRawImage

edlobj2IDOMRawImage()

idomimageresource.h

IDOMRecombineAlphaImage

edlobj2IDOMRecombineAlphaImage()

idomimageresource.h

IDOMRecombineImage

edlobj2IDOMRecombineImage()

idomimageresource.h

IDOMResource

edlobj2IDOMResource()

idomresources.h

IDOMResourceDictionary

edlobj2IDOMResourceDictionary()

idomresources.h

IDOMSampledFunction

edlobj2IDOMSampledFunction()

idomfunction.h

IDOMSecurityInfo

edlobj2IDOMSecurityInfo()

idomsecurity.h

IDOMShadingPatternBrush

edlobj2IDOMShadingPatternBrush()

idombrush.h

IDOMShadingPatternType1Brush

edlobj2IDOMShadingPatternType1Brush()

idombrush.h

IDOMShadingPatternType2Brush

edlobj2IDOMShadingPatternType2Brush()

idombrush.h

IDOMShadingPatternType3Brush

edlobj2IDOMShadingPatternType3Brush()

idombrush.h

IDOMShadingPatternType4567Brush

edlobj2IDOMShadingPatternType4567Brush()

idombrush.h

IDOMShape

edlobj2IDOMShape()

idomshape.h

IDOMSoftMaskBrush

edlobj2IDOMSoftMaskBrush()

idombrush.h

IDOMSolidColorBrush

edlobj2IDOMSolidColorBrush()

idombrush.h

IDOMStandardPDFSecurityInfo

edlobj2IDOMStandardPDFSecurityInfo()

idomsecurity.h

IDOMStitchingFunction

edlobj2IDOMStitchingFunction()

idomfunction.h

IDOMTarget

edlobj2IDOMTarget()

idomtarget.h

IDOMTIFFImage

edlobj2IDOMTIFFImage()

idomimageresource.h

IDOMTile

edlobj2IDOMTile()

domfragment.h

IDOMTilingPatternBrush

edlobj2IDOMTilingPatternBrush()

idombrush.h

IDOMTransformableBrush

edlobj2IDOMTransformableBrush()

idombrush.h

IDOMTransparencyGroup

edlobj2IDOMTransparencyGroup()

idomgroup.h

IDOMType3Font

edlobj2IDOMType3Font()

idomfont.h

IDOMVisualBrush

edlobj2IDOMVisualBrush()

idombrush.h

IDOMVisualRoot

edlobj2IDOMVisualRoot()

idombrush.h

IDOMWMPImage

edlobj2IDOMWMPImage()

idomimageresource.h

IEDLFontSystemFont

edlobj2IEDLFontSystemFont()

idomfont.h

IEDLNamespace

edlobj2IEDLNamespace()

edlqname.h

IEDLStream

edlobj2IEDLStream()

edlstream.h

IEDLTempStore

edlobj2IEDLTempStore()

iedltempstore.h

IEDLTime

edlobj2IEDLTime()

edltime.h

IFileSpec

edlobj2IFileSpec()

ifilespec.h

IFileSpecAsEmbeddedData

edlobj2IFileSpecAsEmbeddedData()

ifilespec.h

IFileSpecAsFileReference

edlobj2IFileSpecAsFileReference()

ifilespec.h

IFileSpecAsUrl

edlobj2IFileSpecAsUrl()

ifilespec.h

IFontHeaderWriteSegmentBlockEnumerator

edlobj2IFontHeaderWriteSegmentBlockEnumerator()

idomfont.h

IFontLibrary

edlobj2IFontLibrary()

libfont.h

IFontOpenTypeTableAccessor

edlobj2IFontOpenTypeTableAccessor()

idomfont.h

IFontPCL5TrueTypeGlyphAccessor

edlobj2IFontPCL5TrueTypeGlyphAccessor()

idomfont.h

IFontPCL5WriteSegmentBlockEnumerator

edlobj2IFontPCL5WriteSegmentBlockEnumerator()

idomfont.h

IFontPCLXLTrueTypeGlyphAccessor

edlobj2IFontPCLXLTrueTypeGlyphAccessor()

idomfont.h

IFontTrueTypeGlyphAccessor

edlobj2IFontTrueTypeGlyphAccessor()

idomfont.h

IImageFrame

edlobj2IImageFrame()

iimagecodec.h

IInputPushbackStream

edlobj2IInputPushbackStream()

edlstream.h

IInputStream

edlobj2IInputStream()

edlstream.h

IOutputStream

edlobj2IOutputStream()

edlstream.h

IPDFStream

edlobj2IPDFStream()

cpsobjects.h

IPSArray

edlobj2IPSArray()

cpsobjects.h

IPSBoolean

edlobj2IPSBoolean()

cpsobjects.h

IPSDictionary

edlobj2IPSDictionary()

cpsobjects.h

IPSFarReference

edlobj2IPSFarReference()

cpsobjects.h

IPSInteger

edlobj2IPSInteger()

cpsobjects.h

IPSName

edlobj2IPSName()

cpsobjects.h

IPSNull

edlobj2IPSNull()

cpsobjects.h

IPSObject

edlobj2IPSObject()

cpsobjects.h

IPSObjectExec

edlobj2IPSObjectExec()

cpsexec.h

IPSOperator

edlobj2IPSOperator()

cpsobjects.h

IPSReal

edlobj2IPSReal()

cpsobjects.h

IPSReference

edlobj2IPSReference()

cpsobjects.h

IPSString

edlobj2IPSString()

cpsobjects.h

IRAInputOutputStream

edlobj2IRAInputOutputStream()

edlstream.h

IRAInputPushbackStream

edlobj2IRAInputPushbackStream()

edlstream.h

IRAInputStream

edlobj2IRAInputStream()

edlstream.h

IRAOutputStream

edlobj2IRAOutputStream()

edlstream.h

IRunnable

edlobj2IRunnable()

isession.h

ISession

edlobj2ISession()

isession.h

Objects without an EDL prefix (obj2)

Object

Code

Header file

CAnnotationReference

obj2CAnnotationReference(obj)

pdfobjects.h

CCITTFaxParams

obj2CCITTFaxParams(obj)

idomimageresource.h

CDomFormDvInstance

obj2CDomFormDvInstance(obj)

domdv.h

CDomPatternDvInstance

obj2CDomPatternDvInstance(obj)

domdv.h

COptionalContentGroupReference

obj2COptionalContentGroupReference(obj)

pdfobjects.h

CPageLayout

obj2CPageLayout(obj)

pagelayout.cpp

CStructureElementReference

obj2CStructureElementReference(obj)

pdfobjects.h

CStructureElementReferenceChild

obj2CStructureElementReferenceChild(obj)

pdfobjects-structure.cpp

CStructureMarkedContentReferenceChild

obj2CStructureMarkedContentReferenceChild(obj)

pdfobjects-structure.cpp

CStructureObjectReferenceChild

obj2CStructureObjectReferenceChild(obj)

pdfobjects-structure.cpp

DCTParams

obj2DCTParams(obj)

idomimageresource.h

FlateLZWParams

obj2FlateLZWParams(obj)

idomimageresource.h

IAnnotationPrivate

obj2IAnnotationPrivate(obj)

pdfobjects.h

ICaretAnnotation

obj2ICaretAnnotation(obj)

interactive.h

IDomDvAnnotationAppearanceState

obj2IDomDvAnnotationAppearanceState(obj)

domdv.h

IDomDvClipState

obj2IDomDvClipState(obj)

domdv.h

IDomDvGState

obj2IDomDvGState(obj)

domdv.h

IDomDvMarkedContentState

obj2IDomDvMarkedContentState(obj)

domdv.h

IDomDvTextState

obj2IDomDvTextState(obj)

domdv.h

IDomDvTransGroupState

obj2IDomDvTransGroupState(obj)

domdv.h

IFormFieldPrivate

obj2IFormFieldPrivate(obj)

pdfobjects.h

IFormPrivate

obj2IFormPrivate(obj)

pdfobjects.h

IFreeTextAnnotation

obj2IFreeTextAnnotation(obj)

interactive.h

IInkAnnotation

obj2IInkAnnotation(obj)

interactive.h

ILineAnnotation

obj2ILineAnnotation(obj)

interactive.h

ILinkAnnotation

obj2ILinkAnnotation(obj)

interactive.h

IMarkedContentArtifactDetails

obj2IMarkedContentArtifactDetails(obj)

structure.h

IMarkedContentStructureDetails

obj2IMarkedContentStructureDetails(obj)

structure.h

IMarkupAnnotation

obj2IMarkupAnnotation(obj)

interactive.h

IOptionalContentPrivate

obj2IOptionalContentPrivate(obj)

pdfobjects.h

IPCL5Output

obj2IPCL5Output(obj)

pcl5output.h

IPCLXLInput

obj2IPCLXLInput(obj)

pclxlinput.h

IPCLXLOutput

obj2IPCLXLOutput(obj)

pclxloutput.h

IPDFInput

obj2IPDFInput(obj)

pdfinput.h

IPDFObjectsWrapper

obj2IPDFObjectsWrapper(obj)

pdfobjects.h

IPDFOutput

obj2IPDFOutput(obj)

pdfoutput.h

IPolyAnnotation

obj2IPolyAnnotation(obj)

interactive.h

IPopupAnnotation

obj2IPopupAnnotation(obj)

interactive.h

IPSOutput

obj2IPSOutput(obj)

psoutput.h

IRedactionAnnotation

obj2IRedactionAnnotation(obj)

interactive.h

IShapeAnnotation

obj2IShapeAnnotation(obj)

interactive.h

ISoundAnnotation

obj2ISoundAnnotation(obj)

interactive.h

IStampAnnotation

obj2IStampAnnotation(obj)

interactive.h

IStructureElementPrivate

obj2IStructureElementPrivate(obj)

pdfobjects.h

IStructureElementReferenceChild

obj2IStructureElementReferenceChild(obj)

structure.h

IStructureMarkedContentReference

obj2IStructureMarkedContentReference(obj)

structure.h

IStructureMarkedContentReferenceChildPrivate

obj2IStructureMarkedContentReferenceChildPrivate(obj)

pdfobjects.h

IStructureObjectReferenceChild

obj2IStructureObjectReferenceChild(obj)

structure.h

IStructureObjectReferenceChildPrivate

obj2IStructureObjectReferenceChildPrivate(obj)

pdfobjects.h

IStructurePrivate

obj2IStructurePrivate(obj)

pdfobjects.h

ITextAnnotation

obj2ITextAnnotation(obj)

interactive.h

ITextMarkupAnnotation

obj2ITextMarkupAnnotation(obj)

interactive.h

IWidgetAnnotation

obj2IWidgetAnnotation(obj)

interactive.h

IXPSFixedDocumentPart

obj2IXPSFixedDocumentPart(obj)

xpspackage.h

IXPSFixedPagePart

obj2IXPSFixedPagePart(obj)

xpspackage.h

IXPSInput

obj2IXPSInput(obj)

xpsinput.h

IXPSOutput

obj2IXPSOutput(obj)

xpsoutput.h

JBIG2Params

obj2JBIG2Params(obj)

idomimageresource.h