LayerPDFEdit_Layer
ObjectPDEContent

The PDEContent object is the workhorse of the PDFEdit API, since it contains the modifiable contents of a PDPage.

A PDEContent may be obtained from an existing page or from a form XObject or from a Type 3 charproc. You can create an empty PDEContent. A PDEContent contains PDEElement objects. In addition, a PDEContent may have attributes such as Form matrix and setcachedevice parameters.

The simplest way to obtain the PDEContent for a page is with the PDPageAcquirePDEContent() method. After your plug-in modifies the content, it can put it back in the page with PDPageSetPDEContent(), using the same filters with which the page was originally encoded.

Once your plug-in has the page's PDEContent, it can get, add, or remove elements with PDEContent methods. It can modify individual page elements with the methods for PDEElement objects such as PDEText or PDEPath.



Typedef Summary
 Typedef
 PDEContent
Contains the modifiable contents of a PDPage. A PDEContent object may be obtained from an existing page, from a Form XObject, or from a Type 3 CharProc. You can create an empty PDEContent object. A PDEContent object contains PDEElement objects. In addition, a PDEContent object may have attributes such as a Form matrix and setcachedevice parameters.
 PDEContentAttrs
 PDEContentAttrsP
Enumeration Summary
 Enumeration
  PDEContentFlags
A bit field for PDEContentAttrs.
  PDEContentGetResourceFlags
A bit field for PDEContentAttrs.
  PDEContentToCosObjFlags
A bit field for the PDEContentToCosObj() method, indicating the type of object to create and how it is created.
Structure Summary
 Structure
 _t_PDEContentAttrs
A structure describing attributes of a PDEContent object.
Method Summary
 Method
 
void PDEContentAddElem(INPDEContent pdeContent, INASInt32 addAfterIndex, INPDEElement pdeElement)
Inserts an element into a PDEContent.
 
void PDEContentAddPage(OUTPDEContent theContent, INASInt32 insertAfterIndex, INCosDoc containerDoc, INPDPage srcPage, INASFixedMatrix* dstMatrix, INASAtom annotTypes, INASInt32 flags, INASFixedRect* bbox)
Superseded by PDEContentAddPageEx() in Acrobat 10.0.
 
void PDEContentAddPageEx(OUTPDEContent theContent, INASInt32 insertAfterIndex, INCosDoc containerDoc, INPDPage srcPage, INASDoubleMatrix* dstMatrix, INASAtom annotTypes, INASInt32 flags, INASDoubleRect* bbox)
Supersedes PDEContentAddPage() in Acrobat 10.0.
 
PDEContent PDEContentCreate()
Creates an empty content object.
 
PDEContent PDEContentCreateFromCosObj(const CosObj* contents, const CosObj* resources)
Creates a content object from a Cos object. This is the main method for obtaining a PDEContent object.
 
ASBool PDEContentFlattenOC(PDEContent content, PDOCContext context)
Flattens the content, removing any PDEElement objects that are not visible in the given optional-content context, and removing the optional-content information from any visible PDFElement objects.
 
void PDEContentGetAttrs(INPDEContent pdeContent, OUTPDEContentAttrsP attrsP, INASUns32 attrsSize)
Gets the attributes of a content.
 
PDEColorSpace PDEContentGetDefaultColorSpace(INPDEContent pdeContent, INASAtom colorSpaceName)
Gets a default color space from a PDEContent object.
 
PDEElement PDEContentGetElem(INPDEContent pdeContent, INASInt32 index)
Gets the requested element from a content.
 
ASInt32 PDEContentGetNumElems(INPDEContent pdeContent)
Gets the number of elements in a PDEContent object.
 
ASInt32 PDEContentGetResources(INPDEContent pdeContent, INASInt32 type, OUTPDEObject* resourcesP)
Gets the number of resources of the specified type and, optionally, gets the pointers to the resource objects.
 
void PDEContentRemoveElem(INPDEContent pdeContent, INASInt32 index)
Removes an element from a PDEContent.
 
void PDEContentSetContainingStream(INPDEContent pdeContent, INCosObj containingStm)
Sets the containing stream and owner stream for any marked content reference handles attached to containers within the content.
 
void PDEContentSetDefaultColorSpace_PEWCalls_(INPDEContent pdeContent, INASAtom colorSpaceName, INPDEColorSpace colorSpace)
Sets the default color space in a PDEContent object. The reference count on any existing default color space is decremented, and the reference count on the new color space is incremented. Note that the new color space can be NULL, indicating that there is no default color space.
 
void PDEContentSetPage(INPDEContent pdeContent, INCosObj pageObj)
Sets the page on which marked content is drawn upon for any marked content reference handles attached to containers within the content.
 
void PDEContentSetStreamOwner(INPDEContent pdeContent, INCosObj streamOwner)
Sets the stream owner for any marked content reference handles attached to containers within the content.
 
void PDEContentToCosObj(INPDEContent pdeContent, INASUns32 flags, INPDEContentAttrsP attrs, INASUns32 attrsSize, INCosDoc cosDoc, INPDEFilterArrayP filtersP, OUTCosObj* contentsP, OUTCosObj* resourcesP)
This is the main method for converting a PDEContent into PDF contents and resources.

Typedefs Detail
PDEContent 
Product availability: All
Platform availability: All

Syntax

typedef struct _t_PDEContent* PDEContent;

Contains the modifiable contents of a PDPage. A PDEContent object may be obtained from an existing page, from a Form XObject, or from a Type 3 CharProc. You can create an empty PDEContent object. A PDEContent object contains PDEElement objects. In addition, a PDEContent object may have attributes such as a Form matrix and setcachedevice parameters.

See Also


File: PEExpT.h
Line: 119
PDEContentAttrs 
Product availability: All
Platform availability: All

Syntax

typedef _t_PDEContentAttrs PDEContentAttrs;

File: PEExpT.h
Line: 497
PDEContentAttrsP 
Product availability: All
Platform availability: All

Syntax

typedef _t_PDEContentAttrs PDEContentAttrsP;

File: PEExpT.h
Line: 497

Enumeration Detail
PDEContentFlags
Product availability: All
Platform availability: All

Syntax

enum PDEContentFlags {
 kPDESetCacheDevice = 0x0001,
 
 kPDESetCharWidth = 0x0002,
 
 kPDEFormMatrix = 0x0004
}

See Also


File: PEExpT.h
Line: 1522

Elements
kPDESetCacheDevice  

If set, cacheDevice contains 6 cache device values.

 
kPDESetCharWidth  

If set, cacheDevice contains 2 charwidth values.

 
kPDEFormMatrix  

If set, formMatrix contains a valid matrix.

PDEContentGetResourceFlags 
Product availability: All
Platform availability: All

Syntax

enum PDEContentGetResourceFlags {
 kPDEGetFonts,
 
 kPDEGetXObjects,
 
 kPDEGetColorSpaces
}

See Also


File: PEExpT.h
Line: 1503

Elements
kPDEGetFonts  

Obtain font resources.

 
kPDEGetXObjects  

Obtain Xobject resources.

 
kPDEGetColorSpaces  

Obtain color space resources.

PDEContentToCosObjFlags 
Product availability: All
Platform availability: All

Syntax

enum PDEContentToCosObjFlags {
 kPDEContentToPage = 0x0001,
 
 kPDEContentToForm = 0x0002,
 
 kPDEContentToCharProc = 0x0004,
 
 kPDEContentRev1Compat = 0x0008,
 
 kPDEContentDoNotResolveForms = 0x0010,
 
 kPDEContentDoNotResolveType3 = 0x0020,
 
 kPDEContentEmitDefaultRGBAndGray = 0x0040,
 
 kPDEContentInheritState = 0x0080,
 
 kPDEContentDoNotEmitBXEX = 0x0100,
 
