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.

Tue Nov 13, 2018 12:06 pm

Hi,

I am converting a word document to PDF using the following code

Code: Select all
using (Spire.Doc.Document doc = new Spire.Doc.Document())
{
   doc.LoadFromFile(wordDocPath, SpireDoc.FileFormat.Doc);
   doc.SaveToFile(pdfFilePath, Spire.Doc.FileFormat.PDF);
}


I am getting a System.OutOfMemoryException when doc.LoadFromFile is called.

Code: Select all
 
 at Spire.Doc.Body..ctor(Document A_0, DocumentObject A_1)
   at Spire.Doc.TableCell..ctor(IDocument document)
   at sprᴈ.ᜎ()
   at sprᴍ.ᜁ()
   at sprᴍ.ᜂ(sprᲦ A_0)
   at sprᴌ.ᜀ(spr᳿ A_0, Int32 A_1, sprᴋ A_2)
   at sprᴌ.ᜀ(spr᳿ A_0)
   at sprᴌ.ᜀ(Int32 A_0, Int32 A_1)
   at sprᴌ.ᜁ()
   at sprᴂ.ᜄ()
   at Spire.Doc.Document.ᜀ(Stream A_0, String A_1, FileFormat A_2)
   at Spire.Doc.Document.ᜀ(String A_0, String A_1, FileFormat A_2)
   at Spire.Doc.Document.LoadFromFile(String fileName, FileFormat fileFormat, String password)
   at Spire.Doc.Document.LoadFromFile(String fileName, FileFormat fileFormat)


I am using the latest version of Spire.Doc that is available on nuget - 6.11.5. I have a pro licence for Spire.Doc.

I am however trying to convert a very large word document. It is 31.6MB and is a "Microsoft Word 97 - 2003 Document (.doc)" word file. The document has 469 pages. The document has lots of tables (about 3 in every 4 or 5 pages has a table), it has lots of full page images (at least 1 in every 5 pages).

Any help would be appreciated.

Thank you

isoperations
 
Posts: 2
Joined: Fri May 11, 2018 8:42 am

Wed Nov 14, 2018 3:19 am

Hi,

Thanks for your inquiry.
To help us investigate and resolve your issue quickly, please provide your sample Word file. Considering the size, you could upload the file to the DropBox or OneDrive and then share the download link with us.
Sincerely,
Mike
E-iceblue support team
User avatar

Mike.Zhang
 
Posts: 93
Joined: Thu Sep 27, 2018 7:11 am

Thu Nov 15, 2018 7:39 am

Hi,

I've discovered it is because I am running the document conversion through IIS. If we take the process out of IIS then the document generation works fine. It does take about 6 minutes but it doesn't fail. So I will probably go down that route.

Thank you

isoperations
 
Posts: 2
Joined: Fri May 11, 2018 8:42 am

Thu Nov 15, 2018 10:08 am

Hi,

Thanks for your feedback.
The performance would be influenced by the memory available and the file size. If the file is large in size, it would cost a little long time. Just feel free to contact us if you need any help.
Sincerely,
Mike
E-iceblue support team
User avatar

Mike.Zhang
 
Posts: 93
Joined: Thu Sep 27, 2018 7:11 am

Return to Spire.Doc