<% OutputStream output=response.getOutputStream(); response.setContentType(\"application/pdf\"); response.setHeader(\"Content-Disposition\", \"inline; filename=detail
XMLWorkerHelper.parseXHtml() expects (X)HTML or (X)HTML snippets. Try this:
XMLWorkerHelper.parseXHtml()
worker.parseXHtml(writer, document, new StringReader("helloworld"));
helloworld