diff options
author | Karl Berry <karl@freefriends.org> | 2019-05-03 22:30:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-05-03 22:30:21 +0000 |
commit | 14849b2636be5c6ff3c2800ef9e5428ce3a83722 (patch) | |
tree | c2918f559dd3fc59bd36af5e5e078ecded5a6f96 /Master/texmf-dist | |
parent | 6c87d764952f4d6eb0d273c68f6033a0b5536fdb (diff) |
media9 (3may19)
git-svn-id: svn://tug.org/texlive/trunk@50973 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/media9/ChangeLog | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/media9/media9.pdf | bin | 3748366 -> 3748721 bytes | |||
-rw-r--r-- | Master/texmf-dist/tex/latex/media9/media9.sty | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/media9/pdfbase.sty | 342 |
4 files changed, 265 insertions, 86 deletions
diff --git a/Master/texmf-dist/doc/latex/media9/ChangeLog b/Master/texmf-dist/doc/latex/media9/ChangeLog index bc5abf6b2dc..cdba72644de 100644 --- a/Master/texmf-dist/doc/latex/media9/ChangeLog +++ b/Master/texmf-dist/doc/latex/media9/ChangeLog @@ -1,3 +1,8 @@ +2019-05-02 + * v0.97 : media9.sty + * v0.28 : pdfbase.sty + * new : pdfbase.sty: PDF Link destinations (doc level navigation) + 2019-02-21 * v0.96 : media9.sty * v0.27 : pdfbase.sty diff --git a/Master/texmf-dist/doc/latex/media9/media9.pdf b/Master/texmf-dist/doc/latex/media9/media9.pdf Binary files differindex 574c375775d..e7a1615d47e 100644 --- a/Master/texmf-dist/doc/latex/media9/media9.pdf +++ b/Master/texmf-dist/doc/latex/media9/media9.pdf diff --git a/Master/texmf-dist/tex/latex/media9/media9.sty b/Master/texmf-dist/tex/latex/media9/media9.sty index d958d842f7d..2c0faa25a9c 100644 --- a/Master/texmf-dist/tex/latex/media9/media9.sty +++ b/Master/texmf-dist/tex/latex/media9/media9.sty @@ -37,8 +37,8 @@ \RequirePackage{xparse} \RequirePackage{atbegshi} -\def\g@mix@date@tl{2019/02/21} -\def\g@mix@version@tl{0.96} +\def\g@mix@date@tl{2019/05/02} +\def\g@mix@version@tl{0.97} \def\g@mix@liiikerneldate{2019/02/15} \def\g@mix@liiipkgdate{2018/10/17} diff --git a/Master/texmf-dist/tex/latex/media9/pdfbase.sty b/Master/texmf-dist/tex/latex/media9/pdfbase.sty index 56563dd4e7b..49dfcbcf049 100644 --- a/Master/texmf-dist/tex/latex/media9/pdfbase.sty +++ b/Master/texmf-dist/tex/latex/media9/pdfbase.sty @@ -69,6 +69,12 @@ % % -------- % +% \pbs_pdfdest:nnnn +% #1: name, #2: fit | fitb | fitbh | fith | fitbv | fitv | xyz | fitr +% #3: zoom, #4: text +% +% -------- +% % \pbs_pdfxform:nnnnn % #1: add pgf/tikz resources (transparency, shading)? (1|0) %dvipdfmx/xetex % #2: used as PDF annotation appearance? (1|0) %dvips/pdftex @@ -151,8 +157,8 @@ \RequirePackage{expl3} \RequirePackage{l3keys2e} -\def\g@pbs@date@tl{2019/02/21} -\def\g@pbs@version@tl{0.27} +\def\g@pbs@date@tl{2019/05/02} +\def\g@pbs@version@tl{0.28} \ProvidesExplPackage{pdfbase}{\g@pbs@date@tl}{\g@pbs@version@tl} {driver independent access to low-level PDF features} @@ -348,6 +354,7 @@ \pdfobj~reserveobjnum }{ \str_case:nn{#2}{ + {generic}{\immediate\pdfobj~\l_pbs_usenum_tl~{#3}} {dict}{\immediate\pdfobj~\l_pbs_usenum_tl~{<<#3>>}} {array}{\immediate\pdfobj~\l_pbs_usenum_tl~{[#3]}} {stream}{\immediate\pdfobj~\l_pbs_usenum_tl~stream~ @@ -362,30 +369,49 @@ } \cs_new_protected_nopar:Nn\pbs_pdfannot:nnnn{ - %dumb dummy Widget, workaround for AR bug; - %see https://forums.adobe.com/message/5787612#5787612 - \str_if_eq_x:nnF{\cs_if_exist_use:N\ocgbase_insert_oc:}{}{ - \immediate\pdfannot~width~3pt~height~3pt~depth~\c_zero_dim { - /Ff~65537/FT/Btn/Subtype/Widget - } - } \immediate\pdfannot~width~#1~height~#2~depth~#3 { \cs_if_exist_use:N\ocgbase_insert_oc:~#4} \tl_gset:Nx\g_pbs_pdflastann_tl{\the\pdflastannot\space 0~R} } \cs_new_protected:Nn\pbs_pdflink:nn{ - %dumb dummy Widget, workaround for AR bug; - %see https://forums.adobe.com/message/5787612#5787612 - \str_if_eq_x:nnF{\cs_if_exist_use:N\ocgbase_insert_oc:}{}{ - \immediate\pdfannot~width~3pt~height~3pt~depth~\c_zero_dim { - /Ff~65537/FT/Btn/Subtype/Widget - } - } + \leavevmode \immediate\pdfstartlink~user~{ \cs_if_exist_use:N\ocgbase_insert_oc:~#1}#2\pdfendlink } + \cs_new_protected:Nn\pbs_pdfdest:nnnn{ + \leavevmode + \str_case:nnTF{#2}{ + {fit}{} + {fitb}{} + {fitbv}{} + {fitv}{} + }{ + \pdfdest~name~{#1}~#2~#4 + }{ + \group_begin: + \hbox_set:Nn\l_tmpa_box{#4} + \str_case:nnTF{#2}{ + {fitbh}{\tl_set:Nn\l_pbs_fittype_tl{#2}} + {fith}{\tl_set:Nn\l_pbs_fittype_tl{#2}} + {xyz}{\tl_set:Nn\l_pbs_fittype_tl{#2~zoom~\int_eval:n{#3*1000}}} + }{ + \box_move_up:nn{\box_ht:N\l_tmpa_box}{\hbox:n{ + \pdfdest~name~{#1}~\l_pbs_fittype_tl + }}#4 + }{ + \pdfdest~name~{#1}~fitr~ + width~\box_wd:N\l_tmpa_box~ + height~\box_ht:N\l_tmpa_box~ + depth~\box_dp:N\l_tmpa_box + \box_use:N\l_tmpa_box + } + \box_clear:N\l_tmpa_box + \group_end: + } + } + \cs_new_protected_nopar:Nn\pbs_pdfxform:nnnnn{ % #1 not used %additional resources \tl_set:Nx\l_tmpa_tl{\the\pdfpageresources~#3}\tl_trim_spaces:N\l_tmpa_tl @@ -528,6 +554,7 @@ } \tl_if_blank:oF{#3}{ \str_case:nn{#2}{ + {generic}{\special{pdf:obj~\l_pbs_usenum_tl\space #3}} {dict}{\special{pdf:obj~\l_pbs_usenum_tl\space<<#3>>}} {array}{\special{pdf:obj~\l_pbs_usenum_tl\space[#3]}} {stream}{\special{pdf:stream~\l_pbs_usenum_tl\space @@ -548,13 +575,6 @@ \bool_if:NTF\g_pbs_lscape_bool{ %fix missing annotation rotation of (x)dvipdfmx on landscape pages \box_move_up:nn{\dim_eval:n{#2}}{\vbox:n{ - %dumb dummy Widget, workaround for AR bug; - %see https://forums.adobe.com/message/5787612#5787612 - \str_if_eq_x:nnF{\cs_if_exist_use:N\ocgbase_insert_oc:}{}{ - \special{pdf:ann~ - width~3pt~height~3pt~depth~0pt~<</Ff~65537/FT/Btn/Subtype/Widget>> - } - } \special{pdf:ann~@pbs@obj\int_use:N\g_pbs_obj_int\space width~\dim_eval:n{#2+#3}\space height~\dim_eval:n{#1}\space @@ -563,13 +583,6 @@ } }} }{ - %dumb dummy Widget, workaround for AR bug; - %see https://forums.adobe.com/message/5787612#5787612 - \str_if_eq_x:nnF{\cs_if_exist_use:N\ocgbase_insert_oc:}{}{ - \special{pdf:ann~ - width~3pt~height~3pt~depth~0pt~<</Ff~65537/FT/Btn/Subtype/Widget>> - } - } \special{pdf:ann~@pbs@obj\int_use:N\g_pbs_obj_int\space width~\dim_eval:n{#1}\space height~\dim_eval:n{#2}\space @@ -581,17 +594,51 @@ } \cs_new_protected:Nn\pbs_pdflink:nn{ - %dumb dummy Widget, workaround for AR bug; - %see https://forums.adobe.com/message/5787612#5787612 - \str_if_eq_x:nnF{\cs_if_exist_use:N\ocgbase_insert_oc:}{}{ - \special{pdf:ann~ - width~3pt~height~3pt~depth~0pt~<</Ff~65537/FT/Btn/Subtype/Widget>> - } - } + \leavevmode \special{pdf:bann~<<\cs_if_exist_use:N\ocgbase_insert_oc:~#1>>}#2 \special{pdf:eann} } + \cs_new_protected:Nn\pbs_pdfdest:nnnn{ + \leavevmode + \str_case:nnTF{#2}{ + {fit}{\tl_set:Nn\l_pbs_fittype_tl{/Fit}} + {fitb}{\tl_set:Nn\l_pbs_fittype_tl{/FitB}} + {fitbv}{\tl_set:Nn\l_pbs_fittype_tl{/FitBV~@xpos}} + {fitv}{\tl_set:Nn\l_pbs_fittype_tl{/FitV~@xpos}} + }{ + \special{pdf:~dest~(#1)~[~@thispage~\l_pbs_fittype_tl]}#4 + }{ + \group_begin: + \hbox_set:Nn\l_tmpa_box{#4} + \str_case:nnTF{#2}{ + {fitbh}{\tl_set:Nn\l_pbs_fittype_tl{/FitBH~@ypos}} + {fith}{\tl_set:Nn\l_pbs_fittype_tl{/FitH~@ypos}} + {xyz}{\tl_set:Nn\l_pbs_fittype_tl{/XYZ~@xpos~@ypos~#3}} + }{ + \box_move_up:nn{\box_ht:N\l_tmpa_box}{\hbox:n{ + \special{pdf:~dest~(#1)~[~@thispage~\l_pbs_fittype_tl]} + }}#4 + }{ % FitR + \box_move_down:nn{\box_dp:N\l_tmpa_box}{\hbox:n{ + \pbs_pdfobj:nnn{}{generic}{@xpos} + \tl_gset_eq:NN\g_pbs_llx_tl\g_pbs_pdflastobj_tl + \pbs_pdfobj:nnn{}{generic}{@ypos} + \tl_gset_eq:NN\g_pbs_lly_tl\g_pbs_pdflastobj_tl + }} + \box_use:N\l_tmpa_box + \box_move_up:nn{\box_ht:N\l_tmpa_box}{\hbox:n{ + \special{pdf:~dest~(#1)~[@thispage~ + /FitR~ + \g_pbs_llx_tl\space\g_pbs_lly_tl\space @xpos~@ypos + ]} + }} + } + \box_clear:N\l_tmpa_box + \group_end: + } + } + \cs_new_protected_nopar:Nn\pbs_pdfxform:nnnnn{ % #2 not used \begin{picture}(0,0) \put(0,0){ @@ -754,13 +801,32 @@ \special{!~ %keeping track of xform nesting level true~setglobal~globaldict~/pbs@xform@level~0~put~false~setglobal - } + %back-transforms user coords to page coords (bigpoints with reference + %point [0,0] in the bottom-left page corner) + % user_x user_y pbs@user2page --> page_x page_y + /pbs@user2page~{ + 0~begin~% make everything local in here + /y~exch~def~/x~exch~def~ + matrix~currentmatrix~ + matrix~defaultmatrix~ + matrix~invertmatrix~ + matrix~concatmatrix~cvx~exec~ + /ty~exch~def~/tx~exch~def~ + /d~exch~def~/c~exch~def~ + /b~exch~def~/a~exch~def~ + x~a~mul~y~c~mul~add~tx~add~ + x~b~mul~y~d~mul~add~ty~add~ + end + }~def~ + /pbs@user2page~load~0~1~dict~put % insert dict at index 0; + } % dict is allocated only once } + \cs_new:Nn\pbs_special:n{\special{ps:~SDict~begin~#1~end}} \bool_if:NT\g_pbs_pkgbigfiles_bool{ \special{psfile=\jobname.pbsdat} %open auxiliary file \jobname.pbsdat for writing hex encoded streams of - %the files to be embedded. This file is inserted into PS during dvips run + %the files to be embedded. This file is inserted into PS during dvips. \iow_new:N\g_pbs_mstreams_stream \iow_open:Nn\g_pbs_mstreams_stream{\jobname.pbsdat} \iow_now:Nn\g_pbs_mstreams_stream{ @@ -775,7 +841,7 @@ %insert literal Postscript code \cs_new_protected_nopar:Nn\pbs_literal:nn{ % #1: empty (`'), `direct' or `page' - \str_if_eq:nnTF{#1}{}{ % #2: raw Postscript + \str_if_eq:nnTF{#1}{}{ % #2: raw Postscript % set current location's coordinates to (0,0) and set unit vectors to % 1bp right and 1bp upwards; graphics state is saved before and % re-instated after insertion @@ -795,6 +861,11 @@ }{ \tl_set:Nx\l_pbs_usenum_tl{#1} } + \str_if_eq:nnT{#2}{generic}{ + \msg_interrupt:nnn{pdfbase~error}{ + generic~object~creation~not~supported~by~PDFmarks + }{} + } \tl_if_blank:oF{#3}{ \bool_if:nTF{ \g_pbs_pkgbigfiles_bool && @@ -804,8 +875,9 @@ M9D~begin~o\l_pbs_usenum_tl O } }{ - \special{ps:~mark~/_objdef~\l_pbs_usenum_tl\space/type + \pbs_special:n{mark~/_objdef~\l_pbs_usenum_tl\space/type \str_case:nn{#2}{ + {generic}{} {dict}{/dict} {array}{/array} {stream}{/stream} @@ -815,13 +887,14 @@ } } \str_case:nn{#2}{ - {dict}{\special{ps:~mark~\l_pbs_usenum_tl~<<#3>>/PUT~pdfmark}} + {generic}{} + {dict}{\pbs_special:n{mark~\l_pbs_usenum_tl~<<#3>>/PUT~pdfmark}} {array}{ - \special{ps:~mark~\l_pbs_usenum_tl~0~[#3]/PUTINTERVAL~pdfmark} + \pbs_special:n{mark~\l_pbs_usenum_tl~0~[#3]/PUTINTERVAL~pdfmark} } - {stream}{\special{ps::[nobreak] - ~mark~\l_pbs_usenum_tl~(\pbs_second_of_two:nn#3)/PUT~pdfmark~ - ~mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>/PUT~pdfmark + {stream}{\special{ps::[nobreak]~SDict~begin~ + mark~\l_pbs_usenum_tl~(\pbs_second_of_two:nn#3)/PUT~pdfmark~ + mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>/PUT~pdfmark~end }} {fstream}{ \tl_set:Nn\l_pbs_offset_tl{0} @@ -840,7 +913,7 @@ })P } }{ - \special{ps: + \pbs_special:n{ mark~ \l_pbs_usenum_tl~ (\pbs_filedump:nnn{\l_pbs_offset_tl}{32767}{ @@ -859,7 +932,7 @@ m\l_pbs_usenum_tl~C~end } }{ - \special{ps: + \pbs_special:n{ mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>~/PUT~pdfmark~ mark~\l_pbs_usenum_tl~/CLOSE~pdfmark } @@ -876,28 +949,15 @@ \dim_set:Nn\unitlength{1pt} \begin{picture}(0,0)% mark annotation rectangle \put(0,-\dim_to_decimal:n{#3}){ - \special{ps:~currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def} + \pbs_special:n{currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def} } \put(\dim_to_decimal:n{#1},\dim_to_decimal:n{#2}){ - \special{ps:~currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def} + \pbs_special:n{currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def} } \end{picture} \group_end: - %dumb dummy Widget, workaround for AR bug; - %see https://forums.adobe.com/message/5787612#5787612 - \str_if_eq_x:nnF{\cs_if_exist_use:N\ocgbase_insert_oc:}{}{ - \special{ps: - mark~ - /_objdef~{pbs@obj\int_use:N\g_pbs_obj_int} - /Rect~[pbs@llx~pbs@lly~pbs@urx~pbs@ury] - /Ff~65537/FT/Btn/Subtype/Widget - /ANN~pdfmark - } - \int_gincr:N\g_pbs_obj_int - } - %the actual annotation \str_if_eq_x:nnF{#4}{}{ - \special{ps: + \pbs_special:n{ mark~ /_objdef~{pbs@obj\int_use:N\g_pbs_obj_int} /Rect~[pbs@llx~pbs@lly~pbs@urx~pbs@ury] @@ -910,9 +970,7 @@ } \cs_new_protected:Nn\pbs_pdflink:nn{ - %dumb dummy Widget, workaround for AR bug; - %see https://forums.adobe.com/message/5787612#5787612 - \pbs_pdfannot:nnnn{3pt}{3pt}{0pt}{} + \leavevmode \cs_if_exist:NTF\pdfmark{ \pdfmark[#2]{pdfmark=/ANN,Raw={ \cs_if_exist_use:N\ocgbase_insert_oc:~#1}} @@ -927,6 +985,100 @@ } } + \cs_new_protected:Nn\pbs_pdfdest:nnnn{ + \leavevmode + \group_begin: + %write destination page number to aux + \iow_shipout_x:Nn\@mainaux{ + \token_to_str:N\pbs@newkey{pbs@#1@destpage}{\int_use:N\g_pbs_page_int} + } + \cs_if_exist:cF{pbs@#1@destpage}{ + \tl_set:cn{pbs@#1@destpage}{0} + \cs_if_exist:NF\g_pbs_rerunwarned_tl{ + \tl_new:N\g_pbs_rerunwarned_tl + \msg_warning:nn{pdfbase}{rerun} + } + } + \str_case:nnTF{#2}{ + {fit}{\tl_set:Nn\l_pbs_fittype_tl{/Fit}} + {fitb}{\tl_set:Nn\l_pbs_fittype_tl{/FitB}} + }{ + \pbs_special:n{ + mark~/Dest~(#1)~cvn~/Page~\tl_use:c{pbs@#1@destpage}~/View~[ + \l_pbs_fittype_tl + ]~/DEST~pdfmark + } + #4 + }{ + \hbox_set:Nn\l_tmpa_box{#4} + %mark anchor/view rect, insert text, insert destination + \str_case:nnTF{#2}{ + {fitbh}{\tl_set:Nn\l_pbs_fittype_tl{/FitBH}} + {fith}{\tl_set:Nn\l_pbs_fittype_tl{/FitH}} + }{ + \box_move_up:nn{\box_ht:N\l_tmpa_box}{\hbox:n{ + \pbs_special:n{ + currentpoint~pbs@user2page~/pbs@top~exch~def~pop~ + mark~/Dest~(#1)~cvn~/Page~\tl_use:c{pbs@#1@destpage}~/View~[ + \l_pbs_fittype_tl\space pbs@top + ]~/DEST~pdfmark + } + }} + #4 + }{ + \str_case:nnTF{#2}{ + {fitbv}{\tl_set:Nn\l_pbs_fittype_tl{/FitBV}} + {fitv}{\tl_set:Nn\l_pbs_fittype_tl{/FitV}} + }{ + \pbs_special:n{ + currentpoint~pbs@user2page~pop~/pbs@left~exch~def~ + mark~/Dest~(#1)~cvn~/Page~\tl_use:c{pbs@#1@destpage}~/View~[ + \l_pbs_fittype_tl\space pbs@left + ]~/DEST~pdfmark + } + #4 + }{ + \str_case:nn{#2}{ + {xyz}{ + \box_move_up:nn{\box_ht:N\l_tmpa_box}{\hbox:n{ + \pbs_special:n{ + currentpoint~pbs@user2page~ + /pbs@top~exch~def~/pbs@left~exch~def~ + mark~/Dest~(#1)~cvn~/Page~\tl_use:c{pbs@#1@destpage}~ + /View~[ + /XYZ~pbs@left~pbs@top~#3 + ]~/DEST~pdfmark + } + }} + #4 + } + {fitr}{ + \box_move_down:nn{\box_dp:N\l_tmpa_box}{\hbox:n{ + \pbs_special:n{ + currentpoint~pbs@user2page~ + /pbs@lly~exch~def~/pbs@llx~exch~def + } + }} + \box_use:N\l_tmpa_box + \box_move_up:nn{\box_ht:N\l_tmpa_box}{\hbox:n{ + \pbs_special:n{ + currentpoint~pbs@user2page~ + /pbs@ury~exch~def~/pbs@urx~exch~def~ + mark~/Dest~(#1)~cvn~/Page~\tl_use:c{pbs@#1@destpage}~ + /View~[ + /FitR~pbs@llx~pbs@lly~pbs@urx~pbs@ury + ]~/DEST~pdfmark + } + }} + } + } + } + } + \box_clear:N\l_tmpa_box + } + \group_end: + } + \msg_set:nnn{pdfbase}{content~too~large}{ Line~\msg_line_number: :\\ Content~exceeds~paper~size~(width~and/or~height)\\ @@ -936,7 +1088,7 @@ \cs_new_protected_nopar:Nn\pbs_pdfxform:nnnnn{ % #1, #3 not used (resources are %this allows nesting \pbs_pdfxform:nnnnn{...} % managed by pdfmarks) - \special{ps: + \pbs_special:n{ gsave~ pbs@xform@level~0~eq~{/pbs@ctm@0~matrix~currentmatrix~def}~if~ pbs@ctm@0~setmatrix~ @@ -959,7 +1111,7 @@ \dim_set:Nn\unitlength{1pt} \begin{picture}(0,0) \put(0,-\dim_to_decimal:n{\box_dp:N#5}){ - \special{ps: + \pbs_special:n{ currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def } } @@ -967,7 +1119,7 @@ \dim_to_decimal:n{\box_wd:N#5}, \dim_to_decimal:n{\box_ht:N#5} ){ - \special{ps: + \pbs_special:n{ currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def } } @@ -975,7 +1127,7 @@ \group_end: %additional dict entries \tl_set:Nx\l_tmpa_tl{#4} \tl_trim_spaces:N\l_tmpa_tl - \special{ps: + \pbs_special:n{ gsave~ currentpoint~/pbs@cury~exch~def~/pbs@curx~exch~def~ %translate graphics to upper left page corner @@ -1023,10 +1175,10 @@ } } \begin{picture}(0,0)\put(0,0){\box_use:N#5}\end{picture} - \special{ps:~mark~/EP~pdfmark~grestore} + \pbs_special:n{~mark~/EP~pdfmark~grestore} %insert additional dict entries (the Ghostscript way) \str_if_eq_x:nnF{\l_tmpa_tl}{}{ - \special{ps: + \pbs_special:n{ product~(Ghostscript)~search~{ pop~pop~pop~ mark~{pbs@obj\int_use:N\g_pbs_obj_int}~<<\l_tmpa_tl>>~/PUT~pdfmark @@ -1042,10 +1194,12 @@ %option `-Ppdf'. \tl_if_exist:NF\g_pbs_dpiwarned_tl{ \tl_new:N\g_pbs_dpiwarned_tl - \pbs_at_end_dvi:n{\special{ps::[nobreak]\pbs_dpiwarning:}} + \pbs_at_end_dvi:n{ + \special{ps::[nobreak]~SDict~begin~\pbs_dpiwarning:\space end} + } } } - \special{ps: + \pbs_special:n{ true~setglobal~ globaldict~/pbs@xform@level~pbs@xform@level~1~sub~put~ false~setglobal~ @@ -1059,9 +1213,11 @@ %require 9.15. \tl_if_exist:NF\g_pbs_gsoldwarned_tl{ \tl_new:N\g_pbs_gsoldwarned_tl - \pbs_at_end_dvi:n{\special{ps::[nobreak]\pbs_gsoldwarning:}} + \pbs_at_end_dvi:n{ + \special{ps::[nobreak]~SDict~begin~\pbs_gsoldwarning:\space end} + } } - \special{ps: + \pbs_special:n{ gsave~currentpoint~translate~1~\tl_use:c{scale_#1}~div~dup~scale~ mark~#1~/SP~pdfmark~grestore } @@ -1074,11 +1230,11 @@ \str_if_eq_p:Vn\l_pbs_ext_tl{ps} ||\str_if_eq_p:Vn\l_pbs_ext_tl{eps} }{ - \special{ps: + \pbs_special:n{ mark~/_objdef~{pbs@obj\int_use:N\g_pbs_obj_int}~/NI~pdfmark } \special{psfile=#1~hsize=0~vsize=0} - \special{ps: + \pbs_special:n{ { 0~0~1~[1~0~0~1~0~0]~{}~image~%empty dummy, in case #1 is not }?pdfmark %a valid raster image file @@ -1093,20 +1249,22 @@ } \cs_new_protected_nopar:Nn\pbs_pdfcatalog:n{ - \special{ps:~mark~{Catalog}~<<#1>>~/PUT~pdfmark} + \pbs_special:n{~mark~{Catalog}~<<#1>>~/PUT~pdfmark} } %marked content BDC/EMC operators %require Ghostscript v. >= 9.15 \cs_new_protected_nopar:Nn\pbs_pdfbdc:nn{ - \special{ps:~mark~#1~#2~/BDC~pdfmark} + \pbs_special:n{~mark~#1~#2~/BDC~pdfmark} \tl_if_exist:NF\g_pbs_gsoldwarned_tl{ \tl_new:N\g_pbs_gsoldwarned_tl - \pbs_at_end_dvi:n{\special{ps::[nobreak]\pbs_gsoldwarning:}} + \pbs_at_end_dvi:n{ + \special{ps::[nobreak]~SDict~begin~\pbs_gsoldwarning:\space end} + } } } - \cs_new_nopar:Nn\pbs_pdfemc:{\special{ps:~mark~/EMC~pdfmark}} - } + \cs_new_nopar:Nn\pbs_pdfemc:{\pbs_special:n{~mark~/EMC~pdfmark}} + } } } @@ -1163,6 +1321,10 @@ \RequirePackage{atbegshi} \AtBeginDocument{ + \bool_new:N\g_pbs_ocgbase_loaded_bool + \@ifpackageloaded{ocgbase}{ + \bool_gset_true:N\g_pbs_ocgbase_loaded_bool + }{} \AtBeginShipout{ \AtBeginShipoutAddToBoxForeground{ %insert /Properties into current page's resources @@ -1172,6 +1334,18 @@ \seq_map_variable:NNn\g_pbs_eod_seq\l_tmpa_tl{\l_tmpa_tl} } } + \AtBeginShipoutUpperLeft{ + % workaround for curious AR bug (pdf annot or link placed on + % OCG remains active when OCG is hidden) + % see https://forums.adobe.com/message/5787612#5787612 + % This can be fixed by placing a dumb (non-interactive) Widget dummy + % somewhere on the page. + \bool_if:NT\g_pbs_ocgbase_loaded_bool{ + \pbs_pdfannot:nnnn{3pt}{\c_zero_dim}{3pt}{ + /Ff~65537/FT/Btn/Subtype/Widget + } + } + } } } |