CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2007
    Posts
    6

    Talking 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.

  2. #2
    Join Date
    Aug 2013
    Posts
    1

    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.

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Adobe Plugin Question.

    Quote Originally Posted by manimce View Post
    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
  •  





Click Here to Expand Forum to Full Width

Featured