Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).


New Forum | Previous | Next | (P-PDF) Developers


Topic: how to get hilited word from AReader -OLE Auto
Conf: (P-PDF) Developers, Msg: 81016
From: alex_alex
Date: 2/8/2003 12:12 AM



Hello all,

objective:
----------
I want to get the word that is been
selected(clicked) in Adobe Acrobat Reader 5.0,
from my VC++ 6.0.

I tried the following using OLE Automation
using the typelib "acrobat.tlb" in MFC
it works well.
But here i have hard coded the value
for hilight(first word from list of 4).

How can i initialize the hilight object
at run time with the current selection.

any clues,suggestion,ideas...!

alex.
alex_alex@rediffmail.com
======================================


including type lib "acrobat.tlb"
#include "acrobat.h"
#define PDBeforeFirstPage -1
-----------------------
class OleInitClass
{
public:
OleInitClass()
{
OleInitialize(NULL);
}

~OleInitClass()
{
OleUninitialize();
}
};
OleInitClass g_OleInitClass;
-----------------------
void somefunction(){

CAcroApp app;
CAcroAVDoc* m_pAcroAVDoc =
new CAcroAVDoc;;
CAcroAVPageView pageView;
CAcroPDPage page;
CAcroPDTextSelect* textSelect =
new CAcroPDTextSelect;
CAcroHiliteList* hilite =
new CAcroHiliteList;
char buf[255];
COleException e;
long num, selectionSize;


app.CreateDispatch("AcroExch.App",&e);
m_pAcroAVDoc->AttachDispatch
(app.GetActiveDoc(), TRUE);
pageView.AttachDispatch
(m_pAcroAVDoc->GetAVPageView(), TRUE);
num = pageView.GetPageNum();

if ((BOOL) num> PDBeforeFirstPage)
{
pageView.AttachDispatch
(m_pAcroAVDoc->GetAVPageView(),TRUE);
hilite->CreateDispatch("AcroExch.HiliteList");
if (hilite)
{
hilite->Add(0,5);
page.AttachDispatch(pageView.GetPage(), TRUE);
textSelect->AttachDispatch
(page.CreateWordHilite(hilite->m_lpDispatch));
m_pAcroAVDoc->SetTextSelection
(textSelect->m_lpDispatch);
m_pAcroAVDoc->ShowTextSelect();
selectionSize = textSelect->GetNumText();
if (selectionSize)
sprintf (buf, "word..: %s",textSelect->GetText(0));
else
sprintf (buf, "Failed to create text selection.");
AfxMessageBox(buf);
}

}

delete textSelect;
delete hilite;
delete m_pAcroAVDoc;

}


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.