PDF/A-2a or PDF/A-3a are not valid PDF/A files (space)

KB-20201117-01

Version

All versions.

Symptoms

If PDF file is PDF/A-2 or PDF/A-3, then veraPDF shows error "complient document shall not contain a reference to .notdef glyph" at validating.

Cause

Space in text.

XFRX creates custom font if PDF/A mode is enabled. The first char is "space" with glyph index 0. Rules for PDF/A-2 or PDF/A-3 don't allow glyph index 0, because it's an index for an undefined glyph.

Workaround

Use hack class

loHACK=CREATEOBJECT("_XFRXHACK", loSession)
loSession.ProcessReport("somereport.frx")
RELEASE loHACK

DEFINE CLASS _XFRXHACK AS CUSTOM
   oEWriter=.NULL.

   PROCEDURE Destroy
      UNBINDEVENTS(This.oEWriter.oPDF)
   ENDPROC
   
   PROCEDURE Init(m.loSession)
      m.loSession=IIF(TYPE("m.loSession.oxfSession")="O",m.loSession.oxfSession,m.loSession)
      =BINDEVENT(m.loSession.oDocumentWriter.oPDF,"setPDFA",This,"setPDFA", 1)
      This.oEWriter=m.loSession.oDocumentWriter
   ENDPROC
 
   PROCEDURE setPDFA
      LPARAMETERS m.tlPDFA, m.tcPDFA
      This.oEWriter.oPDF.lUseUnicodeMapping=.F.
   ENDPROC
 
 ENDDEFINE