Adds a native PDF object to the document.

 

   

Syntax
 

ObjID = Doc.AddObject(Text)

 

   

Params
 
Name Type Description
Text String The raw native object to be added.
ObjID Long The Object ID of the newly added object.

 

   

Notes
 

You will not normally need to use this feature. However, it can be useful if you wish to add objects which are defined in the PDF specification but not supported by ABCpdf.

Be aware that the text you pass to this method must be in native PDF format. This means that unusual characters in text strings must be appropriately escaped. For full details of the way that PDF objects are represented, you should see the Adobe PDF Specification.

Your newly added object needs to be referenced from somewhere in the PDF document. If you do not reference your object, it will be orphaned and will be deleted when the document is saved.

 

   

Example
 

The following code adds a document information section to an existing PDF document. First, it adds an empty dictionary and references it from the document trailer. Then, it adds an Author, Title and Subject before saving.

Set theDoc = Server.CreateObject("ABCpdf12.Doc")
theDoc.Read "c:\mypdfs\sample.pdf"
theID = theDoc.AddObject("<<>>")
theDoc.SetInfo -1, "/Info", theID & " 0 R"
theDoc.SetInfo theID, "/Author", "(Arthur Dent)"
theDoc.SetInfo theID, "/Title", "(Musings on Life)"
theDoc.SetInfo theID, "/Subject", "(Philosophy)"
theDoc.Save "c:\mypdfs\docaddobject.pdf"