Subject: Re: pdf conversion from html 2007-11-06 - By nsk clr
Back Hi Paulo
Thanks for your reply. I'll write code to remove the font tags & style tags.
What shall I do about the wide images that are in the html, which are displayed truncated in pdf.
Thanks
From: Paulo Soares <psoares <at> consiste.pt>
Subject: Re: pdf conversion from html
Newsgroups: gmane.comp.java.lib.itext.general
Date: 2007-11-06 08:59:25 GMT (8 hours and 36 minutes ago)
You are setting the encoding for all the html and are selecting a font afterwards that doesn't support it. If it's not the case post the html that causes the problem.
Paulo
-- -- Original Message -- -- From: "nsk clr" <nskclr <at> yahoo.com> To: <itext-questions <at> lists.sourceforge.net> Sent: Tuesday, November 06, 2007 12:05 AM Subject: [iText-questions] pdf conversion from html
> 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
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- 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 <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ __ 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>Hi Paulo<br><br>Thanks for your reply. I'll write code to remove the font tags & style tags.<br><br>What shall I do about the wide images that are in the html, which are displayed truncated in pdf.<br><br>Thanks<br><br><br > From: Paulo Soares <psoares <at> consiste.pt><br> Subject: <a target="_top" rel="nofollow" href="http://news.gmane.org/find-root .php?message_id=%3c005101c82053%2457f5a570%24587ba8c0%40psoaresw%3e">Re: pdf conversion from html</a><br> Newsgroups: <a href="http://news.gmane.org/gmane.comp.java.lib.itext.general" target="_top">gmane.comp.java.lib.itext.general</a><br> Date: 2007-11-06 08:59:25 GMT (8 hours and 36 minutes ago)<br> <pre>You are setting the encoding for all the html and are selecting a font <br >afterwards that doesn't support it. If it's not the case post the html that <br >causes the problem.<br><br>Paulo<br><br>-- -- Original Message -- -- <br>From: "nsk clr" <nskclr <at> yahoo.com><br>To: <itext-questions <at > lists.sourceforge.net><br>Sent: Tuesday, November 06, 2007 12:05 AM<br >Subject: [iText-questions] pdf conversion from html<br><br>> Hi<br>><br> > I use 'Arial Unicode MS' with 'Identity-H' encoding to convert Html to <br> > pdf.<br>> 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");<br>><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();<br>><br>> In some cases, If the html has font tag and style tag with font (eg. <span <br>> style="FONT-WEIGHT: bold; COLOR: rgb (0,153,204)">), I get the following <br>> exception.<br>> ExceptionConverter: java.io.UnsupportedEncodingException: Identity-H<br>><br >> Also when I convert the html with image, the image fills the page <br>> widthwise and is truncated on the sides. what should i include for images?<br> ><br>> Thanks<br><br>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- -- ---- ---- ---- --<br>This SF.net email is sponsored by: Splunk Inc.<br>Still grepping through log files to find problems? Stop.<br>Now Search log events and configuration files using AJAX and a browser.<br>Download your FREE copy of Splunk now >> <a rel="nofollow" href="http://get.splunk.com/" target="_top">http://get.splunk .com/</a><br>__ ____ ____ ____ ____ ____ ____ ____ ____ ____<br>iText-questions mailing list<br>iText-questions <at> lists.sourceforge.net<br><a rel= "nofollow" href="https://lists.sourceforge.net/lists/listinfo/itext-questions" target="_top">https://lists.sourceforge.net/lists/listinfo/itext-questions</a> <br>Buy the iText book: <a rel="nofollow" href="http://itext.ugent.be/itext-in -action/" target="_top">http://itext.ugent.be/itext-in-action/</a><br><br></pre> <br></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/
|
|