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

Free Support Forum - aspose.com

Specified font file was not found

I downloaded a google font(Allura-Regular.ttf) and im trying to fetch the file using Font Repository OpenFont() but it is throwing an error “Specified font file was not found”. Please help me to resolve this issue as early as possible.

Language: C#
Technology: .Net Framework


Can you please make sure that you are using 22.3 version of the API? We used below code snippet to test the scenario and could not reproduce the issue that you have mentioned. For your kind reference, an output PDF is also attached:

string fontFile = dataDir + "Allura-Regular.ttf";
// Load input PDF file
Document doc = new Document();
// Create text fragment with sample string
TextFragment textFragment = new TextFragment("Hello world");

if (fontFile != "")
 // Load the TrueType font into stream object
 using (FileStream fontStream = System.IO.File.OpenRead(fontFile))
  // Set the font name for text string
  textFragment.TextState.Font = FontRepository.OpenFont(fontStream, FontTypes.TTF);
  // Specify the position for Text Fragment
  textFragment.Position = new Position(100, 600);
  var page = doc.Pages.Add();

 dataDir = dataDir + "LoadingFontFromStream_out.pdf";
 // Save resulting PDF document

LoadingFontFromStream_out.pdf (23.9 KB)

how to check the version of the API?


You can check the API version simply in Visual Studio by going into the properties of the referenced DLL. Also, you can check it in code like below:


Thank you for the response. I have one more doubt please clarify, please check the below image, it is a screenshot of the pdf, on the first-page signature fields are coming as Allura font but on the second-page signature fields are coming as normal font, but in the code, I’m using Allura font style for the signature fields. The values in the Signature field are coming correctly on both the pages only the font style is different. Not sure why on the 2 pages alone Allura font is not working. Please help me to resolve this ASAP. If you need any further information please let me know.
image.png (46.0 KB)


We need to reproduce the same behavior in our environment in order to determine the cause of this issue. Could you please share the sample PDF along with the sample code snippet that can be used to reproduce this case? We will test the scenario in our environment and address it accordingly.