[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: moving setup/version (ea4dc98)
Ulrike Fischer
fischer at troubleshooting-tex.de
Thu May 2 00:20:47 CEST 2019
Repository : https://github.com/latex3/pdfresources
On branch : testlinkstuff
Link : https://github.com/latex3/pdfresources/commit/ea4dc987703bddbe8637e149b0d603493fd43214
>---------------------------------------------------------------
commit ea4dc987703bddbe8637e149b0d603493fd43214
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Thu May 2 00:20:47 2019 +0200
moving setup/version
>---------------------------------------------------------------
ea4dc987703bddbe8637e149b0d603493fd43214
hluatex-experimental.def | 40 +++++++++++++++++++++-------------------
pdfresources.dtx | 41 ++++++++++++++++++++++++++++++++---------
test-pdfresources.tex | 21 ++++++++++++++++-----
3 files changed, 69 insertions(+), 33 deletions(-)
diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index 1f7eb0c..782b08d 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -30,8 +30,8 @@
{\msg_error:nn {hyp}{missing-bookmark-package}}
}}
-% booleans for the (some) option keys. As hyperref disables them it is okay to set them here, hypersetup
-% can't interfere
+% booleans for the (some) option keys. As hyperref disables them it is okay to set them here,
+% hypersetup can't interfere
%%% pdfa key:
\bool_new:N\l__hyp_pdfa_bool
\ifHy at pdfa
@@ -222,11 +222,11 @@
\ifHy at ocgcolorlinks
\pdf_version_min_gset:n { 1.5 }
\fi
-\ExplSyntaxOff
+
% should this go into the drivers?
% or in the pdf level?
% set pdfversion / needs adaption to major version!!!
-\ExplSyntaxOn
+
\bool_if:NT\l__hyp_setpdfversion_bool
{
\ifnum\Hy at pdfversion<5 %
@@ -308,11 +308,10 @@
{ 10 }
{\driver_pdf_version_minor:}
}
- \ExplSyntaxOff
\Hy at DisableOption{pdfversion}%
-\ExplSyntaxOn
-\ifHy at ocgcolorlinks
+\legacy_if:nTF {Hy at ocgcolorlinks}
+ {
\newcommand\OBJ at OCG@view {} % for the hyperref test
\pdf at ifdraftmode{}{
\driver_pdf_object_new:nn { l__hyp_ocg_view_dict_obj } { dict }
@@ -412,9 +411,10 @@
\endgroup
}
}
-\else
+ }
+ {
\Hy at DisableOption{ocgcolorlinks}
-\fi
+ }
\def\setpdflinkmargin#1
{
@@ -677,13 +677,15 @@
\pdf_catalog_gput:nn {URI}{<</Base(\Hy at pstringB)>>}
}
%
- \ifx\@pdfstartpage\@empty
- \else
- \ifx\@pdfstartview\@empty
- \else
- openaction~goto~page\@pdfstartpage{\@pdfstartview}%
- \fi
- \fi
+ \bool_if:nF
+ {
+ \tl_if_empty_p:N \@pdfstartpage
+ ||
+ \tl_if_empty_p:N \@pdfstartview
+ }
+ {
+ \pdf_docview:nn {\@pdfstartpage} {\@pdfstartview}
+ }
\edef\Hy at temp{%
\ifHy at pdftoolbar\else /HideToolbar\c_space_tl true\fi
\ifHy at pdfmenubar\else /HideMenubar\c_space_tl true\fi
@@ -724,9 +726,9 @@
{ Lang }
{(\@pdflang)}%
\fi
-
}
+
\cs_new:Npn \__hyp_info_generate_addons:
{
\group_begin:
@@ -739,11 +741,11 @@
}
-\def\PDF at FinishDoc{}%
+\def\PDF at FinishDoc{}% dummy needed for hyperref ...
\AtEndPreamble{
\pdf at ifdraftmode{}{
- \Hy at UseMaketitleInfos
+ \Hy at UseMaketitleInfos %get Title/Author from \title if pdfusetitle is true
\__hyp_info_generate_addons:
\pdf_info_string_gput:no
{Author} {\@pdfauthor}
diff --git a/pdfresources.dtx b/pdfresources.dtx
index a9c4bc2..69aa818 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -241,8 +241,8 @@
% \section{Management code / pdf Module}
%<@@=pdf>
% \subsection{The info dictionary}
-% The info dictionary is filled by e.g. \verb+\pdfinfo+. Multiple appearances of
-% \verb+\pdfinfo+ are concatenated, so one could end with multiple /Title or /Author entries.
+% The info dictionary is filled by e.g. \cs{pdfinfo}. Multiple appearances of
+% \cs{pdfinfo} are concatenated, so one could end with multiple /Title or /Author entries.
% It is then viewer dependant which one is showed, so it is better to avoid them.
% We therefore setup a property which is filled and written to the info
% directory in one go. According to hyperref a few odd drivers (hvtex, dvipsone, dviwind)
@@ -250,7 +250,7 @@
% strings so there is a special command for this, as entries with empty content
% should be ommited we add a test. The string command should perhaps escape the argument???
% hyperref write the info dictionary as the shipout of the first page --
-% probably to catch the case that \verb+\title+ is issued after the begin of the document.
+% probably to catch the case that \cs{title} is issued after the begin of the document.
% We are outputting at begin document, so all info keys should be set before.
% \begin{macrocode}
%<*package>
@@ -285,12 +285,12 @@
%</package>
% \end{macrocode}
% \subsection{The catalog dictionary}
-% The catalog dictionary is filled by e.g. \verb+\pdfcatalog+. Multiple appearances of
-% \verb+\pdfcatalog+ are concatenated, so one could end with multiple entries.
+% The catalog dictionary is filled by e.g. \cs{pdfcatalog}. Multiple appearances of
+% \cs{pdfcatalog} are concatenated, so one could end with multiple entries.
% We is better to avoid this. We therefore setup a
-% property which is filled and executed in one go at begin document.
-% \verb+\pdfcatalog+ has an option \texttt{openaction} to set the start view options. This is ignored
-% here but set in a separate command (to be in sync with other drivers).
+% property which is filled and executed in one at a sensible (not yet found) place.
+% \cs{pdfcatalog} has an option \texttt{openaction} to set the start view options.
+% This is ignored here but set in a separate command (to be in sync with other drivers).
% \begin{macrocode}
%<*package>
\prop_new:N \g_@@_catalog_dict_prop
@@ -318,7 +318,30 @@
% \end{macrocode}
% \subsection{Setting / comparing pdf versions}
% The code assumes that the versions are two integers separated by a period.
-%
+% The pdf version should be set rather early, before any object has been written.
+% So we define a \cs{documentsetup} commmand which should go before \cs{documentclass}
+% \begin{macro}{\documentsetup}
+% \begin{macrocode}
+%<*package>
+\msg_new:nnn
+ {pdf}
+ {setup-after-documentclass}
+ { \token_to_str:N \documentsetup\c_space_tl should~be~used~only~before~\token_to_str:N\documentclass}
+
+\NewDocumentCommand\documentsetup { m }
+ {
+ \cs_if_eq:NNTF \documentclass \@twoclasseserror
+ {\msg_error:nn {pdf}{setup-after-documentclass }}
+ {\keys_set:nn { pdf / setup } { #1 }}
+ }
+
+\keys_define:nn { pdf / setup }
+ {
+ pdfversion .code:n = \pdf_version_gset:n { #1 }
+ }
+%</package>
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\pdf_version_gset:n, \pdf_version_min_gset:n}
% \begin{macro}{\@@_version_gset:w}
% \begin{macrocode}
diff --git a/test-pdfresources.tex b/test-pdfresources.tex
index 222bc03..46233f1 100644
--- a/test-pdfresources.tex
+++ b/test-pdfresources.tex
@@ -1,9 +1,10 @@
% !Mode:: "TeX:DE:UTF-8:Main"
%\input{regression-test}
-\RequirePackage{pdfresources}
+\RequirePackage{pdfresources}
+\documentsetup{pdfversion=2.0}
\documentclass{article}
-
+\documentsetup{pdfversion=2.0}
%\usepackage{pdfresources}
%don't compress pdf:
@@ -14,8 +15,16 @@
%\driver_pdf_catalog_gput:nn {Lang}
\ExplSyntaxOff
\usepackage{xcolor}
-
-\usepackage[customdriver=hluatex-experimental,pdfversion=2.0,pdftitle=X,ocgcolorlinks]{hyperref}
+\title{some title}
+\usepackage[customdriver=hluatex-experimental,
+ pdfusetitle,ocgcolorlinks,
+ pdftrapped=True,
+ % pdfstartpage=3,
+ % pdfstartview=
+ ]{hyperref}
+\makeatletter
+%\makeatother
+\hypersetup{pdfinfo={blub=bla,blb=zzz}}
\usepackage{bookmark}
@@ -25,7 +34,9 @@
\hypupdateattribute
\makeatletter%\tracingmacros=1
\textwidth=5cm
-\begin{document}\show\pdfoutline
+\begin{document}
+abc\newpage blb\newpage ccc
+\end{document}
\tableofcontents
\section{abc}
\makeatletter%\show\Hy at pstringdef
More information about the latex3-commits
mailing list