I am trying to convert a Word-file (docx) to PDF using Spire.Doc but unfortunately this leads to an exception.
Used Spire.Doc version: 12.3.12
- Code: Select all
ToPdfParameterList tpl = new ToPdfParameterList
{
UsePSCoversion = false
};
using (MemoryStream wordStream = new MemoryStream(File.ReadAllBytes("Memo.docx")))
{
Document document = new Document();
document.LoadFromStream(wordStream, FileFormat.Docx);
using (MemoryStream pdfStream = new MemoryStream())
{
document.SaveToStream(pdfStream, tpl);
var converted = Convert.ToBase64String(pdfStream.ToArray());
}
}
Exception:
- Code: Select all
System.ArgumentNullException
HResult=0x80004003
Message=Value cannot be null.
Parameter name: trueTypeFont
Source=Spire.Doc
StackTrace:
at spr쒵..ctor(Single A_0, FontStyle A_1, spr蘐 A_2, Boolean A_3, Boolean A_4, Boolean A_5)
at spr㹝.ῑ(spr⼫ A_0, spr㞓 A_1, spr黚 A_2)
at spr㣏.ῑ(spr㞓 A_0, spr몆 A_1, spr⼫ A_2)
at spr㣏.Ἤ(spr㞓 A_0)
at spr㥭.↫(ShapeBase A_0)
at spr㥭.ῑ(ShapeBase A_0, spr㪩 A_1)
at spr쵟.ῑ(ShapeBase A_0, spr홒 A_1)
at spr쵟.ῑ(spr홒 A_0, Boolean A_1)
at spr廬.ῑ(spr俍 A_0)
at spr廬.(spr俍 A_0)
at spr廬.ῑ(spr砙 A_0)
at spr缲.谎()
at spr伎.ῑ(spr炱 A_0)
at spr伎.ῑ(spr䱇 A_0, ArrayList A_1, ArrayList A_2)
at spr伎.ῑ(spr䱇 A_0, ArrayList A_1, ArrayList A_2)
at spr伎.ῑ(spr䱇 A_0, ArrayList A_1, ArrayList A_2)
at spr伎.ῑ()
at spr嫩.쎻(spr惆 A_0)
at spr㘏.ῑ(spr嫩 A_0)
at spr㘏.ῑ(spr嫩 A_0, spr俍 A_1)
at spr⋙.ῑ(sprꪨ A_0, spr㘏 A_1)
at spr⋙.鯹(sprꪨ A_0)
at Spire.Doc.Document.⅜(Stream A_0, ToPdfParameterList A_1)
at Spire.Doc.Document.SaveToStream(Stream stream, ToPdfParameterList paramList)
The error occurs in a simple console application running under Windows Server 2016.
The Word-file which produces the error is attached.
Thanks in advance for any suggestions on how to overcome this issue.