From 90ebd477a2d1290345277a5cd6ea1b9aeb51a9c8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 27 Aug 2022 20:21:59 +0000 Subject: pdfoverlay (27aug22) git-svn-id: svn://tug.org/texlive/trunk@64210 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/pdfoverlay/README.md | 2 +- .../texmf-dist/doc/latex/pdfoverlay/pdfoverlay.pdf | Bin 579134 -> 579598 bytes .../source/latex/pdfoverlay/pdfoverlay.dtx | 39 +++++++++++---------- .../source/latex/pdfoverlay/pdfoverlay.ins | 4 +-- .../texmf-dist/tex/latex/pdfoverlay/pdfoverlay.sty | 32 ++++++++--------- 5 files changed, 39 insertions(+), 38 deletions(-) diff --git a/Master/texmf-dist/doc/latex/pdfoverlay/README.md b/Master/texmf-dist/doc/latex/pdfoverlay/README.md index 0839fc4573d..aac5d3b5026 100644 --- a/Master/texmf-dist/doc/latex/pdfoverlay/README.md +++ b/Master/texmf-dist/doc/latex/pdfoverlay/README.md @@ -58,7 +58,7 @@ l3build install --full ## Licence ``` -Copyright (c) 2018-2021 David Purton +Copyright (c) 2018-2022 David Purton This work may be distributed and/or modified under the conditions of the LaTeX Project2 Public License, either version 1.3c of this license diff --git a/Master/texmf-dist/doc/latex/pdfoverlay/pdfoverlay.pdf b/Master/texmf-dist/doc/latex/pdfoverlay/pdfoverlay.pdf index fc25f7bd7e1..740843d9ff7 100644 Binary files a/Master/texmf-dist/doc/latex/pdfoverlay/pdfoverlay.pdf and b/Master/texmf-dist/doc/latex/pdfoverlay/pdfoverlay.pdf differ diff --git a/Master/texmf-dist/source/latex/pdfoverlay/pdfoverlay.dtx b/Master/texmf-dist/source/latex/pdfoverlay/pdfoverlay.dtx index 1ae9d9ded00..4990f49fa32 100644 --- a/Master/texmf-dist/source/latex/pdfoverlay/pdfoverlay.dtx +++ b/Master/texmf-dist/source/latex/pdfoverlay/pdfoverlay.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (c) 2018-2021 David Purton +% Copyright (c) 2018-2022 David Purton % % This work may be distributed and/or modified under the conditions of % the LaTeX Project Public License, either version 1.3c of this license @@ -23,10 +23,11 @@ % \changes{v1.2}{2020/10/29}{Update to use \pkg{l3hooks}} % \changes{v1.2a}{2021/02/25}{Ensure backend loaded before counting pages} % \changes{v1.2b}{2021/11/01}{Protect unexpandable macros} +% \changes{v1.3}{2022/08/27}{Allow PDF file name to be passed in as macro} % % \title{The \pkg{pdfoverlay} package} % \author{David Purton\thanks{Email: \url{dcpurton@marshwiggle.net}}} -% \date{2021/11/01 v1.2b} +% \date{2022/08/27 v1.3} % % \maketitle % @@ -165,7 +166,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[2020-10-01] -\ProvidesExplPackage{pdfoverlay}{2021/11/01}{1.2b} +\ProvidesExplPackage{pdfoverlay}{2022/08/27}{1.3} {Overlay text on an existing PDF document (DCP)} % \end{macrocode} % @@ -177,14 +178,14 @@ % % \noindent Call \cs{@@_output_pdf_page:} on every page. % \begin{macrocode} -\AddToHook { shipout/background } { \@@_output_pdf_page: } +\hook_gput_code:nnn { shipout/background } { pdfoverlay } { \@@_output_pdf_page: } % \end{macrocode} % % \noindent Add an empty \cs{hbox:n} to the end of the document if an action % is pending. This is required to ensure that the last requested page from the % PDF file is output even if there isn't any other content on the page. % \begin{macrocode} -\AtEndDocument { +\hook_gput_code:nnn { enddocument } { pdfoverlay } { \bool_if:NT \g_@@_action_pending_bool { \hbox:n { } @@ -258,10 +259,10 @@ % % \subsection{Private Variables and Helper Functions} % -% \begin{macro}{\g_@@_pdf_file_name_str} +% \begin{macro}{\g_@@_pdf_file_name_tl} % Store the PDF file name. % \begin{macrocode} -\str_new:N \g_@@_pdf_file_name_str +\tl_new:N \g_@@_pdf_file_name_tl % \end{macrocode} % \end{macro} % @@ -333,7 +334,7 @@ { { \bool_if_p:N \g_@@_output_active_bool } { \bool_not_p:n - { \str_if_empty_p:N \g_@@_pdf_file_name_str } } + { \tl_if_empty_p:N \g_@@_pdf_file_name_tl } } { \int_compare_p:n { \c_zero_int <= \g_@@_page_int < \g_@@_page_count_int } } @@ -370,7 +371,7 @@ { \exp_not:N \includegraphics [ \clist_use:Nn \g_@@_graphics_options_clist { , } ] - { \g_@@_pdf_file_name_str } + { \g_@@_pdf_file_name_tl } } } } @@ -393,7 +394,7 @@ % The PDF page to be placed is available as the coffin % \cs{g_@@_pdf_page_coffin}. % \begin{macrocode} -\cs_new:Nn \@@_place_pdf_page: +\cs_new_protected:Nn \@@_place_pdf_page: { \put ( 0.5 \paperwidth, -0.5 \paperheight ) { @@ -405,7 +406,7 @@ % \end{macro} % % \begin{macro}{\@@_count_pdf_pages:} -% Count the number of pages in the current \cs{g_@@_pdf_file_name_str} and +% Count the number of pages in the current \cs{g_@@_pdf_file_name_tl} and % store the result in \cs{g_@@_pdf_page_count_int}. If no PDF has been set % with \cs{pdfoverlay_set_pdf} then \cs{g_@@_pdf_page_count_int} is set to % zero. @@ -413,7 +414,7 @@ \cs_new_protected:Nn \@@_count_pdf_pages: { \int_gzero:N \g_@@_page_count_int - \str_if_empty:NTF \g_@@_pdf_file_name_str + \tl_if_empty:NTF \g_@@_pdf_file_name_tl { \msg_error:nn { pdfoverlay } { file-not-set } } @@ -422,7 +423,7 @@ { \int_gset:Nn \g_@@_page_count_int { - \XeTeXpdfpagecount " \g_@@_pdf_file_name_str " + \XeTeXpdfpagecount " \g_@@_pdf_file_name_tl " } } { @@ -434,7 +435,7 @@ { \sys_if_engine_pdftex:TF { - \pdfximage { \g_@@_pdf_file_name_str } + \pdfximage { \g_@@_pdf_file_name_tl } \int_gset_eq:NN \g_@@_page_count_int \pdflastximagepages @@ -443,7 +444,7 @@ \sys_if_engine_luatex:TF { \saveimageresource - { \g_@@_pdf_file_name_str } + { \g_@@_pdf_file_name_tl } \int_gset_eq:NN \g_@@_page_count_int \lastsavedimageresourcepages @@ -470,7 +471,7 @@ % \begin{macrocode} \prg_new_conditional:Nnn \@@_if_page_exists:n { p, T, F, TF } { - \str_if_empty:NTF \g_@@_pdf_file_name_str + \tl_if_empty:NTF \g_@@_pdf_file_name_tl { \msg_error:nn { pdfoverlay } { file-not-set } \prg_return_false: @@ -485,7 +486,7 @@ } { \msg_error:nnxxx { pdfoverlay } { page-not-found } - { \str_use:N \g_@@_pdf_file_name_str } + { \g_@@_pdf_file_name_tl } { \int_eval:n { #1 } } { \int_use:N \g_@@_page_count_int } \prg_return_false: @@ -508,7 +509,7 @@ % \begin{macrocode} \file_if_exist:nTF { #1 } { - \str_gset:Nn \g_@@_pdf_file_name_str { #1 } + \tl_gset:Nn \g_@@_pdf_file_name_tl { #1 } % \end{macrocode} % Find the number of pages in the PDF file. % \begin{macrocode} @@ -521,7 +522,7 @@ \bool_gset_false:N \g_@@_action_pending_bool } { - \msg_error:nnn { pdfoverlay } { file-not-found } { #1 } + \msg_error:nnx { pdfoverlay } { file-not-found } { #1 } } } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/pdfoverlay/pdfoverlay.ins b/Master/texmf-dist/source/latex/pdfoverlay/pdfoverlay.ins index 9ed5fedbb4e..906b6b0e8ef 100644 --- a/Master/texmf-dist/source/latex/pdfoverlay/pdfoverlay.ins +++ b/Master/texmf-dist/source/latex/pdfoverlay/pdfoverlay.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -Copyright (c) 2018-2021 David Purton +Copyright (c) 2018-2022 David Purton This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license @@ -19,7 +19,7 @@ version 2005/12/01 or later. This is a generated file. -Copyright (c) 2018-2021 David Purton +Copyright (c) 2018-2022 David Purton This work may be distributed and/or modified under the conditions of the LaTeX Project2 Public License, either version 1.3c of this license diff --git a/Master/texmf-dist/tex/latex/pdfoverlay/pdfoverlay.sty b/Master/texmf-dist/tex/latex/pdfoverlay/pdfoverlay.sty index afc108a3a50..8e7759d281b 100644 --- a/Master/texmf-dist/tex/latex/pdfoverlay/pdfoverlay.sty +++ b/Master/texmf-dist/tex/latex/pdfoverlay/pdfoverlay.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (c) 2018-2021 David Purton +%% Copyright (c) 2018-2022 David Purton %% %% This work may be distributed and/or modified under the conditions of %% the LaTeX Project2 Public License, either version 1.3c of this license @@ -25,11 +25,11 @@ %% and the derived files pdfoverlay.sty and pdfoverlay.pdf %% \NeedsTeXFormat{LaTeX2e}[2020-10-01] -\ProvidesExplPackage{pdfoverlay}{2021/11/01}{1.2b} +\ProvidesExplPackage{pdfoverlay}{2022/08/27}{1.3} {Overlay text on an existing PDF document (DCP)} \RequirePackage{graphicx} -\AddToHook { shipout/background } { \__pdfoverlay_output_pdf_page: } -\AtEndDocument { +\hook_gput_code:nnn { shipout/background } { pdfoverlay } { \__pdfoverlay_output_pdf_page: } +\hook_gput_code:nnn { enddocument } { pdfoverlay } { \bool_if:NT \g__pdfoverlay_action_pending_bool { \hbox:n { } @@ -60,7 +60,7 @@ { #1~not~supported. } { The~#1~engine~is~not~supported. \\ Use~one~of~pdftex,~luatex,~or~xetex. } -\str_new:N \g__pdfoverlay_pdf_file_name_str +\tl_new:N \g__pdfoverlay_pdf_file_name_tl \int_new:N \g__pdfoverlay_page_count_int \int_new:N \g__pdfoverlay_page_int \bool_new:N \g__pdfoverlay_output_active_bool @@ -80,7 +80,7 @@ { { \bool_if_p:N \g__pdfoverlay_output_active_bool } { \bool_not_p:n - { \str_if_empty_p:N \g__pdfoverlay_pdf_file_name_str } } + { \tl_if_empty_p:N \g__pdfoverlay_pdf_file_name_tl } } { \int_compare_p:n { \c_zero_int <= \g__pdfoverlay_page_int < \g__pdfoverlay_page_count_int } } @@ -100,11 +100,11 @@ { \exp_not:N \includegraphics [ \clist_use:Nn \g__pdfoverlay_graphics_options_clist { , } ] - { \g__pdfoverlay_pdf_file_name_str } + { \g__pdfoverlay_pdf_file_name_tl } } } } -\cs_new:Nn \__pdfoverlay_place_pdf_page: +\cs_new_protected:Nn \__pdfoverlay_place_pdf_page: { \put ( 0.5 \paperwidth, -0.5 \paperheight ) { @@ -115,7 +115,7 @@ \cs_new_protected:Nn \__pdfoverlay_count_pdf_pages: { \int_gzero:N \g__pdfoverlay_page_count_int - \str_if_empty:NTF \g__pdfoverlay_pdf_file_name_str + \tl_if_empty:NTF \g__pdfoverlay_pdf_file_name_tl { \msg_error:nn { pdfoverlay } { file-not-set } } @@ -124,7 +124,7 @@ { \int_gset:Nn \g__pdfoverlay_page_count_int { - \XeTeXpdfpagecount " \g__pdfoverlay_pdf_file_name_str " + \XeTeXpdfpagecount " \g__pdfoverlay_pdf_file_name_tl " } } { @@ -136,7 +136,7 @@ { \sys_if_engine_pdftex:TF { - \pdfximage { \g__pdfoverlay_pdf_file_name_str } + \pdfximage { \g__pdfoverlay_pdf_file_name_tl } \int_gset_eq:NN \g__pdfoverlay_page_count_int \pdflastximagepages @@ -145,7 +145,7 @@ \sys_if_engine_luatex:TF { \saveimageresource - { \g__pdfoverlay_pdf_file_name_str } + { \g__pdfoverlay_pdf_file_name_tl } \int_gset_eq:NN \g__pdfoverlay_page_count_int \lastsavedimageresourcepages @@ -165,7 +165,7 @@ } \prg_new_conditional:Nnn \__pdfoverlay_if_page_exists:n { p, T, F, TF } { - \str_if_empty:NTF \g__pdfoverlay_pdf_file_name_str + \tl_if_empty:NTF \g__pdfoverlay_pdf_file_name_tl { \msg_error:nn { pdfoverlay } { file-not-set } \prg_return_false: @@ -180,7 +180,7 @@ } { \msg_error:nnxxx { pdfoverlay } { page-not-found } - { \str_use:N \g__pdfoverlay_pdf_file_name_str } + { \g__pdfoverlay_pdf_file_name_tl } { \int_eval:n { #1 } } { \int_use:N \g__pdfoverlay_page_count_int } \prg_return_false: @@ -191,14 +191,14 @@ { \file_if_exist:nTF { #1 } { - \str_gset:Nn \g__pdfoverlay_pdf_file_name_str { #1 } + \tl_gset:Nn \g__pdfoverlay_pdf_file_name_tl { #1 } \__pdfoverlay_count_pdf_pages: \int_gzero:N \g__pdfoverlay_page_int \bool_gset_true:N \g__pdfoverlay_output_active_bool \bool_gset_false:N \g__pdfoverlay_action_pending_bool } { - \msg_error:nnn { pdfoverlay } { file-not-found } { #1 } + \msg_error:nnx { pdfoverlay } { file-not-found } { #1 } } } \cs_new_protected:Nn \pdfoverlay_set_graphics_options:n -- cgit v1.2.3