Closed GoogleCodeExporter closed 8 years ago
Hi,
Many thanks for your zip and explanation. Today I have not time to study it.
@Leszek : do you think it's possible for you to study Chinese character with
our ODT converter? I could modify our Docx converter like ODT converterif you
have time to fix this problem.
If it's possible for Leszek, I think Guo, you should attach an ODT and Docx
with Chinese character.
Many thanks
Regards Angelo
Original comment by angelo.z...@gmail.com
on 26 Feb 2012 at 10:44
Actually I have no much time to investigate the issue.
Guo - first try to set font encoding. See wiki
http://code.google.com/p/xdocreport/wiki/ODFDOMConverterPDFViaIText
http://code.google.com/p/xdocreport/wiki/ODTReportingJavaMainConverter
how to do this. Maybe this will work??
Also I think that you don't need iTextAsian.jar. Xdocreport converter scans
directories like 'c:/windows/fonts' and should be able to find operating system
fonts.
Regards
Leszek
Original comment by abe...@gmail.com
on 1 Mar 2012 at 8:13
Hi,
Leszek, I have quicly tested the Chinese docx and it doesn't works. It seems
that with iText you should use embedded character
http://stackoverflow.com/questions/5785775/japanese-chinese-text-in-pdf-using-it
ext-java
But our converter doesn't support that (how to manage that?) But I think there
is too problem with docx converter to retreives thewell font. For the moment no
time to investigate to the docx converter.
I have added the chinese docx in the JUNit
http://code.google.com/p/xdocreport/source/browse/thirdparties-extension/org.apa
che.poi.xwpf.converter/src/test/java/org/apache/poi/xwpf/converter/itext/XWPFPOI
2PDFViaiTextConverterTest.java which uses the docx
http://xdocreport.googlecode.com/git/thirdparties-extension/org.apache.poi.xwpf.
converter/src/test/resources/org/apache/poi/xwpf/converter/TestChineseCharacters
.docx
Guo, if you wish help us to support Chinese character for docx/odt converter,
you are welcome!
Regards Angelo
Original comment by angelo.z...@gmail.com
on 2 Apr 2012 at 3:47
It is possible to make font embedded by passing extra parameter to getFont
method
Now we use:
FontFactory.getFont( familyName, encoding, size, style, color );
but there is variant with embedded parameter:
FontFactory.getFont( familyName, encoding, embedded, size, style, color );
I think the bigger problem is how to search for a font
In example in an ODT document in style-text-properties we have:
style:font-name="Times New Roman" fo:font-size="12pt"
style:font-name-asian="Lucida Sans Unicode" style:font-size-asian="12pt"
style:language-asian="zxx" style:country-asian="none"
style:font-name-complex="Tahoma" style:font-size-complex="12pt"
so there is three font names. I don't know for now which to use and in what
circumstances. If I have ODT example and Chinese fonts I could do some
experiments.
Regards
Leszek
Original comment by abe...@gmail.com
on 3 Apr 2012 at 8:01
Hi Leszek,
Many thanks for your answer. I will try to see how to docx works with chinese
characters and it's the same problem than ODT.
Guo could you attach to this issue please an ODT with Chinese characters.
Many thanks.
Regards Angelo
Original comment by angelo.z...@gmail.com
on 3 Apr 2012 at 8:34
A chinese people have blogged "How can XDocReport (to PDF) supply the Chinese
character ". See
http://acai-hsieh.blogspot.fr/2012/08/how-can-xdocreport-to-pdf-supply.html
It explains how to it has modified the docx converter to manage chine
character. here her code :
--------------------------------------------------------------------------------
----
// Get font
Font font =
XWPFFontRegistry.getRegistry().getFont( fontFamily, options.getFontEncoding(), fontSize, fontStyle,
fontColor );
// 繁體中文
BaseFont bfChinese = BaseFont.createFont("c:/Windows/Fonts/arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font fontChinese = new Font(bfChinese, font.getSize(), font.getStyle(), font.getColor());
if (fontFamily != null)
fontChinese.setFamily(fontFamily);
font = fontChinese;
--------------------------------------------------------------------------------
----
It forces the font to Arial Uni. I don't understand how docx manage font. It's
my big problem. If anybody can explain me how docx manage font (how to choose
arial unicode when chinese character is used?) it should be very cool to help
me.
Many thank's
Regards Angelo
Original comment by angelo.z...@gmail.com
on 28 Sep 2012 at 9:20
I have added a new interface IFontProvider for ODT and DOCX PDF converter that
you can set it in the PdfOptions to manage as you wish the Font creation. So
with 1.0.0 you can do that:
-------------------------------------------------------------------------
PdfOptions options = PdfOptions.create();
options.fontProvider( new IFontProvider()
{
public Font getFont( String familyName, String encoding, float size, int style, Color color )
{
try
{
BaseFont bfChinese =
BaseFont.createFont( "c:/Windows/Fonts/arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED );
Font fontChinese = new Font( bfChinese, size, style, color );
if ( familyName != null )
fontChinese.setFamily( familyName );
return fontChinese;
}
catch ( Exception e )
{
e.printStackTrace();
return null;
}
}
} );
PdfConverter.getInstance().convert( document, out, options );
-------------------------------------------------------------------------
It's not a clean solution but now I can convert the chinese character. It shoul
dbe cool if chinese people coul dexplain us how docx manage chinese characters
(I don't understand nothing?)
Regards Angelo
Original comment by angelo.z...@gmail.com
on 5 Oct 2012 at 2:57
Hi,
I have added Junit with docx and odt chinese characters for pdf converter :
1) for odt :
http://code.google.com/p/xdocreport/source/browse/thirdparties-extension/org.odf
toolkit.odfdom.converter.pdf/src/test/java/org/odftoolkit/odfdom/converter/pdf/P
dfConvertChineseTestCase.java
2) for docx :
http://code.google.com/p/xdocreport/source/browse/thirdparties-extension/org.apa
che.poi.xwpf.converter.pdf/src/test/java/org/apache/poi/xwpf/converter/pdf/PdfCo
nvertChineseTestCase.java
Regards Angelo
Original comment by angelo.z...@gmail.com
on 9 Oct 2012 at 9:25
Hi,
My notebook environment characters is big5,please find the test result at the
attachment.
a cai
Original comment by chief...@gmail.com
on 15 Oct 2012 at 5:42
Hi cai,
I'm sorry, but I don't understand your problem?
Could you explain me what is the problem.
Thank's
Regards Angelo
Original comment by angelo.z...@gmail.com
on 15 Oct 2012 at 7:14
Hi Angelo,
Just provide test results in order to facilitate reference.
TestChineseCharacters.docx has two pages and TestChineseCharacters.docx.pdf has
five pages,TestChineseCharacters.docx.pdf of 2~4 pages are blank pages.
Thank's
a cai
Original comment by chief...@gmail.com
on 15 Oct 2012 at 8:07
Hi cai,
I have noticed this problem, but it doesn't linked to the chinese characters. I
will study this problem.
Regards Angelo
Original comment by angelo.z...@gmail.com
on 15 Oct 2012 at 8:50
Hi cai,
Problem is fixed. You can test it with our live demo
http://xdocreport-converter.opensagres.cloudbees.net/
There is just again a problem with first row of table which is start on the
first page although it should start of the second page.
Regards Angelo
Original comment by angelo.z...@gmail.com
on 18 Oct 2012 at 2:37
Can reference "Test XDocReport v1.0.0".
http://acai-hsieh.blogspot.tw/2013/02/test-xdocreport-v100.html
Original comment by chief...@gmail.com
on 21 Jun 2013 at 1:23
Hi cai,
Many thank's for your article. For your information, Leszek and me are
improving (planned for 1.0.3) the pdf font in our converter and it should fix
problem whith chinese character (no need to force the use of a font with
"c:/Windows/Fonts/arialuni.ttf" (which works only with windows OS).
Regards Angelo
Original comment by angelo.z...@gmail.com
on 21 Jun 2013 at 5:27
Thank's,I received.
Original comment by chief...@gmail.com
on 21 Jun 2013 at 6:22
Original comment by angelo.z...@gmail.com
on 7 Aug 2014 at 8:59
cleanup
Original comment by pascal.leclercq
on 10 Oct 2014 at 7:37
Original issue reported on code.google.com by
guozwh...@gmail.com
on 26 Feb 2012 at 10:14