public static String asPDFDocEncoded(String basicString){
  final StringBuilder buf=new StringBuilder(basicString.length());
  for (int i=0; i < basicString.length(); ++i) {
    final char c=PDF_DOC_ENCODING_MAP[basicString.charAt(i) & 0xFF];
    buf.append(c);
  }
  return buf.toString();
}

public static String asPDFDocEncoded ( String basicString ) { final StringBuilder buf = new StringBuilder ( basicString . length ( ) ) ; for ( int i = 0 ; i < basicString . length ( ) ; ++ i ) { final char c = PDF_DOC_ENCODING_MAP [ basicString . charAt ( i ) & 0xFF ] ; buf . append ( c ) ; } return buf . toString ( ) ; }
take a basic pdf string and produce a string of its bytes as encoded in pdfdocencoding . the pdfdocencoding is described in the pdf reference .
