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: Releasing objects used in a page
Conf: (P-PDF) Developers, Msg: 70341
From: eround
Date: 8/13/2002 07:16 AM

I have written a plug-in that allows the user to give the information needed to produce a widget annotation(size, location, text, font and so on) on a new blank page. The pages are created successfully and the annotations are correct. If I close Acrobat and open the file up I can delete the pages I created. If I try to delete one of them without closing Acrobat first I get an error "One or more pages are in use and cannot be deleted." If I remove the annotation code and have the plug-in simply create the page and try to delete them, it works fine. I release the PDPage and the PDDoc. I don't know if there is anything else to release. I have looked at the documentation and I can't find any other items I am supposed to release. Any help would be appreciated. Thanks.

Code fragment for the annotation:
PDAnnot annot = PDPageAddNewAnnot(pdPage, -1, ASAtomFromString("Widget"), &pdLocation);
PDField fldP;
ASInt32 center = 1;
CosObj cAnnotObj = PDAnnotGetCosObj(annot), valueObj;
CosDoc cdoc = PDDocGetCosDoc(pdDoc);
srand(time(NULL));
int nRand = rand();
char prefix[3];
_itoa(nRand, prefix, 10 );
char page[5];
_itoa(pageNum, page, 10 );
strcat(prefix, page);
CosDictPut(cAnnotObj, ASAtomFromString("T"), CosNewString(cdoc, false, prefix, strlen(prefix)));
CosDictPut(cAnnotObj, ASAtomFromString("DV"), CosNewString(cdoc, false, tabText, strlen(tabText)));
CosDictPut(cAnnotObj, ASAtomFromString("MK"), CosNewDict(cdoc, true, 1));
CosObj mkDict = CosDictGet(cAnnotObj, ASAtomFromString ("MK"));
CosDictPut(mkDict, ASAtomFromString("R"), CosNewInteger(cdoc, false, fRotate));
CosDictPut(cAnnotObj, ASAtomFromString("Q"), CosNewInteger(cdoc, false, center));
CosDictPut(cAnnotObj, ASAtomFromString("FT"), CosNewName(cdoc, false, ASAtomFromString("Tx")));
fldP = AFPDFieldFromCosObj(cAnnotObj);
TextAppearance_t textP;
memset(&textP,0, sizeof(textP));
AFPDFieldGetDefaultTextAppearance(fldP, &textP);
textP.nameFont = ASAtomFromString(fontName);
AFPDFieldSetDefaultTextAppearance(fldP, &textP);
AF_Flags_t flagType = Flags_Field;
AFPDFieldFlags_t flags = 0x00001000;
AFPDFieldSetFlags (fldP, flagType, flags);
valueObj = CosNewString (cdoc, false, tabText, strlen(tabText));
AFPDFieldSetValue (fldP, valueObj);


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.