summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pdfmanagement-testphase/colorspace-patches-tmp-ltx.sty
blob: 7bef61816305e6cc67c55f23026aed86bd038e82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
%% This is file `hyperxmp-patches-tmp-ltx.sty"
% Copyright (C) 2019-2021 The LaTeX 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
%
% This file is part of the "pdfmanagement bundle" (The Work in LPPL)
% and all files in that bundle must be distributed together.
%
% -----------------------------------------------------------------------
%
% The development version of the bundle can be found at
%
%    https://github.com/latex3/pdfresources
%
% for those people who are interested.
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\ProvidesExplPackage{colorspace-patches-tmp-ltx}{2022-05-11}{0.95o}
  {temporay patches to for the colorspace package to test pdfresource management ... UF}

\hook_gput_code:nnn {begindocument} {pdf}
  {
    \tl_if_exist:NT \spc@op
      {
        \def\spc@Pageresources#1{}
      }

  }

\hook_gput_code:nnn {begindocument/end} {pdf}
  {
    \tl_if_exist:NT \spc@op
      {
        \__pdf_backend_object_new:nn  {__spc_extgstate_op_false}{dict}
        \__pdf_backend_object_write:nn
          {__spc_extgstate_op_false}
          {/Type /ExtGState~/op~false~/OP~false}
        \pdfmanagement_add:nnn
          {Page/Resources/ExtGState}
          {SPCko}
          {\__pdf_backend_object_ref:n {__spc_extgstate_op_false}}
        \__pdf_backend_object_new:nn  {__spc_extgstate_op_true0}{dict}
        \__pdf_backend_object_write:nn
          {__spc_extgstate_op_true0}
          {/Type /ExtGState~/op~true~/OP~true~/OPM~0}%
        \pdfmanagement_add:nnn
          {Page/Resources/ExtGState}
          {SPCmz}
          {\__pdf_backend_object_ref:n {__spc_extgstate_op_true0}}
        \__pdf_backend_object_new:nn  {__spc_extgstate_op_true1}{dict}
        \__pdf_backend_object_write:nn
          {__spc_extgstate_op_true1}
          {/Type /ExtGState~/op~true~/OP~true~/OPM~1}%
         \pdfmanagement_add:nnn
          {Page/Resources/ExtGState}
          {SPCop}
          {\__pdf_backend_object_ref:n {__spc_extgstate_op_true1}}
      }
  }

\RemoveFromHook{begindocument}[colorspace]

\hook_gput_code:nnn {enddocument} {pdf}
 {
  \def\spc@elt#1#2
   {
    \str_set_eq:Nc\l_tmpa_str {spc@ir@#2}
    \seq_set_split:NnV \l_tmpa_seq {~}\l_tmpa_str
    \seq_get_left:NN\l_tmpa_seq\l_tmpa_str
    %remove spaces
    \exp_args:NNx
    \str_replace_all:Nnn\l_tmpa_str {\c_hash_str20}{~}
    %remove slash
    \str_set:Nx\l_tmpa_str{\str_tail:N\l_tmpa_str}
    \pdfmanagement_add:nex
      {Page/Resources/ColorSpace}{\l_tmpa_str}{\seq_item:Nn\l_tmpa_seq{2}~0~R}
   }
   \spc@csall
 }

\endinput