 kPDEContentUseMaxPrecision = 0x0200,
 
 kPDEContentUseSpaceAsEOL = 0x0400,
 
 kPDEContentHonorWasSetFlags = 0x0800
}

See Also


File: PEExpT.h
Line: 1438

Elements
kPDEContentToPage  

Create page contents.

 
kPDEContentToForm  

Create a form.

 
kPDEContentToCharProc  

Create charprocs.

 
kPDEContentRev1Compat  

Currently unused.

 
kPDEContentDoNotResolveForms  

Currently unused.

 
kPDEContentDoNotResolveType3  

Currently unused.

 
kPDEContentEmitDefaultRGBAndGray  

Emit calibrated RGB and gray information using the PDF 1.0 compatible mechanism. In this case, generate rg and k page operators and place DefaultGray and DefaultRGB color space arrays in the Resources dictionary, as described in Section 4.5.7 in the PDF Reference.

 
kPDEContentDoNotEmitBXEX  

Prevents the emission of the content compatibility operators, BX/EX, which cause issues for some versions of PDF/A or PDF/X.

 
kPDEContentUseSpaceAsEOL  

Use a space character as the EOL character in the content stream to make the Flate compressor more effective.

 
kPDEContentHonorWasSetFlags  

Emit a gstate or textstate parameter for any element, only if the corresponding WasSetFlag is set. Settting this flag will skip setting the bounding box of form XObject.


Structure Detail
_t_PDEContentAttrs
Product availability: All
Platform availability: All

Syntax

struct _t_PDEContentAttrs {
 ASUns32 flags; 
 
 ASFixed cacheDevice[8]; 
 
 ASInt32 formType; 
 
 ASFixedRect bbox; 
 
 ASFixedMatrix matrix; 
 
 CosObj XUID; 
}

A structure describing attributes of a PDEContent object.

See Also


File: PEExpT.h
Line: 458

Elements
flags  

PDEContentFlags

 
cacheDevice  

If flags has kPDESetCacheDevice set, the first six cache device values contain the operands for the d1 (setcachedevice) page operator. If flags has kPDESetCacheDevice set, cacheDevice contains two charwidth values.

 
formType  

Only used if PDEContent contains a Form XObject. It corresponds to FormType key in the XObject Form attributes dictionary.

 
bbox  

Only used if PDEContent contains a Form. It is the bounding box of the PDEContent object. It corresponds to the BBox key in the XObject Form attributes dictionary.

 
matrix  

Only used if PDEContent contains a Form. It is the transformation matrix for the PDEContent object. It corresponds to the Matrix key in the XObject Form attributes dictionary.

 
XUID  

Only used if PDEContent contains a Form. It is the form's XUID, which is an ID that uniquely identifies the form. It corresponds to the XUID key in the XObject Form attributes dictionary.


Method Detail
PDEContentAddElem()
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void PDEContentAddElem(INPDEContent pdeContent, INASInt32 addAfterIndex, INPDEElement pdeElement)

Inserts an element into a PDEContent.

Parameters

pdeContent — 

The content to which pdeElement is added.

 
addAfterIndex — 

The location after which pdeElement is added. It should be kPDEBeforeFirst to add to the beginning of the display list.

 
pdeElement — 

The element to add to pdeContent. The reference count of pdeElement is incremented.

See Also

Exceptions

peErrWrongPDEObjectType
genErrBadParm

Since


File: PEWProcs.h
Line: 149
PDEContentAddPage() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void PDEContentAddPage(OUTPDEContent theContent, INASInt32 insertAfterIndex, INCosDoc containerDoc, INPDPage srcPage, INASFixedMatrix* dstMatrix, INASAtom annotTypes, INASInt32 flags, INASFixedRect* bbox)

Superseded by PDEContentAddPageEx() in Acrobat 10.0.

Adds the specfied PDPage to the PDEContent as an Xobject form. It adds a reference to the Xobject form at the indicated index in the PDE Content; the index may be less than 0, which indicates the object is to be appended to the content.

