Skip to content

Internal structures

Antony Dovgal edited this page Jan 15, 2013 · 2 revisions

Table of Contents

Hierarchy of Handles

A handle is an opaque pointer to handle objects. All functions in Haru include one or more handles in their parameter list. The following figure illustrates the relationship between the various types of handles.

http://libharu.org/figures/figure2.png

Document Handle (HPDF_Doc)

The document handle is a handle to operate on a document object. It is created by HPDF_New() or HPDF_NewEx(). And it is freed by HPDF_Free(). When HPDF_Free() is invoked, all objects owned by the document object are freed.

Page Handle (HPDF_Page)

The page handle is used to manipulate an individual page. HPDF_AddPage() or HPDF_InsertPage() create a page handle. Function names starting with "HPDF_Page_" require a page handle as the first parameter.

Image Handle (HPDF_Image)

The image handle is mainly used to put an image to a page. The following functions create an image handle.

  • HPDF_LoadPngImageFromFile()
  • HPDF_LoadJpegImageFromFile()
  • HPDF_LoadRawImageFromFile()
  • HPDF_LoadRawImageFromMem()

Font Handle (HPDF_Font)

The font handle is a font object. HPDF_GetFont() creates a font handle.

Encoding Handle (HPDF_Encoding)

The encoding handle is a handle to handle a encoding object. A encoding handle is returned by invoking HPDF_GetEncoding().

Outline Handle (HPDF_Outline)

The outline handle is used to operate an outline of a document. When HPDF_CreateOutline() is invoked, an outline-node object is created and the handle of the node is returned.

Destination Handle (HPDF_Destination)

The destination object specifies the view of the page to be displayed when the outline item or annotation is clicked. And the destination handle is used to operate destination object.

Annotation Handle (HPDF_Annotation)

There are three type of annotation-object in libHaru:

  • text-annotation represents a "sticky note".
  • link-annotation represents a hypertext link to a destination.
  • URI-link-annotation represents a hypertext link to a web page.
The annotation handle is used to set properties of an annotation object.