PdfSaveOptions does'nt add Arial Narrow system font

I’ve wrote a pretty simple console application. The console application open an .xls file and convert it to .pdf file. I need to include system font (Arial Narrow). If I save with or without the PdfSaveOptions the fonts is nevers embedded since the file bytes always the same. The reason I need to embed this font is because a new version of Arial Narrow (release with windows Update) cause an error when opening the pdf . "Cannot extract the embedded font ‘FAAAEJ+ArialNarrow’… Some characters may not display or print correctly ". This error only occur if the windows update is installed.



Using: Aspose.Cells 7.4.3 (.net 3.5 version), but same behavior with the .net 2.0 version.

With latest version 8.7 there is no error, but some chart are broken when generating our xls file with Aspose. We cannot easily move to 8.7 since this will cause many other problem in our xls source file generation.



source code

-------------------------------------

Workbook book = new Workbook(“mysource.xls”);

book.Settings.CultureInfo = new CultureInfo(“fr-CA”);



PdfSaveOptions so = new PdfSaveOptions(SaveFormat.Pdf);

so.EmbedStandardWindowsFonts = true;



book.Save(“mydestination_direct.pdf”,SaveFormat.Pdf);

book.Save(“mydestination_withFonts.pdf”,so);



////Same behavior using a memory stream, font never included.

Hi,


Thanks for providing us some details.

Well, I am afraid, we cannot fix any issue (if found) in any of the previous releases of the API. This is due to the fact that we maintain single code base therefore all the fixes will be based on the latest APIs set. If you are not able to observe the said issue with latest release (please try our latest version/fix: Aspose.Cells for .NET v8.7.0.2) that means the problem has already been addressed so you should upgrade to use 8.7.0.x. If you have any concerns or issue (regarding rendering charts etc.) with our latest version/fix, please provide complete details, sample console application (runnable) with template files, so we could investigate the issue and may log the appropriate ticket(s) to figure your issue(s) soon. Also, it would be better to start a new thread for each issue, it will help us to figure out and manage your issues precisely.

Thank you.

Ok well with the version 8.7.0.2 the pdfsaveoption does’nt add the Arial Narrow font with the code simple i’ve provided. HAve the same behavior with 7.4.3, 8.7 and 8.7.0.2. Is the Arial Narrow font is supposed to be embedded in the pdf when using my simple?

Hi,


Could you provide us “mysource.xls” file, we will test your issue soon.

Thank you.

here is the simple file.

Like I said, with aspose 8.7.0.2 we don’t have any font problem. But with 7.4.3 yes. the problem wit 8.7.0.2 is that we have lots of reports where chart or other artefact in report that was working great on 7.4.3 but not in 8.7.0.2. If i’m able to “embed” the arial font (the one before the windows update) into the PDF it should work. The probleme is that it does’nt seem to add the embeded font with the code i’ve provide.

one more detail. the problem only occur when opening the .pdf on the local computer where arial narrow 2.40 is installed. If it’s 2.37 it will show up without error. Thats why we want to embed the arial narrow font 2.37 in the generated pdf file. That way we will ensure that this font will be used (i supposed). . Note that the .pdf file is generated from a computer where the arial narrow version is 2.37 and the pdf open well. But when we try open the same pdf on a machine that have the arial narrow 2.40 it’s give an error. That’s why ff it’s possible to add the .ttf file in the generated pdf that will be,I supposed, an option. That way we will add the 2.37 version.

Hi Alex,


Thank you for providing further details.

Please note, Aspose.Cells APIs use the font sub-setting mechanism that means, only those characters that are actually used in the layout are stored in the PDF. If a particular glyph doesn’t appear anywhere in the text, it will not be embedded in the PDF. This mechanism has been opted to reduce the resultant PDF file size because embedding the whole font results in larger PDF files.

Coming back to your original concerns, I have tested the case (using your provided spreadsheet & Aspose.Cells for .NET 7.4.3), and I was not able to observe any error while opening the resultant PDF in Adobe’s Acrobat Reader DC in spite of the fact that the version of Arial Narrow font on my machine is 2.40. However, when I checked the same PDF on another machine by removing the Arial Narrow font family, I was able to observe the error mentioned in your original post. Moreover, when I tried opening the PDF generated with 8.7.0.2 after removing the said font, no error was observed. Based on these findings, I believe the problem is caused due to some bug in the Aspose.Cells for .NET 7.4.3 revision which as already been addressed with recent releases. Moreover, I was not able to bypass the said problem using the 7.4.3 therefore I can only suggest you to upgrade your project to use latest releases.

If you are concerned about the font not being embedded in the PDF, please check the document properties (File>Properties) for the Font tab in Acrobat Reader application, there you will find the list of embedded fonts. I have attached with this post a few snapshots as well as the PDF file generated with Aspose.Cells for .NET 8.7.0.2 & 7.4.3.0.