Parameters

theContent — 

The content to set for the page.

 
insertAfterIndex — 

The index indicates the location after which the specified element is to be added. The index should be kPDBeforeFirst to add to the beginning of the display list.

 
containerDoc — 

The CosDoc in which the page is contained.

 
srcPage — 

The page that will be inserted at insertAfterIndex in theContent.

 
dstMatrix — 

(May be NULL) The matrix applied to the default matrix of the PDPage that is inserted into the CosDoc.

 
annotTypes — 

If the page contains annotations, the annotTypes list is used to determine which annotation types are pumped into the page contents of the CosDoc.

 
flags — 

(May be 0) kAnnotAll specifies all annotation types. If this is not set, then the annotTypes list will be consulted.

 
bbox — 

(May be NULL) specifies the destination BBox for the page being inserted. If it is NULL, the new page's media box is used.

See Also

Since


File: PEWProcs.h
Line: 1777
PDEContentAddPageEx() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void PDEContentAddPageEx(OUTPDEContent theContent, INASInt32 insertAfterIndex, INCosDoc containerDoc, INPDPage srcPage, INASDoubleMatrix* dstMatrix, INASAtom annotTypes, INASInt32 flags, INASDoubleRect* bbox)

Supersedes PDEContentAddPage() in Acrobat 10.0.

Adds the specfied PDPage to the PDEContent as an Xobject form. It adds a reference to the Xobject form at the indicated index in the PDE Content; the index may be less than 0, which indicates the object is to be appended to the content.

Parameters

theContent — 

The content to set for the page.

 
insertAfterIndex — 

The index indicates the location after which the specified element is to be added. The index should be kPDBeforeFirst to add to the beginning of the display list.

 
containerDoc — 

The CosDoc in which the page is contained.

 
srcPage — 

The page that will be inserted at insertAfterIndex in theContent.

 
dstMatrix — 

(May be NULL) The matrix applied to the default matrix of the PDPage that is inserted into the CosDoc.

 
annotTypes — 

If the page contains annotations, the annotTypes list is used to determine which annotation types are pumped into the page contents of the CosDoc.

 
flags — 

(May be 0) kAnnotAll specifies all annotation types. If this is not set, then the annotTypes list will be consulted.

 
bbox — 

(May be NULL) specifies the destination BBox for the page being inserted. If it is NULL, the new page's media box is used.

See Also

Since


File: PEWProcs.h
Line: 3639
PDEContentCreate() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

PDEContent PDEContentCreate()

Creates an empty content object.

Call PDERelease() to dispose of the returned content object when finished with it.

Returns

An empty content object.

See Also

PDEContentCreateFromCosObj
PDPageAcquirePDEContent

Exceptions

peErrPStackUnderflow

Since


File: PEWProcs.h
Line: 49
PDEContentCreateFromCosObj() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

PDEContent PDEContentCreateFromCosObj(const CosObj* contents, const CosObj* resources)

Creates a content object from a Cos object. This is the main method for obtaining a PDEContent object.

Call PDERelease() to dispose of the returned content object when finished with it.

Parameters

contents — 

IN/OUT A Cos object that is the source for the content. It may be page contents, a Form XObject, a Type 3 font CharProc, or an appearance dictionary for an annotation.

 
resources — 

IN/OUT The object's Resources dictionary. If the Form or Type 3 font or appearance dictionary contains a Resources dictionary, this dictionary must be passed in resources. Otherwise, it must be the page resources object of the page containing the Form or Type 3 font contents object.

Returns

The content from the Cos object.

See Also

Exceptions

pdErrOpNotPermitted
peErrPStackUnderflow

Since


File: PERProcs.h
Line: 111
PDEContentFlattenOC() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

ASBool PDEContentFlattenOC(PDEContent content, PDOCContext context)

Flattens the content, removing any PDEElement objects that are not visible in the given optional-content context, and removing the optional-content information from any visible PDFElement objects.

