Embedded fonts missing in PDF/A documents

0 Answers 6 Views
General Discussions
Alain
Top achievements
Rank 1
Alain asked on 06 Nov 2025, 05:35 PM | edited on 06 Nov 2025, 05:39 PM

Hi,

We are trying to merge an existing PDF (not /A) into a PDF/A.

Target file is generated successfully but veraPDF validator (and others) is complaining because it cannot find embedded fonts.

We read the following articles : PDF/A standard and Register fonts . But no luck.

Part of the code is available below.

Do you know why fonts are not embedded ?

Thanks for your help.

Alain.

 

public static void MergeInNewFile(string sourceFile, string outputFilePath, bool registerFonts)
{
    RadFixedDocument resultFile = new RadFixedDocument();

    Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider pdfFormatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();

    pdfFormatProvider.ExportSettings.FontEmbeddingType = FontEmbeddingType.Full;

    PdfExportSettings settings = new PdfExportSettings();
    pdfFormatProvider.ExportSettings = settings;

    settings.ComplianceLevel = PdfComplianceLevel.PdfA3B;
    settings.TaggingStrategy = TaggingStrategyType.UseExisting;
    settings.FontEmbeddingType = FontEmbeddingType.Full;

    if (registerFonts)
    {
        RegisterFont("Helvetica");
        RegisterFont("Helvetica-Bold");
        RegisterFont("Helvetica-Oblique");
    }

    // Merge source in new file
    using (Stream stream = File.OpenRead(sourceFile))
    {
        resultFile = pdfFormatProvider.Import(stream, TimeSpan.FromSeconds(100));
        resultFile.Merge(resultFile);
    }

    // Export new file
    File.Delete(outputFilePath);
    using (Stream output = File.OpenWrite(outputFilePath))
    {
        pdfFormatProvider.Export(resultFile, output, TimeSpan.FromSeconds(10));
    }
}

private static void RegisterFont(string fontName)
{
    byte[] fontData = File.ReadAllBytes(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ressources", $"{fontName}.ttf"));
    System.Windows.Media.FontFamily fontFamily = new System.Windows.Media.FontFamily(fontName);
    FontsRepository.RegisterFont(fontFamily, System.Windows.FontStyles.Normal, System.Windows.FontWeights.Bold, fontData);
}


 

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Alain
Top achievements
Rank 1
Share this question
or