[latex3-commits] [git/LaTeX3-latex3-pdfresources] splitting: move utils out of pdfresource (5a51aba)
Ulrike Fischer
fischer at troubleshooting-tex.de
Thu Jul 16 00:19:33 CEST 2020
Repository : https://github.com/latex3/pdfresources
On branch : splitting
Link : https://github.com/latex3/pdfresources/commit/5a51abaee1fca51f23b57bcc4651adb577e23b67
>---------------------------------------------------------------
commit 5a51abaee1fca51f23b57bcc4651adb577e23b67
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Thu Jul 16 00:19:33 2020 +0200
move utils out of pdfresource
>---------------------------------------------------------------
5a51abaee1fca51f23b57bcc4651adb577e23b67
l3backend-pdf-extra.dtx | 8 +
l3pdfinit.dtx | 7 +-
pdfresources.dtx => l3pdfutils.dtx | 297 ++--------------
pdfresources.dtx | 690 +------------------------------------
pdfresources.ins | 8 +
5 files changed, 44 insertions(+), 966 deletions(-)
diff --git a/l3backend-pdf-extra.dtx b/l3backend-pdf-extra.dtx
index 3367489..fa590ba 100644
--- a/l3backend-pdf-extra.dtx
+++ b/l3backend-pdf-extra.dtx
@@ -59,6 +59,14 @@
% \begin{macrocode}
%<@@=pdf>
% \end{macrocode}
+% \begin{macrocode}
+%<*dvipdfmx|xdvipdfmx>
+% avoid that destinations names are optimized.
+% is this still needed??
+% see https://tug.org/pipermail/dvipdfmx/2019-May/000002.html
+ \__kernel_backend_literal:x { dvipdfmx:config~C~ 0x10 }
+%</dvipdfmx|xdvipdfmx>
+% \end{macrocode}
% \begin{variable}{\g_@@_tmpa_prop, \l_@@_tmpa_tl, \l_@@_tmpa_box }
% Some scratch variables
% \begin{macrocode}
diff --git a/l3pdfinit.dtx b/l3pdfinit.dtx
index 0895997..35988f5 100644
--- a/l3pdfinit.dtx
+++ b/l3pdfinit.dtx
@@ -114,12 +114,13 @@
{ \msg_error:nn { pdf }{ setup-after-documentclass } }
{
\keys_set_groups:nnn { pdf / setup} {init}{ #1 }
- \RequirePackage{l3pdf}
- \RequirePackage{lthooks} %
+ \RequirePackage{l3pdf} %should be loader after the backend is set.
+ \RequirePackage{lthooks} % should be removed later
% %load backend driver
\ExplSyntaxOn\makeatletter
- \file_input:n {l3\g__sys_backend_tl-pdf.def}
+ \file_input:n {l3\g__sys_backend_tl-pdf.def} %should be inside the normal backend
\ExplSyntaxOff\makeatother
+ \RequirePackage{l3pdfutils}
\bool_gset_true:N \g_@@_Core_active_bool
\keys_set_filter:nnn { pdf / setup } { init } { #1 }
}
diff --git a/pdfresources.dtx b/l3pdfutils.dtx
similarity index 67%
copy from pdfresources.dtx
copy to l3pdfutils.dtx
index 1978e85..721380d 100644
--- a/pdfresources.dtx
+++ b/l3pdfutils.dtx
@@ -1,17 +1,17 @@
% \iffalse meta-comment
%
-%% File: pdfresources.dtx
+%% File: l3pdfutils.dtx
%
-% Copyright (C) 2019-2020 The LaTeX3 Project
+% Copyright (C) 2018-2020 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version. The latest version
% of this license is in the file
%
-% https://www.latex-project.org/lppl.txt
+% http://www.latex-project.org/lppl.txt
%
-% This file is part of the "pdfresources bundle" (The Work in LPPL)
+% This file is part of the "(experimental) pdfresources bundle" (The Work in LPPL)
% and all files in that bundle must be distributed together.
%
% -----------------------------------------------------------------------
@@ -23,32 +23,16 @@
% for those people who are interested.
%
%<*driver>
-\documentclass{l3doc}
-\usepackage{tabularx,array,booktabs}
-\newcommand\potentialclash{\noindent\llap{\dbend\ }}
-\raggedbottom
+\documentclass[full]{l3doc}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
-% \begin{macrocode}
-%<@@=pdf>
-%<*package>
-\ProvidesExplPackage {pdfresources} {2020-07-13} {0.7}
- {experimental pdf-resource management}
-\RequirePackage{lthooks,zref-base,bitset}
-\DeclareOption { debug }
- {
- \msg_redirect_module:nnn { pdf } { none } { warning }
- }
-\DeclareOption { patches }{\AtEndOfPackage{\RequirePackage{pdfresources-patches}}}
-\ProcessOptions\relax
-%</package>
-% \end{macrocode}
-%
-% \title{\pkg{pdfresources}}
+% \title{^^A
+% The \pkg{l3pdfutils} package\\ pdf-utilities ^^A
+% }
%
% \author{^^A
% The \LaTeX3 Project\thanks
@@ -59,253 +43,26 @@
% }^^A
% }
%
-% \date{Released 2020-XX-XX}
+% \date{Released XXXX-XX-XX}
%
% \maketitle
% \begin{documentation}
-% \section{Introduction}
-% The \LaTeX{} format currently contains nearly no code specific to the now quite
-% central output format, PDF.
-% It delegates important tasks like supporting PDF standards,
-% creating links, adding special colors, managing the content of
-% central PDF-directories to external packages.
-% This is problematic as it can lead easily to clashes if two packages try
-% to access the same resource in an incompatible way. Also as
-% the primitives differ between the various binaries and backend with
-% which \LaTeX{} is used all packages have to write and maintain \enquote{driver} files
-% for the various backends.
-%
-%
-% The project here tries to resolve this situation by providing interfaces to
-% the various resources and objects in a backend independent way.
-%
-% The supported backends are pdflatex, lualatex, (x)dvipdfmx (latex, xelatex)
-% and dvips with ps2pdf (not completely yet). dvips with distiller could work too
-% but is untested.
-%
-% That the interfaces are backend independent doesn't mean that the results and even
-% the compilation behavior is identical. The backends are too different to allow
-% this. Some backends expand arguments e.g. in a \cs{special} while other don't.
-% Some backends can insert a resource at the first compilation, while another uses
-% the aux-file and a label and so needs at least two.
-%
-% \section{Use}
-% The package should be loaded before \cs{documentclass}. To activate
-% the resource management it should be followed by
-% \cs{DeclareDocumentMetaData}\marg{key-val}. The allowed keys are currently
-% described in \pdf{l3pdfinit}
-%
-% \section{Incompabilities}
-%
-% The package tries to take over the management of core PDF dictionaries. All packages
-% that bypass this package and access this dictionaries with primitives like
-% \cs{pdfcatalog}, \cs{pdfinfo}, \cs{pdfpageresources}, \cs{pdfpagesattr}
-% and \cs{pdfpageattr} or similar commands from other engines and backends are
-% basically incompatible: values can get lost or be wrong.
-%
-% The following describes known incompatible packages along with some suggestions
-% how this should or will be handled in future. The list is not exhaustive.
-%
-% \subsection{hyperref}
-% A generic driver that can
-% be used as replacement has been developed. It can be loaded with
-% \begin{verbatim}
-% \usepackage[customdriver=hgeneric-experimental]{hyperref}
-% \end{verbatim}
-%
-% For bookmarks the bookmarks package should be loaded after hyperref.
-% The new driver supports already most of the functions of the original drivers.
-% Incomplete is the support for form fields.
-%
-% \subsection{pdfx}
-% \pkg{pdfx} is not compatible. Replacement code to setup standards is under
-% development. At first pdf/A will be handled, pdf/X then later.
-%
-% \subsection{hyperxmp}
-% With small adjustments hyperxmp can be used. But the coordination should be
-% improved.
-%
-% \subsection{tikz/pgf}
-% \pkg{pgf} writes to the page resources too and so is incompatible. The needed
-% changes are rather small and will be done in coordination with the maintainer.
-% Until this works, \pkg{pageresources} can be loaded with the option \texttt{patches}
-% which will add the needed patches.
-%
-% \subsection{transparent}
-% The package \pkg{transparent} is incompatible. A replacement has been written
-% (\pkg{new-transparent}) and will be merged into the package.
-%
-% \subsection{pdflscape}
-% The package \pkg{pdflscape} is incompatible. A replacement has been written
-% (\pkg{new-pdflscape}) and will be merged into the package.
-%
-% \subsection{colorspace}
-% The package is incompatible. It works more or less with the option \texttt{patches}.
-% Alternative code for spot colors is under development
-% in the \pkg{l3color} package.
-%
-% \subsection{embedfile}
-% Tools needed to be able to write a replacement
-% to replace this package have been developed in the l3pdffile package.
-%
-% \subsection{tagpdf}
-% The development code is compatible and will be uploaded in time.
-%
%
+% \section{\pkg{l3pdfutils} documentation}
+% This module contains a number of commands to create pdf structures with
+% meaningful contents, currently xform, annotations and destinations.
% \end{documentation}
+%
% \begin{implementation}
-% \section{messages}
-% \begin{macrocode}
-%<*package>
-\msg_new:nnn { pdf } { patches }
- { loading~patch~code }
-\msg_new:nnn { pdf } { pgf-too-late }
- { pgf~is~already~loaded.~Patching~not~possible.}
-
-%</package>
-% \end{macrocode}
-% \section{Loading the core files.}
-% This loads the core files. The backend should not be loaded
-% to allow to set it in the document.
+%
+% \section{\pkg{l3pdfutils} implementation}
+%
% \begin{macrocode}
%<*package>
-\RequirePackage{l3pdfinit} %
-\RequirePackage{l3pdfmeta} %
-\RequirePackage{l3pdfdict}
-\RequirePackage{l3pdftools}
-\RequirePackage{l3pdfcoredict}
-%</package>
+%<@@=pdf>
+\ProvidesExplPackage {l3pdfutils} {2020-07-15} {0.1}
+ {PDF-utils}
% \end{macrocode}
-%
-% \section{The core dictionaries}
-% \subsection{The \enquote{Info} dictionary (pdfinfo)}
-% \begin{NOTE}{UF}
-% path: Info
-% 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 dependent which one is showed, so it is better to avoid this.
-% 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)
-% don't support arbitrary keys, but this should be handle elsewhere. Most entries are
-% strings so there is a special command for this. As entries with empty content
-% should be omitted we add a test. The string command should perhaps escape the argument,
-% but for now we are assuming that the argument is pdf safe.
-% hyperref writes to the info dictionary at the shipout of the first page --
-% probably to catch the case that \cs{title} is issued after the begin of the document.
-% We are outputting at the last page -- this needs a second compilation but
-% this is needed anyway.
-% \end{NOTE}
-%
-% \subsubsection{\enquote{Info}/backend}
-% The backend code is already in \pkg{expl3}.
-% \cs{@@_backend_info_gput:nn} inserts one name/value pair.
-%
-% \subsubsection{\enquote{Info}/management}
-% moved to \pkg{l3pdfcoredict}
-%
-% \subsection{The \enquote{Pages} dictionary (pdfpagesattr)}
-% The content of the property list associated with this dictionary name is written to the
-% /Pages object. This replaces \cs{pdfpagesattr}. This dictionary is global.
-% \subsubsection{\enquote{Pages} / backend}
-% \begin{NOTE}{UF}
-% path: Pages
-% pdfpagesattr is a single token register which is used at the end of the compilation.
-% dvips syntax: \verb+\special{ps: [/ABC /CDE /EFG /FGH /Rotate 90 /PAGES pdfmark}+
-% dvipdfmx syntax: \verb+\special{pdf:put @pages <</ABC /WEZ /EFG /XYZ /Rotate 0>>}+
-% both remove duplicate entries automatically, so there is no need to be careful.
-% \end{NOTE}
-% The code is in the extra backend code in \pkg{l3backend-pdf-extra}.
-% \subsubsection{\enquote{Pages} / management}
-% \begin{NOTE}{UF}
-% The register is normally used only a few times in a document, so it would be
-% okay to update the register/add the special at every change,
-% but with dvips/dvipdfmx this would disable removing entries.
-% So we issue the push code only at the end of the document.
-% \end{NOTE}
-% The code has been moved to \pkg{l3pdfcoredict}
-%
-% \subsection{\enquote{Page} and \enquote{ThisPage} (pdfpageattr)}
-% \subsubsection{\enquote{Page} and \enquote{ThisPage} /backend}
-% The code has been moved to \pgk{l3backend-pdf-extra}.
-% \subsubsection{\enquote{Page} and \enquote{ThisPage} / management}
-% \begin{NOTE}{UF}
-% Open is the question if one need a command to set attribute on a page by page number.
-% Open is the setter for /AF (and perhaps /OutputIntents).
-% See also https://tex.stackexchange.com/questions/479812/extension-of-rotating-package-to-set-pdf-rotation
-% (should work now)
-% \end{NOTE}
-% The code has been moved to \pkg{l3pdfcoredict}.
-%
-% \subsection{\enquote{Page/Resources}: ExtGState, ColorSpace, Shading, Pattern }
-% \begin{NOTE}{UF}
-% Only for pdf/luatex and xdvipdfmx backend- and pdf-code is needed to add values
-% to these resources.
-% With dvips the resources are added through high-level code (e.g. transparency), so the
-% backend/pdf commands are no-ops.
-% For every resources there is only one object. References to these objects are added to
-% all pages starting from the page where the first time something has been added to the
-% resource and to all XObjects. For luatex and pdftex it must be done together
-% with the /Properties, see above.
-% I don't see a need to set e.g. /ColorSpace page wise: preflight handles this
-% fine, see experiment colorspace-resources.
-% As pgf does the same, there is a need to patch it for now. Ditto for package colorspace.
-% \end{NOTE}
-% \subsubsection{\enquote{Page/Resources}: ExtGState, ColorSpace, Shading, Pattern / backend}
-% The code has been moved to \pkg{l3backend-pdf-extra}.
-%
-% \subsection{\enquote{Catalog} \& subdirectories (pdfcatalog) }
-% \subsubsection{\enquote{Catalog} \& subdirectories / backend}
-% The backend command is already in the driver:
-% \cs{@@_backend_catalog_gput:nn}.
-%
-
-% \subsubsection{\enquote{Catalog} \& subdirectories / management }
-% \begin{NOTE}{UF}
-% The catalog dictionary is filled by e.g. \cs{pdfcatalog}. Multiple appearances of
-% \cs{pdfcatalog} are concatenated, so one could end with multiple entries
-% for the same value with luatex and pdftex -- the other backends normally
-% avoid this problem.
-% We therefore setup a property which is filled and executed at a sensible
-% (not fixed) place.
-% /AF is even an array of dictionaries.
-% There is probably no way to test what has already been added to the catalog,
-% so doublets can only be avoided with ``don't do it''.
-% see catalogue.tex for a list of entries ...
-% Perhaps some tools to create the AF-file specification dictionaries is useful.
-% Open for now:
-% /Extensions (dict, pdf 2.0)
-% /Dests ? difference to subdict in Names?
-% /DSS (dict, pdf 2.0)
-% /Acroform/DR/ExtGState etc probably unneeded.
-% \end{NOTE}
-%
-% The code has been moved to \pkg{l3pdfcoredict}.
-%
-% \subsection{Local dictionaries}
-%
-% All dictionaries described above were global dictionaries and basically they
-% are written at most once (or at most once per page) to the PDF. The pdfdict module
-% predefines also a number of local dictionaries. These are used in objects like
-% link annotations (see the pdfannot module) which are written in varying
-% numbers to the PDF and allow to set their features and change them locally
-% if needed. The predefined dictionaries are
-% \begin{NOTE}{UF}
-% sync that with the table in pdfdict ...
-% \end{NOTE}
-% \begin{tabular}{lp{6cm}}
-% \multicolumn{2}{l}{annotation related: here are
-% \texttt{Border} and \texttt{C} (color)}\\
-% annot/Link/Goto & used in GoTo links (internal references) \\
-% annot/Link/URI & used in URI links (external uri references) \\
-% annot/Link/GotoR & used in GoToR links (file references) \\
-% annot/Link/Named & used in Named actions (menu calls) \\
-% annot/Link/Launch & used in Launch links (application calls) \\
-% \end{tabular}
-%
-% \section{Various PDF contents}
-% The following commands allow to create a number of important pdf objects and contents in a
-% backend independant way.
-
% \subsection{Form XObject (pdfxform)}
% \begin{NOTE}{UF}
% - As in dvi mode the xform is immediate, this is done for pdftex/luatex too.
@@ -863,6 +620,7 @@
%</package>
% \end{macrocode}
+%
% \subsection{Destinations}
% \begin{NOTE}{UF}
@@ -955,13 +713,8 @@
}
%</package>
-%<*dvipdfmx|xdvipdfmx>
-% avoid that destinations names are optimized.
-% is this still needed??
-% see https://tug.org/pipermail/dvipdfmx/2019-May/000002.html
- \__kernel_backend_literal:x { dvipdfmx:config~C~ 0x10 }
-%</dvipdfmx|xdvipdfmx>
% \end{macrocode}
+%%
% \section{Drop?}
% \subsubsection{Doc View/Openaction}
% Dropped for now. Is probably not needed
@@ -993,12 +746,8 @@
% }
%</package>
% \end{macrocode}
+
%
-% \section{Document metadata}
-% The code has been moved to \pkg{l3pdfmeta}.
-%
-% \section{Patches}
-% The code has been moved to pageresources-patches.dtx
% \end{implementation}
-% \newpage
+%
% \PrintIndex
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 1978e85..7d92ae9 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -258,7 +258,6 @@
% The backend command is already in the driver:
% \cs{@@_backend_catalog_gput:nn}.
%
-
% \subsubsection{\enquote{Catalog} \& subdirectories / management }
% \begin{NOTE}{UF}
% The catalog dictionary is filled by e.g. \cs{pdfcatalog}. Multiple appearances of
@@ -305,694 +304,7 @@
% \section{Various PDF contents}
% The following commands allow to create a number of important pdf objects and contents in a
% backend independant way.
-
-% \subsection{Form XObject (pdfxform)}
-% \begin{NOTE}{UF}
-% - As in dvi mode the xform is immediate, this is done for pdftex/luatex too.
-% If needed a delayed version can be added later.
-% - the argument for attributes is needed to add e.g. /StructParents
-% - it is not clear if an argument for additional resources is needed, probably they
-% should / need to be added automatically.
-% - code for adding ExtGState etc to the local resource is missing, will be
-% added when the object name is clear.!!!!!!!!!!!!
-% - should the size be stored in dim or tl?
-% - dvips implementation is missing for ideas: pdfbase, atfi-dvips.def,
-% \end{NOTE}
-%
-% \subsubsection{Form XObject / management}
-% \begin{function}[added = 2019-08-05]
-% {
-% \pdf_xform_new:nnn
-% }
-% \begin{syntax}
-% \cs{pdf_xform_new:nnn} \Arg{name} \Arg{attributes} \Arg{content}
-% \end{syntax}
-% This command create a new form XObject that can be used as appearance or
-% directly later.
-% If the content contains BDC-marks it should \emph{not} be given as a
-% previously typeset box, but directly so that the names of the
-% BDC-marks can be added to the resources of the xform. The xform will automatically
-% include the resources of the current page.
-% The content will be typeset in a hbox. With pdflatex and luatex
-% the surrounding color is \emph{not} stored in the XObject
-% but should be if wanted added e.g. with |\color_select:n{.}|. This keeps
-% the option of color injection open.
-% \end{function}
-% \begin{function}[added = 2019-08-05]
-% {
-% \pdf_xform_use:n
-% }
-% \begin{syntax}
-% \cs{pdf_xform_use:n} \Arg{name}
-% \end{syntax}
-% This command uses (typesets) a previously created form XObject.
-% If the surrounding color is different, it is injected in the XObject with the
-% engines pdftex or luatex.
-% \end{function}
-% \begin{function}[EXP,added = 2019-08-05]
-% {
-% \pdf_xform_ref:n
-% }
-% \begin{syntax}
-% \cs{pdf_xform_ref:n} \Arg{name}
-% \end{syntax}
-% Inserts the appropriate information to reference the xform \meta{name}
-% in for example appearance dictionaries.
-% \end{function}
-% \begin{function}[EXP,added = 2019-08-05]
-% {
-% \pdf_xform_wd:n, \pdf_xform_ht:n, \pdf_xform_dp:n
-% }
-% \begin{syntax}
-% \cs{pdf_xform_wd:n} \Arg{name}
-% \end{syntax}
-% These command give back the sizes of the XObject. The values are stored in
-% tl-variables with the unit pt and not in dimensions!
-% \end{function}
-% \begin{function}[EXP,pTF,added = 2020-04-29]
-% {
-% \pdf_xform_if_exist:n
-% }
-% \begin{syntax}
-% \cs{pdf_xform_if_exist_p:n} \Arg{name}
-% \cs{pdf_xform_if_exist:NTF} \meta{name} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% These command tests if an xform with name \Arg{name} has been already defined.
-% \end{function}%
-% \begin{macrocode}
-%<*package>
-\cs_new_protected:Npn \pdf_xform_new:nnn #1 #2 #3
- {
- \@@_backend_xform_new:nnnn { #1 } { #2 } { } { #3 }
- }
-
-\cs_new_protected:Npn \pdf_xform_use:n #1
- {
- \@@_backend_xform_use:n { #1 }
- }
-% expansion?
-\cs_new:Npn \pdf_xform_ref:n #1
- {
- \@@_backend_xform_ref:n { #1 }
- }
-
-\cs_generate_variant:Nn \pdf_xform_ref:n {o}
-
-\cs_new:Npn \pdf_xform_wd:n #1
- {
- \tl_use:c { c_@@_backend_xform_wd_ \tl_to_str:n { #1 } _tl }
- }
-
-\cs_new:Npn \pdf_xform_ht:n #1
- {
- \tl_use:c { c_@@_backend_xform_ht_ \tl_to_str:n { #1 } _tl }
- }
-
-\cs_new:Npn \pdf_xform_dp:n #1
- {
- \tl_use:c { c_@@_backend_xform_dp_ \tl_to_str:n { #1 } _tl }
- }
-%</package>
-% \end{macrocode}
-%
-%
-%\subsection{Annotations}
-% \begin{NOTE}{UF}
-% The code/naming tries to unify general annotations and the special type of
-% link under a common name.
-% regarding naming and relation of annotation commands see
-% https://github.com/FrankMittelbach/AccessiblePDF/issues/73
-% This should probably be moved to l3annot. Or can it be merged with the xform?
-% \end{NOTE}
-
-%\subsubsection{Annotations / backend}
-% The backend commands are already in the driver:
-% \cs{@@_backend_annotation:nnnn} and \cs{@@_backend_annotation_last:}
-% \cs{@@_backend_link_begin_user:nnw}, etc
-%
-% \subsubsection{ general Annotation/management }
-% \begin{variable}
-% { \g__pdfannot_use_lastlink_bool }
-% The pdf engines have two different primitive commands to refer to the last created
-% annotation: one for links, one for boxed annotation. We use a boolean to decide
-% which one should be used, so that only one user command is needed.
-% \begin{macrocode}
-%<*package>
-\bool_new:N \g__pdfannot_use_lastlink_bool
-%</package>
-% \end{macrocode}
-% \end{variable}
-% \begin{NOTE}{UF}
-% !!!type or not type? Syntax for type???
-% \end{NOTE}
-% \begin{function}[added = 2020-04-14]
-% {\pdfannot:nnn}
-% \begin{syntax}
-% \cs{pdfannot:nnn} \Arg{type} \Arg{action spec} \Arg{annot text}
-% \end{syntax}
-% This creates an /Type/Annot object whose rectangle is defined by \Arg{annot text}.
-% If \Arg{type} is a known type the hooks of this type are executed at the begin and
-% the end, and the attribute dictionary of the type is inserted as attributes.
-% This allows to create for example a link annotation which shares border settings
-% with other links. \Arg{type} should e.g. be |Link/URI|. %!!!!!syntax?
-% \end{function}
-% %!!!!!! should there be a version without type??
-% \begin{function}[added = 2019-09-05, updated = 2020-04-14]
-% {\pdfannot_box:nnnn}
-% \begin{syntax}
-% \cs{pdfannot_box:nnnn} \Arg{width} \Arg{height} \Arg{depth} \Arg{annot spec}
-% \end{syntax}
-% This creates an /Type/Annot object with the given dimensions.
-% \end{function}
-% \begin{function}[added = 2020-03-30]
-% {\pdfannot_box:nnnnn}
-% \begin{syntax}
-% \cs{pdfannot_box:nnnnn} \Arg{type} \Arg{width} \Arg{height} \Arg{depth} \Arg{annot spec}
-% \end{syntax}
-% This creates an /Type/Annot object.
-% If \Arg{type} is a known type the hooks of this type are executed at the begin and
-% the end, and the attribute dictionary of the type is inserted as attributes.
-% This allows to create for example a link annotation which shares border settings
-% with other links. \Arg{type} should e.g. be |Link/URI|. %!!!!!syntax?
-% \end{function}
-% \begin{function}[added = 2019-09-05]
-% {\pdfannot_box_last:}
-% \begin{syntax}
-% \cs{pdfannot_box_last:}
-% \end{syntax}
-% This retrieves the object reference of the last box annotation created.
-% \end{function}
-% \begin{macrocode}
-%<*package>
-\cs_new_protected:Npn \pdfannot_box:nnnn #1 #2 #3 #4
- {
- \@@_backend_annotation:nnnn {#1}{#2}{#3}{#4}
- \bool_gset_false:N\g__pdfannot_use_lastlink_bool
- }
-
-\cs_new:Npn \pdfannot_box_last:
- {
- \@@_backend_annotation_last:
- }
-
-\cs_new_protected:Npn \pdfannot_box:nnnnn #1 #2 #3 #4 #5
- {
- \exp_args:Nx
- \@@_backend_annotation:nnnn {#2}{#3}{#4}
- {
- \pdfdict_if_exist:nnT { l } { annot/#1 }
- {
- \pdfdict_use:nn { l } {annot/#1}
- }
- #5
- }
- \bool_gset_false:N\g__pdfannot_use_lastlink_bool
- }
-%</package>
-% \end{macrocode}
-% \subsection{Flags}
-% Every flag should have an associated property that allows to set/clear flag positions by
-% name. The name is \cs{c_@@_flag_\#1_prop}
-% \begin{NOTE}{UF}
-% not sure about this yes, reconsider (naming, implementation ...)
-% \end{NOTE}
-% \begin{macrocode}
-%<*package>
-\cs_new_protected:Npn \pdf_flag_new:nn #1 #2
- {
- \bitsetReset { @@_#1_flag }
- \prop_const_from_keyval:cn { c_@@_flag_#1_prop }
- {
- #2
- }
- }
-
-\pdf_flag_new:nn {annot/Link}
- {
- Invisible = 0,
- Hidden = 1,
- Print = 2,
- NoZoom = 3,
- NoRotate = 4,
- NoView = 5,
- ReadOnly = 6,
- Locked = 7,
- ToggleNoView = 8,
- LockedContents = 9
- }
-
-\pdf_flag_new:nn {annot/Field} %name is wrong ... form?? it is not really an annot,
- {
- ReadOnly = 0,
- Required = 1,
- NoExport = 2,
- Multiline = 12,%Tx
- Password = 13,
- NoToggleToOff = 14,%Btn, radio button
- Radio = 15,%Btn: Radio: 15=1, 16=0
- Pushbutton = 16,%Btn: Checkbox: 15=0, 16=0
- %Btn: Pushbutton: 16=1
- Combo = 17,%Ch: Combo=1 List=0
- Edit = 18,%Ch, Combo=1 -> + edit field
- Sort = 19,%Ch, not relevant for view...
- FileSelect = 20,%Tx
- MultiSelect = 21,%Ch
- DoNotSpellCheck = 22,%Tx, Ch (if Combo + Edit set)
- DoNotScroll = 23,%Tx
- Comb = 24,%Tx, requires MaxLen in dict
- RadiosInUnison = 25,%Btn Radio
- RichText = 25,%Tx
- CommitOnSelChange = 26
- }
-
-\pdf_flag_new:nn {annot/Field/submit} %name is wrong ...
- {
- Include/Exclude = 0,
- IncludeNoValueFields = 1,
- ExportFormat = 2,
- GetMethod = 3, % if ExportFormat=0 -> =0 to
- SubmitCoordinates = 4, % if ExportFormat=0 -> =0 to
- XFDF = 5,
- IncludeAppendSaves = 6,
- IncludeAnnotations = 7,
- SubmitPDF = 8,
- CanonicalFormat = 9,
- ExclNonUserAnnots = 10,
- ExclFKey = 11,
- EmbedForm = 12
- }
-
-% #1: type, e.g. annot/Link
-% #2: name of flag, e.g. Print
-\cs_new_protected:Npn \pdf_flag_set:nn #1 #2
- {
- \bitsetSet { @@_#1_flag }
- { \prop_item:cn {c_@@_flag_#1_prop} {#2} }
- }
-
-\cs_new_protected:Npn \pdf_flag_clear:nn #1 #2
- {
- \bitsetClear{ @@_#1_flag }
- { \prop_item:cn {c_@@_flag_#1_prop} {#2} }
- }
-
-%flags are output as decimals.
-\cs_new:Npn \pdf_flag_use:n #1
- {
- \bitsetGetDec { @@_#1_flag }
- }
-%</package>
-% \end{macrocode}
-% \subsection{Annotations, subtype Widget}\label{pdf:annot:widget}
-% The local dictionary \texttt{annot/Widget} is a sceleton
-% dictionary for this subtype. It currently contains as only entry
-% the subtype setting (the /Type is added by the backend).
-% \begin{macrocode}
-%<*package>
-\pdfdict_new:nn { l } {annot/Widget}
-\pdfdict_put:nnn {annot/Widget}{Subtype}{/Widget}
-%</package>
-% \end{macrocode}
-% \subsection{Annotations, subtype Link}\label{sec:links}
-% Packages like hyperref, ocgx2 and tagpdf all wants to add code
-% to link annotation. So we need commands to start and end a link which allows
-% packages to add their code through hooks. There are three places in a link where
-% hooks are needed: At the begin (for example for a structure command or color),
-% in the \emph{attr spec} of the link (for example for the border), and
-% at the end of the link (to close a structure or the color group).
-%
-% The values for \emph{attr spec} are dictionary values, the order they are
-% inserted in the dictionary doesn't matter. So they are stored
-% like for other dictionary values in a property list, with the key the name
-% without a slash. Packages can add \emph{attr spec} entries through
-% dedicated hook commands described below.
-%
-% Code for the begin and end hooks are stored in sequences. This allows some
-% ordering.
-%
-% The code assumes that there will be different link types
-% (currently URI, GoToR, Launch, GoTo, Named, hyperref uses the names
-% url,file,run,link,menu) and that
-% links of the same type share the \emph{attr spec} and also the same begin/end
-% code. The list of link types need to stay restricted and well documented so that
-% all packages know which types they have to handle. It is stored in a constant
-% seq.
-% \begin{NOTE}{UF}
-% Perhaps a |cite| type will be useful at some time. -- Thinking more about it,
-% a |cite| type is not sensible. hyperref supports it, but it doesn't fit in.
-% Commands like cite, gls, acro, footnote and so one should locally change
-% linkcolor and linkbordercolor.
-% Probably we will need some commands to add an attribute to all link types
-% at once.
-% hyperref commands for the various type:
-% url |\hyper at linkurl|,
-% file |\hyper at linkfile|,
-% run |\@hyper at launch run|,
-% link |\hyper at link|, |\find at pdflink|
-% menu |\Acrobatmenu|
-% \end{NOTE}
-% \begin{variable}[added = 2020-03-12]{ \c_pdfannot_link_types_seq }
-% This constant sequence contains the list of currently supported link types
-% for which hooks and dictionaries exist.
-% \end{variable}
-%
-% \begin{macrocode}
-%<*package>
-\seq_const_from_clist:Nn \c_pdfannot_link_types_seq { URI , GoToR , Launch , GoTo, Named }
-
-\seq_map_inline:Nn \c_pdfannot_link_types_seq
- {
- \pdfdict_new:nn { l } { annot/Link/#1 }
- \pdfdict_put:nnn { annot/Link/#1}{ F }{ \pdf_flag_use:n { annot/Link} }
- \hook_new_pair:nn
- {pdf/annot/Link/#1/before}
- {pdf/annot/Link/#1/after}
- \seq_new:c { l_@@_hook_annot/Link/#1_begin_seq }
- \seq_new:c { l_@@_hook_annot/Link/#1_end_seq }
- }
-%</package>
-% \end{macrocode}
-
-
-% \subsubsection{Annotations, subtype Link /management}
-%
-% \begin{function}[added = 2020-03-12, updated = 2020-04-14]{ \pdfannot_link:nnn }
-% \begin{syntax}
-% \cs{pdfannot_link:nnn} \Arg{type} \Arg{user action spec} \Arg{link text}
-% \end{syntax}
-% This creates a link around the \Arg{link text} with the specified
-% \Arg{user action spec}\footnote{The wording follows the pdftex documentation}.
-% \texttt{/Subtype/Link} is added automatically.
-% If \texttt{annot/Link/}\Arg{type} is a known local dictionary
-% attributes stored in dictionary of type \Arg{type} are inserted as
-% \emph{attr spec} and the code in
-% the begin and end hook is executed before and after the link. \Arg{type} should
-% normally be identical to the value of the |/S| key in the action dictionary.
-% As example
-% \begin{verbatim}
-% \pdfannot_link:nnn { URI }
-% {
-% /A
-% <<
-% /Type/Action
-% /S/URI
-% /URI(https://www.latex-project.org)
-% >>
-% }
-% { link text }
-% \end{verbatim}
-% \end{function}
-%
-% \begin{macrocode}
-%
-%<*package>
-\cs_new_protected:Nn \pdfannot_link:nnn %#1 type (URI, GoTo etc),
- %#2 action spec, #3 link text
- {
- \hook_use:n { pdf/annot/Link/#1/before}
- \mode_leave_vertical:
- \exp_args:Nxx %xetex needs expansion
- \@@_backend_link_begin_user:nnw
- {
- \pdfdict_if_exist:nnT { l } { annot/Link/#1 }
- {
- \pdfdict_use:nn { l } {annot/Link/#1}
- }
- }
- {
- /Subtype/Link
- #2
- }
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- #3
- \@@_backend_link_end:
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- \hook_use:n { pdf/annot/Link/#1/after}
- }
-%</package>
-% \end{macrocode}
-% \begin{function}[added = 2020-03-12]{ \pdfannot_link_begin:nnw, \pdfannot_link_end:n }
-% \begin{syntax}
-% \cs{pdfannot_link_begin:nnw} \Arg{type} \Arg{user action spec} \meta{content}
-% \cs{pdfannot_link_end:n} \Arg{type}
-% \end{syntax}
-% This creates a link around the \meta{content} with the specified
-% \meta{user action spec} (e.g. an /A dictionary with an URI) or
-% \meta{destination} (a name as defined with the
-% first argument of \cs{pdf_destination:nn}).
-% \texttt{/Subtype/Link} is added automatically.
-% In contrast to \cs{pdfannot_link:nnn} this function
-% does not absorb the argument when finding the \meta{content}, and so can
-% be used in circumstances where the \meta{content} may not be a simple
-% argument.
-% If \texttt{annot/Link/}\Arg{type} is a known local dictionary
-% attributes stored in dictionary of type \Arg{type} are inserted as
-% \emph{attr spec} and the code in the begin and end hook is executed
-% before and after the link. As example
-% \begin{verbatim}
-% \pdfannot_link_begin:nnw { URI }
-% {
-% /A<<
-% /Type/Action
-% /S/URI
-% /URI(https://www.latex-project.org)
-% >>
-% }
-% link text
-% \pdfannot_link_end:n { URI }
-% \end{verbatim}
-% \end{function}
-% \begin{macrocode}
-%<*package>
-\cs_new_protected:Npn \pdfannot_link_begin:nnw #1 #2 %#1 type, #2 action spec
- {
- \hook_use:n { pdf/annot/Link/#1/before}
- \exp_args:Nxx %xetex needs expansion
- \@@_backend_link_begin_user:nnw
- {
- \pdfdict_if_exist:nnT { l } { annot/Link/#1 }
- {
- \pdfdict_use:nn { l } {annot/Link/#1}
- }
- }
- { #2 }
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- }
-
-\cs_new_protected:Nn \pdfannot_link_end:n %#1 type, e.g. url
- {
- \@@_backend_link_end:
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- \hook_use:n { pdf/annot/Link/#1/after}
- }
-%</package>
-% \end{macrocode}
-% \begin{function}[updated = 2020-03-30]{ \pdfannot_link_goto_begin:nw, \pdfannot_link_goto_end: }
-% \begin{syntax}
-% \cs{pdfannot_link_goto_begin:nw} \Arg{destination} \meta{content}
-% \cs{pdfannot_link_goto_end:}
-% \end{syntax}
-% This is a special, shorter version for links to internal destinations. It always
-% uses the hooks and dictionary of the |GoTo| link type.
-% \end{function}
-% \begin{macrocode}
-%<*package>
-\cs_new_protected:Npn \pdfannot_link_goto_begin:nw #1 %#1 destination
- {
- \hook_use:n { pdf/annot/Link/GoTo/before}
- \exp_args:Nxx %xetex needs expansion
- \@@_backend_link_begin_goto:nnw
- {
- \pdfdict_use:nn { l } {annot/Link/GoTo}
-
- }
- { #1 }
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- }
-
-\cs_new_protected:Nn \pdfannot_link_goto_end:
- {
- \@@_backend_link_end:
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- \hook_use:n { pdf/annot/Link/GoTo/before}
- }
-%</package>
-% \end{macrocode}
-% \begin{function}[added = 2020-03-12]{ \pdfannot_link_last: }
-% This retrieves the object reference a previously link created with the commands
-% above. This doesn't work currently with xelatex but a feature request has
-% been made.
-% \end{function}
-% \begin{macrocode}
-%<*package>
-\cs_new:Nn \pdfannot_link_last: { \@@_backend_link_last: }
-%</package>
-% \end{macrocode}
-% \begin{function}[added = 2020-06-29]{ \pdfannot_last: }
-% This retrieves the object reference a previously annotation
-% created either with a link or a box command. When the last was a link
-% it won't work with xelatex.
-% \end{function}
-% \begin{macrocode}
-%<*package>
-\cs_new:Npn \pdfannot_last:
- {
- \bool_if:NTF \g__pdfannot_use_lastlink_bool
- {
- \@@_backend_link_last:
- }
- {
- \@@_backend_annotation_last:
- }
- }
-%</package>
-% \end{macrocode}
-% %!!!! only annot link or also annot??
-% \begin{function}[added = 2020-03-12]{ \pdfannot_link_margin:n }
-% \begin{syntax}
-% \cs{pdfannot_link_margin:n} \Arg{dimen}
-% \end{syntax}
-% This sets the dimension of the link margin.
-% \end{function}
-% \begin{macrocode}
-%<*package>
-\cs_new_protected:Npn \pdfannot_link_margin:n #1
- {
- \@@_backend_link_margin:n { #1 }
- }
-
-%</package>
-% \end{macrocode}
-
-% \subsection{Destinations}
-% \begin{NOTE}{UF}
-% I'm unsure about the backend code of the rectangle (FitR) variant. Should it
-% really typeset a box???
-% I'm also unsure if \cs{pdf_destination:nn} should really allow both
-% a type and an integer as second argument. Perhaps a \cs{pdf_destination_zoom:nn}
-% would be better??
-% \end{NOTE}
-% Destinations are \enquote{anchors} for links. The commands here
-% create named destinations. The pdf\LaTeX{} primitive doesn't support all
-% variants described in the pdf reference. The backend code expect lower case
-% arguments, but we add support for the casing of hyperref and the pdf reference.
-%
-% \begin{tabular}{llll}
-% Type & status & input &remark \\\hline
-% /Fit & supported & fit, Fit \\%
-% /FitH & supported & fith, FitH \\
-% /FitH \emph{top} & not supported\\
-% /FitV & supported & fitv, FitV\\
-% /FitV \emph{left}& not supported\\
-% /FitB & supported & fitb, FitB\\
-% /FitBH & supported & fitbh, FitBH\\
-% /FitBH \emph{top}& not supported\\
-% /FitBV & supported & fitbv, FitBV\\
-% /FitBV \emph{left} & not supported\\
-% /FitR \emph{left bottom right top} & supported in part& typesets a box\\
-% /XYZ \emph{left} \emph{top} NULL & supported & xyz, XYZ &left, top are automatic\\
-% /XYZ \emph{left} \emph{top} zoom & supported & integer (percent) &left, top are automatic\\
-% \end{tabular}
-%
-% \begin{function}[added = 2020-03-10]
-% {\pdf_destination:nn}
-% \begin{syntax}
-% \cs{pdf_destination:nn} \Arg{name} \Arg{type or integer}
-% \end{syntax}
-% This creates a destination. \Arg{type or Integer} can be one of |Fit|, |FitH|,
-% |FitV|, |FitB|, |FitBH|, |FitBV|, |XYZ| and the lower case variants,
-% or an integer representing a scale factor in percent.
-% \end{function}
-% \begin{function}[added = 2020-03-10]
-% {\pdf_destination_box:nn}
-% \begin{syntax}
-% \cs{pdf_destination_box:nn} \Arg{name} \Arg{content}
-% \end{syntax}
-% This stores the content in a hbox, outputs the box and
-% creates a destination with |FitR| type encompassing this box.
-% \end{function}
-% \begin{macrocode}
-%<*package>
-% perhaps some manipulation of the argument will be needed to map the current
-% hyperref syntax
-% unclear currently if is this is useful for anything.
-\prop_new:N \l_@@_views_map_prop
-\prop_put:Nnn \l_@@_views_map_prop {XYZ} { xyz }
-\prop_put:Nnn \l_@@_views_map_prop {xyz} { xyz }
-\prop_put:Nnn \l_@@_views_map_prop {Fit} { fit }
-\prop_put:Nnn \l_@@_views_map_prop {fit} { fit }
-\prop_put:Nnn \l_@@_views_map_prop {FitB} { fitb }
-\prop_put:Nnn \l_@@_views_map_prop {fitb} { fitb }
-\prop_put:Nnn \l_@@_views_map_prop {FitBH} { fitbh }
-\prop_put:Nnn \l_@@_views_map_prop {fitbh} { fitbh }
-\prop_put:Nnn \l_@@_views_map_prop {FitBv} { fitbv }
-\prop_put:Nnn \l_@@_views_map_prop {fitbv} { fitbv }
-\prop_put:Nnn \l_@@_views_map_prop {FitH} { fith }
-\prop_put:Nnn \l_@@_views_map_prop {fith} { fith }
-\prop_put:Nnn \l_@@_views_map_prop {FitV} { fitv }
-\prop_put:Nnn \l_@@_views_map_prop {fitv} { fitv }
-
-\cs_new_protected:Npn \pdf_destination:nn #1 #2
- {
- \prop_if_in:NnTF \l_@@_views_map_prop { #2 }
- {
- \exp_args:Nox %xetex?
- \@@_backend_destination:nn { #1 } { \prop_item:Nn \l_@@_views_map_prop {#2} }
- }
- {
- \exp_args:No %xetex?
- \@@_backend_destination:nn { #1 } { #2 }
- % should we assume that it is a zoom value then??
- % should we test that it is really a number?
- % or should there be a third argument for this case and for other coordinates?
- }
- }
-\cs_generate_variant:Nn\pdf_destination:nn {no,nf}
-
-\cs_new_protected:Npn \pdf_destination_box:nn #1 #2 %#1 name, #2 box content
- {
- \@@_backend_destination_box:nn { #1 }{ #2 } %new name!!
- }
-
-%</package>
-%<*dvipdfmx|xdvipdfmx>
-% avoid that destinations names are optimized.
-% is this still needed??
-% see https://tug.org/pipermail/dvipdfmx/2019-May/000002.html
- \__kernel_backend_literal:x { dvipdfmx:config~C~ 0x10 }
-%</dvipdfmx|xdvipdfmx>
-% \end{macrocode}
-% \section{Drop?}
-% \subsubsection{Doc View/Openaction}
-% Dropped for now. Is probably not needed
-% \begin{NOTE}{UF}
-% /OpenAction can be an array:
-% |/OpenAction [5 0 R /Fit]| or an action: |<< /S /GoTo /D [ 7 0 R /Fit ] >>|.
-% The implementation below allows only the first. It is not quite clear, if
-% this is sensible (and if a special docview command is needed at all).
-% The second could be set directly.
-% \end{NOTE}
-%
-% \begin{function}[added = 2019-08-18]
-% {\pdf_docview:nn}
-% \begin{syntax}
-% \cs{pdf_docview:nn} \Arg{page} \Arg{view}
-% \end{syntax}
-% This command allows to set the OpenAction array. The \meta{page}
-% is an absolute page number. \Arg{view} a string for the destination
-% without the leading slash. Examples are e.g. |XYZ left top zoom| or |Fit|.
-% The OpenAction uses (and could also be set directly with)
-% \cs{pdfcoredict_gput:nnn}|{Catalog}|.
-% \end{function}
-%
-% \begin{macrocode}
-%<*package>
-%\cs_new_protected:Npn \pdf_docview:nn #1 #2
-% {
-% \pdfcoredict_gput:nnx {Catalog }{ OpenAction }{[\pdf_object_pageref:n {#1}~/#2]}
-% }
-%</package>
-% \end{macrocode}
+% moved to l3pdfutils.
%
% \section{Document metadata}
% The code has been moved to \pkg{l3pdfmeta}.
diff --git a/pdfresources.ins b/pdfresources.ins
index 6ac6b46..1ab44f8 100644
--- a/pdfresources.ins
+++ b/pdfresources.ins
@@ -101,6 +101,14 @@ and all files in that bundle must be distributed together.
\generate
{%
+ \file{l3pdfutils.sty}
+ {%
+ \from{l3pdfutils.dtx}{package}
+ }%
+ }
+
+\generate
+ {%
\file{l3pdffile.sty}
{%
\from{l3pdffile.dtx}{package}
More information about the latex3-commits
mailing list.