Aspose.pdf font changes on the output pdf

Hello,

I am using Aspose PDF library to generate the pdf files and it is working very nicely.
But I faced one issue where the output pdf has different font for some values than the font in template.

E.g. The template has Foco regular font for a numeric field which is filled in using aspose lib and a pdf is generated. The generated pdf sometimes has correct font but sometimes it just changes to Times new roman though the template has Foco regular font. Same template outputs different font for different values.

Please advise.

@nisg55

Thank you for contacting support.

I am afraid that we may not guess any reason without reproducing the problem. Kindly share a narrowed down sample application reproducing the issue so that we may investigate further to help you out.

Unfortunately I cannot share the pdf due to regulations. But here is what we are facing issue with -

We have a template with Foco regular font. When I replace text using Aspose library with value as 84, it prints the value in Foco Regular font. If I try to replace same text with 87, it prints the value in Times new roman. So the issue is that the font is changing with the values though we use same template.

We need to fix this as soon as possible as we have purchased license copy but this issue is a show stopper for us. Any urgent help is highly appreciated.

@Farhan.Raza

@nisg55

Please share with us if the font in question, Foco Regular, is installed on the machine where problematic PDF file is being rendered. If it is not installed then please download the font from internet and install it or add the font with below line of code:

    // connect custom font directory
    FolderFontSource fs = new FolderFontSource(@"path\to\my\folder");
    FontRepository.Sources.Add(fs);

In case the issue persists, then I am afraid there may not be any other option to sort out this problem, except sharing the source file and sample application with us. We understand your data privacy and data security concerns, so every attachment here can only be accessed by our staff or the person who posts them. However, you may share the file in a personal message to me by following the instructions written over this link. You may attach the source file or some link to access it on Google Drive, Dropbox etc.

@Farhan.Raza
The required font is not installed on the server where the pdf generation logic sits. But it generates correct pdf for some different data with required font though it is not installed on that machine. We have few number of templates which are created with Foco regular and the issue is produced for some templates only and that too for particular data values.
Also the same font is being used across the template and it shows incorrect font at some places only.
Please advise.

@nisg55

The source PDF file may contain an embedded subset of the font. Please follow font related instructions shared with you in my previous reply and in case the issue persists, please share the source file and code sample reproducing the issue, so that we may proceed further to help you out.

@Farhan.Raza
Can we use web font for the same?

I am trying with .woff file but aspose is not able to find that web font.

@nisg55

Please share the source file and narrowed down sample application reproducing the issue, so that we may investigate further to help you out.