Exception when setting fontsSources on linux with mono

Hi,
I followed your sample to add a path to the fontsSources when converting doc to pdf, on linux opensuse with mono, and I always get an exception, except when the font path doesn’t exist …

Attached are the fonts dir and the .doc test file.

Thanks in advance for your help.

- Mono JIT compiler version 2.10.2 (tarball Mon Apr 18 15:12:52 UTC 2011)
Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: debugger softdebug
LLVM: yes(2.9svn-mono)
GC: Included Boehm (with typed GC and Parallel Mark)

- Aspose.Words v13.8.

- program :
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aspose.Words;
using Aspose.Words.Fonts;

namespace DocToPdf
{
class Program
{
static void Main(string[] args)
{
Document doc = new Document(“/tmp/test.doc”);
ArrayList fontSources = new ArrayList(FontSettings.GetFontsSources());
FolderFontSource folderFontSource = new FolderFontSource(“/opt/novaappserver/fonts/truetype”, true);
fontSources.Add(folderFontSource);
FontSourceBase[] updatedFontSources = (FontSourceBase[])fontSources.ToArray(typeof(FontSourceBase));
FontSettings.SetFontsSources(updatedFontSources);
doc.Save(“/tmp/test.doc.pdf”);
}
}
}

- exception :
linuxvm:/opt/novaappserver/libs # mono ./DocToPdf.exe

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
at x4f4df92b75ba3b67.x438bb4a676d170de.x9059a3203c8fc855 (x5794c252ba25e723.xe39d06eee35dd23d x26094932cf7a9139, System.String xb41faee6912a2313) [0x00000] in :0
at x4f4df92b75ba3b67.x58838bb57cb70d36.x9059a3203c8fc855 (x5794c252ba25e723.xe39d06eee35dd23d x26094932cf7a9139, System.String xb41faee6912a2313) [0x00000] in :0
at x4f4df92b75ba3b67.x79e4013ca0fc082a.xd6b2549ca8b77560 (x1c8faa688b1f0b0c.xcc8c7739d82c63ba x199c511544621683) [0x00000] in :0
at x4f4df92b75ba3b67.xd6b2a42851fedfba.xc7234004e9b72a7e (x1c8faa688b1f0b0c.xcc8c7739d82c63ba x199c511544621683) [0x00000] in :0
at x4f4df92b75ba3b67.x92faf2a956f0f5a7.VisitGlyphs (x1c8faa688b1f0b0c.xcc8c7739d82c63ba glyphs) [0x00000] in :0
at x1c8faa688b1f0b0c.xcc8c7739d82c63ba.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x1c8faa688b1f0b0c.xbaec545ec01f92ca.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x1c8faa688b1f0b0c.xb8e7e788f6d59708.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x1c8faa688b1f0b0c.xbaec545ec01f92ca.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x1c8faa688b1f0b0c.xb8e7e788f6d59708.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x1c8faa688b1f0b0c.xbaec545ec01f92ca.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x1c8faa688b1f0b0c.xb8e7e788f6d59708.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x1c8faa688b1f0b0c.xbaec545ec01f92ca.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x1c8faa688b1f0b0c.xb8e7e788f6d59708.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x1c8faa688b1f0b0c.xbaec545ec01f92ca.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x1c8faa688b1f0b0c.xc67adcdbca121a26.Accept (x1c8faa688b1f0b0c.xf51865b83a7a0b3b visitor) [0x00000] in :0
at x4f4df92b75ba3b67.x92faf2a956f0f5a7.xe406325e56f74b46 (x1c8faa688b1f0b0c.x4fdf549af9de6b97 xda5bf54deb817e37) [0x00000] in :0
at x6a671772ec29137f.xcd769e39c0788209.DoRenderPage (x1c8faa688b1f0b0c.xc67adcdbca121a26 page) [0x00000] in :0
at xf989f31a236ff98c.x6c74398bceb133f8.xa2e0b7f7da663553 (x28925c9b27b37a46.x8556eed81191af11 x5ac1382edb7bf2c2) [0x00000] in :0
at Aspose.Words.Document.xf381a641001e6830 (System.IO.Stream xcf18e5243f8d5fd3, System.String xafe2f3653ee64ebc, Aspose.Words.Saving.SaveOptions xc27f01f21f67608c) [0x00000] in :0
at Aspose.Words.Document.Save (System.String fileName, Aspose.Words.Saving.SaveOptions saveOptions) [0x00000] in :0
at Aspose.Words.Document.Save (System.String fileName) [0x00000] in :0
at DocToPdf.Program.Main (System.String[] args) [0x00000] in :0

Sorry, we realized the problem came from a missing font in the truetype fonts directory.
So you can close the ticket.

Best regards

Hi,

Thanks for your inquiry. After an initial test with Aspose.Words 13.11.0, I was unable to reproduce this exception on my side. I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

I hope, this helps.

Best regards,