com.itextpdf.text.html
Class HtmlEncoder

java.lang.Object
  extended by com.itextpdf.text.html.HtmlEncoder

public final class HtmlEncoder
extends Object

This class converts a String to the HTML-format of a String.

To convert the String, each character is examined:

Example:

    String htmlPresentation = HtmlEncoder.encode("Marie-Thérèse Sørensen");
 

for more info: see O'Reilly; "HTML: The Definitive Guide" (page 164)


Field Summary
private static String[] HTML_CODE
          List with the HTML translation of all the characters.
private static Set<String> NEWLINETAGS
          Set containing tags that trigger a new line.
 
Constructor Summary
private HtmlEncoder()
          This class will never be constructed.
 
Method Summary
static String encode(BaseColor color)
          Converts a BaseColor into a HTML representation of this BaseColor.
static String encode(String string)
          Converts a String to the HTML-format of this String.
static String getAlignment(int alignment)
          Translates the alignment value.
static boolean isNewLineTag(String tag)
          Returns true if the tag causes a new line like p, br etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTML_CODE

private static final String[] HTML_CODE
List with the HTML translation of all the characters.

Since:
5.0.6 (renamed from htmlCode)

NEWLINETAGS

private static final Set<String> NEWLINETAGS
Set containing tags that trigger a new line.

Since:
iText 5.0.6
Constructor Detail

HtmlEncoder

private HtmlEncoder()
This class will never be constructed.

Method Detail

encode

public static String encode(String string)
Converts a String to the HTML-format of this String.

Parameters:
string - The String to convert
Returns:
a String

encode

public static String encode(BaseColor color)
Converts a BaseColor into a HTML representation of this BaseColor.

Parameters:
color - the BaseColor that has to be converted.
Returns:
the HTML representation of this BaseColor

getAlignment

public static String getAlignment(int alignment)
Translates the alignment value.

Parameters:
alignment - the alignment value
Returns:
the translated value

isNewLineTag

public static boolean isNewLineTag(String tag)
Returns true if the tag causes a new line like p, br etc.

Since:
iText 5.0.6

Hosted by openminds