Ask a Question related to Adobe Acrobat SDK, Design and Development.
-
dungbkhn02@gmail.com #1
How to determine unique information each Atom of Anote? (VC 2005)
How to determine unique information each Atom of Anote?
This my code, and I see all information of Atom CAN change when I
change anotation--> So can't determine Unique ID of an Atom
ACCB1 void ACCB2 MyPluginCommand(void *clientData)
{
// get this plugin's name for display
ASAtom NameAtom = ASExtensionGetRegisteredName (gExtensionID);
const char * name = ASAtomGetString(NameAtom);
char str[256];
sprintf(str,"This menu item is added by plugin %s.\n", name);
// try to get front PDF document
AVDoc avDoc = AVAppGetActiveDoc();
if(avDoc==NULL) {
// if no doc is loaded, make a message.
strcat(str,"There is no PDF document loaded in Acrobat.");
// display message
AVAlertNote(str);
}
else {
// if a PDF is open, get its number of pages
PDDoc pdDoc = AVDocGetPDDoc (avDoc);
int numPages = PDDocGetNumPages (pdDoc);
sprintf(str,"%sThe front PDF document has %d pages.", str,
numPages);
// display message
AVAlertNote(str);
PDPage page;
ASInt32 i,i2;
PDAnnot annot;
char* subtypeStr;
char buf[2000];
ASAtom atom;
CosObj cos;
CosObj dictEntry;
char subjBuf[256];
char* strValue;
ASTCount length;
char * annBuf;
ASTimeRec asDate;
char dateBuf[128];
char *titleAnnBuf;
ASInt32 titleBufSize;
//Iterate through the PDF document page by page
for (i = 0; i < PDDocGetNumPages(pdDoc); i ++){
//Get each page within the document
page = PDDocAcquirePage(pdDoc, i);
//Get each annotation on the page
for (i2 = 0; i2 < PDPageGetNumAnnots(page); i2++) {
//Get a specific annotation
annot = PDPageGetAnnot(page,i2);
if (PDAnnotIsValid(annot)){
//Annotation's Subject
subjBuf[0]=0x00;
cos = PDAnnotGetCosObj(annot);
if (CosDictKnown(cos, ASAtomFromString("Subj"))){
dictEntry = CosDictGet(cos, ASAtomFromString("Subj"));
strValue = CosStringValue(dictEntry, &length);
sprintf(subjBuf, "%s", strValue);
//Subtype
atom = PDAnnotGetSubtype(annot);
//Cast the ASAtom object to a character pointer
subtypeStr = (char*) ASAtomGetString(atom);
//Annotation's Text
ASInt32 bufSize = PDTextAnnotGetContents(annot, NULL, 0) +1;
//Allocate the size of bufSize to the character pointer
annBuf = (char*)ASmalloc((os_size_t)bufSize);
//Populate annBuf with the annotation's text
PDTextAnnotGetContents(annot, annBuf, bufSize);
//Annotation's Time;
dateBuf[0]=0x00;
if (PDAnnotGetDate(annot, &asDate)){
sprintf(dateBuf, "%02u/%02u/%4u %02u:%02u:%02u", asDate.month,
asDate.date, asDate.year, asDate.hour, asDate.minute, asDate.second);
}
//Annotation's Title
titleBufSize = PDAnnotGetTitle(annot, NULL, 0) +1;
titleAnnBuf = (char*)ASmalloc((os_size_t)titleBufSize);
PDAnnotGetTitle(annot, titleAnnBuf, titleBufSize);
sprintf(buf, "Page [%i]\nAnnot [%li][%li]\nAtom [%u]\nSubType
[%s]\nContents [%s]\nDate [%s]\nTitle [%s]\nSubject [%s]", i+1,
annot.a, annot.b, atom, subtypeStr, annBuf, dateBuf, titleAnnBuf,
subjBuf);
AVAlertNote (buf);
}
}
}
}
}
return;
}
-----------
Thanks in advanced!
dungbkhn02@gmail.com Guest
-
Unique Form inserting into many tables using unique id
I have a Registration Form that have 3 steps. The data could be inserted into many (4) tables. Some data corresponding to a one table (the main or... -
The FreeBSD Diary: 2005-02-06 - 2005-02-26
The FreeBSD Diary contains a large number of practical examples and how-to guides. This message is posted weekly to freebsd-questions@freebsd.org... -
The FreeBSD Diary: 2005-01-30 - 2005-02-19
The FreeBSD Diary contains a large number of practical examples and how-to guides. This message is posted weekly to freebsd-questions@freebsd.org... -
Create Electron and Atom effect?
Trying to create a logo in PS (will be used in After Effects, too) that will be centrally located in the midst of an electron field. You know, the... -
determine image information on image stored in MySQL BLOB
Hi all, I store images in my DB as BLOB. When I want to place them in an html table, I want to determine the width of the image in order to...



Reply With Quote

