[Tex/LaTex] PDF/A compatibility with TikZ

pdf-atikz-pgf

When a LaTeX document contains TikZ figures with color gradients, it seems that Acrobat Pro's preflight function can no longer convert the PDF to comply with the PDF/A-1b standard.

For instance, the code

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
  \tikz  \draw [left color=green, right color=blue] (0, 0) rectangle (1, 1);
\end{document}

produces a rectangle with green-to-blue color gradient,

Color gradient in TikZ

which results in two PDF/A compliance errors ("Syntax problem: real value out of range"), namely "Largest positive real number used: 32768.0" and "Largest negative real number used: -32768.0". The screenshot below indicates that this might be related to a bounding box problem.

At http://www.callassoftware.com/callas/doku.php/en:products:pdftoolbox:all_features:properties is says with respect to "Largest positive real number used" that
"In many environments the valid range is limited to the values as defined by IEEE for single-precision floating-point numbers. This limits the range to: +/- 32,767."

Is there a way to fix this problem and to obtain a PDF/A file?

EDIT: When I add a non-unity opacity value to the TikZ \draw options, such as "opacity=0.9999", one of the errors ("Largest positive real number used: 32768.0") disappears.

Preflight "Verify compliance with PDF/A"

Best Answer

Using TeX Live 2014, pdfTeX 3.14159265-2.6-1.40.15, I don't seem to run into these problems. Maybe updating your TeX-system can solve the problems.

Here is a modification of your MWE that embeds a color profile and metadata (I don't have access to Adobe's Preflight tool or other software that can do this in a post-processing step). Information on how to embed this extra data was found in https://tex.stackexchange.com/a/99666 and https://tex.stackexchange.com/a/136653. The color profile can be downloaded from http://www.color.org/srgbprofiles.xalter.

\documentclass{standalone}
\pdfminorversion 4
\immediate\pdfobj stream attr{/N 3} file{sRGB_IEC61966-2-1_black_scaled.icc}
\pdfcatalog{%
/OutputIntents [ <<
/Type /OutputIntent
/S/GTS_PDFA1
/DestOutputProfile \the\pdflastobj\space 0 R
/OutputConditionIdentifier (sRGB IEC61966-2-1 black scaled)
/Info(sRGB IEC61966-2-1 black scaled)
>> ]
}
\usepackage{hyperxmp}
\usepackage[pdftex, pdfa]{hyperref}
\hypersetup{%
    pdfauthor          = {a},
    pdfkeywords        = {a, b, c},
    pdflang            = {en},
    pdftitle           = {a},
    pdfsubject         = {a},
  pdfcaptionwriter   = {a},
  pdfcontactaddress  = {a},
  pdfcontactcity     = {a},
  pdfcontactcountry  = {a},
  pdfcontactemail    = {a},
  pdfcopyright       = {a},
  pdfmetalang        = {en}
}
\usepackage{tikz}
\begin{document}
  \tikz  \draw [left color=green, right color=blue] (0, 0) rectangle (1, 1);
\end{document}

PDFBox Preflight (http://en.wikipedia.org/wiki/Apache_PDFBox) and 3-Heights PDF Validator Online Tool (http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx) says what I get from this is a valid PDF/A-1b file.