Estou convertendo um HTML para PDF, porém estou com o seguinte problema:
Quanto tenho uma tag no HTML a biblioteca não está convertendo corretamente, segue exemplo:
www.google.com.br * Funciona corretamente
Google * Não funciona
Alguém teve esse problema?
Segue código da classe:
[code]
package br.com.grupow.htmldoc;
import com.lowagie.text.DocumentException;
import java.io.*;
import org.w3c.tidy.Tidy;
import org.xhtmlrenderer.pdf.ITextRenderer;
public class Html2Pdf
{
public Html2Pdf()
{
}
public static void convert(String input, String output)
throws DocumentException, FileNotFoundException, IOException
{
OutputStream out = new FileOutputStream(output);
convert(((InputStream) (new ByteArrayInputStream(input.getBytes()))), out);
}
public static void convert(String input, OutputStream out)
throws DocumentException, IOException
{
convert(((InputStream) (new ByteArrayInputStream(input.getBytes()))), out);
}
public static void convert(InputStream input, OutputStream out)
throws DocumentException, IOException
{
Tidy tidy = new Tidy();
org.w3c.dom.Document doc = tidy.parseDOM(input, null);
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(doc, null);
renderer.layout();
renderer.createPDF(out);
renderer.finishPDF();
out.close();
}
}[/code]