[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: move version stuff (921eb65)

Ulrike Fischer fischer at troubleshooting-tex.de
Thu May 2 23:14:57 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : testlinkstuff
Link       : https://github.com/latex3/pdfresources/commit/921eb65dbcdba70a513206b8a28fbbd531e97016

>---------------------------------------------------------------

commit 921eb65dbcdba70a513206b8a28fbbd531e97016
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu May 2 23:14:57 2019 +0200

    move version stuff


>---------------------------------------------------------------

921eb65dbcdba70a513206b8a28fbbd531e97016
 hluatex-experimental.def |  166 +++++++++++++++++++++++-----------------------
 pdfresources.dtx         |   19 +++++-
 test-pdfresources.tex    |    4 +-
 3 files changed, 104 insertions(+), 85 deletions(-)

diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index 782b08d..b0c667a 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -20,6 +20,11 @@
   {missing-bookmark-package}
   { The~bookmark~package~is~required~for~this~hyperref~driver!}
 
+\msg_new:nnn
+  {hyp}
+  {pdfversion-disabled}
+  { This~hyperref~driver~ignores~the~pdfversion~key!\\
+    Set~the~pdfversion~in~\token_to_str:N \documentsetup}
 
 %% I require the bookmark package to get rid of some of the bookmarks code.
 \AtEndOfPackage{% so that we are later than KOMA ...
@@ -33,17 +38,11 @@
 % 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
+\bool_new:N \l__hyp_pdfa_bool
 \ifHy at pdfa
  \bool_set_true:N \l__hyp_pdfa_bool
 \fi
 
-%%% pdfversion
-\bool_new:N\l__hyp_setpdfversion_bool
-\ifHy at setpdfversion
- \bool_set_true:N \l__hyp_setpdfversion_bool
-\fi
-
 
 % this need sorting out later. pdf standards should be handled outside the driver.
 % pdfa forces the flag /F 4 in some places.
@@ -155,8 +154,8 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 %only used in test if version can be set
-\protected\def\pdflastannot      {\numexpr\pdffeedback lastannot\relax}
-\protected\def\pdflastobj        {\numexpr\pdffeedback lastobj\relax}
+%\protected\def\pdflastannot      {\numexpr\pdffeedback lastannot\relax}
+%\protected\def\pdflastobj        {\numexpr\pdffeedback lastobj\relax}
 
 \protected\def\pdfliteral        {\pdfextension literal}
 
@@ -227,82 +226,83 @@
 % or in the pdf level?
 % set pdfversion / needs adaption to major version!!!
 
-\bool_if:NT\l__hyp_setpdfversion_bool
+\legacy_if:nT { Hy at setpdfversion }
  {
-    \ifnum\Hy at pdfversion<5 %
-        \ifHy at verbose
-          \Hy at InfoNoLine{%
-            PDF~object~streams~are~disabled,~because~they~are%
-            \MessageBreak
-            not~supported~in~requested~PDF~version %
-            1.\Hy at pdfversion
-          }%
-        \fi
-        \driver_pdf_objects_disable:
-      %
-    \fi
-    \ifnum\Hy at pdfminorversion=\Hy at pdfversion\relax
-    \else
-      \let\Hy at temp\ltx at empty
-      \def\Hy at temp@A#1#2{%
-        \ifnum#1>\ltx at zero
-          \edef\Hy at temp{%
-            \Hy at temp
-            \space\space
-            \the#1\space #2%
-            \ifnum#1=\ltx at one\else s\fi
-            \MessageBreak
-          }%
-        \fi
-      }%
-      \Hy at temp@A\pdflastobj{PDF object}%
-      \Hy at temp@A\lastsavedboxresourceindex{form XObject}%
-      \Hy at temp@A\lastsavedimageresourceindex{image XObject}%
-      \Hy at temp@A\pdflastannot{annotation}%
-      \Hy at temp@A\driver_pdf_link_last_int:{link}%
-      \ifx\Hy at temp\ltx at empty
-       \int_compare:nNnTF { \Hy at pdfversion}  = {10 }
-        { %pdf 2.0, temporary solution
-          \pdf_version_gset:n {2.0}
-        }
-        {
-          \pdf_version_gset:n{1.\Hy at pdfversion}
-        }
-      \else
-        \let\Hy at temp@A\ltx at empty
-        \ifnum\Hy at pdfversion=4 %
-          \IfFileExists{pdf14.sty}{%
-            \def\Hy at temp@A{%
-              \MessageBreak
-              Or \string\RequirePackage{pdf14} can be used%
-              \MessageBreak
-              before \string\documentclass\space as shortcut%
-            }%
-          }{}%
-        \fi
-        \Hy at WarningNoLine{%
-          The PDF version number could not be set,\MessageBreak
-          because some PDF objects are already written:%
-          \MessageBreak
-          \Hy at temp
-          The version should be set as early as possible:%
-          \MessageBreak
-          \space\space
-          \string\pdf_version_gset:n{\driver_pdf_version_major:.\driver_pdf_version_minor:}
-          \ifnum\Hy at pdfversion<5 %
-              \MessageBreak
-              \space\space
-              \string\driver_pdf_objects_disable:
-          \fi
-          \Hy at temp@A
-        }%
-      \fi
-    \fi
-    \PackageInfo{hyperref}{%
-      pdf~version~set~to~\driver_pdf_version_major:.\driver_pdf_version_minor:\space
-    }%
+    \msg_warning:nn { hyp }{ pdfversion-disabled }
+ %   \ifnum\Hy at pdfversion<5 %
+%        \ifHy at verbose
+%          \Hy at InfoNoLine{%
+%            PDF~object~streams~are~disabled,~because~they~are%
+%            \MessageBreak
+%            not~supported~in~requested~PDF~version %
+%            1.\Hy at pdfversion
+%          }%
+%        \fi
+%        \driver_pdf_objects_disable:
+%      %
+%    \fi
+%    \ifnum\Hy at pdfminorversion=\Hy at pdfversion\relax
+%    \else
+%      \let\Hy at temp\ltx at empty
+%      \def\Hy at temp@A#1#2{%
+%        \ifnum#1>\ltx at zero
+%          \edef\Hy at temp{%
+%            \Hy at temp
+%            \space\space
+%            \the#1\space #2%
+%            \ifnum#1=\ltx at one\else s\fi
+%            \MessageBreak
+%          }%
+%        \fi
+%      }%
+%      \Hy at temp@A\pdflastobj{PDF object}%
+%      \Hy at temp@A\lastsavedboxresourceindex{form XObject}%
+%      \Hy at temp@A\lastsavedimageresourceindex{image XObject}%
+%      \Hy at temp@A\pdflastannot{annotation}%
+%      \Hy at temp@A\driver_pdf_link_last_int:{link}%
+%      \ifx\Hy at temp\ltx at empty
+%       \int_compare:nNnTF { \Hy at pdfversion}  = {10 }
+%        { %pdf 2.0, temporary solution
+%          \pdf_version_gset:n {2.0}
+%        }
+%        {
+%          \pdf_version_gset:n{1.\Hy at pdfversion}
+%        }
+%      \else
+%        \let\Hy at temp@A\ltx at empty
+%        \ifnum\Hy at pdfversion=4 %
+%          \IfFileExists{pdf14.sty}{%
+%            \def\Hy at temp@A{%
+%              \MessageBreak
+%              Or \string\RequirePackage{pdf14} can be used%
+%              \MessageBreak
+%              before \string\documentclass\space as shortcut%
+%            }%
+%          }{}%
+%        \fi
+%        \Hy at WarningNoLine{%
+%          The PDF version number could not be set,\MessageBreak
+%          because some PDF objects are already written:%
+%          \MessageBreak
+%          \Hy at temp
+%          The version should be set as early as possible:%
+%          \MessageBreak
+%          \space\space
+%          \string\pdf_version_gset:n{\driver_pdf_version_major:.\driver_pdf_version_minor:}
+%          \ifnum\Hy at pdfversion<5 %
+%              \MessageBreak
+%              \space\space
+%              \string\driver_pdf_objects_disable:
+%          \fi
+%          \Hy at temp@A
+%        }%
+%      \fi
+%    \fi
+%    \PackageInfo{hyperref}{%
+%      pdf~version~set~to~\driver_pdf_version_major:.\driver_pdf_version_minor:\space
+%    }%
  }
-  \edef\Hy at pdfversion
+ \edef\Hy at pdfversion
   { % this will need revision when pdf version stuff is better sorted
    \int_compare:nNnTF { \driver_pdf_version_minor: } = { 2 }
     { 10 }
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 69aa818..907852d 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -337,7 +337,11 @@
 
 \keys_define:nn { pdf / setup }
  {
-  pdfversion .code:n = \pdf_version_gset:n { #1 }
+  pdfversion .code:n =
+   {
+    \pdf_version_gset:n { #1 }
+    \@@_version_checks:
+   }
  }
 %</package>
 %    \end{macrocode}
@@ -364,6 +368,19 @@
   \driver_pdf_version_major_gset:n {#1}
   \driver_pdf_version_minor_gset:n {#2}
  }
+
+\cs_new_protected:Npn \@@_version_checks:
+ {
+  \pdf_version_compare:NnT < { 1.5 }
+   {
+    \driver_pdf_objects_disable:
+    \msg_info:nnx {pdf}{object-compression-disabled}
+    { \driver_pdf_version_major:.\driver_pdf_version_minor:}
+   }
+ }
+
+\msg_new:nnn { pdf } {object-compression-disabled}
+             {object~compression~is~not~supported~in~pdf~version~#1}
 %</package>
 %    \end{macrocode}
 % \end{macro}
diff --git a/test-pdfresources.tex b/test-pdfresources.tex
index 46233f1..1fc40fe 100644
--- a/test-pdfresources.tex
+++ b/test-pdfresources.tex
@@ -3,8 +3,9 @@
 
 \RequirePackage{pdfresources}
 \documentsetup{pdfversion=2.0}
+
 \documentclass{article}
-\documentsetup{pdfversion=2.0}
+
 %\usepackage{pdfresources}
 
 %don't compress pdf:
@@ -19,6 +20,7 @@
 \usepackage[customdriver=hluatex-experimental,
             pdfusetitle,ocgcolorlinks,
             pdftrapped=True,
+            pdfversion=1.7
            % pdfstartpage=3,
            % pdfstartview=
             ]{hyperref}





More information about the latex3-commits mailing list