We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Cells - Save to PDF substitutes fonts

Hello Support,

We have a lic for AsposeTotal and are trying to save Excel file with text in custom fonts as PDF document. We noticed that everything on the spreadsheet is being substituted with a different font. Referenced fonts are installed on the machine.
Aspose.Cells version: 17.9.0.0, Runtime version: v4.0.30319
MS Visual Studio 2013 version: 12.0.30110.00 Update 1
MS.NET Framework version: 4.5.51650
C# code:

string filePath = @“C:\install\source.xlsx”;
string fileDir = @“C:\install”;

Aspose.Cells.FontConfigs.SetFontFolder(@“C:\install\BrandingFonts”, false);

Workbook workbook = new Workbook(filePath);
workbook.Save(fileDir + “source.pdf”, Aspose.Cells.SaveFormat.Pdf);
//workbook.Save(fileDir + “source.pdf”); //doesn’t work either

If we try to insert a TextStamp into existing PDF and explicitly set its font using code line below it works, but if we simply save existing Excel into PDF all fonts are replaced with either Arial or Calibri.

myTextStamp.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont(“Alright Sans Regular”);

It seems that Aspose.Pdf recognizes custom fonts and Aspose.Cells does not. Could you please explain in details how to solve this issue?

Attached are two files: source_xlsx.jpg and resulting source.pdf
source.pdf (25.5 KB)
source_xlsx.jpg (72.6 KB)

Thank you,
Alex

@aschledwitz,

Thanks for the PDF file and screenshot.

Well, apparently if the fonts are installed on the machine, you should not find such issue. Please make sure all the fonts are installed on your system and the custom font folder “BrandingFonts” should be accessible to the APIs.

If you still find the issue, kindly do provide us your template file “source.xlsx” and custom font files. You zip template file and font files and share it either here (if the size is less than 3MB) or upload to some file sharing service and share the Download link here, we will check it soon.

@Amjad_Sahi,

Thanks for getting back to me. Please see attached zip files with fonts and two Excel templates we worked with. PDFs created via Aspose.Cells lack custom fonts while ordinary Print-To-PDF generates PDFs correctly. Please note that we have also installed fonts in default C:Windows\Fonts location and ran the code against it to no avail. As I mentioned in my first post Aspose.Pdf.Text.FontRepository.FindFont(“Alright Sans Regular”) produces no errors and inserts correct TextStamp into any existing PDF.

Thank you for your help with this!Alright Sans.zip (582.5 KB)
Excel.zip (23.5 KB)
Source Sans Pro.zip (1.0 MB)

@aschledwitz

Thanks for considering Aspose APIs.

We are afraid, Aspose.Cells does not support OTF fonts. Please convert OTF fonts into TTF fonts manually or using some other API.

Besides, we do not have any plans to support OTF fonts, although this issue is already logged as CELLSNET-43975.

In case, we make any other decision or we have some news for you, we will update you asap.

Thanks for the reply. Although we find it slightly odd that some products within Aspose Total family support OTFs and some - not, at least we have a workaround now.

@aschledwitz

Thanks for your feedback and using Aspose APIs.

Unfortunately, Aspose.Cells product team could not support OTF fonts because of other priority tasks. Therefore users have to use TTF fonts. We are sorry for the inconvenience. Let us know if you face any other issue, we will be glad to look into it and help you further.

@aschledwitz,
Please try our latest version/fix: Aspose.Cells for .NET v20.7.3:
Aspose.Cells20.7.3 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.7.3 For .Net4.0.Zip (5.4 MB)

Your issue should be fixed in it.

Let us know your feedback.

The issues you have found earlier (filed as CELLSNET-43975) have been fixed in Aspose.Cells for .NET v20.8. This message was posted using Bugs notification tool by Amjad_Sahi