And if I post it here from clientCo I can pick it up tonight and stick it into Plan B
Cheers
Code:
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.pdf.PdfWriter; import com.itextpdf.tool.xml.XMLWorkerHelper; /** * * @author XXXX * */ public class Test { /** * * @param args * @throws IOException * @throws DocumentException */ public static void main(String[] args) throws IOException, DocumentException { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter writer = PdfWriter.getInstance(document, baos); document.open(); String text = new String( "<html><head></head><body>" + "<h1>Title</h1><p>Paragraph</p>" + "</body></html>"); InputStream inputHtmlAsStream = new ByteArrayInputStream(text .getBytes("UTF-8")); XMLWorkerHelper.getInstance().parseXHtml(writer, document, inputHtmlAsStream, null); document.close(); System.out.println(baos.toString()); } }
Leave a comment: