Problems Text Decoration Css underline and justify

350 views
Skip to first unread message

rafael.eng

unread,
May 19, 2011, 3:50:32 PM5/19/11
to Flying Saucer Users
I am using flying saucer for export html for pdf, but I have problem,
when I try export one text containing css text-decoration underline,
it comes out badly formatted, html code below is what I am trying to
export and also the code java.

grateful to those who help me!


HTML:

<p style="text-align: justify;">
<span style="font-size: 14px; text-decoration: underline;\-fs-text-
decoration-extent: block;"><span style="font-family: Verdana">"teste
teste teste teste teste teste teste teste teste teste teste teste
teste teste teste teste teste teste teste teste teste teste teste
teste teste teste teste teste teste teste teste teste teste teste
teste teste teste teste teste teste teste teste teste teste teste
teste teste teste teste teste teste teste teste teste.</span></span> </
p>

JAVA:
public static void main(String[] args) throws Exception{
Html2Pdf.convert(new FileInputStream("C:\\temp\\test.html"), new
FileOutputStream("C:\\temp\\test.pdf"));
}

public static void convert(InputStream input, OutputStream out)
throws DocumentException, IOException{

File tmpFontFile = new File("C:\\temp\\verdana.ttf");

File arq = new File("C:\\temp\\VERDANAB.ttf");

File arq2 = new File("C:\\temp\\VERDANAI.ttf");

File arq3 = new File("C:\\temp\\VERDANAZ.ttf");

Tidy tidy = new Tidy();

Document doc = tidy.parseDOM(input, null);

ITextRenderer renderer = new ITextRenderer();


renderer.getFontResolver().addFont( tmpFontFile.getAbsolutePath(),BaseFont.IDENTITY_H,BaseFont.EMBEDDED);

renderer.getFontResolver().addFont( arq.getAbsolutePath(),
BaseFont.IDENTITY_H,BaseFont.EMBEDDED);


renderer.getFontResolver().addFont( arq2.getAbsolutePath(),BaseFont.IDENTITY_H,BaseFont.EMBEDDED);


renderer.getFontResolver().addFont( arq3.getAbsolutePath(),BaseFont.IDENTITY_H,BaseFont.EMBEDDED);

renderer.layout();

renderer.createPDF(out);
}
Reply all
Reply to author
Forward
0 new messages