HiraokaHyperTools.iTextSharp-LGPL  0.2.5
iTextSharp.text.pdf.SimpleBookmark Class Reference
Inheritance diagram for iTextSharp.text.pdf.SimpleBookmark:
iTextSharp.text.xml.simpleparser.ISimpleXMLDocHandler

Public Member Functions

void EndDocument ()
 
void EndElement (String tag)
 
void StartDocument ()
 
void StartElement (String tag, Hashtable h)
 
void Text (String str)
 

Static Public Member Functions

static ArrayList GetBookmark (PdfReader reader)
 
static void EliminatePages (ArrayList list, int[] pageRange)
 
static void ShiftPageNumbers (ArrayList list, int pageShift, int[] pageRange)
 
static Object[] IterateOutlines (PdfWriter writer, PdfIndirectReference parent, ArrayList kids, bool namedAsNames)
 
static void ExportToXMLNode (ArrayList list, TextWriter outp, int indent, bool onlyASCII)
 
static void ExportToXML (ArrayList list, Stream outp, String encoding, bool onlyASCII)
 
static void ExportToXML (ArrayList list, TextWriter wrt, String encoding, bool onlyASCII)
 
static ArrayList ImportFromXML (Stream inp)
 
static ArrayList ImportFromXML (TextReader inp)
 
static String EscapeBinaryString (String s)
 
static String UnEscapeBinaryString (String s)
 

Detailed Description

Bookmark processing in a simple way. It has some limitations, mainly the only action types supported are GoTo, GoToR, URI and Launch.

The list structure is composed by a number of Hashtable, keyed by strings, one Hashtable for each bookmark. The element values are all strings with the exception of the key "Kids" that has another list for the child bookmarks.

All the bookmarks have a "Title" with the bookmark title and optionally a "Style" that can be "bold", "italic" or a combination of both. They can also have a "Color" key with a value of three floats separated by spaces. The key "Open" can have the values "true" or "false" and signals the open status of the children. It's "true" by default.

The actions and the parameters can be:

  • "Action" = "GoTo" - "Page" | "Named"
    • "Page" = "3 XYZ 70 400 null" - page number followed by a destination (/XYZ is also accepted)
    • "Named" = "named_destination"
  • "Action" = "GoToR" - "Page" | "Named" | "NamedN", "File", ["NewWindow"]
    • "Page" = "3 XYZ 70 400 null" - page number followed by a destination (/XYZ is also accepted)
    • "Named" = "named_destination_as_a_string"
    • "NamedN" = "named_destination_as_a_name"
    • "File" - "the_file_to_open"
    • "NewWindow" - "true" or "false"
  • "Action" = "URI" - "URI"
    • "URI" = "http://sf.net" - URI to jump to
  • "Action" = "Launch" - "File"
    • "File" - "the_file_to_open_or_execute"
    Author
    Paulo Soares (psoar.nosp@m.es@c.nosp@m.onsis.nosp@m.te.p.nosp@m.t)

Member Function Documentation

◆ EliminatePages()

static void iTextSharp.text.pdf.SimpleBookmark.EliminatePages ( ArrayList  list,
int[]  pageRange 
)
static

Removes the bookmark entries for a number of page ranges. The page ranges consists of a number of pairs with the start/end page range. The page numbers are inclusive.

Parameters
listthe bookmarks
pageRangethe page ranges, always in pairs.

◆ EndDocument()

void iTextSharp.text.pdf.SimpleBookmark.EndDocument ( )

Called after the document is parsed.

Implements iTextSharp.text.xml.simpleparser.ISimpleXMLDocHandler.

◆ EndElement()

void iTextSharp.text.pdf.SimpleBookmark.EndElement ( String  tag)

Called when an end tag is found.

Parameters
tagthe tag name

Implements iTextSharp.text.xml.simpleparser.ISimpleXMLDocHandler.

◆ EscapeBinaryString()

static String iTextSharp.text.pdf.SimpleBookmark.EscapeBinaryString ( String  s)
static

◆ ExportToXML() [1/2]

static void iTextSharp.text.pdf.SimpleBookmark.ExportToXML ( ArrayList  list,
Stream  outp,
String  encoding,
bool  onlyASCII 
)
static

Exports the bookmarks to XML. The DTD for this XML is:

<?xml version='1.0' encoding='UTF-8'?>
<!ELEMENT Title (#PCDATA|Title)*>
<!ATTLIST Title
   Action CDATA #IMPLIED
   Open CDATA #IMPLIED
   Page CDATA #IMPLIED
   URI CDATA #IMPLIED
   File CDATA #IMPLIED
   Named CDATA #IMPLIED
   NamedN CDATA #IMPLIED
   NewWindow CDATA #IMPLIED
   Style CDATA #IMPLIED
   Color CDATA #IMPLIED
>
<!ELEMENT Bookmark (Title)*>
Parameters
listthe bookmarks
outthe export destination. The stream is not closed
encodingthe encoding according to IANA conventions
onlyASCIIcodes above 127 will always be escaped with &#nn; if true, whatever the encoding
Exceptions
IOExceptionon error

◆ ExportToXML() [2/2]

static void iTextSharp.text.pdf.SimpleBookmark.ExportToXML ( ArrayList  list,
TextWriter  wrt,
String  encoding,
bool  onlyASCII 
)
static

Exports the bookmarks to XML.

Parameters
listthe bookmarks
wrtthe export destination. The writer is not closed
encodingthe encoding according to IANA conventions
onlyASCIIcodes above 127 will always be escaped with &#nn; if true, whatever the encoding
Exceptions
IOExceptionon error

◆ ExportToXMLNode()

static void iTextSharp.text.pdf.SimpleBookmark.ExportToXMLNode ( ArrayList  list,
TextWriter  outp,
int  indent,
bool  onlyASCII 
)
static

Exports the bookmarks to XML. Only of use if the generation is to be include in some other XML document.

Parameters
listthe bookmarks
outthe export destination. The writer is not closed
indentthe indentation level. Pretty printing significant only
onlyASCIIcodes above 127 will always be escaped with &#nn; if true, whatever the encoding
Exceptions
IOExceptionon error

◆ GetBookmark()

static ArrayList iTextSharp.text.pdf.SimpleBookmark.GetBookmark ( PdfReader  reader)
static

Gets a List with the bookmarks. It returns null if the document doesn't have any bookmarks.

Parameters
readerthe document
Returns
a List with the bookmarks or null if the document doesn't have any

◆ ImportFromXML() [1/2]

static ArrayList iTextSharp.text.pdf.SimpleBookmark.ImportFromXML ( Stream  inp)
static

Import the bookmarks from XML.

Parameters
inthe XML source. The stream is not closed
Exceptions
IOExceptionon error
Returns
the bookmarks

◆ ImportFromXML() [2/2]

static ArrayList iTextSharp.text.pdf.SimpleBookmark.ImportFromXML ( TextReader  inp)
static

Import the bookmarks from XML.

Parameters
inthe XML source. The reader is not closed
Exceptions
IOExceptionon error
Returns
the bookmarks

◆ IterateOutlines()

static Object [] iTextSharp.text.pdf.SimpleBookmark.IterateOutlines ( PdfWriter  writer,
PdfIndirectReference  parent,
ArrayList  kids,
bool  namedAsNames 
)
static

◆ ShiftPageNumbers()

static void iTextSharp.text.pdf.SimpleBookmark.ShiftPageNumbers ( ArrayList  list,
int  pageShift,
int[]  pageRange 
)
static

For the pages in range add the pageShift to the page number. The page ranges consists of a number of pairs with the start/end page range. The page numbers are inclusive.

Parameters
listthe bookmarks
pageShiftthe number to add to the pages in range
pageRangethe page ranges, always in pairs. It can be null to include all the pages

◆ StartDocument()

void iTextSharp.text.pdf.SimpleBookmark.StartDocument ( )

Called when the document starts to be parsed.

Implements iTextSharp.text.xml.simpleparser.ISimpleXMLDocHandler.

◆ StartElement()

void iTextSharp.text.pdf.SimpleBookmark.StartElement ( String  tag,
Hashtable  h 
)

Called when a start tag is found.

Parameters
tagthe tag name
hthe tag's attributes

Implements iTextSharp.text.xml.simpleparser.ISimpleXMLDocHandler.

◆ Text()

void iTextSharp.text.pdf.SimpleBookmark.Text ( String  str)

Called when a text element is found.

Parameters
strthe text element, probably a fragment.

Implements iTextSharp.text.xml.simpleparser.ISimpleXMLDocHandler.

◆ UnEscapeBinaryString()

static String iTextSharp.text.pdf.SimpleBookmark.UnEscapeBinaryString ( String  s)
static

The documentation for this class was generated from the following file: