0

I have an issue where including a normal pdf makes my document fail to be pdf/a compliant, because of the font includes. My template uses pdfx for pdf/a compatibility, I'm using pdfpages to include the pdf, and Lualatex to build.

\documentclass[a4paper]{report}
\usepackage{pdfpages}
\begin{document}
\tableofcontents
\includepdf{test.pdf}
\end{document}

Unfortunately, I can't provide test.pdf itself as it has some confidential information. The PDF has all of the fonts embedded, but is not itself pdf/a compliant. When I validate the pdf (of the whole document with test.pdf included) using verapdf, I get:

<?xml version="1.0" encoding="utf-8"?>
<report>
  <buildInformation>
    <releaseDetails id="core" version="1.18.11" buildDate="2021-04-19T10:21:00+02:00"></releaseDetails>
    <releaseDetails id="validation-model" version="1.18.8" buildDate="2021-04-19T10:35:00+02:00"></releaseDetails>
    <releaseDetails id="gui" version="1.18.6" buildDate="2021-04-27T08:53:00+02:00"></releaseDetails>
  </buildInformation>
  <jobs>
    <job>
      <item size="718642">
        <name>/path/to/file.pdf</name>
      </item>
      <validationReport profileName="PDF/A-2B validation profile" statement="PDF file is not compliant with Validation Profile requirements." isCompliant="false">
        <details passedRules="121" failedRules="1" passedChecks="58863" failedChecks="2">
          <rule specification="ISO 19005-2:2011" clause="6.2.11.4" testNumber="4" status="failed" passedChecks="0" failedChecks="2">
            <description>If the FontDescriptor dictionary of an embedded CID font contains a CIDSet stream, then it shall identify all CIDs which are present in the font program,
            regardless of whether a CID in the font is referenced or used by the PDF or not.</description>
            <object>PDCIDFont</object>
            <test>fontFile_size == 0 || fontName.search(/[A-Z]{6}\+/) != 0 || CIDSet_size == 0 || cidSetListsAllGlyphs == true</test>
            <check status="failed">
              <context>root/document[0]/pages[1](26 0 obj PDPage)/contentStream[0](27 0 obj PDContentStream)/operators[7]/xObject[0]/contentStream[0](24 0 obj PDContentStream)/operators[72]/font[0](KYIDZT+SymbolMT)/DescendantFonts[0](KYIDZT+SymbolMT)</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[1](26 0 obj PDPage)/contentStream[0](27 0 obj PDContentStream)/operators[7]/xObject[0]/contentStream[0](24 0 obj PDContentStream)/operators[234]/font[0](MAYIVC+FrontPagePro-Medium)/DescendantFonts[0](MAYIVC+FrontPagePro-Medium)</context>
            </check>
          </rule>
        </details>
      </validationReport>
      <duration start="1675365559348" finish="1675365560315">00:00:00.967</duration>
    </job>
  </jobs>
  <batchSummary totalJobs="1" failedToParse="0" encrypted="0">
    <validationReports compliant="0" nonCompliant="1" failedJobs="0">1</validationReports>
    <featureReports failedJobs="0">0</featureReports>
    <repairReports failedJobs="0">0</repairReports>
    <duration start="1675365559279" finish="1675365560330">00:00:01.051</duration>
  </batchSummary>
</report>

Using pdffonts, I can see that all the fonts are embedded in the pdf:

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
TTJGTY+Roboto-Regular                CID Type 0C       Identity-H       yes yes yes     13  0
QMJPLU+Roboto-Bold                   CID Type 0C       Identity-H       yes yes yes     15  0
MAYIVC+FrontPagePro-Medium           CID TrueType      Identity-H       yes yes yes     35  0
KYIDZT+SymbolMT                      CID TrueType      Identity-H       yes yes yes     36  0
PGCUGW+Charter-Bold                  TrueType          WinAnsi          yes yes no      37  0
DAESFN+FrontPageMedium               TrueType          WinAnsi          yes yes no      38  0
KUYJMB+FrontPagePro-Medium           TrueType          WinAnsi          yes yes no      39  0
IJGRYF+Charter                       TrueType          WinAnsi          yes yes no      40  0
BHNTXR+Stafford                      TrueType          WinAnsi          yes yes no      41  0
GUTOKG+ArialMT                       Type 1C           WinAnsi          yes yes no      42  0
KKKIUW+XCharter-Roman                CID Type 0C       Identity-H       yes yes yes     72  0
AIWZML+XCharter-Bold                 CID Type 0C       Identity-H       yes yes yes    117  0
FMADMD+XCharter-Italic               CID Type 0C       Identity-H       yes yes yes    158  0
KEZTQT+RobotoMono-Regular            CID Type 0C       Identity-H       yes yes yes    204  0

