docs-to-pdf-converter
docs-to-pdf-converter copied to clipboard
chinese incorrect codes
第1章绪论练习题
一、判断题
- 数据元素是数据的最小单位。( )
- 记录是数据处理的最小单位。 ( )
- 数据的逻辑结构是指数据的各数据项之间的逻辑关系。( ) 4.算法的优劣与算法描述语言无关,但与所用计算机有关。( ) 5.健壮的算法不会因非法的输入数据而出现莫名其妙的状态。( ) 6.数据的物理结构是指数据在计算机内的实际存储形式。( )
- 数据结构的抽象操作的定义与具体实现有关。( ) #1
- #############( )
- ############# ( )
- ########################( ) 4##########################( ) 5###########################( ) 6#########################( )
- ####################( )
I have run your request via Google Translate into English but I do not understand your request.
I am sorry After publish my project to the linux server, when the document contains Chinese, pdf no Chinese. Just like upstairs --Chinese garbled.
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.
Thank you very much. It`s my fault. I forgot to install fonts library on my server. Thanks again!!!
I met the same issue as yours.Have you ever fixed this probelm? @yukixiong ,how to convert doc to pdf with chinese characters.
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);
@littlebox692 Have you ever fixed this probelm?
@yukixiong @littlebox692 @sunwenwu 请问你们解决中文变成#号的问题没? Have you solved the problem of Chinese becoming ##?