
Adobe Acrobat SDK
Working with Page Views and Contents
Developing Plug-ins and Applications
Modifying text elements 129
●
The address of an
ASFixed
object whose elements specify the length of dashes and gaps. You can
specify
NULL
to draw a solid outline.
●
An
AVTArraySize
object that specifies the number of elements in the
ASFixed
object. This value
is ignored if you specified
Null
as the previous argument. As a result, you can specify
0
for this
argument. The maximum allowed number of elements is currently 10.
The following code example modifies page contents by placing a red border around text elements and
places a blue border around other elements that are located within a
PDEContent
object.
Example 10.5
Modifying page contents
//Declare objects used in this code example
PDEElement pdeElement;
ASFixedRect bbox;
AVRect rect;
PDColorValueRec red, blue;
//Define red
red.space = PDDeviceRGB;
red.value[0] = ASInt32ToFixed(1);
red.value[1] = 0;
red.value[2] = 0;
//Define blue
blue.space = PDDeviceRGB;
blue.value[0] = 0;
blue.value[1] = 0;
blue.value[2] = ASInt32ToFixed(1);
//Create a PDEContent object based on the current page view
AVDoc avDoc = AVAppGetActiveDoc();
AVPageView pageView = AVDocGetPageView(avDoc);
PDPageNumber pageNum = AVPageViewGetPageNum(pageView);
PDDoc pdDoc = AVDocGetPDDoc(avDoc);
PDPage pdPage = PDDocAcquirePage(pdDoc, pageNum);
PDEContent pdeContent = PDPageAcquirePDEContent(pdPage, gExtensionID);
//Get the number of elements located in the PDEContent object
ASInt32 eleNum = PDEContentGetNumElems(pdeContent);
//Retrieve each element in the PDEContent object
for (int j=0; j < eleNum; j++){
//Get a specific element
pdeElement = PDEContentGetElem(pdeContent, j);
//Determine if the object is of type text
if (PDEObjectGetType((PDEObject) pdeElement) == kPDEText){
//Get the number of text runs in the text element
int numTextRuns = PDETextGetNumRuns((PDEText) pdeElement);
//Assign red to the page view
AVPageViewSetColor(pageView, &red);