The goal: to launch Acrobat Reader from an external application, automatically highlighting some words.
-Courtesy of www.PDFzone.com
Question: How can I launch Acrobat Reader from an external
application, automatically highlighting some words?--Filippo
Mariani
Answers:
For adding the highlights,
there are two good possibilities:
1. Add highlighting to the document before
you send it to the user. This is not easy, but Reader would draw the content
stream happily without the user needing to install a plug-in. This avoids the
user having to re-install your application to get the plug-in back if they
reinstall Acrobat Reader.
2. Write a
Reader plug-in that registers for the AVPageViewDidDraw notification and draws
highlighting on the just-drawn page using platform-specific drawing calls or
AVPageViewInvertRect or AVPageViewInvertQuad.
For navigating to the
desired page, there are two possibilities:
1. Before you send the PDF to the
user, set the page-open action to go to the proper page. Like choice 1 above,
this would require some server software for manipulating the PDF.
2. I think
Acrobat supports some kind of IAC for legally (and without a plug-in) navigating
to the proper page. I'm a plug-in person, not an IAC person, so this is as
specific as I can get.
Be careful, certain things may be allowed by the
license but the calls you use in a plug-in may not be implemented in Reader. I
stick mostly to full-Acrobat plug-ins and have not done a Reader plug-in for a
while, so you will have to check to see if the calls I named above are available
in Reader. --Dan-Ari Feinberg
The FDFToolkit supports
adding JavaScript to a document that will be executed when the document is first
opened, though it isn't mentioned in the FDF spec (which is within the PDF spec:
7.6.6.). Inside JavaScript you can change the current page and create
annotations like little boxes around the appropriate words.
You might
even be able to do something a bit fancier than little boxes. If you're willing
to stick to Acrobat 5, you can use transparency. Form fields and annotations
don't support it directly, but form fields to support having their appearance
set to some file (button icon). This file can be any PDF. . . including one
that's just a X% opaque box of whatever color you choose.
Unless you can make
the "highlight" PDF available to your readers through a path (I don't know if
URLs are supported or not), you'd have to embed the icon appearance in a hidden
field. In JavaScript, you can then use field.buttonGetIcon and
field.buttonSetIcon. That way might actually be easier. You set the icon scaling
using buttonScaleWhen property (to always). --Mark Storer