Aspose.Words.Document convert changing icons

Hello,

I have a attached a couple documents that when converted to PDF will result in rendering issues. The code is just a simple conversion from word to pdf using Aspose.Words (23.3.0)

(Icons are being converted to other icons)
Health Canada QIU (2).docx (120.0 KB)

(Content is being pushed onto the second page and partially cut off)Financial Disclosure Form - Sauder (1).docx (41.8 KB)

The document above that is having overflow does not have the same overflow effect when it becomes a docx, but will have issues if the file is a .doc. I am unfortunately unable to upload .docs here.

Aspose.Words.Document document = new Aspose.Words.Document(docFilePath);
        document.Save(tempConvertedDocPath, SaveFormat.Pdf);

Is this a bug or a way to resolve this?

Thanks

@OpenDevSolutions I have tested conversion of your documents on my side.

  • Health Canada QIU (2).docx the result of conversion is identical to PDF produced by MS Word. Could you please attach your output PDF document for our reference and specify what icons have been changed? here is output produced on my side using the latest 23.6 version of Aspose.Words: out.pdf (177.2 KB)

  • Financial Disclosure Form - Sauder (1).docx. The same with the second document. The result of conversion is correct on my side: out2.pdf (97.7 KB)

Thanks for the response alexey. Sorry for the delay. It appears the conversion works locally on my machine but does not on my server hosted on AWS. For the life of me, I cant find a difference. Using the exact same file and function in both situations are yielding different icons.

I thought maybe the .dll on the server was mismatched somehow but they appear to match. I assume that for this conversion to work, just Aspose.Words.dll should be identical? Are there potentially other dependencies that could effect this function?

@OpenDevSolutions Could you please attach the problematic PDF output documents produced on your side? Also, please provide your environment details.

Layout issues upon rendering document to PDF might occur because the fonts required for rendering document are not available in the environment where document is converted. If Aspose.Words cannot find the font used in the document, the font is substituted. This might lead into fonts mismatch and document layout differences due to the different fonts metrics and also to different PDF file size and binary representation. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to lean where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/

The AWS server is missing Wingdings 2 Regular. I will have to find a way to include this when processing documents. Is it possible to load multiple font sources, one defaulting to the C:\Windows\Fonts and another to my application?

Thanks

@OpenDevSolutions Sure, you can specify multiple font sources using FontSettings.SetFontsSources.

Hi,
In the Word document, it is the “Wingdings 3” font. But while converting this word to PDF, it became “Wingdings”. Me also, it is working perfectly in my local. But while generating from the hosted web server, this is happening. Can you please guide me? Is there anything I need to write in code while converting to PDF?

@jithin.p Please ensure that the Wingdings 3 font is installed on your server. The fonts are required to build document layout. If Aspose.Words cannot find the font used in the document, the font is substituted . This might lead into fonts mismatch and document layout differences due to the different fonts metrics. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:

If that font is not available on the server, how is it coming correctly in the Word document?

@jithin.p MS Word can load fonts from the cloud, but Aspose.Words requires all necessary fonts to be installed.

Ok, thanks for the information. If I am using the below code, it will load the fonts from the system folder, and if it is not there, I need to take from the below path. Is this work? Can you please confirm?

@jithin.p In your code, fonts will only be searched for in this folder. The correct code to use is as follows:

FontSettings.DefaultInstance.SetFontsSources(new FontSourceBase[] { new SystemFontSource(), new FolderFontSource(@"C:\Temp\fonts", true) });

In this case, all fonts will be searched for in the default system folder and in any other folder you add.

Hi,

Do I need to install this font on the server, or can I just call it from a path? Which will work?

Thanks
Jithin V P

@jithin.p Yes, you can call it from a path.

I changed the substitutepath value to my path to take the font without installing the font in the webserver. But it is not working.

FontSettings.DefaultInstance.SetFontsSources(new FontSourceBase[] { new SystemFontSource(), new FolderFontSource(@"SubstitutePath", true) });

@jithin.p Are there any warnings from the IWarningCallback?