Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Apr 08, 2024 10:16 am

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());

Code: Select all
  Message=Value cannot be null.
Parameter name: trueTypeFont
   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.

Posts: 3
Joined: Thu Aug 13, 2020 10:18 am

Tue Apr 09, 2024 2:42 am


Thanks for your inquiry.
I tested your Word file and reproduced your issue, and I logged it into our bug tracking system with the ticket number SPIREDOC-10425, our Dev team will investigate and fix it. Once it is resolved, I will inform you in time. Sorry for the inconvenience caused.

E-iceblue support team
User avatar

Posts: 997
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.Doc