Parameters

content — 

The content to be modified.

 
context — 

The optional-content context in which content is checked for visibility.

Returns

true if the operation is successful, false otherwise.

See Also


File: PEWProcs.h
Line: 2570
PDEContentGetAttrs() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void PDEContentGetAttrs(INPDEContent pdeContent, OUTPDEContentAttrsP attrsP, INASUns32 attrsSize)

Gets the attributes of a content.

Parameters

pdeContent — 

IN/OUT A content object.

 
attrsP — 

IN/OUT (Filled by the method) A pointer to a PDEContentAttrs structure containing the attributes of the content.

 
attrsSize — 

IN/OUT The size of the attrsP buffer in bytes.

Exceptions

peErrWrongPDEObjectType

Since


File: PERProcs.h
Line: 126
PDEContentGetDefaultColorSpace() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

PDEColorSpace PDEContentGetDefaultColorSpace(INPDEContent pdeContent, INASAtom colorSpaceName)

Gets a default color space from a PDEContent object.

See Section 4.5.4 in the PDF Reference for more information about default color spaces.

Parameters

pdeContent — 

IN/OUT A content object.

 
colorSpaceName — 

IN/OUT An ASAtom for the name of the desired color space. It must be an ASAtom for one of DefaultRGB, DefaultCMYK, or DefaultGray.

Returns

The desired color space in pdeContent. It returns NULL if colorSpaceName does not correspond to a known default, such as DefaultRGB.

See Also

Since


File: PERProcs.h
Line: 2018
PDEContentGetElem() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

PDEElement PDEContentGetElem(INPDEContent pdeContent, INASInt32 index)

Gets the requested element from a content.

Parameters

pdeContent — 

IN/OUT A content object.

 
index — 

IN/OUT The index of element to obtain.

Returns

The requested element.

See Also

Exceptions

peErrWrongPDEObjectType

Since


File: PERProcs.h
Line: 182
PDEContentGetNumElems() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

ASInt32 PDEContentGetNumElems(INPDEContent pdeContent)

Gets the number of elements in a PDEContent object.

Parameters

pdeContent — 

IN/OUT A content object.

Returns

The number of elements in pdeContent.

See Also

Exceptions

peErrWrongPDEObjectType

Since


File: PERProcs.h
Line: 163
PDEContentGetResources() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

ASInt32 PDEContentGetResources(INPDEContent pdeContent, INASInt32 type, OUTPDEObject* resourcesP)

Gets the number of resources of the specified type and, optionally, gets the pointers to the resource objects.

Parameters

pdeContent — 

IN/OUT A content object.

 
type — 

IN/OUT The type of resources to query or obtain: PDEFont, PDEXGroup, or PDEColorSpace. It must be one of PDEContentGetResourceFlags.

 
resourcesP — 

IN/OUT (Filled by the method) If non-NULL, it must point to an array of PDEObject pointers. On return, the array contains pointers to the requested resources. If resourcesP is NULL, only the number of resources of type is returned. Note that the object in resourcesP may only be valid for this method. Use PDEAcquire() if you need to hold on to the object longer than the scope of resourcesP.

Returns

The number of resources of type returned in resourcesP.

Exceptions

peErrWrongPDEObjectType
genErrBadParm

Since


File: PERProcs.h
Line: 151
PDEContentRemoveElem() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void PDEContentRemoveElem(INPDEContent pdeContent, INASInt32 index)

Removes an element from a PDEContent.

Parameters

pdeContent — 

IN/OUT A content object.

 
index — 

IN/OUT The index in pdeContent of the element to remove whose reference count is decremented.

See Also

Exceptions

peErrWrongPDEObjectType

Since


File: PEWProcs.h
Line: 125
PDEContentSetContainingStream() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void PDEContentSetContainingStream(INPDEContent pdeContent, INCosObj containingStm)

Sets the containing stream and owner stream for any marked content reference handles attached to containers within the content.

