Adobe ACROBAT SDK 8.1 Manual page 200

Developing plug-ins and applications
Table of Contents

Advertisement

Adobe Acrobat SDK
Developing Plug-ins and Applications
CosArrayPut (procArray, 1, CosNewName (cd, false, ASAtomFromString ("Text")));
/*
** Place the proc set key-value pair into the page's resource dictionary.
*/
CosDictPut (ResDict, ASAtomFromString ("ProcSet"), procArray);
HANDLER
CosObjDestroy (FontDictObj);
CosObjDestroy (FontDict);
CosObjDestroy (ResDict);
CosObjDestroy (procArray);
return false;
END_HANDLER
return true;
}
// Create and return the stream's dictionary that defines the Length attribute
CosObj CreateAttribsDict(CosDoc Doc, ASInt32 Len)
{
//Declare local variables
CosObj Dict; /* Holds newly created dictionary */
ASAtom Key; /* Key used to retrieve CosObj in dictionary */
CosObj Value; /* Assigned, then added to dictionary */
CosObj DecodeArray;
//Create the stream dictionary
Dict = CosNewDict(Doc, false, 10);
Key = ASAtomFromString("Length");
Value = CosNewInteger(Doc, false, Len);
CosDictPut(Dict, Key, Value);
return Dict;
}
//Add stream to page. Return false if there are problems
ASBool AddStreamToPage (PDPage page, char* StreamBuf, ASInt32 StreamBufLen)
{
//Declare local variables
CosDoc cd;
ASStm Stm=NULL;
CosObj PageStrm;
CosObj EncodeParms = CosNewNull();
DURING
//Create the CosDoc object
cd = PDDocGetCosDoc (PDPageGetDoc (page));
HANDLER
AVAlertNote("Unable to get CosDoc");
return false;
END_HANDLER
//Retrieve the Attributes dictionary
AttrDict = CreateAttribsDict (cd, StreamBufLen);
if (CosObjEqual (AttrDict, CosNewNull ()) == true){
AVAlertNote("Not making stream. Attribs dict not created.");
Populating a PDF document with a content stream
Working with Cos Objects
200

Advertisement

Table of Contents
loading

Table of Contents