-
December 13th, 2007, 09:21 AM
#1
Adobe Plugin Question.
I'm writing an adobe plugin that is searching through pdf's for text that has the annotation strikeout.
I can find the annotation, but it selects text that is above and blow the text that has the strikeout.
I know PDF works in blocks, I was wondering, when I retrieve the block and the text in the block is there a way to determine what text in the block has the annotation?
Code so far :-
Code:
for (int iPageCount = 0; iPageCount < iNumPages; iPageCount++)
{
//Aquire each page in the document in each round of the loop
PDPage thisPDPage = PDDocAcquirePage (thisPDDoc, iPageCount);
//Aquire PDEContent object for the page
PDEContent thisPDEContent = PDPageAcquirePDEContent(thisPDPage, gExtensionID);
//Loop through the number of annotations on the page
for (int iAnnotCount = 0; iAnnotCount < PDPageGetNumAnnots(thisPDPage); iAnnotCount++)
{
//We are only interested in annotations of type 'Strikout' as these are the annotations to be redacted
PDAnnot thisPDAnnot = PDPageGetAnnot (thisPDPage, iAnnotCount);
if(PDAnnotIsValid(thisPDAnnot) && PDAnnotGetSubtype(thisPDAnnot) == ASAtomFromString("StrikeOut"))
{
ASFixedRect thisASFixedRect;
//Get the Rectangle points for the Annotated text.
PDAnnotGetRect(thisPDAnnot, &thisASFixedRect);
//Retrieve the text from inside the rectangle.
PDTextSelect thisPDTextSelect = PDDocCreateTextSelect(thisPDDoc, iPageCount, &thisASFixedRect);
// Enumerate the text to build the linked list of words
if (thisPDTextSelect)
{
FRSelection selection;
FRSelectionContext context;
// Initialise the selection
selection.numWords = 0;
// ISSUE 5591 REWORK JP 11/01/2006 Initialise pointer
selection.words = NULL;
// Initialise the context for the text selection processing
context.pageView = pageView;
context.selection = &selection;
context.currentWord = NULL;
context.wordListTail = &context.selection->words;
PDTextSelectEnumText (thisPDTextSelect, ASCallbackCreateProto (PDTextSelectEnumTextProc, &PDTextSelectEnumTextCB), &context);
// Reset the current row/word pointers to the head of the linked list
context.currentWord = context.selection->words;
// Enumerate the quads and assigne them to words
PDTextSelectEnumQuads (thisPDTextSelect, ASCallbackCreateProto (PDTextSelectEnumQuadProc, &PDTextSelectEnumQuadCB), &context);
RedactFRSelection(thisPDEContent, selection);
FreeFRSelection(selection);
PDTextSelectDestroy(thisPDTextSelect);
PDEPath thisPDEPath = CreateStrokedAndFilledRectPDEPathFromASFixedRect(thisASFixedRect);
}
//Remove the StikeOut Annotation once it has been redacted.
PDPageRemoveAnnot(thisPDPage, iAnnotCount);
}
}
Any help would be extremely grateful!
Kev.
-
August 19th, 2013, 06:30 AM
#2
Re: Adobe Plugin Question.
Dear friend,
Please let me know,how to get the below variable,i have'nt see any frselction in adobe sdk
FRSelection selection;
FRSelectionContext context;
Warm regards
Manikandan P K.
-
August 19th, 2013, 08:46 AM
#3
Re: Adobe Plugin Question.
Originally Posted by manimce
i have'nt see any frselction in adobe sdk
FRSelection selection;
FRSelectionContext context;
Perhaps, they are some user defined types in the project of OP?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|