title: itextpdf HTML to PDF containing Cyrillic letters
body: <p>I have asked another question about this problem but I couldn't make it work. I changed my code, so now it's something like this:</p>
  
  <pre><code>import java.io.FileOutputStream;
  import java.io.StringReader;
  
  import com.itextpdf.text.Document;
  import com.itextpdf.text.PageSize;
  import com.itextpdf.text.pdf.PdfWriter;
  import com.itextpdf.tool.xml.XMLWorkerHelper;
  public class HTM {
  
      public static void main(String ... args ) {
          try {
              Document document = new Document(PageSize.LETTER);
              PdfWriter pdfWriter = PdfWriter.getInstance
                             (document, new FileOutputStream("C:\\testpdf.pdf"));
              document.open();
  
              XMLWorkerHelper worker = XMLWorkerHelper.getInstance();
  
              String htmlString = "&lt;html&gt;&lt;head&gt;"
                      + "&lt;meta http-equiv=\"content-type\" content=\"application/xhtml+xml; charset=UTF-8\" /&gt;"
                      + "&lt;/head&gt;&lt;body&gt;"
                      + "&lt;h1&gt;Zdravo Кристијан!&lt;/h1&gt;"
                      + "&lt;/body&gt;&lt;/html&gt;";
  
  
              worker.parseXHtml(pdfWriter, document, new StringReader(htmlString));
              document.close();
              System.out.println("Done.");
          }
          catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>My problem is that the pdf doesn't display the Cyrillic characters. I know how to make a simple pdf with different charsets and fonts but I want to convert a html file or string (in my case it is a html string) into pdf. Thanks in advance.</p>