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.

Fri Jul 22, 2022 11:34 am

Hi,

I'm using spire.office version 5.2.0 (licensed). When I try to convert .docx to .pdf using SaveToStream function, it is throwing a null reference exception for few files.

Code: Select all
Document doc = new Document();
doc.LoadFromFile(@"D:Dummy.docx");

MemoryStream pdfStream = new MemoryStream();
doc.SaveToStream(pdfStream, FileFormat.PDF);


It generates the following error:

System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Spire.Doc
StackTrace:
at spr⢾.ᜃ(Paragraph A_0, spr⑚ A_1)
at Spire.Doc.Documents.Paragraph.Spire.Doc.Layout.IDocumentBase.Draw(spr⢾ dc, spr⑚ ltWidget)
at spr⑚.ᜂ(spr⢾ A_0)
at spr⑚.ᜂ(spr⢾ A_0)
at spr⣋.ᜂ(spr⢾ A_0)
at spr⢶.ᜁ(Int32 A_0, Int32 A_1)
at spr⣡.ᜀ(spr⢶ A_0, Stream A_1)
at spr⣡.ᜀ(Document A_0, Stream A_1, ToPdfParameterList A_2)
at Spire.Doc.Document.ᜁ(Stream A_0, ToPdfParameterList A_1)
at Program.<Main>$(String[] args) in D:\02-SourceCode\ConvertToPdf\ConvertToPdf\Program.cs:line 13

The same issue is reported with converting a .PPTX file to .PDF using SaveToFile function.

Note: When I executed the same code using Spire.Office version 7.7.2, it is working fine.

Thank you in advance.

SudhiHebbar
 
Posts: 5
Joined: Thu May 26, 2022 12:56 pm

Mon Jul 25, 2022 6:26 am

Hi,

Thank you for your inquiry and sorry for the late reply due to weekend.
Please note that Spire.Office v7.7.2 is the latest version at present, it contains more fixes and new features than the older versions. The NullReferenceException is resolved in v7.7.2, so this exception is not thrown when you test with the latest version. Your license is valid for the Spire.Office v7.7.2, please remove the old version from your project and use the new version 7.7.2 instead. If there is any question, please feel free to write back.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Fri Jul 29, 2022 10:24 am

Hello,

Thanks for the response. I tried to upgrade the library version 7.7.2 and tried to apply the license what I was using with 5.2.0. I am getting the following watermark in the converted pdf document, "Evaluation warning: The document was created with Sprire.Doc with .NET". Can you please let me know why the license of 5.2.0 is not applicable on the upgraded version.

Thanks & Regards
Sudheendra

SudhiHebbar
 
Posts: 5
Joined: Thu May 26, 2022 12:56 pm

Mon Aug 01, 2022 3:01 am

Hi,

Sorry for the late reply due to weekend.
Kindly note that our license is based on one year subscription. The 1-year subscription enables free priority support and updates for one year, after the subscription expires, you can still use the licensed version of the product, but the new releases and hotfixes are no longer available.
In addition, I didn't find your purchase information according to your email. Could you please provide the authorized email address or order number for our reference? Thank you in advance.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Return to Spire.Doc