
Adobe Acrobat SDK
Creating 3D Annotations
Developing Plug-ins and Applications
Setting the annotation appearance 212
The parameters to this method are:
●
The
PDEContent
object.
●
A flag indicating what type of Cos object should be created; in this case, a form XObject.
●
The
PDEContentAttrs
structure containing information about the
PDEContent
.
●
The size of the
PDEContentAttrs
structure.
●
The Cos document.
●
A pointer indicating which filters to use to encode the contents (in this case, null).
●
The resulting Cos object (in this case, the form XObject which is the variable
contentFormXObject
).
●
The resulting Cos object representing the resources needed by the Cos object. These resources can
include fonts and other items (see section 3.7.2 of the
PDF Reference
).
if (!CosObjEqual(contentFormXObject, CosNewNull()) &&
!CosObjEqual(contentResources, CosNewNull())) {
The returned resources must be put into the form XObject’s
Resources
dictionary:
CosDictPutKeyString(contentFormXObject, "Resources",
contentResources);
The
BBox
entry of the form XObject is required and is set to the value of the page’s media box:
ASFixedRect boundingBox;
PDPageGetMediaBox(pdPageImage, &boundingBox);
CosObj BBoxArray = CosNewArray(pdDocCos, 4, false);
CosArrayPut(BBoxArray,0, CosNewInteger(pdDocCos, false,
ASFixedRoundToInt16(boundingBox.left)));
CosArrayPut(BBoxArray,1, CosNewInteger(pdDocCos, false,
ASFixedRoundToInt16(boundingBox.bottom)));
CosArrayPut(BBoxArray,2, CosNewInteger(pdDocCos, false,
ASFixedRoundToInt16(boundingBox.right)));
CosArrayPut(BBoxArray,3, CosNewInteger(pdDocCos, false,
ASFixedRoundToInt16(boundingBox.top)));
CosDictPutKeyString(contentFormXObject, "BBox", BBoxArray);
// Set matrix key in form object
The
Matrix
entry of the form XObject is set to the values obtained from the page by means of the
PDPageGetDefaultMatrix
method:
ASFixedMatrix defaultMatrix;
PDPageGetDefaultMatrix(pdPageImage, &defaultMatrix);
CosObj MatrixArray = CosNewArray(pdDocCos, 6, false);
CosArrayPut(MatrixArray,0, CosNewFixed(
pdDocCos, false, defaultMatrix.a));
CosArrayPut(MatrixArray,1, CosNewFixed
(pdDocCos, false, defaultMatrix.b));
CosArrayPut(MatrixArray,2, CosNewFixed
(pdDocCos, false, defaultMatrix.c));
CosArrayPut(MatrixArray,3, CosNewFixed
(pdDocCos, false, defaultMatrix.d));
CosArrayPut(MatrixArray,4, CosNewFixed
(pdDocCos, false, defaultMatrix.h));
CosArrayPut(MatrixArray,5, CosNewFixed
(pdDocCos, false, defaultMatrix.v));