[latex3-commits] [git/LaTeX3-latex3-pdfresources] renamedict77: saving (d5d8c4d)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Apr 14 00:29:11 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : renamedict77
Link       : https://github.com/latex3/pdfresources/commit/d5d8c4df4fc134fcc457bdb428ba029875ab67d0

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

commit d5d8c4df4fc134fcc457bdb428ba029875ab67d0
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Apr 14 00:29:11 2020 +0200

    saving


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

d5d8c4df4fc134fcc457bdb428ba029875ab67d0
 dicthandler.tex                | 49 +++++++++++++++++++++++++++
 newpackages/atfi-generic.def   | 38 ++++++++++-----------
 newpackages/new-attachfile.sty | 77 +++---------------------------------------
 3 files changed, 72 insertions(+), 92 deletions(-)

diff --git a/dicthandler.tex b/dicthandler.tex
index ace8336..cbb05c5 100644
--- a/dicthandler.tex
+++ b/dicthandler.tex
@@ -39,3 +39,52 @@
 Page:             code /resources for all pages (starting from first use) = \pageattr
 ThisPage:         code specific to one Page
 ThisPage<number>: code specific to page <number>
+
+
+% object dictionaries
+
+/Type/Filespec%
+
+/FS  - name optional
+/F   - string
+/UF  - string (BOM + utf8 bytes) /=path separator.
+/DOS - bytestring - optional, deprecated 2.0
+/Mac
+/Unix
+/ID - array with two entries [<B822F9570D48EBF9E10849164052EDF1> <B822F9570D48EBF9E10849164052EDF1>]
+      (first entry: creation, second after update. Always equal for us
+/V boolean
+/Desc string
+/AFRelationship name
+/Thumb stream (pdf 2.0)
+/CI  obj reference to dictionary
+/EF: dictionary: /F objref to stream, /UF objref to stream (/EF=embedded
+/RF: R=related 
+/EP: dictionarie, related to encryption content unclear
+
+
+Stream object:
+obj
+/Type/Embeddedfile
+/Subtype/text#2Fplain  (mime type, escaped)
+/Params dictionary required for AF
+        /Size         integer
+        /CreationDate date
+        /ModDate      date
+        /Mac dict, deprecated in 2.0
+        /CheckSum string, optional
+stream .... endstream
+endobj
+      
+/Desc (This embedded file is encrypted using the Acme Custom Crypto filter)
+/EF <</F 18 0 R>>
+/F (AcmeCustomCrypto Protected PDF.pdf)
+/Type /Filespec
+/UF (AcmeCustomCrypto Protected PDF.pdf)
+/EP
+<<
+/Type /EncryptedPayload
+/Subtype /AcmeCustomCrypto
+/Version /1.0
+>>
+/AFRelationship /EncryptedPayload
diff --git a/newpackages/atfi-generic.def b/newpackages/atfi-generic.def
index b071189..7b51757 100644
--- a/newpackages/atfi-generic.def
+++ b/newpackages/atfi-generic.def
@@ -42,7 +42,7 @@
 \ProvidesFile{atfi-generic.def}%
   [2020/04/13 v1.0 generic attachfile2 (UF)]%
 \ExplSyntaxOn
-\cs_set_eq:NN \atfi at literal \__draw_backend_literal:n
+\cs_set:Npn \atfi at literal #1{ \__draw_backend_literal:x {#1}} %???
 \ExplSyntaxOff
 %\let\atfi at literal\pdfliteral %<---
 \def\atfi at GSAVE{q }
@@ -72,6 +72,7 @@
 \define at key{AtFi at file}{Size}{%
   \edef\atfi at params{\atfi at params/Size #1}%
 }
+\ExplSyntaxOn
 \def\atfi at embedfile#1{%
   \ltx at IfUndefined{atfi at fileobj@#1}{%
     \begingroup
@@ -93,18 +94,15 @@
       \else
         \edef\atfi at params{/Params<<\atfi at params>>}%
       \fi
-      \immediate\pdfobj stream attr {%
-        /Type/EmbeddedFile%
-        \atfi at mimetype
-        \atfi at params
-      } file {#1}%
+      \pdf_object_now:nx{fstream}{{/Type/EmbeddedFile\atfi at mimetype\atfi at params}{#1}}
       \expandafter
-      \xdef\csname atfi at fileobj@#1\endcsname{\the\pdflastobj}%
+      \xdef\csname atfi at fileobj@#1\endcsname{\pdf_object_last:}%
     \endgroup
   }{%
     % file already embedded
   }%
 }
+\ExplSyntaxOff
 \def\atfi at xform{%
   \immediate\pdfxform\atfi at appearancebox
   \edef\atfi at appearanceobj{\the\pdflastxform}%
@@ -113,14 +111,15 @@
 \def\atfi at refxform#1{%
   \pdfrefxform#1\relax
 }
+\ExplSyntaxOn
 \def\atfi at insert@file at annot#1{%
   \rule{0pt}{0pt}%
   \ifatfi at appearance
     \def\atfi at appearance@dict{%
       /AP<<%
-        /N \atfi at appearanceobj\space 0 R%
-        /R \atfi at appearanceobj\space 0 R%
-        /D \atfi at appearanceobj\space 0 R%
+        /N~ \atfi at appearanceobj\space 0~ R%
+        /R~ \atfi at appearanceobj\space 0~ R%
+        /D~ \atfi at appearanceobj\space 0~ R%
       >>%
     }%
   \else
@@ -130,8 +129,7 @@
     \begingroup
       \hypersetup{unicode=false}%
       \atfi at pdfstringdef\atfi at file{#1}%
-      \immediate\pdfobj{%
-        <<%
+      \pdf_object_now:nx{dict}{%
           /Type/Filespec%
           /F(\atfi at file)%
           \ifx\atfi at ucfilespec\ltx at empty
@@ -139,19 +137,18 @@
             /UF(\atfi at ucfilespec)%
           \fi
           /EF<<%
-            /F \@nameuse{atfi at fileobj@#1} 0 R%
+            /F~ \@nameuse{atfi at fileobj@#1}%
           >>%
-        >>%
       }%
       \expandafter\xdef\csname atfi at fsobj@#1\endcsname{%
-        \the\pdflastobj
+        \pdf_object_last:
       }%
     \endgroup
   }{%
   }%
-  \pdfannot width \atfi at scale\atfi at appearancewidth
-            height \atfi at scale\atfi at appearanceheight
-            depth \atfi at scale\atfi at appearancedepth {%
+  \pdfannot width ~\atfi at scale\atfi at appearancewidth
+            height~ \atfi at scale\atfi at appearanceheight
+            depth~ \atfi at scale\atfi at appearancedepth {%
     /Subtype/FileAttachment%
     \atfi at icon
     \atfi at color@annot
@@ -161,13 +158,14 @@
     \atfi at description
     \atfi at subject
     \atfi at appearance@dict
-    /F \theatfi at flags
-    /FS \@nameuse{atfi at fsobj@#1} 0 R%
+    /F~ \theatfi at flags
+    /FS~ \@nameuse{atfi at fsobj@#1}%
   }%
   \rule{0pt}{\atfi at appearanceheight}%
   \rule[-\atfi at appearancedepth]{0pt}{\atfi at appearancedepth}%
   \rule{\atfi at appearancewidth}{0pt}%
 }
+\ExplSyntaxOff
 \endinput
 %%
 %% End of file `atfi-pdftex.def'.
diff --git a/newpackages/new-attachfile.sty b/newpackages/new-attachfile.sty
index 941798a..260934b 100644
--- a/newpackages/new-attachfile.sty
+++ b/newpackages/new-attachfile.sty
@@ -41,6 +41,7 @@
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{new-attachfile}%
   [2020/04/13 v1.00 Attach files into PDF (HO/UF)]%
+\RequirePackage{pdfresources}  
 \RequirePackage{iftex}[2019/11/07]
 \RequirePackage{keyval}
 \RequirePackage{color}
@@ -242,35 +243,8 @@
   \fi
 }
 \DeclareBoolOption{nofiles}
-\let\atfi at driver\ltx at empty
-\def\atfi at driver@pdftex{pdftex}
-\def\atfi at driver@luatex{luatex}
-\def\atfi at driver@dvips{dvips}
-\def\atfi at driver@dvipdfmx{dvipdfmx}
-\DeclareVoidOption{pdftex}{%
- \ifpdf
-  \let\atfi at driver\atfi at driver@pdftex
- \else
-   \let\atfi at driver\ltx at empty
-    \PackageError{attachfile2}{%
-      Wrong driver option `pdftex',\MessageBreak
-      because pdfTeX in PDF mode is not detected%
-    }\@ehc
- \fi
-}
-\DeclareVoidOption{luatex}{%
-  \let\atfi at driver\atfi at driver@luatex
-}
-\DeclareVoidOption{dvips}{%
-  \let\atfi at driver\atfi at driver@dvips
-}
-\DeclareVoidOption{dvipdfmx}{%
-  \let\atfi at driver\atfi at driver@dvipdfmx
-}
-\DeclareVoidOption{xetex}{%
-  \let\atfi at driver\atfi at driver@dvipdfmx
-}
-\DeclareStringOption{driverfallback}
+
+
 \DeclareRobustCommand{\attachfilesetup}[1]{\setkeys{AtFi}{#1}}
 \DeclareLocalOptions{%
   annotname,%
@@ -294,48 +268,7 @@
 \def\atfi at DisableOption{%
   \DisableKeyvalOption[action=error,package=attachfile2]{AtFi}%
 }
-\ifpdf
- \ifluatex
-  \let\atfi at driver\atfi at driver@luatex
- \else
-  \let\atfi at driver\atfi at driver@pdftex
- \fi
-\else
- \ifxetex
-    \let\atfi at driver\atfi at driver@dvipdfmx
-  \else
-    \ifx\atfi at driver\ltx at empty
-      \ifx\atfi at driverfallback\ltx at empty
-      \else
-        \expandafter\let\expandafter\atfi at driver
-            \csname atfi at driver@\atfi at driverfallback\endcsname
-        \ifx\atfi at driver\atfi at driver@dvips
-        \else
-          \ifx\atfi at driver\atfi at driver@dvipdfmx
-          \else
-             \let\atfi at driver\ltx at empty
-             \PackageWarningNoLine{attachfile2}{%
-               Option `driverfallback' with unsupported\MessageBreak
-               DVI driver (\atfi at driverfallback)%
-             }%
-          \fi
-        \fi
-      \fi
-      \ifx\atfi at driver\ltx at empty
-        \PackageWarningNoLine{attachfile2}{%
-          Driver is not specified,\MessageBreak
-          enforce draft settings%
-        }%
-        \atfi at drafttrue
-      \fi
-    \fi
-  \fi
-\fi
-\atfi at DisableOption{pdftex}
-\atfi at DisableOption{dvips}
-\atfi at DisableOption{dvipdfmx}
-\atfi at DisableOption{xetex}
-\atfi at DisableOption{driverfallback}
+
 \DeclareRobustCommand{\notextattachfile}[2][]{%
   \begingroup
     \atfi at setup{#1}%
@@ -368,7 +301,7 @@
   }%
    \expandafter\endinput
 \fi
-\input{atfi-\atfi at driver.def}
+\input{atfi-generic.def}
 \def\atfi at acroGraph@data{%
   \atfi at GSAVE
   0.5 \atfi at SETGRAYFILL





More information about the latex3-commits mailing list.