ByteArrayInputStream tInputStringStream = new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8));
XMLWorkerHelper xhelp = XMLWorkerHelper.getInstance();
xhelp.parseXHtml(writer, document, tInputStringStream, StandardCharsets.UTF_8);
說明:itext.jar、XMLWorker.jar