title: How to write UTF-8 encoded PDF-Files using PDFBox?
body: <p>I have written the following code:</p>
  
  <pre><code>document = new PDDocument();
  PDPage page = new PDPage();
  document.addPage( page );
  
  PDFont font = PDTrueTypeFont.loadTTF( document, new File("c:/windows/fonts/ARIALUNI.ttf"));   
  font.setFontEncoding(new PdfDocEncoding()); 
  
  
  //PDFont font = PDType1Font.HELVETICA_BOLD;
  PDPageContentStream contentStream = new PDPageContentStream(document, page);
  
  
  contentStream.beginText();
  contentStream.setFont( font, 12 );
  contentStream.moveTextPositionByAmount( 100, 700 );
  contentStream.drawString( "ग्रीटिंग आण्विक" );
  contentStream.endText();
  contentStream.close();
  document.save("E:\\amitpdfbox.pdf");
  document.close();
  </code></pre>
  
  <p>But the text displayed in PDF files is not proper.</p>
  
  <p>It displays something like this: <code>þÿ    **M0@?ˇ#M5?**</code>.</p>
  
  <p><strong>What should I do resolve this issue?</strong></p>
  
  <p>Please let me know how to set UTF-8 encoding and also how to make it able to support Hindi, Marathi, etc. (Indian languages).</p>