Bom tarde possoal, to com uma imensa dificuldade de converter um html em rtf. Já tentei usando RTFEditorKit, que foi minha melhor opção converteu muito bem só que nao manteve as imagens do arquivo html.
HTML
String texto =
"<div id='esquerda' style='border:0px solid red; min-height:100px; width: 25%; float: left; padding: 0;>"
+ "<p style='text-align: right;'>"
+ " <span style='font-size:8px;'>CASTELO BRANCO, , CACHOEIRINHA</span></p>"
+ " <p style='text-align: right;'>"
+ " <span style='font-size:8px;'>Fone: 1111-1111</span></p>"
+ " <p style='text-align: right;'>"
+ " <span style='font-size:8px;'>MANAUS - Amazonas - CEP </span></p>"
+ "<p align='center'>"
+ " <u><strong>TERMO DE DESENTRANHAMENTO</strong></u></p>"
+ "<p align='center'>"
+ " </p>"
+ "<p>"
+ "Nesta data, foi desentranhado deste Inquérito Policial, a(s) o(s) nomexdaxpeçaxextraídaxdosxautos elaborado pela(o) <strong>1º Distrito Integrado de Polícia</strong>, tendo em vista informarxoxmotivoxdoxdesentranhamento.</p>"
+ "<p>"
+ " Para constar, lavro este termo.</p>"
+ "<p align='left'>"
+ " </p>"
+ "<p align='left'>"
+ " Aos vinte do mês de Março de 2013.</p>"
+ "<p align='left'>"
+ " </p>"
+ "<p align='center'>"
+ "_________________________________</>"
+ "_________________________________</>"
+ " <strong>Geison Santos do Nascimento</strong><p />"
+ " Escrivão de Polícia</p>"
+ "<p style='text-align: center;'>"
+ "<img id='1334698852890' src='parteDocumento.do?acao=exibirImagem&idAnexo=121' style='width: 54px; height: 72px;' /></p>"
+ "<p style='text-align: center;'>"
+ "<span style='font-size:12px;'><strong>GOVERNO DO ESTADO DO AMAZONAS</strong></span></p>";
Usando o itext- rtf
Document document = new Document();
FileOutputStream evidenceDocument = new FileOutputStream(outFile+nomeArquivo);
RtfWriter2.getInstance(document, evidenceDocument);
response.setContentType("text/rtf");
//Sem sucesso
Usando o RTFEditorKit
StringWriter writer = new StringWriter();
try {
File file = new File(pathFileSource);
FileInputStream fi = new FileInputStream(file);
RTFEditorKit rtfEditorKit = new RTFEditorKit();
HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
Document doc = rtfEditorKit.createDefaultDocument();
rtfEditorKit.read(fi, doc, 0);
htmlEditorKit.write(writer, doc, 0, doc.getLength());
fi.close();
} catch (Exception ex) {
Logger.getLogger(Rtf2Html.class.getName()).log(Level.SEVERE, null, ex);
}
return writer.toString();
//Não manteve a formatação como no html
Alguma opção??