Hi
I need to use the same in Linux too. Is it possible to install ArialUnicode
MS ttf in Linux or is there an equivalent font available?
Thanks
nsk clr <[EMAIL PROTECTED]> wrote:
Thanks Paulo
It's working fine. It was classpath setting clash that was giving the problem.
Paulo Soares <[EMAIL PROTECTED]> wrote:
It works with my code and my html.
File file = new File("C:\\chinese.html");
int fileLen = (int)file.length();
FileInputStream fis = new FileInputStream(file);
byte[] bytes = new byte[fileLen];
fis.read(bytes,0,fileLen);
String userHTML = new String(bytes, "UTF-8");
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");
StringReader stringReader = new StringReader(userHTML);
PdfWriter.getInstance(document, new FileOutputStream("C:\\chinese.pdf"));
document.open();
ArrayList p = HTMLWorker.parseToList(stringReader, st);
for (int k = 0; k < p.size(); ++k)
document.add((Element)p.get(k));
document.close();
Paulo
----- Original Message -----
From: "nsk clr"
To: "Post all your questions about iText here"
Sent: Wednesday, September 26, 2007 5:45 PM
Subject: Re: [iText-questions] Issue in converting chinese content to pdf
After removing the encoding="utf-8" in the html and using my code, I don't
get the ouput like the one you have attached.
It's all jumbled in a single line and with junk characters.
Do I need to change any other basic settings in my system or in pdf?
Thanks
Paulo Soares
wrote:
Also remove the encoding in the html that is masking the real font encoding.
I attach the modified html and the resulting pdf.
Paulo
----- Original Message -----
From: "nsk clr"
To: "Post all your questions about iText here"
Sent: Tuesday, September 25, 2007 11:27 PM
Subject: Re: [iText-questions] Issue in converting chinese content to pdf
When I use String userHTML = new String(bytes, "UTF-8");, I get nothing in
the pdf.
Otherwise, in the pdf- document properties, the encoding is shown as ANSI,
inspite of me setting as Identity-H in
st.loadTagStyle("body", "encoding", "Identity-H");
How to set the Identity-H as encoding? Why is it not being set?
Thanks
Paulo Soares wrote:
You must use the right charset. In this case:
String userHTML = new String(bytes, "UTF-8");
Paulo
----- Original Message -----
From: "nsk clr"
To:
Sent: Tuesday, September 25, 2007 10:06 PM
Subject: [iText-questions] Issue in converting chinese content to pdf
Hi
I use Itext to convert chinese html to pdf.
The code is
File file = new File("C:\\Itext\\chinese.html");
int fileLen = (int)file.length();
FileInputStream fis = new FileInputStream(file);
byte[] bytes = new byte[fileLen];
fis.read(bytes,0,fileLen);
String userHTML = new String(bytes);
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");
StringReader stringReader = new StringReader(userHTML);
PdfWriter.getInstance(document, new
FileOutputStream("C:\\Swarna\\Itext\\chinese.pdf"));
document.open();
ArrayList p = HTMLWorker.parseToList(stringReader, st);
for (int k = 0; k < p.size(); ++k)
document.add((Element)p.get(k));
document.close();
I have attached the input and ouput files.
Please let me know what to do to get the correct output
Thanks
å®sè°·æ­OEç½'页ï¼OE讯æ¯ï¼OEå¹¶æOE?é'®æ¥æ~¾ç¤ºä½
æ?EURéEUR?语è¨EURéEURsè¿?æ^'们çs"å好页ãEUR'
è°·æ­OEç>®å?æä¾>ä¸<å^-语è¨EURç*OEé¢ï¼s
å®sè°·æ­OEç½'页ï¼OE讯æ¯ï¼OEå¹¶æOE?é'®æ¥æ~¾ç¤ºä½
æ?EURéEUR?语è¨EURéEURsè¿?æ^'们çs"å好页ãEUR'
è°·æ­OEç>®å?æä¾>ä¸<å^-语è¨EURç*OEé¢ï¼s
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
________________________________
Tonight's top picks. What will you watch tonight? Preview the hottest shows
on Yahoo! TV.
å®è°·æ­ç½é¡µï¼è®¯æ¯ï¼å¹¶æé®æ¥æ¾ç¤ºä½
æé语è¨éè¿æä»¬çå好页ã
è°·æ­ç®åæä¾ä¸å语è¨çé¢ï¼
å®è°·æ­ç½é¡µï¼è®¯æ¯ï¼å¹¶æé®æ¥æ¾ç¤ºä½
æé语è¨éè¿æä»¬çå好页ã
è°·æ­ç®åæä¾ä¸å语è¨çé¢ï¼
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
---------------------------------
Building a website is a piece of cake.
Yahoo! Small Business gives you all the tools to get
online.-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
---------------------------------
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out. -------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/