summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-02-24 23:39:33 +0000
committerKarl Berry <karl@freefriends.org>2021-02-24 23:39:33 +0000
commitaf6523eabc8ad027567831103afe0cb2ff123671 (patch)
treee7fe820424436f04bd056a4e81646120ba4ef73d /Master/texmf-dist/doc/latex
parent6db38b426042bc6fece00e3af99df6c2c9bc670b (diff)
pdfmanagement-testphase runtime files
git-svn-id: svn://tug.org/texlive/trunk@57885 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex')
-rw-r--r--Master/texmf-dist/doc/latex/pdfmanagement-testphase/l3backend-testphase.lua143
-rw-r--r--Master/texmf-dist/doc/latex/pdfmanagement-testphase/pdfmanagement-testphase.ltx1940
2 files changed, 0 insertions, 2083 deletions
diff --git a/Master/texmf-dist/doc/latex/pdfmanagement-testphase/l3backend-testphase.lua b/Master/texmf-dist/doc/latex/pdfmanagement-testphase/l3backend-testphase.lua
deleted file mode 100644
index f6ae9306076..00000000000
--- a/Master/texmf-dist/doc/latex/pdfmanagement-testphase/l3backend-testphase.lua
+++ /dev/null
@@ -1,143 +0,0 @@
---
--- This is file `l3backend-testphase.lua',
--- generated with the docstrip utility.
---
--- The original source files were:
---
--- l3backend-testphase.dtx (with options: `lua')
---
--- 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 "LaTeX PDF management testphase bundle" (The Work in LPPL)
--- and all files in that bundle must be distributed together.
---
--- File: l3backend-testphase.dtx
-
-
-
-ltx= ltx or {}
-ltx.__pdf = ltx.__pdf or {}
-ltx.__pdf.Page = ltx.__pdf.Page or {}
-ltx.__pdf.Page.dflt = ltx.__pdf.Page.dflt or {}
-ltx.__pdf.Page.Resources = ltx.__pdf.Resources or {}
-ltx.__pdf.Page.Resources.Properties = ltx.__pdf.Page.Resources.Properties or {}
-ltx.__pdf.Page.Resources.List={"ExtGState","ColorSpace","Pattern","Shading"}
-ltx.__pdf.object = ltx.__pdf.object or {}
-
-ltx.pdf= ltx.pdf or {} -- for "public" functions
-
-local __pdf = ltx.__pdf
-local pdf = pdf
-
-local function __pdf_backend_Page_gput (name,value)
- __pdf.Page.dflt[name]=value
-end
-
-local function __pdf_backend_Page_gremove (name)
- __pdf.Page.dflt[name]=nil
-end
-
-local function __pdf_backend_Page_gclear ()
- __pdf.Page.dflt={}
-end
-
-local function __pdf_backend_ThisPage_gput (page,name,value)
- __pdf.Page[page] = __pdf.Page[page] or {}
- __pdf.Page[page][name]=value
-end
-
-local function __pdf_backend_ThisPage_gpush (page)
- local token=""
- local t = {}
- local tkeys= {}
- for name,value in pairs(__pdf.Page.dflt) do
- t[name]=value
- end
- if __pdf.Page[page] then
- for name,value in pairs(__pdf.Page[page]) do
- t[name] = value
- end
- end
- -- sort the table to get reliable test files.
- for name,value in pairs(t) do
- table.insert(tkeys,name)
- end
- table.sort(tkeys)
- for _,name in ipairs(tkeys) do
- token = token .. "/"..name.." "..t[name]
- end
- return token
-end
-
-function ltx.__pdf.backend_ThisPage_gput (page,name,value) -- tex.count["g_shipout_readonly_int"]
- __pdf_backend_ThisPage_gput (page,name,value)
-end
-
-function ltx.__pdf.backend_ThisPage_gpush (page)
- pdf.setpageattributes(__pdf_backend_ThisPage_gpush (page))
-end
-
-function ltx.__pdf.backend_Page_gput (name,value)
- __pdf_backend_Page_gput (name,value)
-end
-
-function ltx.__pdf.backend_Page_gremove (name)
- __pdf_backend_Page_gremove (name)
-end
-
-function ltx.__pdf.backend_Page_gclear ()
- __pdf_backend_Page_gclear ()
-end
-
-local Properties = ltx.__pdf.Page.Resources.Properties
-local ResourceList= ltx.__pdf.Page.Resources.List
-local function __pdf_backend_PageResources_gpush (page)
- local token=""
- if Properties[page] then
--- we sort the table, so that the pdf test works
- local t = {}
- for name,value in pairs (Properties[page]) do
- table.insert (t,name)
- end
- table.sort (t)
- for _,name in ipairs(t) do
- token = token .. "/"..name.." ".. Properties[page][name]
- end
- token = "/Properties <<"..token..">>"
- end
- for i,name in ipairs(ResourceList) do
- if ltx.__pdf.Page.Resources[name] then
- token = token .. "/"..name.." "..ltx.pdf.object_ref("Page/Resources/"..name)
- end
- end
- return token
-end
-
--- the function is public, as I probably need it in tagpdf too ...
-function ltx.pdf.Page_Resources_Properties_gput (page,name,value) -- tex.count["g_shipout_readonly_int"]
- Properties[page] = Properties[page] or {}
- Properties[page][name]=value
- pdf.setpageresources(__pdf_backend_PageResources_gpush (page))
-end
-
-function ltx.pdf.Page_Resources_gpush(page)
- pdf.setpageresources(__pdf_backend_PageResources_gpush (page))
-end
-
-function ltx.pdf.object_ref (objname)
- if ltx.__pdf.object[objname] then
- local ref= ltx.__pdf.object[objname]
- return ref
- else
- return "false"
- end
-end
---
--- End of File `l3backend-testphase.lua'.
diff --git a/Master/texmf-dist/doc/latex/pdfmanagement-testphase/pdfmanagement-testphase.ltx b/Master/texmf-dist/doc/latex/pdfmanagement-testphase/pdfmanagement-testphase.ltx
deleted file mode 100644
index 66293c0401e..00000000000
--- a/Master/texmf-dist/doc/latex/pdfmanagement-testphase/pdfmanagement-testphase.ltx
+++ /dev/null
@@ -1,1940 +0,0 @@
-%%
-%% This is file `pdfmanagement-testphase.ltx',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% pdfmanagement-testphase.dtx (with options: `header')
-%% l3pdfdict.dtx (with options: `package')
-%% l3pdfmanagement.dtx (with options: `package')
-%% ltdocinit.dtx (with options: `package')
-%% l3pdfannot.dtx (with options: `package')
-%% l3pdfxform.dtx (with options: `package')
-%% l3pdfmeta.dtx (with options: `package')
-%% l3pdftools.dtx (with options: `package')
-%% l3pdffile.dtx (with options: `package')
-%%
-%% 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 "LaTeX PDF management testphase bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% File: pdfmanagement-testphase.dtx
-\ProvidesExplFile
- {pdfmanagement-testphase.ltx}{2021-02-22}{0.95a}
- {PDF~management~code~(testphase)}
-%% File: l3pdfdict.dtx
-\cs_new:Npn \__pdfdict_get_type:n #1
- {
- \str_case_e:nn { \str_head:n{#1} }
- {
- {g}{global}
- {l}{local}
- }
- }
-\msg_new:nnn { pdfdict } { show-dict }
- { %#1: name of the dictionary
- %#2: expanded content
- %#3: type
- The~#3~dictionary~'#1'~
- \tl_if_empty:nTF {#2}
- { is~empty \\>~ . }
- { contains~the~pairs~(without~outer~braces): #2 . }
- }
-\msg_new:nnn { pdfdict } { unknown-dict }
- {
- The~dictionary~'#1'~is~unknown.
- }
-\msg_new:nnn { pdfdict } { dict-already-defined }
- {
- The~#2~dictionary~'#1'~is~already~defined.
- }
-\msg_new:nnn { pdfdict } { empty-value }
- { The~value~#1~for~#2~is~blank~and~will~be~ignored }
-
-\msg_new:nnn { pdfdict } { invalid-name }
- { Name~'#1'~is~not~valid\\
- Names~of~dictionaries~should~start~with~'g_'~or~'l_' }
-
-
-\seq_new:N \g__pdfdict_lnames_seq
-\seq_new:N \g__pdfdict_gnames_seq
-\cs_new:Npn \__pdfdict_name:n #1 % #1 dictionary name
- {
- \str_head:n{#1}__pdfdict_/#1_prop
- }
-\cs_set_eq:NN \__kernel_pdfdict_name:n \__pdfdict_name:n
-
-\cs_new_protected:Npn \__pdfdict_new:n #1
- {
- \__pdfdict_if_exist:nTF { #1 }
- {
- \msg_error:nnxx
- { pdfdict }
- { dict-already-defined }
- { \tl_to_str:n {#1} }
- { \__pdfdict_get_type:n{#1} }
- }
- {
- \str_case_e:nnF { \str_head:n{#1} }
- {
- {g}
- {
- \prop_new:c { \__pdfdict_name:n { #1 } }
- \seq_gput_right:cn {g__pdfdict_gnames_seq} { #1 }
- }
- {l}
- {
- \prop_new:c { \__pdfdict_name:n { #1 } }
- \seq_gput_right:cn {g__pdfdict_lnames_seq} { #1 }
- }
- }
- {
- \msg_error:nnx{pdfdict}{invalid-name}{\tl_to_str:n{#1}}
- }
- }
- }
-
-\cs_set_eq:NN \pdfdict_new:n \__pdfdict_new:n
-\cs_new_protected:Npn \__pdfdict_set_eq:nn #1 #2
- {
- \__pdfdict_if_exist:nTF { #2 }
- {
- \__pdfdict_if_exist:nF { #1 }
- {
- \__pdfdict_new:n { #1 }
- }
- \prop_set_eq:cc { \__pdfdict_name:n {#1} }{ \__pdfdict_name:n {#2} }
- }
- {
- \msg_error:nnn { pdfdict } { unknown-dict } { #1 }
- }
- }
-
-\cs_set_eq:NN \pdfdict_set_eq:nn \__pdfdict_set_eq:nn
-
-\cs_new_protected:Npn \__pdfdict_gset_eq:nn #1 #2
- {
- \__pdfdict_if_exist:nTF { #2 }
- {
- \__pdfdict_if_exist:nF { #1 }
- {
- \__pdfdict_new:n { #1 }
- }
- \prop_gset_eq:cc { \__pdfdict_name:n {#1} }{ \__pdfdict_name:n {#2} }
- }
- {
- \msg_error:nnn { pdfdict } { unknown-dict } { #1 }
- }
- }
-
-\cs_set_eq:NN \pdfdict_gset_eq:nn \__pdfdict_gset_eq:nn
-\prg_new_conditional:Npnn \__pdfdict_if_exist:n #1 { p , T , F , TF }
- {
- \prop_if_exist:cTF
- { \__pdfdict_name:n { #1 } }
- { \prg_return_true: }
- { \prg_return_false: }
- }
-\prg_set_eq_conditional:NNn
- \pdfdict_if_exist:n \__pdfdict_if_exist:n { p , T , F , TF }
-\prg_new_conditional:Npnn \__pdfdict_if_empty:n #1 { p , T , F , TF }
- {
- \prop_if_empty:cTF
- { \__pdfdict_name:n { #1 } }
- { \prg_return_true: }
- { \prg_return_false: }
- }
-
-\prg_set_eq_conditional:NNn
- \pdfdict_if_empty:n \__pdfdict_if_empty:n { p , T , F , TF }
-\cs_new_protected:Npn \__pdfdict_put:nnn #1 #2 #3 %#1 (local) dict, #2 name, #3 value
- {
- \tl_if_blank:nTF { #3 }
- {
- \msg_warning:nnnn { pdfdict }{ empty-value }{ #2 } { #1 }
- }
- {
- \__pdfdict_if_exist:nTF { #1 }
- {
- \exp_args:Nnx \prop_put:cnn
- { \__pdfdict_name:n { #1 } }{ \str_convert_pdfname:n { #2 } } { #3 }
- }
- {
- \msg_error:nnn { pdfdict } { unknown-dict } { #1 }
- }
- }
- }
-
-\cs_set_eq:NN \pdfdict_put:nnn \__pdfdict_put:nnn
-\cs_generate_variant:Nn \pdfdict_put:nnn {nnx,nno}
-
-\cs_new_protected:Npn \__pdfdict_gput:nnn #1 #2 #3 %#1 global dict, #2 name, #3 value
- {
- \tl_if_empty:nTF { #3 }
- {
- \msg_warning:nnnn { pdfdict }{ empty-value }{ #2 } { #1 }
- }
- {
- \__pdfdict_if_exist:nTF { #1 }
- {
- \exp_args:Nnx \prop_gput:cnn
- { \__pdfdict_name:n { #1 } }{ \str_convert_pdfname:n { #2 } } { #3 }
- }
- {
- \msg_error:nnn { pdfdict } { unknown-dict } { #1 }
- }
- }
- }
-
-\cs_set_eq:NN \pdfdict_gput:nnn \__pdfdict_gput:nnn
-\cs_generate_variant:Nn \pdfdict_gput:nnn {nnx,nno}
-\cs_new_protected:Npn \__pdfdict_get:nnN #1 #2 #3 %dict,key,macro
- {
- \__pdfdict_if_exist:nTF { #1 }
- {
- \exp_args:Nnx \prop_get:cnN
- { \__pdfdict_name:n { #1 } }
- { \str_convert_pdfname:n { #2 } } #3
- }
- {
- \msg_error:nnn { pdfdict } { unknown-dict } { #1 }
- }
- }
-
-\cs_set_eq:NN \pdfdict_get:nnN \__pdfdict_get:nnN
-\cs_new_protected:Npn \__pdfdict_remove:nn #1 #2 %dict,name
- {
- \__pdfdict_if_exist:nTF { #1 }
- {
- \exp_args:Nnx \prop_remove:cn
- { \__pdfdict_name:n { #1 } }{ \str_convert_pdfname:n { #2 } }
- }
- {
- \msg_error:nnn { pdfdict } { unknown-dict } { #1 }
- }
- }
-\cs_set_eq:NN \pdfdict_remove:nn \__pdfdict_remove:nn
-
-\cs_new_protected:Npn \__pdfdict_gremove:nn #1 #2 %dict,name
- {
- \__pdfdict_if_exist:nTF { #1 }
- {
- \exp_args:Nnx \prop_gremove:cn
- { \__pdfdict_name:n { #1 } }{ \str_convert_pdfname:n { #2 } }
- }
- {
- \msg_error:nnn { pdfdict } { unknown-dict } { #1 }
- }
- }
-
-\cs_set_eq:NN \pdfdict_gremove:nn \__pdfdict_gremove:nn
-\cs_new_protected:Npn \__pdfdict_show:Nn #1#2 %#1 message command, #2 dict
- {
- \prop_if_exist:cTF { \__pdfdict_name:n { #2 } }
- {
- #1
- { pdfdict }
- { show-dict }
- { \tl_to_str:n {#2} }
- { \prop_map_function:cN {\__pdfdict_name:n { #2 }} \msg_show_item:nn }
- { \__pdfdict_get_type:n{#2} }
- { }
- }
- {
- #1 { pdfdict } { unknown-dict } { #2 } {}{}{}
- }
- }
-\cs_new_protected:Npn \pdfdict_show:n #1
- {
- \__pdfdict_show:Nn \msg_show:nnxxxx {#1}
- }
-\cs_new:Npn \__pdfdict_item:nn #1 #2 %#1 name, #2 value
- {
- \tl_if_blank:nF {#2} { /#1~#2~ }
- }
-\cs_generate_variant:Nn \__pdfdict_item:nn {ne}
-\cs_set_eq:NN \pdfdict_item:nn \__pdfdict_item:nn
-\cs_generate_variant:Nn \pdfdict_item:nn {ne}
-\cs_new:Npn \__pdfdict_use:n #1 %#1 dict
- {
- \prop_map_function:cN { \__pdfdict_name:n { #1 } } \__pdfdict_item:ne
- }
-
-\cs_set_eq:NN \pdfdict_use:n \__pdfdict_use:n
-%% File: l3pdfmanagement.dtx
-
-\msg_new:nnn { pdfmanagement } { unknown-dict }
- { The~PDF~management~resource~'#1'~is~unknown. }
-
-\msg_new:nnn { pdfmanagement } { empty-value }
- { The~value~for~#1~is~empty~and~will~be~ignored }
-
-\msg_new:nnn { pdfmanagement } { no-removal }
- { It~is~not~possible~to~remove~values~from~'#1'.}
-
-\msg_new:nnn { pdfmanagement } { no-show }
- { It~is~not~possible~to~show~the~content~of~'#1'.}
-
-\msg_new:nnn { pdfmanagement } { show-dict }
- {
- The~PDF~resource~'#1'~
- \tl_if_empty:nTF {#2}
- { is~empty \\>~ . }
- { contains~the~pairs~(without~outer~braces): #2 . }
- }
-\msg_new:nnn { pdfmanagement } { dict-already-defined }
- {
- The~path~'#1'~is~already~defined.
- }
-\msg_new:nnn { pdfmanagement } { inactive }
- {
- The~PDF~resources~management~is~not~active\\
- command~'#1'~ignored.
- }
-\bool_new:N \g__pdfmanagement_active_bool
-\prg_new_conditional:Npnn \__pdfmanagement_if_active: { p , T , F , TF }
- {
- \bool_if:NTF \g__pdfmanagement_active_bool
- { \prg_return_true: }
- { \prg_return_false: }
- }
-\prg_set_eq_conditional:NNn
- \pdfmanagement_if_active: \__pdfmanagement_if_active: { p , T , F , TF }
-
-\hook_new:n {pdfmanagement/add}
-\cs_new_protected:Npn \pdfmanagement_add:nnn #1 #2 #3
- {
- \__pdfmanagement_if_active:TF
- {
- \pdfdict_if_exist:nTF { g__pdf_Core/#1 }
- {
- \hook_gput_code:nnn
- {pdfmanagement/add}
- {pdfmanagement}
- {
- \__pdfmanagement_handler_gput:nnn { #1 }{ #2 }{ #3 }
- }
- }
- {
- \msg_error:nnn{pdfmanagement}{unknown-dict}{#1}
- }
- }
- {
- \msg_warning:nnx {pdfmanagement}{inactive}
- {\tl_to_str:n {\pdfmanagement_add:nnn}}
- }
- }
-
-\cs_generate_variant:Nn \pdfmanagement_add:nnn {nnx,nxx}
-\tl_new:N \g__kernel_pdfmanagement_thispage_shipout_code_tl
-\tl_new:N \g__kernel_pdfmanagement_lastpage_shipout_code_tl
-\tl_new:N \g__kernel_pdfmanagement_end_run_code_tl
-\tl_gset:Nn \g__kernel_pdfmanagement_thispage_shipout_code_tl
- {
- \bool_if:NT \g__pdfmanagement_active_bool
- {
- \exp_args:NV \__pdf_backend_ThisPage_gpush:n { \g_shipout_readonly_int }
- \exp_args:NV \__pdf_backend_PageResources_gpush:n { \g_shipout_readonly_int }
- }
- }
-
-\tl_gset:Nn \g__kernel_pdfmanagement_lastpage_shipout_code_tl
- {
- \bool_if:NT \g__pdfmanagement_active_bool
- {
- \__pdf_backend_PageResources_obj_gpush: %ExtGState etc
- }
- }
-
-\tl_gset:Nn \g__kernel_pdfmanagement_end_run_code_tl
- {
- \bool_if:NT \g__pdfmanagement_active_bool
- {
- \__pdfmanagement_Pages_gpush: %pagesattr
- \__pdfmanagement_Info_gpush: %pdfinfo
- \__pdfmanagement_Catalog_gpush:
- }
- }
-
-
-
-\cs_new_protected:Npn \__pdfmanagement_handler_gput:nnn #1 #2 #3 %#1 dict, #2 name, #3 value
- {
- \tl_if_empty:nTF { #3 }
- {
- \msg_none:nnn { pdfmanagement }{ empty-value }{ /#1/#2 }
- }
- {
- \pdfdict_if_exist:nTF { g__pdf_Core/#1 }
- {
- \cs_if_exist:cTF
- { __pdfmanagement_handler/#1/?_gput:nn } %general, name independant handler
- { \use:c {__pdfmanagement_handler/#1/?_gput:nn} {#2} {#3} }
- {
- \cs_if_exist:cTF
- { __pdfmanagement_handler/#1/#2_gput:n }
- { \use:c {__pdfmanagement_handler/#1/#2_gput:n} {#3} } %special handler
- {
- \exp_args:Nnx
- \prop_gput:cnn
- { \__kernel_pdfdict_name:n { g__pdf_Core/#1 } }
- { \str_convert_pdfname:n { #2 } }
- { #3 }
- }
- }
- }
- {
- \msg_error:nnn { pdfmanagement } { unknown-dict } { #1 }
- }
- }
- }
-
-\cs_generate_variant:Nn \__pdfmanagement_handler_gput:nnn {nxx}
-
-\cs_new_protected:Npn \__pdfmanagement_get:nnN #1 #2 #3 %path,key,macro
- {
- \exp_args:Nnx
- \prop_get:cnN
- { \__kernel_pdfdict_name:n { g__pdf_Core/#1 } }
- { \str_convert_pdfname:n {#2} } #3
- }
-
-\cs_new_protected:Npn \__pdfmanagement_handler_gremove:nn #1 #2 %path,key
- {
- \pdfdict_if_exist:nTF { g__pdf_Core/#1 }
- {
- \cs_if_exist:cTF
- { __pdfmanagement_handler/#1/?_gremove:n } %general, name independant handler
- { \use:c {__pdfmanagement_handler/#1/?_gremove:n} {#2} }
- {
- \cs_if_exist:cTF
- { __pdfmanagement_handler/#1/#2_gremove: }
- { \use:c {__pdfmanagement_handler/#1/#2_gremove:} } %special handler
- {
- \exp_args:Nnx
- \prop_gremove:cn
- { \__kernel_pdfdict_name:n { g__pdf_Core/#1 } }
- { \str_convert_pdfname:n {#2} }
- }
- }
- }
- {
- \msg_error:nnn { pdfmanagement } { unknown-dict } { #1 }
- }
- }
-
-\cs_new_protected:Npn \__pdfmanagement_gremove:nn #1 #2 %path,key
- {
- \pdfdict_if_exist:nTF { g__pdf_Core/#1 }
- {
- \exp_args:Nnx
- \prop_gremove:cn
- { \__kernel_pdfdict_name:n { g__pdf_Core/#1 } }
- { \str_convert_pdfname:n{#2} }
- }
- {
- \msg_error:nnn { pdfmanagement } { unknown-dict } { #1 }
- }
- }
-
-\cs_new_protected:Npn \__pdfmanagement_show:Nn #1#2
- {
- \cs_if_exist:cTF
- { __pdfmanagement_handler/#2/?_show: } %general, name independant handler
- { \use:c {__pdfmanagement_handler/#2/?_show:} }
- {
- \prop_if_exist:cTF { \__kernel_pdfdict_name:n { g__pdf_Core/#2 } }
- {
- #1
- { pdfmanagement } { show-dict }
- { \tl_to_str:n {#2} }
- {
- \prop_map_function:cN
- {\__kernel_pdfdict_name:n { g__pdf_Core/#2 }}
- \msg_show_item:nn
- }
- { } { }
- }
- {
- #1 { pdfmanagement } { unknown-dict } {#2}{}{}{}
- }
- }
- }
-
-\cs_new_protected:Npn \__pdfmanagement_show:n #1 %path
- {
- \prop_show:c { \__kernel_pdfdict_name:n { g__pdf_Core/#1 } }
- }
-\cs_new_protected:Npn \pdfmanagement_show:n #1
- {
- \__pdfmanagement_show:Nn \msg_show:nnxxxx {#1}
- }
-\cs_new_protected:Npn \pdfmanagement_remove:nn #1 #2
- {
- \pdfdict_if_exist:nTF { g__pdf_Core/#1 }
- {
- \__pdfmanagement_handler_gremove:nn { #1 }{ #2 }
- }
- {
- \msg_error:nnn{pdfmanagement}{unknown-dict}{#1}
- }
- }
-\cs_new_protected:Npn \pdfmanagement_get:nnN #1 #2 #3
- {
- \pdfdict_if_exist:nTF { g__pdf_Core/#1 }
- {
- \__pdfmanagement_get:nnN { #1 }{ #2 } #3
- }
- {
- \msg_error:nnn{pdfmanagement}{unknown-dict}{#1}
- }
- }
-\pdfdict_new:n { g__pdf_Core/Info}
-\cs_new_protected:Npn \__pdfmanagement_Info_gpush:
- {
- \prop_map_function:cN
- { \__kernel_pdfdict_name:n { g__pdf_Core/Info} }
- \__pdf_backend_info_gput:nn
- \prop_gclear:c { \__kernel_pdfdict_name:n { g__pdf_Core/Info} }
- }
-\pdfdict_new:n { g__pdf_Core/Pages}
-\cs_new_protected:Npn \__pdfmanagement_Pages_gpush:
- {
- \exp_args:Nx \__pdf_backend_Pages_primitive:n
- {
- \pdfdict_use:n { g__pdf_Core/Pages}
- }
- }
-
-\pdfdict_new:n { g__pdf_Core/Page }
-\pdfdict_new:n { g__pdf_Core/ThisPage }
-
-\cs_new_protected:cpn { __pdfmanagement_handler/Page/?_gput:nn } #1 #2
- {
- \__pdf_backend_Page_gput:nn { #1 }{ #2 }
- }
-\cs_new_protected:cpn { __pdfmanagement_handler/Page/?_gremove:n } #1
- {
- \__pdf_backend_Page_gremove:n { #1 }
- }
-
-\cs_new_protected:cpn { __pdfmanagement_handler/ThisPage/?_gput:nn } #1 #2
- {
- \prop_gput:cnn { \__kernel_pdfdict_name:n { g__pdf_Core/ThisPage } }{ #1 } { #2 }
- \bool_if:NT \g__pdfmanagement_active_bool
- {
- \__pdf_backend_ThisPage_gput:nn { #1 }{ #2 }
- }
- }
-
-\cs_new_protected:cpn { __pdfmanagement_handler/ThisPage/?_gremove:n } #1
- {
- \msg_warning:nnn { pdfmanagement } { no-removal }{ThisPage}
- }
-
-\cs_new_protected:cpn { __pdfmanagement_handler/ThisPage/?_show: }
- {
- \msg_warning:nnn { pdfmanagement } { no-show }{ThisPage}
- }
-
-\clist_const:Nn \c__pdfmanagement_PageResources_clist
- {
- ExtGState,
- ColorSpace,
- Pattern,
- Shading,
- }
-
-\clist_map_inline:Nn \c__pdfmanagement_PageResources_clist
- {
- \pdfdict_new:n { g__pdf_Core/Page/Resources/#1}
- }
-\cs_new_protected:cpn { __pdfmanagement_handler/Page/Resources/ExtGState/?_gput:nn } #1 #2
- {
- \__pdf_backend_PageResources_gput:nnn {ExtGState} { #1 }{ #2 }
- }
-
-\cs_new_protected:cpn { __pdfmanagement_handler/Page/Resources/ColorSpace/?_gput:nn } #1 #2
- {
- \__pdf_backend_PageResources_gput:nnn {ColorSpace} { #1 }{ #2 }
- }
-
-\cs_new_protected:cpn { __pdfmanagement_handler/Page/Resources/Shading/?_gput:nn } #1 #2
- {
- \__pdf_backend_PageResources_gput:nnn {Shading} { #1 }{ #2 }
- }
-
-\cs_new_protected:cpn { __pdfmanagement_handler/Page/Resources/Pattern/?_gput:nn } #1 #2
- {
- \__pdf_backend_PageResources_gput:nnn {Pattern} { #1 }{ #2 }
- }
-\pdfdict_new:n { g__pdf_Core/Catalog}
-
-\clist_const:Nn \c__pdfmanagement_Catalog_toplevel_clist
- {
- Collection,
- DPartRoot,
- Lang,
- Legal,
- Metadata,
- NeedsRendering,
- OCProperties/D,
- OpenAction,
- PageLabels,
- PageLayout,
- PageMode,
- Perms,
- PieceInfo,
- SpiderInfo,
- StructTreeRoot,
- Threads,
- URI,
- Version
- }
-
-\clist_const:Nn \c__pdfmanagement_Catalog_sub_clist
- {
- AA,
- AcroForm,
- AcroForm/DR,
- AcroForm/DR/Font,
- MarkInfo,
- ViewerPreferences,
- OCProperties
- }
-
-\clist_map_inline:Nn \c__pdfmanagement_Catalog_sub_clist
- {
- \pdfdict_new:n { g__pdf_Core/Catalog/#1}
- }
-
-\clist_const:Nn \c__pdfmanagement_Catalog_seq_clist
- {
- AF,
- OCProperties/OCGs,
- OCProperties/Configs,
- OutputIntents,
- Requirements,
- AcroForm/Fields,
- AcroForm/CO
- }
-
-\clist_map_inline:Nn \c__pdfmanagement_Catalog_seq_clist
- {
- \seq_new:c { g__pdfmanagement_/Catalog/#1_seq } % new name later
- \cs_new_protected:cpn { __pdfmanagement_handler/Catalog/#1_gput:n } ##1
- {
- \seq_gput_right:cn { g__pdfmanagement_/Catalog/#1_seq } { ##1 }
- }
- }
-
-\cs_new_protected:cpn { __pdfmanagement_handler/Catalog/OCProperties/D_gput:n } #1
- {
- \seq_gput_left:cn
- { g__pdfmanagement_/Catalog/OCProperties/Configs_seq }
- { #1 }
- }
-\cs_new_protected:Npn \__pdfmanagement_Catalog_gpush:
- {
- \use:c { __pdfmanagement_/Catalog/AA_gpush: }
- \use:c { __pdfmanagement_/Catalog/AcroForm_gpush: }
- \use:c { __pdfmanagement_/Catalog/AF_gpush: }
- \use:c { __pdfmanagement_/Catalog/MarkInfo_gpush: }
- \pdfmeta_standard_verify:nT {Catalog_no_OCProperties}
- {
- \use:c { __pdfmanagement_/Catalog/OCProperties_gpush: }
- }
- \use:c { __pdfmanagement_/Catalog/OutputIntents_gpush: }
- \use:c { __pdfmanagement_/Catalog/Requirements_gpush: }
- \use:c { __pdfmanagement_/Catalog/ViewerPreferences_gpush: }
- % output the single values:
- \prop_map_function:cN
- { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog} }
- \__pdf_backend_catalog_gput:nn
- % output names tree:
- \use:c { __pdfmanagement_/Catalog/Names/EmbeddedFiles_gpush: }
- }
-\cs_new_protected:cpn { __pdfmanagement_/Catalog/AA_gpush: }
- {
- \prop_if_empty:cF
- { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/AA } }
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/AA_obj } { dict }
- \__pdf_backend_object_write:nx
- { g__pdfmanagement_/Catalog/AA_obj }
- { \pdfdict_use:n { g__pdf_Core/Catalog/AA } }
- \exp_args:Nnx
- \__pdf_backend_catalog_gput:nn
- {AA}
- {
- \__pdf_backend_object_ref:n { g__pdfmanagement_/Catalog/AA_obj }
- }
- }
- }
-\cs_new_protected:cpn { __pdfmanagement_/Catalog/AcroForm_gpush: }
- {
- \seq_if_empty:cF { g__pdfmanagement_/Catalog/AcroForm/Fields_seq }
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/AcroForm/Fields_obj } { array }
- \__pdf_backend_object_write:nx
- { g__pdfmanagement_/Catalog/AcroForm/Fields_obj }
- { \seq_use:cn { g__pdfmanagement_/Catalog/AcroForm/Fields_seq } {~} }
- \exp_args:Nnnx
- \prop_gput:cnn %we have to use \prop here to avoid the handler ...
- { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/AcroForm } }
- { Fields }
- { \__pdf_backend_object_ref:n { g__pdfmanagement_/Catalog/AcroForm/Fields_obj } }
- }
- \seq_if_empty:cF { g__pdfmanagement_/Catalog/AcroForm/CO_seq }
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/AcroForm/CO_obj } { array }
- \exp_args:Nnx
- \__pdf_backend_object_write:nn
- { g__pdfmanagement_/Catalog/AcroForm/CO_obj }
- { \seq_use:cn { g__pdfmanagement_/Catalog/AcroForm/CO_seq } {~} }
- \exp_args:Nnnx
- \prop_gput:cnn %we have to use \prop here to avoid the handler ...
- { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/AcroForm } }
- { CO }
- { \__pdf_backend_object_ref:n { g__pdfmanagement_/Catalog/AcroForm/CO_obj } }
- }
- \prop_if_empty:cF { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/AcroForm/DR/Font}}
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/AcroForm/DR/Font_obj } {dict}
- \exp_args:Nnx
- \__pdf_backend_object_write:nn
- { g__pdfmanagement_/Catalog/AcroForm/DR/Font_obj }
- { \pdfdict_use:n { g__pdf_Core/Catalog/AcroForm/DR/Font } }
- \exp_args:Nnnx
- \prop_gput:cnn %we have to use \prop here to avoid the handler ...
- { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/AcroForm/DR } }
- { Font }
- { \__pdf_backend_object_ref:n { g__pdfmanagement_/Catalog/AcroForm/DR/Font_obj } }
- }
- \prop_if_empty:cF { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/AcroForm/DR}}
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/AcroForm/DR_obj } {dict}
- \exp_args:Nnx
- \__pdf_backend_object_write:nn
- { g__pdfmanagement_/Catalog/AcroForm/DR_obj }
- { \pdfdict_use:n { g__pdf_Core/Catalog/AcroForm/DR } }
- \exp_args:Nnnx
- \prop_gput:cnn %we have to use \prop here to avoid the handler ...
- { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/AcroForm } }
- { DR }
- { \__pdf_backend_object_ref:n { g__pdfmanagement_/Catalog/AcroForm/DR_obj } }
- }
- \prop_if_empty:cF { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/AcroForm} }
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/AcroForm_obj } {dict}
- \exp_args:Nnx
- \__pdf_backend_object_write:nn
- { g__pdfmanagement_/Catalog/AcroForm_obj }
- { \pdfdict_use:n { g__pdf_Core/Catalog/AcroForm } }
- \exp_args:Nnnx
- \__pdfmanagement_handler_gput:nnn
- { Catalog }
- { AcroForm }
- { \__pdf_backend_object_ref:n { g__pdfmanagement_/Catalog/AcroForm_obj } }
- }
- }
-
-\cs_new_protected:cpn { __pdfmanagement_/Catalog/AF_gpush: }
- {
- \seq_if_empty:cF
- { g__pdfmanagement_/Catalog/AF_seq }
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/AF_obj } { array }
- \exp_args:Nnx
- \__pdf_backend_object_write:nn
- { g__pdfmanagement_/Catalog/AF_obj }
- { \seq_use:cn { g__pdfmanagement_/Catalog/AF_seq } {~} }
- \exp_args:Nnx
- \__pdf_backend_catalog_gput:nn
- {AF}
- {
- \__pdf_backend_object_ref:n {g__pdfmanagement_/Catalog/AF_obj}
- }
- }
- }
-\cs_new_protected:cpn { __pdfmanagement_/Catalog/MarkInfo_gpush: }
- {
- \prop_if_empty:cF
- { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/MarkInfo } }
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/MarkInfo_obj } { dict }
- \exp_args:Nnx
- \__pdf_backend_object_write:nn
- { g__pdfmanagement_/Catalog/MarkInfo_obj }
- { \pdfdict_use:n { g__pdf_Core/Catalog/MarkInfo } }
- \exp_args:Nnx
- \__pdf_backend_catalog_gput:nn
- {MarkInfo}
- {
- \__pdf_backend_object_ref:n {g__pdfmanagement_/Catalog/MarkInfo_obj}
- }
- }
- }
-\cs_new_protected:cpn { __pdfmanagement_/Catalog/OCProperties_gpush: }
- {
- \int_compare:nNnT
- {
- ( \seq_count:c { g__pdfmanagement_/Catalog/OCProperties/OCGs_seq } )*
- ( \seq_count:c { g__pdfmanagement_/Catalog/OCProperties/Configs_seq } )
- }
- >
- { 0 }
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/OCProperties_obj } { dict }
- \seq_gpop_left:cN { g__pdfmanagement_/Catalog/OCProperties/Configs_seq} \l_tmpa_tl
- \exp_args:Nnx
- \__pdf_backend_object_write:nn {g__pdfmanagement_/Catalog/OCProperties_obj}
- {
- /OCGs~[ \seq_use:cn { g__pdfmanagement_/Catalog/OCProperties/OCGs_seq } {~} ]
- /D~\l_tmpa_tl~
- \seq_if_empty:cF { g__pdfmanagement_/Catalog/OCProperties/Configs_seq }
- {
- /Configs~
- [ \seq_use:cn { g__pdfmanagement_/Catalog/OCProperties/Configs_seq} {~} ]
- }
- }
- \exp_args:Nnx
- \__pdf_backend_catalog_gput:nn
- { OCProperties }
- { \__pdf_backend_object_ref:n {g__pdfmanagement_/Catalog/OCProperties_obj} }
- }
- }
-\cs_new_protected:cpn { __pdfmanagement_/Catalog/OutputIntents_gpush: }
- {
- \seq_if_empty:cF
- { g__pdfmanagement_/Catalog/OutputIntents_seq }
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/OutputIntents_obj } { array }
- \exp_args:Nnx
- \__pdf_backend_object_write:nn
- { g__pdfmanagement_/Catalog/OutputIntents_obj }
- { \seq_use:cn { g__pdfmanagement_/Catalog/OutputIntents_seq } {~} }
- \exp_args:Nnx
- \__pdf_backend_catalog_gput:nn
- {OutputIntents}
- {
- \__pdf_backend_object_ref:n {g__pdfmanagement_/Catalog/OutputIntents_obj}
- }
- }
- }
-\cs_new_protected:cpn { __pdfmanagement_/Catalog/Requirements_gpush: }
- {
- \seq_if_empty:cF
- { g__pdfmanagement_/Catalog/Requirements_seq }
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/Requirements_obj } { array }
- \exp_args:Nnx
- \__pdf_backend_object_write:nn
- { g__pdfmanagement_/Catalog/Requirements_obj }
- { \seq_use:cn { g__pdfmanagement_/Catalog/Requirements_seq } {~} }
- \exp_args:Nnx
- \__pdf_backend_catalog_gput:nn
- {Requirements}
- {
- \__pdf_backend_object_ref:n { g__pdfmanagement_/Catalog/Requirements_obj }
- }
- }
- }
-\cs_new_protected:cpn { __pdfmanagement_/Catalog/ViewerPreferences_gpush: }
- {
- \prop_if_empty:cF
- { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/ViewerPreferences } }
- {
- \__pdf_backend_object_new:nn { g__pdfmanagement_/Catalog/ViewerPreferences_obj } { dict }
- \exp_args:Nnx
- \__pdf_backend_object_write:nn
- { g__pdfmanagement_/Catalog/ViewerPreferences_obj }
- { \pdfdict_use:n { g__pdf_Core/Catalog/ViewerPreferences } }
- \exp_args:Nnx
- \__pdf_backend_catalog_gput:nn
- {ViewerPreferences}
- {
- \__pdf_backend_object_ref:n {g__pdfmanagement_/Catalog/ViewerPreferences_obj}
- }
- }
- }
-\pdfdict_new:n { g__pdf_Core/Catalog/Names }
-
-\cs_new_protected:cpn { __pdfmanagement_handler/Catalog/Names/EmbeddedFiles_gput:n } #1
- {
- \__pdf_backend_NamesEmbeddedFiles_add:n { #1 }
- }
-\cs_new_protected:cpn { __pdfmanagement_/Catalog/Names/EmbeddedFiles_gpush: }
- {
- \seq_if_empty:NF \g__pdf_backend_EmbeddedFiles_seq
- {
- \exp_args:Nx \__pdf_backend_NamesEmbeddedFiles_gpush:n
- {
- \seq_use:Nn \g__pdf_backend_EmbeddedFiles_seq {~}
- }
- }
- }
-\cs_new_protected:cpn {__pdfmanagement_handler/Catalog/?_show:}
- {
- \iow_term:x
- {
- \iow_newline:
- The~Catalog~contains~in~the~top~level~the~single~value~entries
- \prop_map_function:cN
- {\__kernel_pdfdict_name:n { g__pdf_Core/Catalog }}
- \msg_show_item:nn
- }
- \clist_map_inline:Nn \c__pdfmanagement_Catalog_seq_clist
- {
- \seq_if_empty:cF { g__pdfmanagement_/Catalog/##1_seq }
- {
- \iow_term:x
- {
- The~'##1'~array~contains~the~entries
- \seq_map_function:cN { g__pdfmanagement_/Catalog/##1_seq } \msg_show_item:n
- }
- }
- }
- \clist_map_inline:Nn \c__pdfmanagement_Catalog_sub_clist
- {
- \prop_if_empty:cF { \__kernel_pdfdict_name:n { g__pdf_Core/Catalog/##1 } }
- {
- \iow_term:x
- {
- The~Catalog~subdirectory~'##1'~contains~the~single~value~entries
- \prop_map_function:cN
- {\__kernel_pdfdict_name:n { g__pdf_Core/Catalog/##1 }}
- \msg_show_item:nn
- }
- }
- }
- \tl_show:x {\tl_to_str:n{\pdfmanagement_show:n{Catalog}}}
- }
-\pdfdict_new:n { g__pdf_Core/Xform/Resources/Properties}
-%% File: ltdocinit.dtx
-\msg_new:nnn { document } { setup-after-documentclass }
- {
- \token_to_str:N \DeclareDocumentMetadata \c_space_tl
- should~be~used~only~before~\token_to_str:N\documentclass
- }
-\NewDocumentCommand\DeclareDocumentMetadata { m }
- {
- \cs_if_eq:NNTF \documentclass \@twoclasseserror
- { \msg_error:nn { document }{ setup-after-documentclass } }
- {
- \keys_set_groups:nnn { document / metadata} {init}{ #1 }
- %should be loaded after the backend is set, and only if not in the kernel
- \cs_if_free:NTF \pdf_uncompress:
- {\RequirePackage{l3pdf}}{\RequirePackage{expl3}}
- \ExplSyntaxOn\makeatletter
- \file_input:n {l3backend-testphase-\c_sys_backend_str.def}
- \ExplSyntaxOff\makeatother
- \bool_gset_true:N \g__pdfmanagement_active_bool
- \keys_set_filter:nnn { document / metadata } { init } { lang=en-US, #1 }
- \bool_if:NT \g__pdfmanagement_active_bool
- {
- \PassOptionsToPackage{customdriver=hgeneric-testphase}{hyperref}
- }
- \hook_use_once:n {pdfmanagement/add}
- \RenewDocumentCommand\DeclareDocumentMetadata { m }
- {
- \keys_set_filter:nnn { document / metadata } { init } { ##1 }
- \bool_if:NTF \g__pdfmanagement_active_bool
- {
- \str_remove_all:cn {opt@hyperref.sty}{customdriver=hgeneric-testphase}
- \PassOptionsToPackage{customdriver=hgeneric-testphase}{hyperref}
- }
- {
- \str_remove_all:cn {opt@hyperref.sty}{customdriver=hgeneric-testphase}
- }
- }
- \RequirePackage{pdfmanagement-firstaid}
- }
- }
-\prop_new:N \g__pdfmanagement_documentproperties_prop %
-\NewDocumentCommand\AddToDocumentProperties{O{\@currname}mm}
- {
- \exp_args:NNx
- \prop_gput:Nnn \g__pdfmanagement_documentproperties_prop
- {
- \tl_if_blank:eTF {#1}{top-level/}{#1/} #2
- }
- { #3}
- }
-\NewExpandableDocumentCommand\GetDocumentProperties{m}
- {
- \prop_item:Nn \g__pdfmanagement_documentproperties_prop {#1}
- }
-\msg_new:nnn { pdfmanagement } { show-properties }
- {
- The~following~document~properties~have~been~stored:
- #1
- }
-\NewDocumentCommand\ShowDocumentProperties {}
- {
- \msg_show:nnx {pdfmanagement}{show-properties}
- {
- \prop_map_function:NN \g__pdfmanagement_documentproperties_prop \msg_show_item:nn
- }
- }
-\clist_new:N \g__pdfmanagement_firstaidoff_clist
-\keys_define:nn { document / metadata }
- {
- backend .code:n =
- {
- \PassOptionsToPackage { driver=#1 } {expl3}
- \AddToDocumentProperties[document]{backend}{#1}
- },
- backend .groups:n = { init } ,
- }
-
-\keys_define:nn { document / metadata }
- {
- ,pdfversion .code:n =
- {
- \pdf_version_gset:n { #1 }
- \AddToDocumentProperties[document]{pdfversion}{#1}
- }
- ,uncompress .code:n =
- {
- \pdf_uncompress:
- }
- ,uncompress .value_forbidden:n = true
- ,lang .code:n =
- {
- \pdfmanagement_add:nnn {Catalog} {Lang}{(#1)}
- \AddToDocumentProperties[document]{lang}{#1}
- }
- %,xmpmeta .bool_gset:N = \g_pdfmeta_xmp_bool %see pdfmeta unused and undefined for now!
- % this uses internal command from pdfmeta, it should probably move there ...
- ,pdfstandard .code:n =
- {
- \exp_args:Nnx
- \keys_set:nn {document / metadata} {_pdfstandard=\str_uppercase:n{#1}}
- }
- ,_pdfstandard .choices:nn =
- {A-1B,A-2B,A-3B}
- {
- \prop_if_exist:cT { g__pdfmeta_standard_pdf/#1_prop }
- {
- \prop_gset_eq:Nc \g__pdfmeta_standard_prop { g__pdfmeta_standard_pdf/#1 _prop }
- }
- \AddToDocumentProperties [document]{pdfstandard}{#1}
- }
- ,_pdfstandard / unknown .code:n =
- {
- \msg_warning:nnn{pdf}{unknown-standard}{#1}
- }
- ,pdfmanagement .bool_gset:N = \g__pdfmanagement_active_bool
- ,pdfmanagement .initial:n = {true}
- ,firstaidoff .clist_gset:N = \g__pdfmanagement_firstaidoff_clist
- }
-%% File: l3pdfannot.dtx
-\RequirePackage{l3bitset}
-\bitset_new:Nn \l_pdfannot_F_bitset
- {
- Invisible = 1,
- Hidden = 2,
- Print = 3,
- NoZoom = 4,
- NoRotate = 5,
- NoView = 6,
- ReadOnly = 7,
- Locked = 8,
- ToggleNoView = 9,
- LockedContents = 10
- }
-\bool_new:N \g__pdfannot_use_lastlink_bool
-
-\cs_new_protected:Npn \pdfannot_box:nnnn #1 #2 #3 #4
- {
- \__pdf_backend_annotation:nnnn {#1}{#2}{#3}{#4}
- \bool_gset_false:N\g__pdfannot_use_lastlink_bool
- }
-
-\cs_new:Npn \pdfannot_box_ref_last:
- {
- \__pdf_backend_annotation_last:
- }
-
-\cs_new_protected:Npn \pdfannot_box:nnnnn #1 #2 #3 #4 #5
- {
- \exp_args:Nx
- \__pdf_backend_annotation:nnnn {#2}{#3}{#4}
- {
- \pdfdict_if_exist:nT { l__pdfannot/#1 }
- {
- \pdfdict_use:n { l__pdfannot/#1}
- }
- #5
- }
- \bool_gset_false:N\g__pdfannot_use_lastlink_bool
- }
- \pdfdict_new:n { l__pdfannot/widget }
- \pdfdict_put:nnn { l__pdfannot/widget }{ Subtype }{ /Widget }
-\seq_const_from_clist:Nn \c_pdfannot_link_types_seq { URI , GoToR , Launch , GoTo, Named }
-\seq_map_inline:Nn \c_pdfannot_link_types_seq
- {
- \pdfdict_new:n { l__pdfannot/link/#1 }
- \hook_new_pair:nn
- {pdfannot/link/#1/before}
- {pdfannot/link/#1/after}
- \hook_new_pair:nn
- {pdfannot/link/#1/begin}
- {pdfannot/link/#1/end}
- }
-\cs_new_protected:Nn \pdfannot_link:nnn %#1 type (URI, GoTo etc),
- %#2 action spec, #3 link text
- {
- \hook_use:n { pdfannot/link/#1/before}
- \mode_leave_vertical:
- \exp_args:Nxx %xetex needs expansion
- \__pdf_backend_link_begin_user:nnw
- {
- \pdfdict_if_exist:nT { l__pdfannot/link/#1 }
- {
- \pdfdict_use:n { l__pdfannot/link/#1}
- }
- }
- {
- /Subtype/Link
- #2 %exp_not?
- }
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- \hook_use:n { pdfannot/link/#1/begin}
- #3
- \hook_use:n { pdfannot/link/#1/end}
- \__pdf_backend_link_end:
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- \hook_use:n { pdfannot/link/#1/after}
- }
-\cs_generate_variant:Nn \pdfannot_link:nnn {nxn}
-\cs_new_protected:Npn \pdfannot_link_begin:nnw #1 #2 %#1 type, #2 action spec
- {
- \hook_use:n { pdfannot/link/#1/before}
- \mode_leave_vertical:
- \exp_args:Nxx %xetex needs expansion
- \__pdf_backend_link_begin_user:nnw
- {
- \pdfdict_if_exist:nT { l__pdfannot/link/#1 }
- {
- \pdfdict_use:n { l__pdfannot/link/#1}
- }
- }
- { #2 }
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- \hook_use:n { pdfannot/link/#1/begin}
- }
-
-\cs_new_protected:Nn \pdfannot_link_end:n %#1 type, e.g. url
- {
- \hook_use:n { pdfannot/link/#1/end}
- \__pdf_backend_link_end:
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- \hook_use:n { pdfannot/link/#1/after}
- }
-\cs_generate_variant:Nn \pdfannot_link_begin:nnw {nxw}
-\cs_new_protected:Npn \pdfannot_link_goto_begin:nw #1 %#1 destination
- {
- \hook_use:n { pdfannot/link/GoTo/before}
- \mode_leave_vertical:
- \exp_args:Nxx %xetex needs expansion
- \__pdf_backend_link_begin_goto:nnw
- {
- \pdfdict_use:n { l__pdfannot/link/GoTo}
- }
- { #1 }
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- \hook_use:n { pdfannot/link/GoTo/begin}
- }
-
-\cs_new_protected:Nn \pdfannot_link_goto_end:
- {
- \hook_use:n { pdfannot/link/GoTo/end}
- \__pdf_backend_link_end:
- \bool_gset_true:N \g__pdfannot_use_lastlink_bool
- \hook_use:n { pdfannot/link/GoTo/after}
- }
-\cs_new:Nn \pdfannot_link_ref_last: { \__pdf_backend_link_last: }
-\cs_new:Npn \pdfannot_ref_last:
- {
- \bool_if:NTF \g__pdfannot_use_lastlink_bool
- {
- \__pdf_backend_link_last:
- }
- {
- \__pdf_backend_annotation_last:
- }
- }
-\cs_new_protected:Npn \pdfannot_link_margin:n #1
- {
- \__pdf_backend_link_margin:n { #1 }
- }
-\cs_new_protected:Npn \pdfannot_dict_put:nnn #1 #2 #3
- {
- \pdfdict_put:nnn { l__pdfannot/#1 } { #2 }{ #3 }
- }
-\cs_generate_variant:Nn \pdfannot_dict_put:nnn {nnx}
-\cs_new_protected:Npn \pdfannot_dict_remove:nn #1 #2
- {
- \pdfdict_remove:nn { l__pdfannot/#1 } { #2 }
- }
-\cs_new_protected:Npn \pdfannot_dict_show:n #1
- {
- \pdfdict_show:n { l__pdfannot/#1 }
- }
-%% File: l3pdfxform.dtx
-\cs_new_protected:Npn \pdfxform_new:nnn #1 #2 #3
- {
- \__pdf_backend_xform_new:nnnn { #1 } { #2 } { } { #3 }
- }
-\cs_new_protected:Npn \pdfxform_use:n #1
- {
- \__pdf_backend_xform_use:n { #1 }
- }
-\cs_new:Npn \pdfxform_ref:n #1
- {
- \__pdf_backend_xform_ref:n { #1 }
- }
-
-\cs_generate_variant:Nn \pdfxform_ref:n {o}
-\cs_new:Npn \pdfxform_wd:n #1
- {
- \tl_use:c { c__pdf_backend_xform_wd_ \tl_to_str:n { #1 } _tl }
- }
-
-\cs_new:Npn \pdfxform_ht:n #1
- {
- \tl_use:c { c__pdf_backend_xform_ht_ \tl_to_str:n { #1 } _tl }
- }
-
-\cs_new:Npn \pdfxform_dp:n #1
- {
- \tl_use:c { c__pdf_backend_xform_dp_ \tl_to_str:n { #1 } _tl }
- }
-%% File: l3pdfmeta.dtx
-\msg_new:nnn {pdf }{unknown-standard}{The~standard~'#1'~is~unknown~and~has~been~ignored}
-\tl_new:N\l__pdfmeta_tmpa_tl
-\tl_new:N\l__pdfmeta_tmpb_tl
-\str_new:N \l__pdfmeta_tmpa_str
-\prop_new:N \g__pdfmeta_standard_prop
-\cs_new:Npn \pdfmeta_standard_item:n #1
- {
- \prop_item:Nn \g__pdfmeta_standard_prop {#1}
- }
-\cs_new_protected:Npn \pdfmeta_standard_get:nN #1 #2
- {
- \prop_get:NnN \g__pdfmeta_standard_prop {#1} #2
- }
-\prg_new_conditional:Npnn \pdfmeta_standard_verify:n #1 {T,F,TF}
- {
- \prop_if_in:NnTF \g__pdfmeta_standard_prop {#1}
- {
- \prg_return_false:
- }
- {
- \prg_return_true:
- }
- }
-\prg_new_protected_conditional:Npnn \pdfmeta_standard_verify:nn #1 #2 {T,F,TF}
- {
- \prop_if_in:NnTF \g__pdfmeta_standard_prop {#1}
- {
- \cs_if_exist:cTF {__pdfmeta_standard_verify_handler_#1:nn}
- {
- \exp_args:Nnnx
- \use:c
- {__pdfmeta_standard_verify_handler_#1:nn}
- { #2 }
- { \prop_item:Nn \g__pdfmeta_standard_prop {#1} }
- }
- {
- \prg_return_false:
- }
- }
- {
- \prg_return_true:
- }
- }
-\cs_new_protected:Npn \__pdfmeta_standard_verify_handler_min_pdf_version:nn #1 #2
- {
- \pdf_version_compare:NnTF <
- { #2 }
- {\prg_return_false:}
- {\prg_return_true:}
- }
-
-\cs_new_protected:Npn \__pdfmeta_standard_verify_handler_named_actions:nn #1 #2
- {
- \tl_if_in:nnTF { #2 }{ #1 }
- {\prg_return_true:}
- {\prg_return_false:}
- }
-\cs_new_protected:Npn \__pdfmeta_standard_verify_handler_annot_action_A:nn #1 #2
- {
- \tl_if_in:nnTF { #2 }{ #1 }
- {\prg_return_true:}
- {\prg_return_false:}
- }
-\cs_new_protected:Npn \__pdfmeta_standard_verify_handler_outputintent_subtype:nn #1 #2
- {
- \tl_if_eq:nnTF { #2 }{ #1 }
- {\prg_return_true:}
- {\prg_return_false:}
- }
-\cs_new_protected:Npn \__pdfmeta_verify_pdfa_annot_flags:
- {
- \bitset_set_true:Nn \l_pdfannot_F_bitset {Print}
- \bitset_set_false:Nn \l_pdfannot_F_bitset {Hidden}
- \bitset_set_false:Nn \l_pdfannot_F_bitset {Invisible}
- \bitset_set_false:Nn \l_pdfannot_F_bitset {NoView}
- \pdfannot_dict_put:nnn {link/URI}{F}{ \bitset_to_arabic:N \l_pdfannot_F_bitset }
- \pdfannot_dict_put:nnn {link/GoTo}{F}{ \bitset_to_arabic:N \l_pdfannot_F_bitset }
- \pdfannot_dict_put:nnn {link/GoToR}{F}{ \bitset_to_arabic:N \l_pdfannot_F_bitset }
- \pdfannot_dict_put:nnn {link/Launch}{F}{ \bitset_to_arabic:N \l_pdfannot_F_bitset }
- \pdfannot_dict_put:nnn {link/Named}{F}{ \bitset_to_arabic:N \l_pdfannot_F_bitset }
- }
-\hook_gput_code:nnn {begindocument} {pdf}
- {
- \pdfmeta_standard_verify:nF { annot_flags }
- { \__pdfmeta_verify_pdfa_annot_flags: }
- }
-\prop_new:c { g__pdfmeta_standard_pdf/A-1B_prop }
-\prop_set_from_keyval:cn { g__pdfmeta_standard_pdf/A-1B_prop }
- {
- ,name = pdf/A-1B
- ,type = A
- ,year = 2005
- ,min_pdf_version = 1.4 %minimum
- ,no_encryption =
- ,no_external_content = % no F, FFilter, or FDecodeParms in stream dicts
- ,no_embed_content = % no EF key in filespec, no /Type/EmbeddedFiles
- ,max_string_size = 65535
- ,max_array_size = 8191
- ,max_dict_size = 4095
- ,max_obj_num = 8388607
- ,max_nest_qQ = 28
- ,named_actions = {NextPage, PrevPage, FirstPage, LastPage}
- ,annot_flags =
- %booleans. Only the existence of the key matter.
- %If the entry is added it means a requirements is there
- %(in most cases "don't use ...")
- %
- %===============
- % Rule 6.1.13-1 CosDocument, isOptionalContentPresent == false
- ,Catalog_no_OCProperties =
- %===============
- % Rule 6.6.1-1: PDAction, S == "GoTo" || S == "GoToR" || S == "Thread"
- % || S == "URI" || S == "Named" || S == "SubmitForm"
- % means: no /S/Launch, /S/Sound, /S/Movie, /S/ResetForm, /S/ImportData,
- % /S/JavaScript, /S/Hide
- ,annot_action_A = {GoTo,GoToR,Thread,URI,Named,SubmitForm}
- %===============
- % Rule 6.6.2-1: PDAnnot, Subtype != "Widget" || AA_size == 0
- % means: no AA dictionary
- ,annot_widget_no_AA =
- %===============
- % Rule 6.9-2: PDAnnot, Subtype != "Widget" || (A_size == 0 && AA_size == 0)
- % (looks like a tightening of the previous rule)
- ,annot_widget_no_A_AA =
- %===============
- % Rule 6.9-1 PDAcroForm, NeedAppearances == null || NeedAppearances == false
- ,form_no_NeedAppearances =
- %===============
- %Rule 6.9-3 PDFormField, AA_size == 0
- ,form_no_AA =
- %===============
- % to be continued https://docs.verapdf.org/validation/pdfa-part1/
- % - Outputintent/colorprofiles requirements
- % an outputintent should be loaded and is unique.
- ,outputintent_A = {GTS_PDFA1}
- % - no Alternates key in image dictionaries
- % - no OPI, Ref, Subtype2 with PS key in xobjects
- % - Interpolate = false in images
- % - no TR, TR2 in ExtGstate
- }
-
-\prop_new:c { g__pdfmeta_standard_pdf/A-2B_prop }
-\prop_gset_eq:cc
- { g__pdfmeta_standard_pdf/A-2B_prop }
- { g__pdfmeta_standard_pdf/A-1B_prop }
-\prop_gput:cnn
- { g__pdfmeta_standard_pdf/A-2B_prop }{name}{pdf/A-2B}
-\prop_gput:cnn
- { g__pdfmeta_standard_pdf/A-2B_prop }{year}{2011}
-\prop_gremove:cn
- { g__pdfmeta_standard_pdf/A-2B_prop }
- { embed_content}
-
-\prop_new:c { g__pdfmeta_standard_pdf/A-3B_prop }
-\prop_gset_eq:cc
- { g__pdfmeta_standard_pdf/A-3B_prop }
- { g__pdfmeta_standard_pdf/A-2B_prop }
-\prop_gput:cnn
- { g__pdfmeta_standard_pdf/A-3B_prop }{name}{pdf/A-3B}
-\prop_gput:cnn
- { g__pdfmeta_standard_pdf/A-2B_prop }{year}{2012}
-\prop_gremove:cn
- { g__pdfmeta_standard_pdf/A-3B_prop }
- { embed_content}
-\prop_new:N \g__pdfmeta_outputintents_prop
-\keys_define:nn { document / metadata }
- {
- colorprofiles .code:n =
- {
- \keys_set:nn { document / metadata / colorprofiles }{#1}
- }
- }
-\keys_define:nn { document / metadata / colorprofiles }
- {
- ,A .code:n =
- {
- \tl_if_blank:nF {#1}
- {
- \prop_gput:Nnn \g__pdfmeta_outputintents_prop
- { GTS_PDFA1 } {#1}
- }
- }
- ,a .code:n =
- {
- \tl_if_blank:nF {#1}
- {
- \prop_gput:Nnn \g__pdfmeta_outputintents_prop
- { GTS_PDFA1 } {#1}
- }
- }
- ,X .code:n =
- {
- \tl_if_blank:nF {#1}
- {
- \prop_gput:Nnn \g__pdfmeta_outputintents_prop
- { GTS_PDFX } {#1}
- }
- }
- ,x .code:n =
- {
- \tl_if_blank:nF {#1}
- {
- \prop_gput:Nnn \g__pdfmeta_outputintents_prop
- { GTS_PDFX } {#1}
- }
- }
- ,unknown .code:n =
- {
- \tl_if_blank:nF {#1}
- {
- \exp_args:NNo
- \prop_gput:Nnn \g__pdfmeta_outputintents_prop
- { \l_keys_key_str } {#1}
- }
- }
- }
-\pdfdict_new:n {l_pdfmeta/outputintent}
-\pdfdict_put:nnn {l_pdfmeta/outputintent}
- {Type}{/OutputIntent}
-\prop_const_from_keyval:cn { c__pdfmeta_colorprofile_sRGB.icc}
- {
- ,OutputConditionIdentifier=IEC~sRGB
- ,Info=IEC~61966-2.1~Default~RGB~colour~space~-~sRGB
- ,RegistryName=http://www.iec.ch
- ,N = 3
- }
-\prop_const_from_keyval:cn { c__pdfmeta_colorprofile_FOGRA39L_coated.icc}
- {
- ,OutputConditionIdentifier=FOGRA39L~Coated
- ,Info={Offset~printing,~according~to~ISO~12647-2:2004/Amd~1,~OFCOM,~ %
- paper~type~1~or~2~=~coated~art,~115~g/m2,~tone~value~increase~
- curves~A~(CMY)~and~B~(K)}
- ,RegistryName=http://www.fogra.org
- ,N = 4
- }
-\cs_new_protected:Npn \__pdfmeta_embed_colorprofile:n #1%#1 file name
- {
- \pdf_object_if_exist:nF { __color_icc_ #1 }
- {
- \pdf_object_new:nn { __color_icc_ #1 }{fstream}
- \pdf_object_write:nx { __color_icc_ #1 }
- {
- {/N\c_space_tl
- \prop_item:cn{c__pdfmeta_colorprofile_#1}{N}
- }
- {#1}
- }
- }
- }
-
-\cs_new_protected:Npn \__pdfmeta_write_outputintent:nn #1 #2 %#1 file name, #2 subtype
- {
- \group_begin:
- \pdfdict_put:nnx {l_pdfmeta/outputintent}{S}{/\str_convert_pdfname:n{#2}}
- \pdfdict_put:nnx {l_pdfmeta/outputintent}
- {DestOutputProfile}
- {\pdf_object_ref:n{ __color_icc_ #1 }}
- \clist_map_inline:nn { OutputConditionIdentifier, Info, RegistryName }
- {
- \prop_get:cnNT
- { c__pdfmeta_colorprofile_#1}
- { ##1 }
- \l__pdfmeta_tmpa_tl
- {
- \pdf_string_from_unicode:nVN {utf8/string}\l__pdfmeta_tmpa_tl\l__pdfmeta_tmpa_str
- \pdfdict_put:nnx
- {l_pdfmeta/outputintent}{##1}{\l__pdfmeta_tmpa_str}
- }
- }
- \pdf_object_unnamed_write:nx {dict}{\pdfdict_use:n {l_pdfmeta/outputintent} }
- \pdfmanagement_add:nnx {Catalog}{OutputIntents}{\pdf_object_ref_last:}
- \group_end:
- }
-
-\AddToHook{begindocument/end}
- {
- \pdfmeta_standard_verify:nTF {outputintent_A}
- {
- \prop_map_inline:Nn \g__pdfmeta_outputintents_prop
- {
- \__pdfmeta_embed_colorprofile:n
- {#2}
- \__pdfmeta_write_outputintent:nn
- {#2}
- {#1}
- }
- }
- {
- \exp_args:NNx
- \prop_if_in:NnF
- \g__pdfmeta_outputintents_prop
- { \pdfmeta_standard_item:n { outputintent_A } }
- {
- \exp_args:NNx
- \prop_gput:Nnn
- \g__pdfmeta_outputintents_prop
- { \pdfmeta_standard_item:n { outputintent_A } }
- { sRGB.icc }
- }
- \exp_args:NNx
- \prop_get:NnN
- \g__pdfmeta_outputintents_prop
- { \pdfmeta_standard_item:n { outputintent_A } }
- \l__pdfmeta_tmpb_tl
- \exp_args:NV \__pdfmeta_embed_colorprofile:n \l__pdfmeta_tmpb_tl
- \prop_map_inline:Nn \g__pdfmeta_outputintents_prop
- {
- \exp_args:NV
- \__pdfmeta_write_outputintent:nn
- \l__pdfmeta_tmpb_tl
- { #1 }
- }
- }
- }
-%% File: l3pdftools.dtx
-\cs_generate_variant:Nn \str_convert_pdfname:n { e }
-
-\cs_new:Npn \pdf_name_from_unicode_e:n #1
- {
- / \str_convert_pdfname:e { \text_expand:n { #1 } }
- }
-
-\cs_generate_variant:Nn \pdf_name_from_unicode_e:n {V}
-\bool_lazy_any:nTF
- {
- \sys_if_engine_luatex_p:
- \sys_if_engine_xetex_p:
- }
- {
- \prop_gput:Nnn \g__str_alias_prop { default } { }
- }
- {
- \prop_gput:Nnn \g__str_alias_prop { default } { utf8 }
- }
-\cs_new:Npn \pdf_string_from_unicode:nnN #1 #2 #3
- {
- \cs_if_exist_use:cF { __pdf_string_from_unicode_#1:nN }
- {
- \__kernel_msg_error:nnn { pdf } { unknown-convert } {#1}
- \use_none:nn
- }
- { #2 } #3
- }
-
-\cs_generate_variant:Nn \pdf_string_from_unicode:nnN {nVN}
-%% TODO Names need a review when it is clear which converters
-%% are actually needed
-%% string conversions and printing
-%% we assume here that the text purify step has been done. The input is
-%% a list of (utf8) chars.
-%% str convert, not expandable.
-
-
-\cs_new_protected:cpn { __pdf_string_from_unicode_utf8/string-raw:nN } #1 #2
- {
- \str_set_convert:Nnnn #2
- { #1 }
- { default }
- {utf8/string}
- }
-
-\cs_new_protected:cpn { __pdf_string_from_unicode_utf8/string:nN } #1 #2
- {
- \use:c { __pdf_string_from_unicode_utf8/string-raw:nN } { #1 } #2
- \str_put_left:Nn #2 {(}
- \str_put_right:Nn #2 {)}
- }
-\cs_new_protected:cpx { __pdf_string_from_unicode_utf8/URI-raw:nN } #1 #2
- {
- \exp_not:N \str_set_convert:Nnnn #2
- { #1 }
- { default }
- {utf8/url}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 3A} {:}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 2F} {/}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 23} {\c_hash_str}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 5B} {[}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 5D} {]}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 40} {\c_atsign_str}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 21} {!}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 24} {\c_dollar_str}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 26} {\c_ampersand_str}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 27} {'}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 2A} {*}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 2B} {+}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 2C} {,}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 3B} {;}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 3D} {=}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 30} {0}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 31} {1}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 32} {2}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 33} {3}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 34} {4}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 35} {5}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 36} {6}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 37} {7}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 38} {8}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 39} {9}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 28} {\c_backslash_str(}
- \exp_not:N \str_replace_all:Nnn #2 {\c_percent_str 29} {\c_backslash_str)}
- }
-
-\cs_new_protected:cpn { __pdf_string_from_unicode_utf8/URI:nN } #1 #2
- {
- \use:c { __pdf_string_from_unicode_utf8/URI-raw:nN } {#1} #2
- \str_put_left:Nn #2 {(}
- \str_put_right:Nn #2 {)}
- }
-\cs_new_protected:cpn { __pdf_string_from_unicode_utf16/string-raw:nN } #1 #2
- {
- \str_set_convert:Nnnn #2
- { #1 }
- { default }
- {utf16/string}
- }
-
-\cs_new_protected:cpn { __pdf_string_from_unicode_utf16/string:nN } #1 #2
- {
- \use:c { __pdf_string_from_unicode_utf16/string-raw:nN } {#1} #2
- \str_put_left:Nn #2 {(}
- \str_put_right:Nn #2 {)}
- }
-
-\cs_new_protected:cpn { __pdf_string_from_unicode_utf16/hex-raw:nN } #1 #2
- {
- \str_set_convert:Nnnn #2
- { #1 }
- { default }
- {utf16/hex}
- }
-
-\cs_new_protected:cpn { __pdf_string_from_unicode_utf16/hex:nN } #1 #2
- {
- \use:c { __pdf_string_from_unicode_utf16/hex-raw:nN } {#1} #2
- \str_put_left:Nn #2 {<}
- \str_put_right:Nn #2 {>}
- }
-
-\cs_new_protected:Npn \pdf_bdc:nn #1 #2 { \__pdf_backend_bdc:nn { #1 }{ #2 } }
-\cs_new_protected:Npn \pdf_bdcobject:nn #1 #2 { \__pdf_backend_bdcobject:nn { #1 }{ #2 } }
-\cs_new_protected:Npn \pdf_bdcobject:n #1 { \__pdf_backend_bdcobject:n { #1 } }
-\cs_new_protected:Npn \pdf_bmc:n #1 { \__pdf_backend_bmc:n { #1 } }
-\cs_new_protected:Npn \pdf_emc: { \__pdf_backend_emc: }
-%% File: l3pdffile.dtx
-
-\cs_new_protected:Npn \__pdffile_filename_convert_to_print:nN #1 #2
- {\pdf_string_from_unicode:nnN {utf16/hex}{#1}{#2}}
-\msg_new:nnn { pdffile } { file-not-found }
- {
- File~'\tl_to_str:n{#1}'~not~found
- }
-
-\msg_new:nnn { pdffile } { mimetype-missing }
- {
- Mime~type~not~set~for~file~'\tl_to_str:n{#1}'
- }
-
-\msg_new:nnn { pdffile } { target-name-missing }
- {
- a~target~name~for~the~/FileSpec~dictionary~is~missing.
- }
-
-\msg_new:nnn { pdffile } { object-exists }
- {
- object~name~'#1'~is~already~used.
- }
-
-\msg_new:nnn { pdffile } { show-files }
- {
- The~following~files~have~been~embedded\\
- #1
- }
-\tl_new:N \l__pdffile_tmpa_tl
-\tl_new:N \l__pdffile_tmpb_tl
-\str_new:N \l__pdffile_tmpa_str
-\str_new:N \l__pdffile_tmpb_str
-\str_new:N \l__pdffile_ext_str
-\tl_new:N \l__pdffile_automimetype_tl
-\tl_new:N \l__pdffile_embed_ref_tl
-\prop_new:N \g_pdffile_mimetypes_prop
-\prop_set_from_keyval:Nn \g_pdffile_mimetypes_prop
- {
- ,.csv = text/csv
- ,.html= text/html
- ,.dtx = text/plain %or application/x-tex, not in iana.org list
- ,.eps = application/postscript
- ,.jpg = image/jpeg
- ,.mp4 = video/mp4
- ,.pdf = application/pdf
- ,.png = image/png
- ,.tex = text/plain %or application/x-tex, not in iana.org list
- ,.txt = text/plain
- ,.sty = text/plain
- }
-\str_new:N \l_pdffile_source_name_str
-\pdfdict_new:n { l_pdffile }
-\pdfdict_put:nnn { l_pdffile }{Type}{/EmbeddedFile}
-\pdfdict_new:n { l_pdffile/Params }
-\pdfdict_put:nnn { l_pdffile/Params }
- {ModDate} { (\file_timestamp:n { \l_pdffile_source_name_str }) }
-\pdfdict_put:nnn { l_pdffile/Params }
- {Size} { \file_size:n { \l_pdffile_source_name_str } }
-\pdfdict_put:nnn { l_pdffile/Params }
- {CheckSum} { (\file_mdfive_hash:n { \l_pdffile_source_name_str }) }
-\pdfdict_new:n { l_pdffile/streamParams }
-\pdfdict_put:nnn { l_pdffile/streamParams }
- {ModDate} {
- (
- D:\int_use:N\c_sys_year_int
- \int_compare:nNnT{\c_sys_month_int}<{10}{0}
- \int_use:N\c_sys_month_int
- \int_compare:nNnT{\c_sys_day_int}<{10}{0}
- \int_use:N\c_sys_day_int
- )
- }
-\pdfdict_new:n { l_pdffile/FileSpec }
-\pdfdict_put:nnn { l_pdffile/FileSpec }
- {Type} { /FileSpec }
-\pdfdict_put:nnn { l_pdffile/FileSpec }
- {AFRelationship} { /Unspecified }
-
-\prop_new:N \g_pdffile_embed_prop
-\cs_new_protected:Npn \pdffile_embed_show:
- {
- \msg_show:nnx
- {pdffile}{show-files}
- {
- \prop_map_function:NN {\g_pdffile_embed_prop} \msg_show_item:nn
- }
- }
-\cs_new_protected:Npn \__pdffile_mimetype_set:nN #1 #2
- {
- \file_parse_full_name:nNNN
- {#1}
- \l__pdffile_tmpa_str %unused
- \l__pdffile_tmpb_str %unused
- \l__pdffile_ext_str
- %check if Subtype has been set
- \pdfdict_get:nnN { l_pdffile}{Subtype}\l__pdffile_tmpa_tl
- %if not look up in the prop:
- \quark_if_no_value:NT \l__pdffile_tmpa_tl
- {
- \prop_get:NVNTF
- \g_pdffile_mimetypes_prop
- \l__pdffile_ext_str
- \l__pdffile_tmpb_tl
- {
- \tl_set:Nx #2 {/Subtype~\pdf_name_from_unicode_e:V \l__pdffile_tmpb_tl}
- }
- {
- \msg_warning:nnx { pdffile }{ mimetype-missing} {#1}
- \tl_clear:N #2
- }
- }
- }
-
-\cs_generate_variant:Nn \__pdffile_mimetype_set:nN {VN}
-
-\cs_new_protected:Npn \__pdffile_fstream_write:nN #1 #2
- {
- \pdf_object_unnamed_write:nx { fstream }
- {
- {
- #2
- \pdfdict_use:n { l_pdffile}
- \pdfdict_if_empty:nF { l_pdffile/Params}
- {
- /Params
- <<
- \pdfdict_use:n { l_pdffile/Params}
- >>
- }
- }
- { #1 }
- }
- \tl_clear:N \l__pdffile_automimetype_tl
- }
-
-\cs_generate_variant:Nn \__pdffile_fstream_write:nN {VN}
-
-\cs_new_protected:Npn \__pdffile_stream_write:nN #1 #2
- {
- \pdf_object_unnamed_write:nx { stream }
- {
- {
- #2
- \pdfdict_use:n { l_pdffile}
- \pdfdict_if_empty:nF { l_pdffile/streamParams}
- {
- /Params
- <<
- \pdfdict_use:n { l_pdffile/streamParams}
- >>
- }
- }
- { \exp_not:n { #1 } }
- }
- \tl_clear:N \l__pdffile_automimetype_tl
- }
-
-\cs_generate_variant:Nn \__pdffile_stream_write:nN {VN}
-
-\cs_new_protected:Npn \__pdffile_filespec_write:nnn #1 #2 #3
- {
- \tl_if_blank:nT { #2 }
- {
- \msg_error:nn {pdffile}{target-name-missing}
- }
- {
- \pdf_object_new:nn { #1 } {dict}
- \group_begin:
- \__pdffile_filename_convert_to_print:nN { #2 } \l__pdffile_tmpa_str
- \pdfdict_put:nnx {l_pdffile/FileSpec}{F} { \l__pdffile_tmpa_str }
- \pdfdict_put:nnx {l_pdffile/FileSpec}{UF}{ \l__pdffile_tmpa_str }
- \pdf_object_write:nx { #1 }
- {
- \pdfdict_use:n { l_pdffile/FileSpec}
- \tl_if_empty:nF { #3 }
- {
- /EF <</F~#3 /UF~#3>>
- }
- }
- \group_end:
- }
- }
-
-\cs_new_protected:Npn \pdffile_embed_file:nnn #1 #2 #3
- { % if #1 empty => only filespec
- % if #2 empty => = #1
- \pdf_object_if_exist:nTF { #3 }
- {
- \msg_error:nnn { pdffile }{ object-exists } { #3 }
- }
- {
- \tl_if_blank:nTF { #1 }
- {
- \tl_set:Nn \l__pdffile_embed_ref_tl {}
- }
- {
- \file_get_full_name:nNTF {#1} \l_pdffile_source_name_str
- {
- \__pdffile_mimetype_set:VN
- \l_pdffile_source_name_str
- \l__pdffile_automimetype_tl
- \__pdffile_fstream_write:VN
- \l_pdffile_source_name_str
- \l__pdffile_automimetype_tl
- \tl_set:Nx \l__pdffile_embed_ref_tl { \pdf_object_ref_last: }
- }
- {
- \msg_error:nnn { pdffile }{ file-not-found }{ #1 }
- }
-
- }
- \prop_gput:Nnx
- \g_pdffile_embed_prop
- { #3 }
- {
- { \tl_if_blank:nTF { #1 } {filespec}{file} }
- {\l_pdffile_source_name_str}
- {
- \tl_if_blank:nTF { #2 }
- { \l_pdffile_source_name_str }
- { \tl_to_str:n{#2}}
- }
- }
- \tl_if_blank:nTF { #2 }
- {
- \exp_args:Nnnx
- \__pdffile_filespec_write:nnn
- %#1 dict, #2 target file name, #3 object ref
- { #3 }
- { #1 }
- {\l__pdffile_embed_ref_tl}
- }
- {
- \exp_args:Nnnx
- \__pdffile_filespec_write:nnn
- %#1 dict, #2 target file name, #3 object ref
- { #3 }
- { #2 }
- {\l__pdffile_embed_ref_tl}
- }
- }
- }
-
-\cs_new_protected:Npn \pdffile_embed_stream:nnn #1 #2 #3
- {
- % if #2 empty => error
- \pdf_object_if_exist:nTF { #3 }
- {
- \msg_error:nnn { pdffile }{ object-exists } { #3 }
- }
- {
- \prop_gput:Nnx
- \g_pdffile_embed_prop
- { #3 }
- {{stream}{}{\tl_if_blank:nTF {#2}{stream.txt}{\exp_not:n{#2}}}}
- \tl_if_blank:nTF {#2}
- { \__pdffile_mimetype_set:nN {stream.txt}\l__pdffile_automimetype_tl}
- { \__pdffile_mimetype_set:nN { #2 } \l__pdffile_automimetype_tl }
- \__pdffile_stream_write:nN
- { #1 }
- \l__pdffile_automimetype_tl
- \tl_set:Nx \l__pdffile_embed_ref_tl { \pdf_object_ref_last: }
- \exp_args:Nnxx
- \__pdffile_filespec_write:nnn
- %#1 dict, #2 target file name, #3 object ref
- { #3 }
- { \tl_if_blank:nTF {#2}{stream.txt}{\exp_not:n{#2}} }
- {\l__pdffile_embed_ref_tl}
- }
- }
-
-%%
-%%
-%% End of file `pdfmanagement-testphase.ltx'.