[latex3-commits] [git/LaTeX3-latex3-pdfresources] develop: add support for uncompress metadata (e1f9f87)

Ulrike Fischer fischer at troubleshooting-tex.de
Wed Aug 31 17:02:05 CEST 2022


Repository : https://github.com/latex3/pdfresources
On branch  : develop
Link       : https://github.com/latex3/pdfresources/commit/e1f9f8713addb9e5a2d579037a21bd64607a2969

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

commit e1f9f8713addb9e5a2d579037a21bd64607a2969
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Wed Aug 31 17:02:05 2022 +0200

    add support for uncompress metadata


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

e1f9f8713addb9e5a2d579037a21bd64607a2969
 firstaid/hyperxmp-patches-tmp-ltx.sty |  5 +++--
 l3backend-testphase.dtx               | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/firstaid/hyperxmp-patches-tmp-ltx.sty b/firstaid/hyperxmp-patches-tmp-ltx.sty
index 5c77d8c..abef384 100644
--- a/firstaid/hyperxmp-patches-tmp-ltx.sty
+++ b/firstaid/hyperxmp-patches-tmp-ltx.sty
@@ -38,8 +38,9 @@
    \typeout{}
    \hyxmp at construct@packet
    %or some other command to write a object:
-   \exp_args:Nnx
-    \pdf_object_unnamed_write:nn{stream}{{/Type~/Metadata~/Subtype~/XML}{\hyxmp at xml}}%
+   \exp_args:Nx
+    \__pdf_backend_metadata_stream:n {\hyxmp at xml}
+    %\pdf_object_unnamed_write:nn{stream}{{/Type~/Metadata~/Subtype~/XML}}%
     % reference in the Catalog:
     \pdfmanagement_add:nnx {Catalog} {Metadata}{\pdf_object_ref_last:}
  }
diff --git a/l3backend-testphase.dtx b/l3backend-testphase.dtx
index 7b3fc31..3cca8d2 100644
--- a/l3backend-testphase.dtx
+++ b/l3backend-testphase.dtx
@@ -2004,6 +2004,40 @@
    }
 %</drivers>
 %    \end{macrocode}
+%
+% \subsection{Uncompressed metadata object stream}
+% The xmp metadata should be written uncompressed to pdf.
+% With luatex this is possible by using the |uncompressed| key word.
+% With pdftex one can change locally the compresslevel. (x)dvipdfmx does
+% it automatically and doesn't need some special command. No solution
+% is known imho for the dvips route. We need it only once, so we make
+% it special and probably no public interface is needed. It writes
+% an unnamed object so should be referenced directly with |\pdf_object_ref_last:|
+%    \begin{macrocode}
+%<*luatex>
+\cs_new_protected:Npn \__pdf_backend_metadata_stream:n #1
+  {
+    \tex_immediate:D \tex_pdfextension:D obj ~uncompressed~
+      \__pdf_backend_object_write:nn {stream} {{/Type~/Metadata~/Subtype~/XML}{#1}}
+  }
+%</luatex>
+%<*pdftex>
+\cs_new_protected:Npn \__pdf_backend_metadata_stream:n #1
+  {
+    \group_begin:
+     \tex_pdfcompresslevel:D  0 \scan_stop:
+     \tex_immediate:D \tex_pdfobj:D
+     \__pdf_backend_object_write:nn {stream} {{/Type~/Metadata~/Subtype~/XML}{#1}}
+    \group_end:
+  }
+%</pdftex>
+%<*xdvipdfmx|dvipdfmx|dvips|dvisvgm>
+\cs_new_protected:Npn \__pdf_backend_metadata_stream:n #1
+  {
+    \pdf_object_unnamed_write:nn {stream}{{/Type~/Metadata~/Subtype~/XML}{#1}}
+  }
+%</xdvipdfmx|dvipdfmx|dvips|dvisvgm>
+%    \end{macrocode}
 % \subsection{lua code for lualatex}
 %    \begin{macrocode}
 %<*lua>





More information about the latex3-commits mailing list.