Ask a Question related to Adobe Acrobat SDK, Design and Development.
-
Alexander_Zuban@adobeforums.com #1
Problem with export annotations to FDF file
Hello,
We develop our Acrobat plug-in which is export annotations from the document to file. We faced with the problem, that when annotation is open in popup editor, export function not saves it correctly. As a workaround we try to detect if there are any open annotations and then ask user to close them before proceed, but this also not work, because when user open annotation with context menu, then application return it's state correctly, but when popup was opened with double click, then annotation state is not recognized as opened. I attached to the current case a code snippet which is scan document for the annotations and check state of the annotation and annotation popup. After that it exports annotations to file. Please could you advice are there any solution for this problem? We noticed that Adobe close all open annotations before export to data file, are there the same think available for plug-In ( PDTextAnnotSetOpen is not work)?
Is anybody solve the simular problem? Any help will be appreciated!
{{{
void SaveFDFFile ()
{
ASFileSys fileSys = ASGetDefaultFileSys();
ASPathName volatile fdfPathName = NULL;
AVDoc avDoc = AVAppGetActiveDoc();
PDDoc pdDoc = AVDocGetPDDoc (avDoc);
bool g_hasOpenPopup = false;
//check annotations
DURING
//get document information
ASInt32 lastPage = PDDocGetNumPages(pdDoc) - 1;
PDPage pdPage;
ASInt32 annotCount;
PDAnnot annotation;
//check each page of the document
for (ASInt32 i=0; i<=lastPage; i++) { pdPage = PDDocAcquirePage(pdDoc, i); annotCount = PDPageGetNumAnnots(pdPage);
//check each annotation on the page
for (ASInt32 j=0; j<annotCount; j++) { annotation = PDPageGetAnnot(pdPage, j); if(PDAnnotIsValid(annotation)) { CosObj dict = PDAnnotGetCosObj(annotation); if(PDTextAnnotIsOpen(annotation)){ //never come here when annotation open with double click g_hasOpenPopup = true; } //check using popup property if(CosDictKnown(dict, ASAtomFromString("Popup"))){ CosObj popup = CosDictGet(dict, ASAtomFromString("Popup")); if(PDTextAnnotIsOpen(popup)){ //never come here when annotation open with double click g_hasOpenPopup = true; }
}
}
}
PDPageRelease (pdPage);
}
HANDLER
char buf[255];
AVAlertNote(ASGetErrorString(ERRORCODE, buf, 254));
END_HANDLER
//export
ASInt32 exportCount;
PDDocWillExportAnnotCallback exportCallback;
exportCallback = ASCallbackCreateProto(PDDocWillExportAnnotCallback , ExportFilter);
CosDoc fdfDoc = PDDocExportNotes(pdDoc, NULL, NULL, NULL, NULL, exportCallback, &exportCount);
ASCallbackDestroy(exportCallback);
//save annotations
fdfPathName = ASFileSysCreatePathName (fileSys, ASAtomFromString("Cstring"),"test.fdf", 0);
ASInt32 errorCode;
ASFile volatile fdfFile = NULL;
CosDocSaveParamsRec params;
// Initialize save params
memset (¶ms, 0, sizeof(CosDocSaveParamsRec));
params.size = sizeof(CosDocSaveParamsRec);
params.header = "%FDF-1.2";
DURING
if (fdfDoc == NULL) {
// if there were no annotations, create a blank document
fdfDoc = CosDocCreate(0);
}
// Create/Open the file
errorCode = ASFileSysOpenFile (fileSys, fdfPathName, ASFILE_CREATE | ASFILE_WRITE, (ASFile*)&fdfFile);
// If we succeeded, save the doc to the file
if (errorCode == 0) {
CosDocSaveToFile (fdfDoc, fdfFile, cosSaveFullSave, ¶ms);
CosDocClose (fdfDoc);
ASFileClose (fdfFile);
} else {
AVAlertNote("Error in saving the fdf file!");
ASRaise (ASFileError(fileErrOpenFailed));
}
HANDLER
if (fdfFile){
ASFileClose (fdfFile);
}
RERAISE();
END_HANDLER
if (fdfPathName){
ASFileSysReleasePath (fileSys, fdfPathName);
}
}
}}}
Thank you in advance!
Alexander
Alexander_Zuban@adobeforums.com Guest
-
Export annotations to FDF file
Hello, We develop our Acrobat plug-in which is export annotations from the document to file. We faced with the problem, that when annotation is... -
3D annotations and File format Conversion
I am writing a plug-in for Acrobat Extended Pro that will export embedded 3D files in other formats. I only have access to a U3D converter right now... -
PDF to XFDF file annotation export problem with XPAAJ
Hi, I'm using XPAAJ library to export annotations contained in a PDF file to XFDF file. The files which have fileAttachmentAnnotations cannot be... -
File export problem in IE and Mozilla
I'm using the following code to export a tab delimited file comprised of mysql query data: header("Content-type: text/tab-separated-values");... -
Canīt add comments or annotations to a pdf file
I have Acrobat Reader 6.0.1 Full version and I canīt add comments to a pdf file with no security. The Comments toolbar doesnīt appears in the menu. I...



Reply With Quote

