Class PdfEncodings

java.lang.Object
com.itextpdf.io.font.PdfEncodings

public class PdfEncodings extends Object
  • Field Details

  • Constructor Details

    • PdfEncodings

      public PdfEncodings()
  • Method Details

    • convertToBytes

      public static byte[] convertToBytes (String text, String encoding)
      Converts a String to a byte array according to the font's encoding.
      Parameters:
      encoding - the encoding
      text - the String to be converted
      Returns:
      an array of byte representing the conversion according to the font's encoding
    • convertToBytes

      public static byte[] convertToBytes (char ch, String encoding)
      Converts a char to a byte array according to the font's encoding.
      Parameters:
      encoding - the encoding
      ch - the char to be converted
      Returns:
      an array of byte representing the conversion according to the font's encoding
    • convertToString

      public static String convertToString (byte[] bytes, String encoding)
      Converts a byte array to a String according to the some encoding.
      Parameters:
      bytes - the bytes to convert
      encoding - the encoding
      Returns:
      the converted String
    • isPdfDocEncoding

      public static boolean isPdfDocEncoding (String text)
      Checks is text only has PDF_DOC_ENCODING characters.
      Parameters:
      text - the String to test
      Returns:
      true if only PDF_DOC_ENCODING characters are present
    • addExtraEncoding

      public static void addExtraEncoding (String name, IExtraEncoding enc)
      Adds an extra encoding.
      Parameters:
      name - the name of the encoding. The encoding recognition is case insensitive
      enc - the conversion class