[pdftex] [Tex] very subtle endobj bug in latest pdftex

Peter Selinger selinger at mathstat.dal.ca
Sat Aug 9 03:19:43 CEST 2014


Ross Moore wrote:
> I've been able to feed the  Copyright Notice, using
>   
>  <dc:rights><rdf:Alt><rdf:li xml:lang="x-default">\xmpCopyright</rdf:li></rdf:Alt></dc:rights>
>
> but my attempts to set the  Copyright Status  popup,
> and the  Copyright Info  field  and URL , using 
>
>  <xmpRights:Marked>True</xmpRights:Marked>
>  <xmpRights:UsageTerms> __Copyright__ </xmpRights:UsageTerms>
>  <xmpRights:WebStatement>  __URL__ </xmpRights:WebStatement>
> 
> fail to validate.
> Any ideas?

If your version of pdfa-1b.xmp still includes the declaration

            xmlns:xapRights = "http://ns.adobe.com/xap/1.0/rights/"

then you should use xapRights:Marked instead, and similarly for the
other properties. Of course, it would be better to instead change the
declaration to 

            xmlns:xmpRights = "http://ns.adobe.com/xap/1.0/rights/"

as recommended on p.42 (bullet 2) of 

 http://partners.adobe.com/public/developer/en/xmp/sdk/XMPspecification.pdf

Moreover, on the same page it says that the type of
xmpRights:UsageTerms is Lang Alt, so you need to use the syntax

  <xmpRights:UsageTerms>
    <rdf:Alt>
      <rdf:li xml:lang="x-default">__Copyright__</rdf:li>
    </rdf:Alt>
  </xmpRights:UsageTerms>

(Line breaks and indentation for readability only). In principle, you
could even specify usage terms in multiple languages!

Such a typing error is sufficient to cause validation to fail with a
useless error message. In general, I found that the Preflight report
is not very helpful when my XML is ill-formed. Errors such as using an
undeclared namespace or using the wrong data type for a property are
XML errors, so Preflight will not even look at the content to give a
meaningful error message.

My solution is to send the XMP data through the following online
validator: http://www.w3.org/RDF/Validator/. This gives helpful error
messages for all kinds of syntax, scoping, and type errors. And once
the data passes this validator, then any further semantic errors will
yield more meaningful error messages in Preflight.

I've just joined this mailing list, so I have not seen your updated
pdfx package. I am still working from the v1.2 version from 2008 that
is on CTAN. But I've fixed a number of bugs and added some features as
well. This is a work in progress (I still have to go back and update
the .dtx and the documentation, and I am hoping to have a better
rationale for what set of properties are configurable). In any case, I
am attaching my modified files in case this is useful.

For example, one validation error that was not trivial to fix was the
following. Depending on the properties specified, the pdfx package
sometimes uses the PRISM namespace, which is not one of the standard XMP
namespaces. In such cases, PDF/A requires that an embedded XMP
Extension Scheme definition is included within the XMP data (see PDF/A
Competence Center, TechNote 0009: XMP Extension Schemas in PDF/A-1 of
2008/03/20:
http://www.pdfa.org/publication/technical-note-tn-009-xmp-extension-schemas-in-pdfa-1/).

The pdfx package did not provide such a definition, causing the
resulting PDF's to fail PDF/A validation. I fixed this by writing an
XMP Extension Scheme for those properties that are potentially used by
pdfx.

I hope this helps, -- Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pdfa-1b.xmp
Type: application/octet-stream
Size: 13274 bytes
Desc: ASCII English text
URL: <http://tug.org/pipermail/pdftex/attachments/20140808/9420425c/attachment-0001.obj>
-------------- next part --------------
%%
%% This is file `pdfx.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pdfx.dtx  (with options: `package')
%% 
%%  Copyright (c) 2008, CV Radhakrishnan <cvr at river-valley.org>,
%%    Han The Thanh <thanh at river-valley.org>
%%  Copyright (c) 2014, Peter Selinger <selinger at mathstat.dal.ca>
%% 
%%  This file may be distributed and/or modified under the conditions
%%  of the LaTeX Project Public License, either version 1.2 of this
%%  license or (at your option) any later version.  The latest version
%%  of this license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%%  and version 1.2 or later is part of all distributions of LaTeX
%%  version 1999/12/01 or later.
%% 
%% Changes:
%% 2014/08/06: PS1 - fixed time zone bug.
%% 2014/08/06: PS1 - changed sRGB color profile to a freely available one.
%% 2014/08/06: PS1 - define \xmpAbout in addition to \xmpDoi.
%% 2014/08/06: PS1 - added \PublicationType property
%% 2014/08/06: PS1 - added \Description property (e.g. abstract)
%% 2014/08/07: PS1 - added new a-1a-fake option for creating nominally
%%  PDF/A-1a compliant documents. These documents pass the PDF/A-1a
%%  compliance test, but they are not really meaningful PDF/A-1a, 
%%  because the required StructTreeRoot and MarkInfo elements are
%%  bogus.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pdfx}
  [2008/12/10 v1.2 PDF/X and PDF/A support (CVR/HTH)]

