Parsing PDF; looking to count number of markup annotations per re viewer (user) in Mac OS 9.2.2.
Parsing PDF; looking to count number of markup annotations per re viewer (user) in Mac OS 9.2.2.
- Subject: Parsing PDF; looking to count number of markup annotations per re viewer (user) in Mac OS 9.2.2.
- From: "Fox, Christopher B" <email@hidden>
- Date: Thu, 18 Dec 2003 09:59:41 -0500
I'd like to come up with a way in Mac OS 9 to count the number of
annotations per reviewer in a PDF file. AppleScript seems like the only
solution. Unfortunately, Adobe Acrobat 5 has a fairly limited AppleScript
dictionary, which also seems to be largely broken. So, I've decided to
tackle the PDF file itself, rather then expect to get any help from Acrobat.
I've taken a gander at the PDF 1.5 spec from Adobe's website, and I
came up with the following string of Unix shell commands that seem to work
great in Mac OS X 10.3.2:
strings test.pdf | awk '/\/Type \/Annot/, /endobj/' | grep '/T ' | sort |
uniq -c
Essentially what this does is:
1) Eliminate binary data, and put the resulting strings on separate lines.
2) Filter out lines not between "/Type /Annot" and "endobj" pairs. This
eliminates anything not an Annotation object.
3) Filter once again, selecting only lines that begin with '/T ' which is
the markup annotation key that indicates the user or reviewer who made the
annotation.
4) Sort the remaining lines.
5) Count the number of times each unique line occurs, and print the results.
Unfortunately, our user population is still on Mac OS 9.2.2, so Unix
solutions aren't an option. I know AppleScript has direct file access
capability (using open for access, read, write, close access, etc.), but I
can't seem to get the equivalent of "strings" or the awk pattern recognition
out of AppleScript.
Any thoughts would be most appreciated.
Thanks!
Christopher Fox
>
CapitalOne
Senior Technician, Enterprise Macintosh Support Services
MSG-IT
Tel: Internal: 425-1553; External: 804-967-1553
Mobile: 804-301-4117
email: email@hidden
**************************************************************************
The information transmitted herewith is sensitive information intended only
for use by the individual or entity to which it is addressed. If the reader
of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other
use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error,
please contact the sender and delete the material from your computer.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.