summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pdfx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-12-23 23:04:18 +0000
committerKarl Berry <karl@freefriends.org>2018-12-23 23:04:18 +0000
commit13cae12a372b2095aa728c7f7dc41b712d9beef1 (patch)
tree9a58836f177869cb597db06078522ccfdc26849d /Master/texmf-dist/tex/latex/pdfx
parent5b38ea096283729f26d79088180038e9ca575faf (diff)
pdfx (23dec18)
git-svn-id: svn://tug.org/texlive/trunk@49487 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pdfx')
-rw-r--r--Master/texmf-dist/tex/latex/pdfx/pdfx.sty208
1 files changed, 127 insertions, 81 deletions
diff --git a/Master/texmf-dist/tex/latex/pdfx/pdfx.sty b/Master/texmf-dist/tex/latex/pdfx/pdfx.sty
index 51e70d637c5..2f3f578de01 100644
--- a/Master/texmf-dist/tex/latex/pdfx/pdfx.sty
+++ b/Master/texmf-dist/tex/latex/pdfx/pdfx.sty
@@ -31,7 +31,7 @@
}{}%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pdfx}
- [2018/11/29 v1.6 PDF/X and PDF/A support (CVR/HTH/RRM/PS)]
+ [2018/12/22 v1.6.1 PDF/X and PDF/A support (CVR/HTH/RRM/PS)]
\newif\ifpdfx@noBOM \pdfx@noBOMfalse % use a BOM in the XMP packet
\newif\ifpdfx@x \pdfx@xfalse % PDF/X mode
@@ -118,7 +118,7 @@
}% external OPI workflow, i.e. multiple files involved
\DeclareOption{x-3}{\global\pdfx@xtrue\def\xmp@Part{3}% RGB allowed, but rare!
\def\xmp@Conformance{}\def\xmp@ReleaseDate{2003}%
- \global\pdfminorversion=4 }% same as x-303
+ \global\pdfx@minorversion=4 }% same as x-303
\DeclareOption{x-302}{\global\pdfx@xtrue\def\xmp@Part{3}%
\def\xmp@Conformance{}\def\xmp@ReleaseDate{2002}% ISO 15930-3:2002
\global\pdfx@minorversion=3 }
@@ -376,12 +376,14 @@
\RequirePackage{ifxetex}
\ifxetex
\def\pdfx@pages@xetex#1{\special{pdf:put @pages <<#1>>}}
+ \def\pdfx@pageattr@xetex#1{\special{pdf:put @thispage <<#1>>}}
\def\pdfx@docinfo@xetex#1{\special{pdf:put @docinfo <<#1>>}}
\def\pdfx@catalog@xetex#1{\special{pdf:put @catalog <<#1>>}}
- \def\pdfx@mapline@xetex#1{}
+ \def\pdfx@mapline@xetex#1{\special{pdf:mapline #1}}%% does this work ??
+%% \def\pdfx@mapline@xetex#1{}
\def\pdf@compress@xetex=#1{}
%%
- \let\pdfpageattr\pdfx@pages@xetex
+ \let\pdfpagesattr\pdfx@pages@xetex
\let\pdfinfo\pdfx@docinfo@xetex
\let\pdfcatalog\pdfx@catalog@xetex
\let\pdfmapline\pdfx@mapline@xetex
@@ -391,6 +393,7 @@
%%\newif\ifpdfx@pdfmark % control future support for dvips
+\RequirePackage{everyshi}
\RequirePackage{ifluatex}
\ifluatex
\IfFileExists{luatex85.sty}{% 2016+
@@ -403,7 +406,6 @@
\let\pdfescapestring\pdf@escapestring
\else
\ifxetex
- \usepackage{everyshi}%
\expandafter\ifx\csname mdfivesum\endcsname\relax
% too early a version of XeTeX
\let\pdfx@mdfivesum\relax
@@ -461,11 +463,13 @@
\edef\pdfx@theight{\strip@pt\dimen0}%
\ifxetex
\xdef\pdfx@everypage@xetex{%
- /MediaBox[0 0 \pdfx@mwidth\space \pdfx@mheight]^^J
- /TrimBox[25 20 \pdfx@twidth\space \pdfx@theight]%
+ /MediaBox[0 0 \pdfx@mwidth\space \pdfx@mheight]^^J
+ /BleedBox[0 0 \pdfx@mwidth\space \pdfx@mheight]^^J
+ /CropBox[0 0 \pdfx@mwidth\space \pdfx@mheight]^^J
+ /TrimBox[25 20 \pdfx@twidth\space \pdfx@theight]%
}%
\fi
- \edef\next{\endgroup\pdfpageattr{%
+ \edef\next{\endgroup\pdfpagesattr{%
/MediaBox[0 0 \pdfx@mwidth\space \pdfx@mheight]^^J
%% /ArtBox[0 0 \pdfx@mwidth\space \pdfx@mheight]^^J
/BleedBox[0 0 \pdfx@mwidth\space \pdfx@mheight]^^J
@@ -474,9 +478,14 @@
}\next
\ifxetex
\AtBeginDvi{%
- \immediate\special{pdf:put @thispage <<\pdfx@everypage@xetex>>}}%
+ \expandafter\immediate\pdfx@pageattr@xetex{\pdfx@everypage@xetex}}%
\EveryShipout{%
- \immediate\special{pdf:put @thispage <<\pdfx@everypage@xetex>>}}%
+ \expandafter\immediate\pdfx@pageattr@xetex{\pdfx@everypage@xetex}}%
+ \else
+ \EveryShipout{%
+ \expandafter\ifx\expandafter\relax\the\pdfpageattr\relax
+ \immediate\pdfpageattr\expandafter{\the\pdfpagesattr}%
+ \fi }%
\fi
\else
%% PDF/A-1b doesn't allow object compression
@@ -2266,25 +2275,50 @@
%% But some PDF readers don't support XMP, so it is nice to have
%% /Info fields, when this can be done reliably.
%%
+%% 2018-12-16: load package outside the grouping
+\RequirePackage{stringenc}%
\begingroup
- \RequirePackage{stringenc}%
- \expandafter\ifx\csname pdf@escapehex\endcsname\relax
- \PackageWarning{pdfx}{%
- Missing an implementation of \string\pdf@escapehex ^^J
- Translated Metadata cannot be generated as PDF strings.^^J}%
- \def\pdfx@GeneratePdfString#1#2{}%
- \def\pdfx@ConvertUTFtoBE#1#2{}%
- \else
- \def\pdfx@GeneratePdfString#1#2{%
+ \catcode`\| 0
+ \catcode `\\ 12
+ |gdef |pdfx@parsebackslash#1{%
+ |begingroup
+ |def |pdfx@parsemacro{#1}%
+ |def |pdfx@parseout{}%
+ |expandafter |pdfx@doparsebackslash#1\|pdfx@endparse
+ }
+ |gdef |pdfx@doparsebackslash#1\#2|pdfx@endparse{%
+ |edef |pdfx@parseout{|pdfx@parseout#1}%
+ |ifx |relax#2|relax
+ |let |next |pdfx@parseend
+ |else
+ |edef |pdfx@parseout{|pdfx@parseout \\}%
+ |def |next{|pdfx@doparsebackslash#2|pdfx@endparse}%
+ |fi |next
+ }
+|endgroup
+\def\pdfx@parseend{%
+ \edef\next{\endgroup\def\expandafter\noexpand\pdfx@parsemacro{\pdfx@parseout}}%
+ \next
+}%
+\begingroup
+%% \expandafter\ifx\csname pdf@escapehex\endcsname\relax
+%% \PackageWarning{pdfx}{%
+%% Missing an implementation of \string\pdf@escapehex ^^J
+%% Translated Metadata cannot be generated as PDF strings.^^J}%
+%% \def\pdfx@GeneratePdfString#1#2{}%
+%% \def\pdfx@ConvertUTFtoBE#1#2{}%
+%% \fi %%\else
+ \gdef\pdfx@GeneratePdfString#1#2{%
% converts a UTF-8 string to UTF-16be
\StringEncodingConvert{#1}{#2}{utf8}{utf16be}%
- \xdef#1{\string\376\string\377\pdfescapestring{#1}}%
+ \edef\pdfx@tempii{#1}\relax
+ \xdef#1{\string\376\string\377\pdfescapestring{\pdfx@tempii}}%
}%
- \def\pdfx@ConvertUTFtoBE#1#2{%
+ \gdef\pdfx@ConvertUTFtoBE#1#2{%
\setbox0=\hbox{% catch any rubbish escaping to the MVL
\def\cf@encoding{L8U}\fontencoding{L8U}%
\ifluatex
- \let\pdfescapestring\luaescapestring
+%% \let\pdfescapestring\luaescapestring
\else\ifxetex\else
\inputencoding{8bit}%
\fi\fi
@@ -2292,10 +2326,18 @@
\pdfx@xmpunimarkup
\let\backslash\textbackslash
\edef\pdfx@temp{#2}% ensure XMP expands to UTF8
- \pdfx@GeneratePdfString{#1}{\pdfx@temp}%
- }%
+ \ifluatex
+ \pdfx@parsebackslash\pdfx@temp
+ \pdfstringdef{#1}{\pdfx@temp}%
+ \else\ifxetex
+ \pdfx@parsebackslash\pdfx@temp
+ \pdfstringdef{#1}{\pdfx@temp}%
+ \else
+ \pdfx@GeneratePdfString{#1}{\pdfx@temp}%
+ \fi\fi
+ }% end of \setbox
}%
- \fi
+%% \fi
\pdfx@pdfmarkup
\global\let\pdfx@pdfAuthor\@empty
\global\let\pdfx@pdfTitle\@empty
@@ -2303,45 +2345,57 @@
\global\let\pdfx@pdfKeywords\@empty
\ifpdfx@nopdfinfo % transliterated strings present
%% RRM: this may still work with parser macros ???
- \ifluatex
- %% \pdf@escapehex gets it wrong!!
- %% Is there a better way ?
- \else
- \pdfx@ConvertUTFtoBE\pdfx@pdfTitle\xmp@Title
- \pdfx@ConvertUTFtoBE\pdfx@pdfSubject\xmp@Subject
- \fi
-\else
- \pdfx@topdfstring\pdfx@pdfTitle\xmp@Title
- \ifpdfx@e\else\ifpdfx@x\else
- \pdfx@topdfstring\pdfx@pdfSubject\xmp@Subject
- \fi\fi
- \fi
+ \expandafter\ifx\expandafter\relax\xmp@Title\relax\else
+ \pdfx@ConvertUTFtoBE{\pdfx@pdfTitle}{\xmp@Title}%
+ \fi
+ \expandafter\ifx\expandafter\relax\xmp@Subject\relax\else
+ \pdfx@ConvertUTFtoBE{\pdfx@pdfSubject}{\xmp@Subject}%
+ \fi
+\else %% pdfx@nopdfinfotrue
+ \expandafter\ifx\expandafter\relax\xmp@Title\relax\else
+ \ifluatex
+ \pdfx@ConvertUTFtoBE\pdfx@pdfTitle\xmp@Title
+ \else\ifxetex
+ \pdfx@ConvertUTFtoBE\pdfx@pdfTitle\xmp@Title
+ \else
+ \pdfx@GeneratePdfString\pdfx@pdfTitle\xmp@Title
+ \fi\fi
+ \fi
+ \expandafter\ifx\expandafter\relax\xmp@Subject\relax\else
+ \ifluatex
+ \pdfx@ConvertUTFtoBE\pdfx@pdfSubject\xmp@Subject
+ \else\ifxetex
+ \pdfx@ConvertUTFtoBE\pdfx@pdfSubject\xmp@Subject
+ \else
+ \pdfx@GeneratePdfString\pdfx@pdfSubject\xmp@Subject
+ \fi\fi
+ \fi
+ \fi % end of \ifpdfx@nopdfinfo
\pdfx@topdfstring\pdfx@CreatorTool\xmp@CreatorTool
\pdfx@topdfstring\pdfx@Producer\xmp@Producer
%% \pdfescapestring needed
- \expandafter\ifx\csname pdfescapestring\endcsname\relax
- \else
+%% \expandafter\ifx\csname pdfescapestring\endcsname\relax
+%% \else
\expandafter\ifx\expandafter\relax\xmp@Author\relax
\else
%% check for multiple authors with parser macro
\expandafter\pdfx@parseforsep\xmp@Author\sep\pdfx@endparse
\ifpdfx@sep@infield@
\else
- \pdfx@ConvertUTFtoBE{\pdfx@pdfAuthor}{\xmp@Author}%
+ \pdfx@ConvertUTFtoBE{\pdfx@pdfAuthor}{\xmp@Author}%
\fi %% end of \ifpdfx@sep@infield@
\fi %% end of \xmp@Author test
\expandafter\ifx\expandafter\relax\xmp@Keywords\relax
\else
%% check for multiple keywords with parser macro
\expandafter\pdfx@parseforsep\xmp@Keywords\sep\pdfx@endparse
- \ifpdfx@sep@infield@\else
- \ifluatex\else
- \pdfx@ConvertUTFtoBE{\pdfx@pdfKeywords}{\xmp@Keywords}%
- \fi
+ \ifpdfx@sep@infield@
+ \else
+ \pdfx@ConvertUTFtoBE{\pdfx@pdfKeywords}{\xmp@Keywords}%
\fi %% end of \ifpdfx@sep@infield@
\fi %% end of \xmp@Keywords test
%%
- \fi %% end of \pdfescapestring test
+%% \fi %% end of \pdfescapestring test
\endgroup
%% Affects CMap creation for certain fonts, according to glyph names
@@ -2473,11 +2527,11 @@
\begingroup
\def\sep{; }% should not be needed, but just in case
\pdfinfo{%
- \ifx\pdfx@pdfTitle\@empty\else /Title(\pdfx@pdfTitle)\fi
- \ifx\pdfx@pdfAuthor\@empty\else /Author(\pdfx@pdfAuthor)\fi
- \ifx\pdfx@pdfSubject\@empty\else /Subject(\pdfx@pdfSubject)\fi
- \ifx\pdfx@pdfKeywords\@empty\else /Keywords(\pdfx@pdfKeywords)\fi
- /Creator(\pdfx@CreatorTool)%
+ \ifx\pdfx@pdfTitle\@empty\else /Title(\pdfx@pdfTitle)^^J\fi
+ \ifx\pdfx@pdfAuthor\@empty\else /Author(\pdfx@pdfAuthor)^^J\fi
+ \ifx\pdfx@pdfSubject\@empty\else /Subject(\pdfx@pdfSubject)^^J\fi
+ \ifx\pdfx@pdfKeywords\@empty\else /Keywords(\pdfx@pdfKeywords)^^J\fi
+ /Creator(\pdfx@CreatorTool)^^J%
\ifx\@pdfcreationdate\@empty
/CreationDate(D:\pdfx@convDate)%
\else
@@ -2489,8 +2543,8 @@
\else
/ModDate(\@pdfmoddate)%
\fi
- /Producer(\pdfx@Producer)%
- /Trapped/False
+ ^^J/Producer(\pdfx@Producer)%
+ /Trapped/False^^J%
\ifnum\xmp@Part=1
/GTS_PDFXVersion(PDF/X-1\ifnum\xmp@ReleaseDate>2001
\xmp@Conformance\fi:\xmp@ReleaseDate)%
@@ -2545,11 +2599,11 @@
\begingroup
\def\sep{; }% should not be needed, but just in case
\pdfinfo{%
- \ifx\pdfx@pdfTitle\@empty\else /Title(\pdfx@pdfTitle)\fi
- \ifx\pdfx@pdfAuthor\@empty\else /Author(\pdfx@pdfAuthor)\fi
- \ifx\pdfx@pdfSubject\@empty\else /Subject(\pdfx@pdfSubject)\fi
- \ifx\pdfx@pdfKeywords\@empty\else /Keywords(\pdfx@pdfKeywords)\fi
- /Creator(\pdfx@CreatorTool)%
+ \ifx\pdfx@pdfTitle\@empty\else /Title(\pdfx@pdfTitle)^^J\fi
+ \ifx\pdfx@pdfAuthor\@empty\else /Author(\pdfx@pdfAuthor)^^J\fi
+ \ifx\pdfx@pdfSubject\@empty\else /Subject(\pdfx@pdfSubject)^^J\fi
+ \ifx\pdfx@pdfKeywords\@empty\else /Keywords(\pdfx@pdfKeywords)^^J\fi
+ /Creator(\pdfx@CreatorTool)^^J%
\ifx\@pdfcreationdate\@empty
/CreationDate(D:\pdfx@convDate)%
\else
@@ -2561,8 +2615,8 @@
\else
/ModDate(\@pdfmoddate)%
\fi
- /Producer(\pdfx@Producer)%
- /Trapped/False
+ ^^J/Producer(\pdfx@Producer)%
+ /Trapped/False^^J%
/GTS_PDFEVersion(PDF/E-1\xmp@Conformance:\xmp@ReleaseDate)%
}% end of PDF/E info
\endgroup %% end of scope for \sep
@@ -2597,11 +2651,11 @@
\begingroup
\def\sep{; }% should not be needed, but just in case
\pdfinfo{%
- \ifx\pdfx@pdfTitle\@empty\else /Title(\pdfx@pdfTitle)\fi
- \ifx\pdfx@pdfAuthor\@empty\else /Author(\pdfx@pdfAuthor)\fi
- \ifx\pdfx@pdfSubject\@empty\else /Subject(\pdfx@pdfSubject)\fi
- \ifx\pdfx@pdfKeywords\@empty\else /Keywords(\pdfx@pdfKeywords)\fi
- /Creator(\pdfx@CreatorTool)%
+ \ifx\pdfx@pdfTitle\@empty\else /Title(\pdfx@pdfTitle)^^J\fi
+ \ifx\pdfx@pdfAuthor\@empty\else /Author(\pdfx@pdfAuthor)^^J\fi
+ \ifx\pdfx@pdfSubject\@empty\else /Subject(\pdfx@pdfSubject)^^J\fi
+ \ifx\pdfx@pdfKeywords\@empty\else /Keywords(\pdfx@pdfKeywords)^^J\fi
+ /Creator(\pdfx@CreatorTool)^^J%
\ifx\@pdfcreationdate\@empty
/CreationDate(D:\pdfx@convDate)%
\else
@@ -2613,8 +2667,8 @@
\else
/ModDate(\@pdfmoddate)%
\fi
- /Producer(\pdfx@Producer)%
- /Trapped/False
+ ^^J/Producer(\pdfx@Producer)%
+ /Trapped/False^^J%
/GTS_PDFA1Version (PDF/A-\xmp@Part\xmp@conf:\xmp@ReleaseDate)%
}% end of PDF/A info
\endgroup %% end of scope for \sep
@@ -2623,21 +2677,14 @@
\fi\fi
%%----------------------------------------------------------------------
+%% 2018-12-16: xmpincl needs the ifthen package
+%% it should be loaded outside the grouping, else biblatex may barf
+%%
+\RequirePackage{ifthen}
\begingroup
-%% override the \ifpdf check of xmpincl package
-\ifxetex
- \pdftrue
-\else\ifluatex
+%% override the \ifpdf check of xmpincl package, inside the grouping
\pdftrue
-\fi\fi
-\RequirePackage{xmpincl}
-\ifxetex
- % revert \ifpdf
- \pdffalse
-\else\ifluatex
- \pdffalse
-\fi\fi
-
+ \RequirePackage{xmpincl}
%% combine coding from xmpincl and hyperxml to support XeTeX
\def\pdfx@xmpincl@xetex#1{%
\IfFileExists{#1.xmp}{%
@@ -2876,7 +2923,6 @@
%%----------------------------------------------------------------------
\ifpdfx@transliterated
%% support for bookmarks with transliterated input
- \RequirePackage{stringenc}
\ifxetex\let\pdf@escapehex\empty\fi % don't need it
\expandafter\ifx\csname pdf@escapehex\endcsname\relax
\PackageWarning{pdfx}{%