We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.words for .net txt文件转PDF文件中文乱码

使用aspose.words 将txt文件转为PDF时,中文乱码 该如何解决?附件.zip (6.3 KB)

代码如下:
Document doc = new Document(_spoolFileName);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.PageSetup.PaperSize = PaperSize.A3;
builder.PageSetup.Orientation = Orientation.Portrait;//纵向
doc.Save(PdfFilePath, SaveFormat.Pdf);

@iccolor

请使用如下所示的 LoadOptions.Encoding 属性来获得所需的输出。 希望这对你有帮助。

com.aspose.words.LoadOptions options = new com.aspose.words.LoadOptions();
options.setLoadFormat(com.aspose.words.LoadFormat.TEXT);
options.setEncoding(Charset.forName("Shift_JIS"));
Document document = new Document("input.txt", options);
document.save("21.12.pdf", SaveFormat.PDF);