Example 10.5 Modifying Page Contents - Adobe ACROBAT SDK 8.1 Manual

Developing plug-ins and applications
Table of Contents

Advertisement

Adobe Acrobat SDK
Developing Plug-ins and Applications
The address of an
specify
An
is ignored if you specified
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

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);
ASFixed
to draw a solid outline.
NULL
object that specifies the number of elements in the
AVTArraySize
Null
object whose elements specify the length of dashes and gaps. You can
as the previous argument. As a result, you can specify
Working with Page Views and Contents
Modifying text elements
object. This value
ASFixed
object.
PDEContent
129
for this
0

Advertisement

Table of Contents
loading

Table of Contents