Free Support Forum - aspose.com

MSG to PDF conversion

on certain machines MSG to PDF conversion throws the the following error :
"Could not find a part of the path ‘C:\Windows\Fonts\private\ARIALNB.TTF’ "

what could be causing this error?, Fonts are installed on the machines under C:\Windows\Fonts, but the library is looking into the folder C:\Windows\Fonts\private\

Here is the code snippet
using (MailMessage mailMsg = MailMessage.Load(InputFileName))
{

                using (MemoryStream ms = new MemoryStream())
                {

                    //Save as MHTML
                    mailMsg.Save(ms, MsgSaveOptions.DefaultMhtml);

                    //create an instance of LoadOptions and set the LoadFormat to Mhtml
                    var loadOptions = new Aspose.Words.LoadOptions();
                    loadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml;

                    //create an instance of Document and load the MTHML from MemoryStream
                    var document = new Aspose.Words.Document(ms, loadOptions);
                    

                    //create an instance of HtmlSaveOptions and set the SaveFormat to Html
                    var saveOptions = new Aspose.Words.Saving.PdfSaveOptions()
                    {
                        MemoryOptimization = true,
                        SaveFormat = SaveFormat.Pdf
                    };

                    //save the document to Html file
                    document.Save(OutputFileName, saveOptions);
                }
            }

@subhashpk

In the same code that you have used, you are referring to two APIs. Can you please share at which stage you are encountering issue. If you are getting issue while processing MSG file and saving to MHTML or you are getting issue while saving MHTML to PDF. I also request you to please share the details of the issue along with snapshot. Please also provide the source MSG file and intermediate MHTML (if any) for further verification on our end.

That is the difficult part, it is working at my end without any issues , only certain machines at client side we are having this issues. we are trying to figure out what is missing on those machines. As per them, it happens for all the PST files they have when they try in from certain machines and it is working fine from other machines(all are windows 10 machines). Unfortunately because of the some confidentiality issues they could not share the files with us.

With our observation so far, i don’t think it is a MSG file specific issue(as it is working fine from some machines),it is most likely their machine is missing something that Aspose library is looking for
if you can get the information from your development team on what context it will exception out "Could not find a part of the path ‘C:\Windows\Fonts\private\ARIALNB.TTF’ " that will lead us to some where. Appreciate the help.

@subhashpk

Can you please ensure the availability of the fonts on machine where things are failing. Moreover, you can also compare on your end the difference between machines and the respective user permissions too where things are working fine and where things are failing. To me either, it doesn’t sound to be an API related issue its getting reproduced on some but not all.

About the font :

We have verified the font already and it is installed, one thing about the font is, as per the exception it is looking for font under c:\windows\fonts\private folder, but all the machine( both on working and not working machines) I checked fonts are installed under c:\windows\fonts

Permission: we have checked the permission on those machines, the user has full permission to the folders that aspose is reading and writing.

What else we need to check ?, also could you please find out on what context aspose will exception out the message " Could not find a part of the path ‘C:\Windows\Fonts\private\ARIALNB.TTF’ " ?

Thanks,
Subhash

@subhashpk

Can you please confirm one fact that if you are getting exception before following line or on/after it.

 //create an instance of Document and load the MTHML from MemoryStream
                    var document = new Aspose.Words.Document(ms, loadOptions);
                    

Unfortunately, without provision of priority requested information it is not possible for us investigate the issue and find its root cause.