\newif\ifpdfxonea \pdfxoneafalse
\newif\ifpdfaoneb \pdfaonebfalse
\newif\ifpdfaoneafake \pdfaonebfalse

\DeclareOption{a-1b}{\global\pdfaonebtrue}
\DeclareOption{a-1a-fake}{\global\pdfaoneafaketrue}
\DeclareOption{x-1a}{\global\pdfxoneatrue}
\ProcessOptions

\ifpdfxonea
 \pdfminorversion=3
 \pdfpageattr{/MediaBox[0 0 595 793]
              /BleedBox[0 0 595 793]
              /TrimBox[25 20 570 773]}
\else
 \pdfminorversion=4
\fi
\def\hash{\expandafter\@gobble\string\#}
\def\amp{\expandafter\@gobble\string\&}
\def\xmpAmp{\amp\hash x0026;}
\def\sep{</rdf:li><rdf:li>}
\def\TextCopyright{\amp\hash x00A9;}
\def\Title#1{\gdef\xmpTitle{#1}}
 \let\xmpTitle\@empty
\def\Author#1{\gdef\xmpAuthor{#1}}
 \let\xmpAuthor\@empty
\def\Keywords#1{\gdef\xmpKeywords{#1}}
 \let\xmpKeywords\@empty
 \let\xmpSubject\xmpKeywords
\def\Description#1{\gdef\xmpDescription{#1}}
 \let\xmpDescription\@empty
\def\Creator#1{\gdef\xmpCreator{#1}}
 \def\xmpCreator{\@pdfcreator}
\def\Producer#1{\gdef\xmpProducer{#1}}
 \def\xmpProducer{pdfTeX}
\def\Volume#1{\gdef\xmpVolume{#1}}
 \let\xmpVolume\@empty
\def\Issue#1{\gdef\xmpIssue{#1}}
 \let\xmpIssue\@empty
\def\CoverDisplayDate#1{\gdef\xmpCoverDisplayDate{#1}}
 \let\xmpCoverDisplayDate\@empty
\def\CoverDate#1{\gdef\xmpCoverDate{#1}}
 \let\xmpCoverDate\@empty
\def\Copyright#1{\gdef\xmpCopyright{#1}}
 \let\xmpCopyright\@empty
\def\Doi#1{\gdef\xmpDoi{#1}\gdef\xmpAbout{doi:#1}}
 \let\xmpDoi\@empty
 \let\xmpAbout\@empty
\def\Lastpage#1{\gdef\xmpLastpage{#1}}
 \let\xmpLastpage\@empty
\def\Firstpage#1{\gdef\xmpFirstpage{#1}}
 \let\xmpFirstpage\@empty
\def\PublicationType#1{\gdef\xmpPublicationType{#1}}
 \let\xmpPublicationType\@empty
\def\Journaltitle#1{\gdef\xmpJournaltitle{#1}\PublicationType{journal}}
 \let\xmpJournaltitle\@empty
\def\Journalnumber#1{\gdef\xmpJournalnumber{#1}}
 \let\xmpJournalnumber\@empty
\def\Org#1{\gdef\xmpOrg{#1}}
 \let\xmpOrg\@empty
\def\CreatorTool#1{\gdef\xmpCreatorTool{#1}}
 \def\xmpCreatorTool{\xmpProducer}
\def\AuthoritativeDomain#1{\gdef\xmpAuthoritativeDomain{#1}}
 \let\xmpAuthoritativeDomain\@empty
\def\findUUID#1{\edef\tmpstring{\pdfmdfivesum{#1}}
     \expandafter\eightofnine\tmpstring\end}
