在Linux上使用Aspose 将RTF转换为PDF乱码问题

在Linux上使用apose将RTF文件转换为PDF时出现日语乱码问题

我使用Windows没有问题。我尝试在Linux服务器上安装CSEUPKDFMTJAPANESE和utf-8字符编码,并安装了日语字体库,
Screenshot 2023-06-25 162112.png (13.7 KB)

但转换仍然失败
下面是安装的字体
/usr/share/fonts/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold
/usr/share/fonts/dejavu/DejaVuSerif-Italic.ttf: DejaVu Serif:style=Italic
/usr/share/fonts/custom/courier_new.ttf: Courier New:style=Standaard,Regular
/usr/share/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf: DejaVu Sans Mono:style=B old Oblique
/usr/share/fonts/dejavu/DejaVuSansCondensed-Oblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Oblique,Oblique
/usr/share/fonts/dejavu/DejaVuSansCondensed-Bold.ttf: DejaVu Sans,DejaVu Sans Co ndensed:style=Condensed Bold,Bold
/usr/share/fonts/dejavu/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Book
/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf: DejaVu Sans Mono:style=Bold
/usr/share/fonts/custom/ipam.ttf: IPAMincho:style=Regular
/usr/share/fonts/vlgothic/VL-Gothic-Regular.ttf: VL Gothic:style=regular
/usr/share/fonts/dejavu/DejaVuSans.ttf: DejaVu Sans:style=Book
/usr/share/fonts/dejavu/DejaVuSerifCondensed-BoldItalic.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold Italic,Bold Italic
/usr/share/fonts/dejavu/DejaVuSerifCondensed-Bold.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold,Bold
/usr/share/fonts/custom/ipag.ttf: IPAGothic:style=Regular
/usr/share/fonts/vlgothic/VL-PGothic-Regular.ttf: VL PGothic:style=regular
/usr/share/fonts/dejavu/DejaVuSerif.ttf: DejaVu Serif:style=Book
/usr/share/fonts/dejavu/DejaVuSansMono-Oblique.ttf: DejaVu Sans Mono:style=Obliq ue
/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: DejaVu Sans:style=Bold
/usr/share/fonts/custom/times_new_roman.ttf: Times New Roman:style=Normál,Regula r
/usr/share/fonts/dejavu/DejaVuSerifCondensed.ttf: DejaVu Serif,DejaVu Serif Cond ensed:style=Condensed,Book
/usr/share/fonts/custom/arial.ttf: Arial:style=Standaard,Regular
/usr/share/fonts/dejavu/DejaVuSerifCondensed-Italic.ttf: DejaVu Serif,DejaVu Ser if Condensed:style=Condensed Italic,Italic
/usr/share/fonts/dejavu/DejaVuSansCondensed.ttf: DejaVu Sans,DejaVu Sans Condens ed:style=Condensed,Book
/usr/share/fonts/dejavu/DejaVuSerif-BoldItalic.ttf: DejaVu Serif:style=Bold Ital ic
/usr/share/fonts/dejavu/DejaVuSans-ExtraLight.ttf: DejaVu Sans,DejaVu Sans Light :style=ExtraLight
/usr/share/fonts/dejavu/DejaVuSansCondensed-BoldOblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold Oblique,Bold Oblique
/usr/share/fonts/dejavu/DejaVuSans-Oblique.ttf: DejaVu Sans:style=Oblique
/usr/share/fonts/dejavu/DejaVuSans-BoldOblique.ttf: DejaVu Sans:style=Bold Obliq ue

set(“asposeWordsVersion”, “21.5.0”)

@JosephYi, 请在出现字体问题的计算机上运行以下代码。 此代码应该打印缺失字体的列表。

Document doc = new Document("in.rtf");

HandleDocumentWarnings warningsHandler = new HandleDocumentWarnings();
doc.setWarningCallback(warningsHandler);

doc.save("out.pdf");

warningsHandler.printMissingFontDetails();



public static class HandleDocumentWarnings implements IWarningCallback {
    public ArrayList listOfFonts = new ArrayList();

    public void warning(WarningInfo info) {
        if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) {
            if (!listOfFonts.contains(info.getDescription()))
                listOfFonts.add(info.getDescription());
        }
    }

    public void printMissingFontDetails() {
        for (int i = 0; i < listOfFonts.size(); i++)
            System.out.println(listOfFonts.get(i).toString());
    }
}

如果您仍然遇到文档的字体问题,请提供该文档进行分析。