Parameters

pdeContent — 

The content stream within which to update marked content references.

 
containingStm — 

The containing stream object for the content stream.

See Also

Since


File: PEWProcs.h
Line: 3025
PDEContentSetDefaultColorSpace_PEWCalls_() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void PDEContentSetDefaultColorSpace_PEWCalls_(INPDEContent pdeContent, INASAtom colorSpaceName, INPDEColorSpace colorSpace)

Sets the default color space in a PDEContent object. The reference count on any existing default color space is decremented, and the reference count on the new color space is incremented. Note that the new color space can be NULL, indicating that there is no default color space.

See Section 4.5.4 in the PDF Reference for more information about default color spaces.

Parameters

pdeContent — 

IN A content object.

 
colorSpaceName — 

IN An ASAtom for the name of the desired color space. It must be an ASAtom for one of the following:

  • DefaultRGB

  • DefaultCMYK

  • DefaultGray

 
colorSpace — 

IN The color space to use as the default.

Since


File: PEWProcs.h
Line: 3478
PDEContentSetPage() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void PDEContentSetPage(INPDEContent pdeContent, INCosObj pageObj)

Sets the page on which marked content is drawn upon for any marked content reference handles attached to containers within the content.

Parameters

pdeContent — 

The content stream whose marked content reference handles should be updated.

 
pageObj — 

The page object upon which contents are drawn.

See Also

Since


File: PEWProcs.h
Line: 3004
PDEContentSetStreamOwner() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void PDEContentSetStreamOwner(INPDEContent pdeContent, INCosObj streamOwner)

Sets the stream owner for any marked content reference handles attached to containers within the content.

Parameters

pdeContent — 

The content stream within which to update marked content references.

 
streamOwner — 

The owner object for any references attached to the content.

See Also

Since


File: PEWProcs.h
Line: 3045
PDEContentToCosObj() 
Product availability: Acrobat, PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void PDEContentToCosObj(INPDEContent pdeContent, INASUns32 flags, INPDEContentAttrsP attrs, INASUns32 attrsSize, INCosDoc cosDoc, INPDEFilterArrayP filtersP, OUTCosObj* contentsP, OUTCosObj* resourcesP)

This is the main method for converting a PDEContent into PDF contents and resources.

This method does not change the PDEContent object or its reference count.

The caller of this function is responsible for adding the contents and the resources returned from this method to the Page Object.

Parameters

pdeContent — 

IN/OUT A content object.

 
flags — 

IN/OUT Flags specifying the type of object to create (page contents, form, or charproc) and how it is created. It must be one or more of PDEContentToCosObjFlags.

 
attrs — 

IN/OUT A pointer to a PDEContentAttrs structure that contains the appropriate form attributes or cache device/char-width attributes, and so on. If it is zero, no attributes are set.

 
attrsSize — 

IN/OUT The size of the attrs buffer in bytes. Zero if attrs is zero.

 
cosDoc — 

IN/OUT The document in which the contents and resources are created.

 
filtersP — 

IN/OUT A pointer to a PDEFilterArray structure that specifies which filters to use in encoding the contents; it may be NULL. If filtersP contains any encodeParms, they must belong to cosDoc.

 
contentsP — 

IN/OUT (Filled by the method) The Cos object for the resulting contents in pdeContent.

 
resourcesP — 

IN/OUT (Filled by the method) The Cos object for the resulting resources in pdeContent. Note that the client is responsible for putting the resourcesP dictionary into the contentsP stream for non-page objects. The client must do this for XObject Forms and appearance dictionaries in annotations. For Type 3 fonts, the resource dictionaries must be merged and put into the Type 3 font dictionary. For a page, the contents and resources must be put into the page object.

See Also

Exceptions

peErrUnknownResType
pageErrErrorParsingImage
pdErrBadResMetrics
peErrWrongPDEObjectType
peErrUnknownPDEColorSpace

Since


File: PEWProcs.h
Line: 108