docs-to-pdf-converter icon indicating copy to clipboard operation
docs-to-pdf-converter copied to clipboard

chinese incorrect codes

Open yukixiong opened this issue 8 years ago • 8 comments

第1章绪论练习题

一、判断题

  1. 数据元素是数据的最小单位。( )
  2. 记录是数据处理的最小单位。 ( )
  3. 数据的逻辑结构是指数据的各数据项之间的逻辑关系。( ) 4.算法的优劣与算法描述语言无关,但与所用计算机有关。( ) 5.健壮的算法不会因非法的输入数据而出现莫名其妙的状态。( ) 6.数据的物理结构是指数据在计算机内的实际存储形式。( )
  4. 数据结构的抽象操作的定义与具体实现有关。( ) #1
  1. #############( )
  2. ############# ( )
  3. ########################( ) 4##########################( ) 5###########################( ) 6#########################( )
  4. ####################( )

yukixiong avatar May 14 '16 11:05 yukixiong

I have run your request via Google Translate into English but I do not understand your request.

yeokm1 avatar Jun 06 '16 08:06 yeokm1

I am sorry After publish my project to the linux server, when the document contains Chinese, pdf no Chinese. Just like upstairs --Chinese garbled.

yukixiong avatar Jun 08 '16 02:06 yukixiong

Oh, I have never tested the app with non-English characters. I depend on external libraries to handle the conversion. If they can't manage those characters then I can't do anything about it.

yeokm1 avatar Jun 10 '16 03:06 yeokm1

Thank you very much. It`s my fault. I forgot to install fonts library on my server. Thanks again!!!

yukixiong avatar Jun 10 '16 04:06 yukixiong

I met the same issue as yours.Have you ever fixed this probelm? @yukixiong ,how to convert doc to pdf with chinese characters.

littlebox692 avatar Jun 24 '17 09:06 littlebox692

Simple docx to pdf convert. Use font provider fix it. Copy any ttf font from Windows c:/Windows/Fonts to src/main/resources

XWPFDocument document = new XWPFDocument(file);
PdfOptions options = PdfOptions.create();
options.fontProvider(new ITextFontRegistry() {
    public Font getFont(String familyName, String encoding, float size, int style, Color color) {
        try {
            BaseFont bfChinese =
                BaseFont.createFont("font/PingFang_Regular.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
            Font fontChinese = new Font(bfChinese, size, style, color);
            if (familyName != null)
                fontChinese.setFamily(familyName);
            return fontChinese;
        } catch (Throwable e) {
            e.printStackTrace();
            // An error occurs, use the default font provider.
            return ITextFontRegistry.getRegistry().getFont(familyName, encoding, size, style, color);
        }
    }
});
PdfConverter.getInstance().convert(document, os, options);

co-kevin avatar Apr 22 '18 04:04 co-kevin

@littlebox692 Have you ever fixed this probelm?

wanglewoba avatar Jun 19 '18 02:06 wanglewoba

@yukixiong @littlebox692 @sunwenwu 请问你们解决中文变成#号的问题没? Have you solved the problem of Chinese becoming ##?

chengqun2 avatar Sep 07 '18 03:09 chengqun2