Customizable type of PDF/A for the ConTeXt writer (issue #5608) (#5610)

* Let the user choose type of PDF/A generated with ConTeXt (closes #5608)
* Updated ConTeXt test documents for changes in tagging
* Updated color profile settings in accordance with ConTeXt wiki
* Made ICC profile and output intent for PDF/A customizable
* Read pdfa variable from meta (and updated manual)
This commit is contained in:
Karl Pettersson 2019-07-15 20:55:04 +02:00 committed by John MacFarlane
parent 680d7b515f
commit 5303791bc4
5 changed files with 34 additions and 12 deletions

View file

@ -1,6 +1,6 @@
% Pandoc User's Guide
% John MacFarlane
% June 11, 2019
% July 6, 2019
Synopsis
========
@ -1799,12 +1799,28 @@ Pandoc uses these variables when [creating a PDF] with ConTeXt.
repeat for multiple options
`pdfa`
: adds to the preamble the setup necessary to generate PDF/A-1b:2005.
: adds to the preamble the setup necessary to generate PDF/A of the type
specified, e.g. `1a:2005`, `2a`. If no type is specified (i.e. the value
is set to True, by e.g. `--metadata=pdfa` or `pdfa: true` in a YAML metadata
block), `1b:2005` will be used as default, for reasons of backwards
compatibility. Using `--variable=pdfa` without specified value is not supported.
To successfully generate PDF/A the required ICC color profiles have to
be available and the content and all included files (such as images)
have to be standard conforming. The ICC profiles can be obtained
from [ConTeXt ICC Profiles]. See also [ConTeXt PDFA] for more
details.
have to be standard conforming. The ICC profiles and output intent
may be specified using the variables `pdfaiccprofile` and `pdfaintent'.
See also [ConTeXt PDFA] for more details.
`pdfaiccprofile`
: when used in conjunction with `pdfa', specifies the ICC profile to use
in the PDF, e.g. `default.cmyk'. If left unspecified, `sRGB.icc' is
used as default. May be repeated to include multiple profiles. Note that
the profiles have to be available on the system. They can be obtained
from [ConTeXt ICC Profiles].
`pdfaintent'
: when used in conjunction with `pdfa', specifies the output intent for
the colors, e.g. `ISO coated v2 300\letterpercent\space (ECI)'
If left unspecified, `sRGB IEC61966-2.1' is used as default.
`toc`
: include table of contents (can also be set using `--toc/--table-of-contents`)

View file

@ -27,7 +27,6 @@ $endif$
% make chapter, section bookmarks visible when opening document
\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
\setupinteractionscreen[option=bookmark]
\setuptagging[state=start]
$if(papersize)$
\setuppapersize[$for(papersize)$$papersize$$sep$,$endfor$]
@ -41,10 +40,12 @@ $endif$
$if(pdfa)$
% attempt to generate PDF/A
\setupbackend
[format=PDF/A-1b:2005,
intent=sRGB IEC61966-2.1,
profile=sRGB.icc]
[format=PDF/A-$pdfa$,
profile={$if(pdfaiccprofile)$$for(pdfaiccprofile)$$pdfaiccprofile$$sep$,$endfor$$else$sRGB.icc$endif$},
intent=$if(pdfaintent)$$pdfaintent$$else$sRGB IEC61966-2.1$endif$]
$endif$
\setupbackend[export=yes]
\setupstructure[state=start,method=auto]
% use microtypography
\definefontfeature[default][default][script=latn, protrusion=quality, expansion=quality, itlc=yes, textitalics=yes, onum=yes, pnum=yes]

View file

@ -15,7 +15,7 @@ Conversion of 'Pandoc' format into ConTeXt.
module Text.Pandoc.Writers.ConTeXt ( writeConTeXt ) where
import Prelude
import Control.Monad.State.Strict
import Data.Char (ord, isDigit)
import Data.Char (ord, isDigit, toLower)
import Data.List (intercalate, intersperse)
import Data.Maybe (mapMaybe)
import Data.Text (Text)
@ -93,6 +93,9 @@ pandocToConTeXt options (Pandoc meta blocks) = do
Just (('a':d:ds) :: String)
| all isDigit (d:ds) -> resetField "papersize"
(('A':d:ds) :: String)
_ -> id)
$ (case toLower <$> lookupMetaString "pdfa" meta of
"true" -> resetField "pdfa" ("1b:2005" :: String)
_ -> id) metadata
let context' = defField "context-dir" (toContextDir
$ getField "dir" context) context

View file

@ -10,8 +10,9 @@
% make chapter, section bookmarks visible when opening document
\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
\setupinteractionscreen[option=bookmark]
\setuptagging[state=start]
\setupbackend[export=yes]
\setupstructure[state=start,method=auto]
% use microtypography
\definefontfeature[default][default][script=latn, protrusion=quality, expansion=quality, itlc=yes, textitalics=yes, onum=yes, pnum=yes]

View file

@ -8,8 +8,9 @@
% make chapter, section bookmarks visible when opening document
\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
\setupinteractionscreen[option=bookmark]
\setuptagging[state=start]
\setupbackend[export=yes]
\setupstructure[state=start,method=auto]
% use microtypography
\definefontfeature[default][default][script=latn, protrusion=quality, expansion=quality, itlc=yes, textitalics=yes, onum=yes, pnum=yes]