Class SimpleNamedDestination

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.HashMap<java.lang.String,​java.lang.String> xmlLast  
      private java.util.HashMap<java.lang.String,​java.lang.String> xmlNames  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static PdfArray createDestinationArray​(java.lang.String value, PdfWriter writer)  
      void endDocument()
      Called after the document is parsed.
      void endElement​(java.lang.String tag)
      Called when an end tag is found.
      static java.lang.String escapeBinaryString​(java.lang.String s)  
      static void exportToXML​(java.util.HashMap<java.lang.String,​java.lang.String> names, java.io.OutputStream out, java.lang.String encoding, boolean onlyASCII)
      Exports the destinations to XML.
      static void exportToXML​(java.util.HashMap<java.lang.String,​java.lang.String> names, java.io.Writer wrt, java.lang.String encoding, boolean onlyASCII)
      Exports the destinations to XML.
      static java.util.HashMap<java.lang.String,​java.lang.String> getNamedDestination​(PdfReader reader, boolean fromNames)  
      static java.util.HashMap<java.lang.String,​java.lang.String> importFromXML​(java.io.InputStream in)
      Import the names from XML.
      static java.util.HashMap<java.lang.String,​java.lang.String> importFromXML​(java.io.Reader in)
      Import the names from XML.
      static PdfDictionary outputNamedDestinationAsNames​(java.util.HashMap<java.lang.String,​java.lang.String> names, PdfWriter writer)  
      static PdfDictionary outputNamedDestinationAsStrings​(java.util.HashMap<java.lang.String,​java.lang.String> names, PdfWriter writer)  
      void startDocument()
      Called when the document starts to be parsed.
      void startElement​(java.lang.String tag, java.util.Map<java.lang.String,​java.lang.String> h)
      Called when a start tag is found.
      void text​(java.lang.String str)
      Called when a text element is found.
      static java.lang.String unEscapeBinaryString​(java.lang.String s)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • xmlNames

        private java.util.HashMap<java.lang.String,​java.lang.String> xmlNames
      • xmlLast

        private java.util.HashMap<java.lang.String,​java.lang.String> xmlLast
    • Constructor Detail

      • SimpleNamedDestination

        private SimpleNamedDestination()
    • Method Detail

      • getNamedDestination

        public static java.util.HashMap<java.lang.String,​java.lang.String> getNamedDestination​(PdfReader reader,
                                                                                                     boolean fromNames)
      • exportToXML

        public static void exportToXML​(java.util.HashMap<java.lang.String,​java.lang.String> names,
                                       java.io.OutputStream out,
                                       java.lang.String encoding,
                                       boolean onlyASCII)
                                throws java.io.IOException
        Exports the destinations 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:
        java.io.IOException - on error
        Since:
        5.0.1 (generic type in signature)
      • exportToXML

        public static void exportToXML​(java.util.HashMap<java.lang.String,​java.lang.String> names,
                                       java.io.Writer wrt,
                                       java.lang.String encoding,
                                       boolean onlyASCII)
                                throws java.io.IOException
        Exports the destinations 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:
        java.io.IOException - on error
        Since:
        5.0.1 (generic type in signature)
      • importFromXML

        public static java.util.HashMap<java.lang.String,​java.lang.String> importFromXML​(java.io.InputStream in)
                                                                                        throws java.io.IOException
        Import the names from XML.
        Parameters:
        in - the XML source. The stream is not closed
        Returns:
        the names
        Throws:
        java.io.IOException - on error
      • importFromXML

        public static java.util.HashMap<java.lang.String,​java.lang.String> importFromXML​(java.io.Reader in)
                                                                                        throws java.io.IOException
        Import the names from XML.
        Parameters:
        in - the XML source. The reader is not closed
        Returns:
        the names
        Throws:
        java.io.IOException - on error
      • createDestinationArray

        static PdfArray createDestinationArray​(java.lang.String value,
                                               PdfWriter writer)
      • outputNamedDestinationAsNames

        public static PdfDictionary outputNamedDestinationAsNames​(java.util.HashMap<java.lang.String,​java.lang.String> names,
                                                                  PdfWriter writer)
      • outputNamedDestinationAsStrings

        public static PdfDictionary outputNamedDestinationAsStrings​(java.util.HashMap<java.lang.String,​java.lang.String> names,
                                                                    PdfWriter writer)
                                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • escapeBinaryString

        public static java.lang.String escapeBinaryString​(java.lang.String s)
      • unEscapeBinaryString

        public static java.lang.String unEscapeBinaryString​(java.lang.String s)
      • endElement

        public void endElement​(java.lang.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
      • startElement

        public void startElement​(java.lang.String tag,
                                 java.util.Map<java.lang.String,​java.lang.String> 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​(java.lang.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.