\def\eightofnine#1#2#3#4#5#6#7#8#9\end{%
     \xdef\eightchars{#1#2#3#4#5#6#7#8}
     \fouroffive#9\end}
\def\fouroffive#1#2#3#4#5\end{\xdef\ffourchars{#1#2#3#4}
     \sfouroffive#5\end}
\def\sfouroffive#1#2#3#4#5\end{\xdef\sfourchars{#1#2#3#4}
     \tfouroffive#5\end}
\def\tfouroffive#1#2#3#4#5\end{\xdef\tfourchars{#1#2#3#4}
     \xdef\laststring{#5}}

\def\uuid{\eightchars-%
          \ffourchars-%
          \sfourchars-%
          \tfourchars-%
          \laststring}

\findUUID{\jobname.pdf}
\edef\xmpdocid{\uuid}
\findUUID{\pdfcreationdate}
\edef\xmpinstid{\uuid}
\InputIfFileExists{\jobname.xmpdata}{}{}
\RequirePackage{xmpincl}
\def\convertDate{\getYear}
{\catcode`\D=12
 \gdef\getYear D:#1#2#3#4{\edef\xYear{#1#2#3#4}\getMonth}
}
\def\getMonth#1#2{\edef\xMonth{#1#2}\getDay}
\def\getDay#1#2{\edef\xDay{#1#2}\getHour}
\def\getHour#1#2{\edef\xHour{#1#2}\getMin}
\def\getMin#1#2{\edef\xMin{#1#2}\getSec}
\def\getSec#1#2{\edef\xSec{#1#2}\getTZh}
\def\getTZh #1#2#3{\edef\xTZh{#1#2#3}\getTZm}
\def\getTZm '#1#2'{%
    \edef\xTZm{#1#2}%
    \edef\convDate{\xYear-\xMonth-\xDay
      T\xHour:\xMin:\xSec\xTZh:\xTZm}}
\expandafter\convertDate\pdfcreationdate
\ifpdfxonea
 \def\@pctchar{\expandafter\@gobble\string\%}
 \def\@bchar{\expandafter\@gobble\string\\}
 \immediate\pdfobj stream attr{/N 4}  file{FOGRA39L.icc}
 \edef\OBJ at CVR{\the\pdflastobj}
 \pdfcatalog{/OutputIntents [ <<
   /Type/OutputIntent
   /S/GTS_PDFX
   /OutputCondition (FOGRA39)
   /OutputConditionIdentifier (FOGRA39 \@bchar(ISO Coated v2
    300\@pctchar\space \@bchar(ECI\@bchar)\@bchar))
   /DestOutputProfile \OBJ at CVR\space 0 R
   /RegistryName(http://www.color.org)
  >> ]}
\else
 \immediate\pdfobj stream attr{/N 4}  file{sRGB_IEC61966-2-1_black_scaled.icc}
 \edef\OBJ at RVT{\the\pdflastobj}
 \pdfcatalog{%
   /OutputIntents [ <<
   /Type /OutputIntent
   /S/GTS_PDFA1
   /DestOutputProfile \OBJ at RVT\space 0 R
   /OutputConditionIdentifier (sRGB IEC61966-2-1 black scaled)
   /Info(sRGB IEC61966-2-1 black scaled)
  >> ]}
 \ifpdfaoneafake
  \pdfcatalog{%
    /StructTreeRoot <<
      /Type /StructTreeRoot
   >>}
  \pdfcatalog{%
    /MarkInfo << 
      /Marked true
   >>}
 \fi
\fi
\begingroup
\let\&=\xmpAmp
\ifpdfxonea
 \includexmp{pdfx-1a}
\else
 \ifpdfaoneafake
  \def\xmpConformance{A}
 \else
  \def\xmpConformance{B}
 \fi
 \includexmp{pdfa-1b}
\fi
\endgroup

\input glyphtounicode.tex
\input glyphtounicode-cmr.tex
\pdfgentounicode=1
\ifpdfxonea
  \RequirePackage[draft,pdftex,pdfpagemode=UseNone,bookmarks=false]{hyperref}
  \pdfinfo{
      /Title(\xmpTitle)%
      /Author(\xmpAuthor)%
      /Creator(\xmpProducer)%
      /CreationDate(\convDate)%
      /ModDate(\convDate)%
      /Producer(\xmpProducer)%
      /Trapped /False
      /GTS_PDFXVersion (PDF/X-1:2001)%
      /GTS_PDFXConformance (PDF/X-1a:2001)%
  }
\else
  \RequirePackage[pdftex,pdfa]{hyperref}
 \def\PDF at FinishDoc{%
  \Hy at UseMaketitleInfos
  \pdfinfo{%
     /Creator(\xmpProducer)%
     \ifx\@pdfcreationdate\@empty
    \else
      /CreationDate(\@pdfcreationdate)%
    \fi
    \ifx\@pdfmoddate\@empty
    \else
      /ModDate(\@pdfmoddate)%
    \fi
      /Producer(\xmpProducer)%
     /Trapped /False
     /GTS_PDFA1Version (PDF/A-1b:2005)%
  }%
  \Hy at DisableOption{pdfauthor}%
  \Hy at DisableOption{pdftitle}%
  \Hy at DisableOption{pdfsubject}%
  \Hy at DisableOption{pdfcreator}%
  \Hy at DisableOption{pdfcreationdate}%
  \Hy at DisableOption{pdfmoddate}%
  \Hy at DisableOption{pdfproducer}%
  \Hy at DisableOption{pdfkeywords}}
\fi
\endinput
%%
%% End of file `pdfx.sty'.


More information about the pdftex mailing list