Can't create PDF using Cambria font

Using Aspose.Pdf 7.5, I get an error when trying to generate a PDF from HTML that has CSS declaring Cambria as the default font, even though the font is installed on the machine.

Example CSS:



body
{
font-size: 11pt;
font-family: Cambria, Trebuchet MS, verdana, helvetica;
padding: 10px;
}




The Cambria font is confirmed as installed, but Aspose still throws the following error when calling the Save method: The Font ‘cambria’ is not found. This font is not supported.

Note: I have also tried downloading and using the 8.4.1 hotfix to Aspose.Pdf released on 9/10 and get the same error.

Any suggestions and assistance will be greatly appreciated.

Thanks.

Bryan

Hi Bryan,


Thanks for your inquiry. I’m afraid I’m unable to replicate the issue, while testing the scenario with latest version of Aspose.Pdf for .NET. I’m using Win 7 64 bit, VS2010 and 4.0 Client profile as target framework. Can you please share your environment setting? So I try to replicate the issue.

We are sorry for the inconvenience faced.

Best Regards,

Thanks for the reply Tilal. Please find environment details below.

Development:

Win 7 64 bit
VS2012
.NET 4.5 target framework
IIS 7

Production:

Windows 2012
.NET 4.5 target framework
IIS 8

The problem occurs in both environments. Please let me know if I can provide any additional information. Thanks again.

Bryan

Hi Bryan,


Thank you for sharing your environment details. I’ve tested the scenario over Win7 64 bit and VS2012, but unfortunately I’m unable to reproduce the issue. We will appreciate if you could share a sample application to replicate the issue? I’m afraid its difficult to investigate the issue without replicating it.

We are truly sorry for the inconvenience caused.

Best Regards,

Hi Tilal,

Thank you for continuing to investigate this issue. I can certainly appreciate the difficulty troubleshooting an issue can be when it won’t reproduce. As requested, I created a small ASP.NET MVC 4 web application with a very stripped down version of how the Aspose.Pdf library is being used in my case. Rather than post the entire solution I’ve uploaded only the relevant files (zipped since the original extensions are not allowed for uploads). Here’s the steps to recreate the solution:

  1. In VS2012 create a new ASP.NET MVC4 web application using C# called CambriaFont.
  2. Add a reference to the Aspose.Pdf library (I used the Nuget package for version 8.4.1).
  3. Create a HomeController.cs file and replace its contents with the attached file.
  4. Create an Index.cshtml View for the HomeController and replace its contents with the attached file.
  5. Create a new Html folder in the existing root level Content directory and add the 2 attached font named .html files to the new folder (note that the only difference between these 2 files is which font is declared in the style tag).
  6. Build and run the application and click the links to invoke the Pdf ActionMethod on the HomeController:
    1. Click the “Times New Roman” link (succeeds, generates a PDF)
    2. Click the “Cambria” link (fails with the original error mentioned in my first post)

Hope this helps in replicating the issue I’m seeing. Please let me know if there are any other details I can provide.

Thanks.

Bryan

Hi Bryan,

Thanks for sharing the details. While testing the scenario in MVC application, I've managed to reproduce Cambria font issue on my side and logged it as PDFNEWNET-35818 in our bug tracking system for further investigation and resolution. I've also linked your request to this issue and you will be notified via this thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

Thank you Tilal. I appreciate your diligence and persistence.

Bryan