Free Support Forum - aspose.com

PDF/A Generated File in Linux is misplacing fonts and texts

The pdf file when being converted to PDF/A in Windows is working fine. The same file when moved to our Linux server - then it is misisng fonts and texts.
I included the error pdf along with the actual pdf file. Please let me know what can be done as our customer is waiting on this.

Annotation 2020-11-20 141613.jpg (68.0 KB)
Export DGF Customer Invoice_11202020_114126.pdf (42.3 KB)

@venkata.veerubhotla

Please try to install:

  1. package with Microsoft compatible fonts: ttf-mscorefonts-installer. (e.g. sudo apt-get install ttf-mscorefonts-installer )

These fonts should be placed in “/usr/share/fonts/truetype/msttcorefonts” directory as Aspose.PDF scans this folder on Linux like operating systems.

Thank you Asad Ali for the swift response. Could you please share the link where these fonts can be found?

Also, in the /usr/share/fonts folder - i do not see any thing. So what ever is needed to be installed, can you provide the whole list?

@venkata.veerubhotla

The fonts can be installed by only running following command in the terminal:

sudo apt install ttf-mscorefonts-installer

The easiest way to obtain these other fonts is by copying them over from a Windows PC. You can find them within C:\Windows\Fonts . Copy the font files over to your Linux machine and then install them using your font manager application (often by simply double-clicking a font file from a file browser).

Is there anyway that we can use fonts in separate directory rather than installing? I mean copy over fonts into a directory where aspose can read it?

@venkata.veerubhotla

You can surely copy the fonts in separate directory. In this case, you need to specify the font directory for the API as follows:

[.NET]

Aspose.Pdf.Text.FontRepository.Sources.Add(new FolderFontSource("<user's path to ms fonts>"));

[Java]

setLocalFontPaths(List<String> newFontPathsList)

Thank you Asad. This worked now. Thank you