How to convert an html String to a PDF InputStream?
<p>If we have string with a content of a html page, how can we convert it to a <strong>InputStream</strong> made after transform this string to a pdf document?</p>

<p>I'm trying to use iText with <strong><a href="http://demo.itextsupport.com/xmlworker/itextdoc/flatsite.html" rel="nofollow">XMLWorkerHelper</a></strong>, and this following code works, but the problem is I don't want the output on a file. I have tried several variations in order to get the result on a <strong>InputStream</strong> that I could convert to a Primefaces <strong><a href="http://www.primefaces.org/showcase/ui/file/download.xhtml" rel="nofollow">StreamedContent</a></strong> but no success. How we can do it?</p>

<p>Is there another technique that we can use to solve this problem?
The motivation to this is use xhtml files wich is already rendered and output it as a pdf to be downloaded by the user.</p>

<pre><code>Document document = new Document();

PdfWriter writer = PdfWriter.getInstance(document,

    new FileOutputStream("results/loremipsum.pdf"));

document.open();

XMLWorkerHelper.getInstance().parseXHtml(writer, document,

    new FileInputStream("/html/loremipsum.html"));

document.close();
</code></pre>