Subject: pdf conversion from html 2007-11-05 - By nsk clr
Back Hi I use 'Arial Unicode MS' with 'Identity-H' encoding to convert Html to pdf. Document document = new Document(); FontFactory.register("C:\\Windows\\fonts\\arialuni.ttf"); StyleSheet st = new StyleSheet(); st.loadTagStyle("body", "face", "Arial Unicode MS"); st.loadTagStyle("body", "encoding", "Identity-H"); st.loadTagStyle("body", "leading", "12,0");
document.open(); ArrayList p = HTMLWorker.parseToList(stringReader, st); for (int k = 0; k < p.size(); ++k) { document.add((Element)p.get(k)); } document.close(); In some cases, If the html has font tag and style tag with font (eg. <span style="FONT-WEIGHT: bold; COLOR: rgb(0,153,204)">), I get the following exception. ExceptionConverter: java.io.UnsupportedEncodingException: Identity-H Also when I convert the html with image, the image fills the page widthwise and is truncated on the sides. what should i include for images? Thanks
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com <html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head> <body><div style="font-family:times new roman, new york, times, serif;font-size :12pt"><DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> <DIV> <DIV>Hi </DIV> <DIV> </DIV> <DIV>I use 'Arial Unicode MS' with 'Identity-H' encoding to convert Html to pdf . </DIV> <DIV> Document document = new Document();<BR>   ;FontFactory.register("C:\\Windows\\fonts\\arialuni.ttf");<BR>   ;StyleSheet st = new StyleSheet();<BR> st.loadTagStyle("body", "face", "Arial Unicode MS");<BR> st.loadTagStyle("body", "encoding", "Identity-H");<BR> st.loadTagStyle("body", "leading ", "12,0");</DIV> <DIV><BR> document.open();<BR> ArrayList p = HTMLWorker.parseToList(stringReader, st);<BR> for (int k = 0; k < p.size(); ++k) {<BR> document.add((Element)p.get (k));<BR> }<BR> document.close();</DIV> <DIV> </DIV> <DIV>In some cases, If the html has font tag and style tag with font (eg. < ;span style="FONT-WEIGHT: bold; COLOR: rgb(0,153,204)">), I get the following exception.</DIV> <DIV><SPAN>ExceptionConverter: <A href="http://java.io/" target=_blank>java.io< /A>.UnsupportedEncodingException: Identity-H</SPAN></DIV> <DIV><SPAN></SPAN> </DIV> <DIV><SPAN>Also when I convert the html with image, the image fills the page widthwise and is truncated on the sides. what should i include for images? </SPAN></DIV> <DIV><SPAN></SPAN> </DIV> <DIV><SPAN>Thanks</SPAN></DIV></DIV></DIV><BR><BR></DIV></DIV></div><br>__ ____ __ ____ ____ ____ ____ ____ ____ ____ _____<br>Do You Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection around <br>http://mail.yahoo.com < /body></html> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
|
|