Skip to content

PDF/A-1b bug with local characters #295

@miha-blurp

Description

@miha-blurp

Expected Behavior

The PDF/A document should be generated successfully with embedded font and Unicode text (šššččč) and validate as PDF/A-1b compliant.

Actual Behavior

When I add letters ččč the pdf fails to pass https://www.pdf-online.com/osa/validate.aspx (I also tried other validators ...) with the issue reported:

Validating file "minimal_not_working.pdf" for conformance level pdfa-1aThe key CIDSet is required but missing.The document does not conform to the requested standard.The document contains fonts without embedded font programs or encoding information (CMAPs).The document does not conform to the PDF/A-1a standard.Done.

If I remove "ččč" it passes no problem.

Steps to Reproduce the Behavior

Sub minimal_not_working()

    Dim Document As New PdfDocument()

    Dim font As XFont = New XFont("Arial Unicode MS", 12, XFontStyleEx.Regular, New XPdfFontOptions(PdfFontEmbedding.EmbedCompleteFontFile))

    Document.Info.Title = "PDF/A Minimal Test"
    Document.Info.Author = "Tester"
    Document.Info.Subject = "PDF/A-1b Compliance"
    Document.Info.Creator = "PDFSharp VB.NET"
    Document.Version = 14
    Document.SetPdfA()

    Dim UAManager As UAManager = UAManager.ForDocument(Document)
    Dim PdfPage As PdfPage = Document.AddPage()
    Dim gfx As XGraphics = XGraphics.FromPdfPage(PdfPage)

    Dim sb As StructureBuilder = UAManager.StructureBuilder
    sb.BeginElement(PdfGroupingElementTag.Article)
    sb.BeginElement(PdfBlockLevelElementTag.Paragraph)

    gfx.DrawString("šššččč", font, New XSolidBrush(XColor.FromArgb(0, 0, 0)), New XRect(50, 100, 500, 30), XStringFormats.TopLeft)
    sb.End()
    sb.End()
    Document.Save("minimal_not_working.pdf")
End Sub

The following variation works correctly:

gfx.DrawString("ššš", font, New XSolidBrush(XColor.FromArgb(0, 0, 0)), New XRect(50, 100, 500, 30), XStringFormats.TopLeft)

Environment

  • PDFsharp version: 6.2.0 (PDFsharp-GDI)
  • .NET version: .NET Framework 4.7.2
  • Font: Arial Unicode MS

Additional Context

I tried many different fonts and no luck. Thank You.

minimal_working.pdf
minimal_not_working.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions