com.lowagie.text.pdf
Class SimpleNamedDestination

java.lang.Object
  extended by com.lowagie.text.pdf.SimpleNamedDestination
All Implemented Interfaces:
SimpleXMLDocHandler

public class SimpleNamedDestination
extends Object
implements SimpleXMLDocHandler

Author:
Paulo Soares (psoares@consiste.pt)

Method Summary
 void endDocument()
          Called after the document is parsed.
 void endElement(String tag)
          Called when an end tag is found.
static String escapeBinaryString(String s)
           
static void exportToXML(HashMap names, OutputStream out, String encoding, boolean onlyASCII)
          Exports the bookmarks to XML.
static void exportToXML(HashMap names, Writer wrt, String encoding, boolean onlyASCII)
          Exports the bookmarks to XML.
static HashMap getNamedDestination(PdfReader reader, boolean fromNames)
           
static HashMap importFromXML(InputStream in)
          Import the names from XML.
static HashMap importFromXML(Reader in)
          Import the names from XML.
static PdfDictionary outputNamedDestinationAsNames(HashMap names, PdfWriter writer)
           
static PdfDictionary outputNamedDestinationAsStrings(HashMap names, PdfWriter writer)
           
 void startDocument()
          Called when the document starts to be parsed.
 void startElement(String tag, HashMap h)
          Called when a start tag is found.
 void text(String str)
          Called when a text element is found.
static String unEscapeBinaryString(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNamedDestination

public static HashMap getNamedDestination(PdfReader reader,
                                          boolean fromNames)

exportToXML

public static void exportToXML(HashMap names,
                               OutputStream out,
                               String encoding,
                               boolean onlyASCII)
                        throws IOException
Exports the bookmarks to XML. The DTD for this XML is:

 <?xml version='1.0' encoding='UTF-8'?>
 <!ELEMENT Name (#PCDATA)>
 <!ATTLIST Name
    Page CDATA #IMPLIED
 >
 <!ELEMENT Destination (Name)*>
 

Parameters:
names - the names
out - the export destination. The stream is not closed
encoding - the encoding according to IANA conventions
onlyASCII - codes above 127 will always be escaped with &#nn; if true, whatever the encoding
Throws:
IOException - on error

exportToXML

public static void exportToXML(HashMap names,
                               Writer wrt,
                               String encoding,
                               boolean onlyASCII)
                        throws IOException
Exports the bookmarks to XML.

Parameters:
names - the names
wrt - the export destination. The writer is not closed
encoding - the encoding according to IANA conventions
onlyASCII - codes above 127 will always be escaped with &#nn; if true, whatever the encoding
Throws:
IOException - on error

importFromXML

public static HashMap importFromXML(InputStream in)
                             throws IOException
Import the names from XML.

Parameters:
in - the XML source. The stream is not closed
Returns:
the names
Throws:
IOException - on error

importFromXML

public static HashMap importFromXML(Reader in)
                             throws IOException
Import the names from XML.

Parameters:
in - the XML source. The reader is not closed
Returns:
the names
Throws:
IOException - on error

outputNamedDestinationAsNames

public static PdfDictionary outputNamedDestinationAsNames(HashMap names,
                                                          PdfWriter writer)
                                                   throws IOException
Throws:
IOException

outputNamedDestinationAsStrings

public static PdfDictionary outputNamedDestinationAsStrings(HashMap names,
                                                            PdfWriter writer)
                                                     throws IOException
Throws:
IOException

escapeBinaryString

public static String escapeBinaryString(String s)

unEscapeBinaryString

public static String unEscapeBinaryString(String s)

endDocument

public void endDocument()
Description copied from interface: SimpleXMLDocHandler
Called after the document is parsed.

Specified by:
endDocument in interface SimpleXMLDocHandler

endElement

public void endElement(String tag)
Description copied from interface: SimpleXMLDocHandler
Called when an end tag is found.

Specified by:
endElement in interface SimpleXMLDocHandler
Parameters:
tag - the tag name

startDocument

public void startDocument()
Description copied from interface: SimpleXMLDocHandler
Called when the document starts to be parsed.

Specified by:
startDocument in interface SimpleXMLDocHandler

startElement

public void startElement(String tag,
                         HashMap h)
Description copied from interface: SimpleXMLDocHandler
Called when a start tag is found.

Specified by:
startElement in interface SimpleXMLDocHandler
Parameters:
tag - the tag name
h - the tag's attributes

text

public void text(String str)
Description copied from interface: SimpleXMLDocHandler
Called when a text element is found.

Specified by:
text in interface SimpleXMLDocHandler
Parameters:
str - the text element, probably a fragment.


Copyright © 2006-2007 EGIZ - E-Government Innovationszentrum. All Rights Reserved.