@Test
public void roundTripWriteAndRead() throws TaskException, IOException {

    List<String> strings = Arrays.asList("ଓଡ଼ିଆଭାଷା", "ગુજરાતી ਪੰਜਾਬੀ தமிழ்", "සිංහල", "န\u103Aမာဘာသာ",
            "هذا هو كل الحق إلى اليسار", "123 יתימאה ןחבמ", "032 ציר הורמון הגדילה",
            "This is الحق  Mixed יתימאה ןחבמ",
            "ਹਰਜੋਤ ਸਿੰਘ ភាសាខ្មែរ latin ąćęłńóśźż ทดสอบ വീട मानक हिन्दी ് జ উ ☗⦄✸▃ ", "ציר הורמון הגדילה");
    for (String str : strings) {
        PDDocument doc = new PDDocument();
        PDPage page = new PDPage();
        new PageTextWriter(doc).write(page, new Point(10, 10), str,
                getStandardType1Font(StandardType1Font.HELVETICA), 10.0d, Color.BLACK);
        doc.addPage(page);
        try (PDDocumentHandler handler = new PDDocumentHandler(doc)) {
            File tmp = IOUtils.createTemporaryBuffer();
            handler.savePDDocument(tmp, NoEncryptionAtRest.INSTANCE);
            PDDocument doc2 = PDFParser.parse(SeekableSources.seekableSourceFrom(tmp));
            String text = new PdfTextExtractorByArea().extractTextFromArea(doc2.getPage(0),
                    new Rectangle(0, 0, 1000, 1000));
            assertEquals(noWhitespace(str), noWhitespace(text));
        }
    }
}