To break this down further, I ran pdffonts on just the document I'm including:

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
MAYIVC+FrontPagePro-Medium           CID TrueType      Identity-H       yes yes yes     25  0
KYIDZT+SymbolMT                      CID TrueType      Identity-H       yes yes yes     15  0
PGCUGW+Charter-Bold                  TrueType          WinAnsi          yes yes no      20  0
DAESFN+FrontPageMedium               TrueType          WinAnsi          yes yes no       8  0
KUYJMB+FrontPagePro-Medium           TrueType          WinAnsi          yes yes no      10  0
IJGRYF+Charter                       TrueType          WinAnsi          yes yes no      12  0
BHNTXR+Stafford                      TrueType          WinAnsi          yes yes no      22  0
GUTOKG+ArialMT                       Type 1C           WinAnsi          yes yes no      18  0

So I can see that all of the fonts are embedded, but something about the way they are encoded or packaged is making my document no longer PDF/A compliant. Just to verify, I switched off the document include, and checked the document without the included PDF; it passes the PDF/A compliance check.

If I run verapub on test.pdf (the pdf that's being included), I get:

<?xml version="1.0" encoding="utf-8"?>
<report>
  <buildInformation>
    <releaseDetails id="core" version="1.18.11" buildDate="2021-04-19T10:21:00+02:00"></releaseDetails>
    <releaseDetails id="validation-model" version="1.18.8" buildDate="2021-04-19T10:35:00+02:00"></releaseDetails>
    <releaseDetails id="gui" version="1.18.6" buildDate="2021-04-27T08:53:00+02:00"></releaseDetails>
  </buildInformation>
  <jobs>
    <job>
      <item size="103546">
        <name>/path/to/test.pdf</name>
      </item>
      <validationReport profileName="PDF/A-1B validation profile" statement="PDF file is not compliant with Validation Profile requirements." isCompliant="false">
        <details passedRules="94" failedRules="7" passedChecks="9353" failedChecks="100">
          <rule specification="ISO 19005-1:2005" clause="6.3.7" testNumber="3" status="failed" passedChecks="0" failedChecks="5">
            <description>Font programs' "cmap" tables for all symbolic TrueType fonts shall contain exactly one encoding</description>
            <object>TrueTypeFontProgram</object>
            <test>isSymbolic == false || nrCmaps == 1</test>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[8]/font[0](DAESFN+FrontPageMedium)/fontFile[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[12]/font[0](KUYJMB+FrontPagePro-Medium)/fontFile[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[23]/font[0](IJGRYF+Charter)/fontFile[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[161]/font[0](PGCUGW+Charter-Bold)/fontFile[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[188]/font[0](BHNTXR+Stafford)/fontFile[0]</context>
            </check>
          </rule>
          <rule specification="ISO 19005-1:2005" clause="6.2.3" testNumber="2" status="failed" passedChecks="0" failedChecks="88">
            <description>DeviceRGB may be used only if the file has a PDF/A-1 OutputIntent that uses an RGB colour space</description>
            <object>PDDeviceRGB</object>
            <test>gOutputCS != null &amp;&amp; gOutputCS == "RGB "</test>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[2]/colorSpace[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[8]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[12]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[14]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[18]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[20]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[23]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[25]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[27]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[29]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[31]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[33]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[35]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[37]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[39]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[41]/fillCS[0]</context>
            </check>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[44]/fillCS[0]</context>
            </check>

          </rule>
          <rule specification="ISO 19005-1:2005" clause="6.1.7" testNumber="2" status="failed" passedChecks="0" failedChecks="1">
            <description>The stream keyword shall be followed either by a CARRIAGE RETURN (0Dh) and LINE FEED (0Ah) character sequence
            or by a single LINE FEED character. The endstream keyword shall be preceded by an EOL marker</description>
            <object>CosStream</object>
            <test>streamKeywordCRLFCompliant == true &amp;&amp; endstreamKeywordEOLCompliant == true</test>
            <check status="failed">
              <context>root/indirectObjects[40](6 0)/directObject[0]</context>
            </check>
          </rule>
          <rule specification="ISO 19005-1:2005" clause="6.1.8" testNumber="1" status="failed" passedChecks="0" failedChecks="3">
            <description>The object number and generation number shall be separated by a single white-space character. The generation number and obj keyword 
    shall be separated by a single white-space character. The object number and endobj keyword shall each be preceded by an EOL marker. The obj and endobj
    keywords shall each be followed by an EOL marker.</description>
            <object>CosIndirect</object>
            <test>spacingCompliesPDFA</test>
            <check status="failed">
              <context>root/indirectObjects[1](29 0)</context>
            </check>
            <check status="failed">
              <context>root/indirectObjects[18](5 0)</context>
            </check>
            <check status="failed">
              <context>root/indirectObjects[44](2 0)</context>
            </check>
          </rule>
          <rule specification="ISO 19005-1:2005" clause="6.7.11" testNumber="1" status="failed" passedChecks="0" failedChecks="1">
            <description>The PDF/A version and conformance level of a file shall be specified using the PDF/A Identification extension schema.</description>
            <object>MainXMPPackage</object>
            <test>Identification_size == 1</test>
            <check status="failed">
              <context>root/document[0]/metadata[0](46 0 obj PDMetadata)/XMPPackage[0]</context>
            </check>
          </rule>
          <rule specification="ISO 19005-1:2005" clause="6.4" testNumber="2" status="failed" passedChecks="0" failedChecks="1">
            <description>An XObject dictionary shall not contain the SMask key</description>
            <object>PDXObject</object>
            <test>containsSMask == false</test>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/contentStream[0](6 0 obj PDContentStream)/operators[291]/xObject[0](31 0 obj PDXImage)</context>
            </check>
          </rule>
          <rule specification="ISO 19005-1:2005" clause="6.4" testNumber="3" status="failed" passedChecks="0" failedChecks="1">
            <description>A Group object with an S key with a value of Transparency shall not be included in a form XObject. 
            A Group object with an S key with a value of Transparency shall not be included in a page dictionary</description>
            <object>PDGroup</object>
            <test>S != "Transparency"</test>
            <check status="failed">
              <context>root/document[0]/pages[0](4 0 obj PDPage)/Group[0](5 0 obj PDGroup)</context>
            </check>
          </rule>
        </details>
      </validationReport>
      <duration start="1675365944670" finish="1675365945226">00:00:00.556</duration>
    </job>
  </jobs>
  <batchSummary totalJobs="1" failedToParse="0" encrypted="0">
    <validationReports compliant="0" nonCompliant="1" failedJobs="0">1</validationReports>
    <featureReports failedJobs="0">0</featureReports>
    <repairReports failedJobs="0">0</repairReports>
    <duration start="1675365944608" finish="1675365945246">00:00:00.638</duration>
  </batchSummary>
</report>

I'm struggling to figure out if the cmap error given by verapdf on test.pdf is related to the CID issue highlighted by verapdf on the main document. Basically, my question is: what do I need to do to this pdf in order for pdfx to be able to successfully make the entire document PDFA compliant?

2
  • 1
    well probably you will have to ensure that also the included pdf is pdf/A. But without a complete example it is quite impossible to be more specific. Feb 2, 2023 at 22:17
  • @UlrikeFischer yes, I ended up using LibreOffice to save it as a pdfa. I had some issues things being distorted because I didn't have one of the embedded fonts installed on my system and LO loaded its own, but once I installed the font and flushed the font cache, I was able to save it as a pdfa. Thanks for the tip!
    – evamvid
    Feb 2, 2023 at 23:44

1 Answer 1

1

This is not a new issue. I do not know if this advice works, but here is a link to a PDF file (dated 2022) that has information regarding your question. See Section 4.

Even though the fonts are all embedded, they are not embedded "the same way" as far as PDF/A is concerned. I do not believe that any modification to the pdfx package code would solve that issue. So the trick is to dismantle the original PDF, then re-build it with PDF software (rather than LaTeX). Then, the second build embeds all fonts "the same way." That is what the linked file says.

EDIT: The ghostscript code, previously posted here, has problems. Further research indicates that the use of ghostscript may fix one problem, but cause others (such as wiping metadata, or changing font names). As the OP discovered, the best approach is to use external software.

5
  • Since SE is a question&answer site, link-only answers aren't considered useful answers. Links can break in the future. Please provide the gist of the explanation here, in an answer as self-contained as possible.
    – Miyase
    Feb 2, 2023 at 21:18
  • Thanks for the answer! Unfortunately I get the same error about CID FontDescriptor dictionaries after trying that ghostscript oneliner.
    – evamvid
    Feb 2, 2023 at 22:58
  • 1
    I figured it out! Your tip about re-building it with dedicated PDF software was very helpful, in the end -- I ended up opening it in LibreOffice and using the save to PDFA function in there. I had a little bit of trouble with things getting distorted because I didn't have one of the embedded fonts installed on my system, so LO loaded its own font, but once I installed that font it worked perfectly.
    – evamvid
    Feb 2, 2023 at 23:41
  • After doing that, the included PDF is now PDF/A compliant, and the whole paper as generated by lualatex is too. thanks!
    – evamvid
    Feb 2, 2023 at 23:42
  • Good! I now notice that the linked file referred to a special case where there were missing fonts. I did not catch that, earlier.
    – rallg
    Feb 2, 2023 at 23:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .