This is an old revision of the document!


PDF types in PDFtalk

A PDF consists of a network of objects which are connected through attributes of dictionaries or arrays. The PDF specifiction defines restrictions for which objects can be held by an attribute.

The restrictions specify

  • which kind of object - its PDF type - including forms like Array of aType or Dictionary of aType.
  • whether it is or can be indirectly held by a reference
  • whether it is required or optional.

These restrictions are called Attribute types in the following.

An attribute is represented as method of a PDF object. The methods are categorized in the protocol accessing entries. The methods name should be as close to the name in the specification. They usually start with a capital letter (unlike normal Smalltalk methods). The attribute type is defined by pragmas (method tags) in the method. The code of the method returns the object stored in or referenced by the attribute, or a default if the attribute is not required.

The following pragmas are used for declaring a type:

  • #type: *aSymbol* The value (or referenced value) should be of type aSymbol
Catalog>>PageMode
  <type: #Name>
  • #typeDirect: *aSymbol* The value should be of type aSymbol
Trailer>>Size
  <typeDirect: #Integer>
  • #typeIndirect: *aSymbol* The value should be a reference to an object of type aSymbol
Trailer>>Root
  <typeIndirect: #Catalog>
  • #typeArrayOf: *aSymbol* The value should be an array with values (or referenced values) of type aSymbol
Pages>>Kids
  <typeArrayOf: #PageTree>
  • #typeDictionaryOf: *aSymbol* The value should be a dictionary with values (or referenced values) of type aSymbol
Resources>>ColorSpace
  <typeDictionaryOf: #ColourSpace>

An attribute can contain a number of alternative type declarations of which only one should apply. The scope of the alternative types should not overlap.

Page>>Contents
  <type: #Contents>
  <typeArrayOf: #Contents>

The symbol in the declarations above is the PDF type name of the object.

  • newtyping.1492153085.txt.gz
  • Last modified: 2017/04/14 08:58
  • by christian