Cannot convert PDF to PDF/A on Linux using Aspose.PDF.Drawing 25.3.0

Scenario: Convert PDF to PDF/A. Aspose.PDF.Drawing 25.3.0.

Issue: Document.Convert method returns false when run on Linux.

Sample project and test file: sample.zip (152.5 KB)

Notes:

  • You have to run the test on Linux.
  • I used (Remote Testing) feature in Visual Studio 2022 (see testenvironments.json and Dockerfile.tests in the provided archive) and Docker Desktop.

Thanks,
Oleksii

For internal reference: CLN-1723

@oleksii88
We are looking into it and will be sharing our feedback with you shortly.

@oleksii88
When converting to Pdf/A, fonts are embedded into the document (this is a standard requirement). Some fonts are not embedded into the document
1.png (27.1 KB)
(on the screen there is only part of the document fonts) and when converting they must be installed in the system (or, as an option, specify the paths to the font files or specify font replacement).

Are all the necessary fonts installed in your Linux system?

  1. Convert error action is set to ConvertErrorAction.Delete. Isn’t the conversion supposed to ignore font error?
  2. When the test is run on Windows, the conversion log also contains the font error (“Font ‘ArialMT’ is not embedded”), but the conversion does not fail. Why is the behavior different for the same conversion error on Windows and Linux?

Conversion log on Windows

<Compliance Name="Log" Operation="Validation" Target="PDF/A-3B">
	<Version>1.0</Version>
	<Copyright>Copyright (c) 2001-2025 Aspose Pty Ltd. All Rights Reserved.</Copyright>
	<Date>2025/05/02 14:53</Date>
	<File Version="1.7" Name="no-password.pdf" Pages="2">
		<Security/>
		<Catalog/>
		<Header/>
		<Annotations/>
		<Fonts>
			<Problem Severity="Error" Clause="6.2.11.4" ObjectID="16" Page="1" Convertable="True">Font 'ArialMT' is not embedded</Problem>
		</Fonts>
		<trailer/>
		<Metadata>
			<Problem Severity="Error" Clause="6.6.3" Convertable="True">Document information entry 'CreationDate' not synchronized with metadata property 'xmp:CreateDate'</Problem>
			<Problem Severity="Error" Clause="6.6.3" Convertable="True">Document information entry 'ModDate' not synchronized with metadata property 'xmp:ModifyDate'</Problem>
			<Problem Severity="Error" Clause="6.6.4" Convertable="True">Required property 'pdfaid:part' for schema 'pdfaid' missing</Problem>
			<Problem Severity="Error" Clause="6.6.4" Convertable="True">Required property 'pdfaid:conformance' for schema 'pdfaid' missing</Problem>
		</Metadata>
		<objects/>
		<xObjects/>
		<actions/>
		<xmpmeta/>
		<EmbeddedFiles/>
	</File>
</Compliance>

Conversion log on Linux

<Compliance Name="Log" Operation="Validation" Target="PDF/A-3B">
	<Version>1.0</Version>
	<Copyright>Copyright (c) 2001-2025 Aspose Pty Ltd. All Rights Reserved.</Copyright>
	<Date>05/02/2025 11:56:06</Date>
	<File Version="1.7" Name="no-password.pdf" Pages="2">
		<Security/>
		<Catalog/>
		<Header/>
		<Annotations/>
		<Fonts>
			<Problem Severity="Error" Clause="6.2.11.4" ObjectID="16" Page="1" Convertable="False">Font 'ArialMT' is not embedded</Problem>
			<Problem Severity="Error" Clause="6.2.11.4" ObjectID="16" Page="1" Convertable="False">Font 'ArialMT' is not embedded</Problem>
			<Problem Severity="Error" Clause="6.2.11.4" ObjectID="16" Page="1" Convertable="False">Font 'ArialMT' is not embedded</Problem>
			<Problem Severity="Error" Clause="6.2.11.4" ObjectID="16" Page="2" Convertable="False">Font 'ArialMT' is not embedded</Problem>
		</Fonts>
		<trailer/>
		<Metadata/>
		<objects/>
		<xObjects/>
		<actions/>
		<xmpmeta/>
		<EmbeddedFiles/>
	</File>
</Compliance>

@oleksii88
I will study the information provided and write to you later.

@oleksii88
In the example you provided, the result of the command
RUN apt install -y libfontconfig1
is not checked in any way.
And besides, I have doubts that the Arial font family is loaded by this command.

Another nuance when working with the library in Linux:
The package looks for fonts in folders:
“/usr/share/fonts”
“/usr/share/fonts/truetype/msttcorefonts”
“/usr/share/fonts/msttcore”
“/usr/local/share/fonts”
“~/.fonts”
and does not take into account what is located in the cache. Let’s say that the font is shown by the command “fc-list | grep “.ttf” | cut -f2 -d: | sort | uniq" does not mean that it will be used by the library.

Most likely, you should use 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 for .NET scans this folder on Linux like operating systems.
In case the operating system has other default folder/directory for fonts, you should use the following line of code before performing any operation using Aspose.PDF.

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

Thus, the easiest option to start with is to place the files of the fonts you use in a folder and explicitly set the path to it

FontRepository.Sources.Add(new FolderFontSource("dir with fonts"));

In addition, you can specify a font replacement for one that is definitely in the system

FontRepository.Substitutions.Add(new SimpleFontSubstitution("ArialMT", "DejaVu Sans"));

I suggest trying these options and then trying more complex ones.