summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-11-01 22:14:21 +0000
committerKarl Berry <karl@freefriends.org>2015-11-01 22:14:21 +0000
commitecb1680ccb53b3b96460fda99cecfb770843d96f (patch)
tree45df2d46b1b697e61df59db6b11b6f0229e7a7df /Master
parent88cec4fd84673a2e6336d375cd43c316b3acad48 (diff)
media9 (1nov15)
git-svn-id: svn://tug.org/texlive/trunk@38759 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/media9/ChangeLog7
-rw-r--r--Master/texmf-dist/doc/latex/media9/media9.pdfbin3605771 -> 3606048 bytes
-rw-r--r--Master/texmf-dist/source/latex/media9/media9.tex8
-rw-r--r--Master/texmf-dist/tex/latex/media9/media9.sty785
-rw-r--r--Master/texmf-dist/tex/latex/media9/pdfbase.sty635
5 files changed, 810 insertions, 625 deletions
diff --git a/Master/texmf-dist/doc/latex/media9/ChangeLog b/Master/texmf-dist/doc/latex/media9/ChangeLog
index 1f23f766086..29cd11a17f9 100644
--- a/Master/texmf-dist/doc/latex/media9/ChangeLog
+++ b/Master/texmf-dist/doc/latex/media9/ChangeLog
@@ -1,3 +1,10 @@
+2015-10-28
+ * v0.59 (media9.sty)
+ * v0.1 (pdfbase.sty)
+ * new: code restructured (new file pdfbase.sty with commands
+ for low-level access to PDF features); now using new ocgbase.sty
+ from ocgx2
+
2015-09-01
* fix: recompiled VPlayer, APlayer, SlideShow, StrobeMediaPlayback
diff --git a/Master/texmf-dist/doc/latex/media9/media9.pdf b/Master/texmf-dist/doc/latex/media9/media9.pdf
index 69d2301d859..e347dff1ff1 100644
--- a/Master/texmf-dist/doc/latex/media9/media9.pdf
+++ b/Master/texmf-dist/doc/latex/media9/media9.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/media9/media9.tex b/Master/texmf-dist/source/latex/media9/media9.tex
index c278a4c5ee7..77c42234fce 100644
--- a/Master/texmf-dist/source/latex/media9/media9.tex
+++ b/Master/texmf-dist/source/latex/media9/media9.tex
@@ -29,7 +29,7 @@
\usepackage{menukeys}
\usepackage{hyperref}
\usepackage{hypcap}
-\def\keywords{embed flash movie LaTeX pdf 3d include sound swf mp3 video mp4 h.264 aac slideshow image gallery flv audio multimedia streamed media rtmp YouTube animation JavaScript pdfLaTeX dvips ps2pdf dvipdfmx XeLaTeX u3d prc Adobe Reader RichMedia annotation LuaLaTeX}
+\def\keywords{embed flash movie LaTeX pdf 3d include sound swf mp3 video mp4 h.264 aac slideshow image gallery flv audio multimedia streamed media rtmp YouTube animation JavaScript pdfLaTeX dvips ps2pdf dvipdfmx XeLaTeX u3d prc Adobe Reader Foxit RichMedia annotation LuaLaTeX}
\hypersetup{
bookmarksnumbered,linktocpage,breaklinks,
pdftitle={The media9 Package},
@@ -95,7 +95,7 @@ A \LaTeX{} package for embedding interactive Adobe Flash (SWF) and 3D files (Ado
\tableofcontents
\section{Introduction}
-This package provides an interface to embed, in the first place, interactive Flash (SWF) and 3D objects (Adobe U3D \& PRC) into PDF documents. Video and sound files or streams in the popular MP4, FLV and MP3 formats can be embedded as well. However, a media player Flash component is required for playback, as will be explained shortly. Playback of multimedia files uses Adobe Flash Player, which was bundled with Adobe Reader 9 and 10 versions. Unfortunately, beginning with Adobe Reader 11, it must be installed as a separate plug-in.
+This package provides an interface to embed, in the first place, interactive Flash (SWF) and 3D objects (Adobe U3D \& PRC) into PDF documents. Video and audio files or streams in the popular MP4, FLV and MP3 formats can be embedded as well. However, a media player Flash component is required for playback, as will be explained shortly. Playback of multimedia files uses Adobe Flash Player, which was bundled with Adobe Reader 9 and 10 versions. Unfortunately, beginning with Adobe Reader 11, it must be installed as a separate plug-in.
Among the supported media types, video and sound files require an additional Flash (SWF) application for playback, which must be either embedded into the PDF or loaded at runtime from the internet. There are numerous such players, both open-source and commercial, available on the internet. One of them is the highly configurable open-source `StrobeMediaPlayback.swf'~\cite{strobe}, maintained by Adobe and hosted on \href{http://sourceforge.net/projects/osmf.adobe/files/}{SourceForge.net}. Package `media9' comes with an enhanced version of `StrobeMediaPlayback.swf'. In addition, two simple players for video and audio, `VPlayer.swf' and `APlayer.swf' are included, which can be used instead. They provide sufficient functionality for playing embedded files and streamed media.
@@ -119,7 +119,7 @@ Both examples insert a key frame (option `\verb+-g+') at every second since the
Package `media9' supports the usual PDF making workflows, i.\,e. pdf\LaTeX{}, Lua\LaTeX, \LaTeX{} $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+/Distiller and \pXepLaTeX{} $\rightarrow$ \verb+(x)dvipdfmx+.
-The final PDF can be viewed in current Adobe Readers on MS Windows and other platforms. On Unix platforms including Linux, however, support of Flash, video and sound was discontinued at Reader version 9.4.2, probably for security reasons. PDF documents which target \href{ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.4.1/}{Adobe Reader 9.4.1 for Linux} should use `VPlayer9.swf' and `APlayer9.swf' (also included in the `media9' package). These media player components are compatible with the older Flash Player 9 plugin that is bundled with the Reader for Linux. On tablets and phones running Android or iOS, ezPDF Reader was reported to play video and sound files embedded with `media9'.
+The final PDF can be viewed in current Adobe Readers on MS Windows and other platforms. On Unix platforms including Linux, however, support of Flash, video and sound was discontinued at Reader version 9.4.2, probably for security reasons. PDF documents which target \href{ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.4.1/}{Adobe Reader 9.4.1 for Linux} should use `VPlayer9.swf' and `APlayer9.swf' (also included in the `media9' package). These media player components are compatible with the older Flash Player 9 plugin that is bundled with the Reader for Linux. Recent versions of Foxit PDF Reader, which is available on the Windows platform, are known to render embedded Flash, video and audio content. Foxit also uses Adobe Flash Player plugin. On tablets and phones running Android or iOS, ezPDF Reader was reported to play video and sound files embedded with `media9'.
\section{Requirements}
\begin{trivlist}
@@ -130,7 +130,7 @@ The final PDF can be viewed in current Adobe Readers on MS Windows and other pla
\item pdf\TeX{}, version $\ge1.30$
\item Ghostscript, version $\ge8.31$ or Adobe Distiller for PS to PDF conversion
\item dvipdfmx, version $\ge 20120420$ for DVI to PDF conversion
-\item Adobe Reader, version $\ge9$, but not greater than 9.4.1 on Linux
+\item Adobe Reader, version $\ge9$, but not greater than 9.4.1 on Linux; Foxit Reader (Flash, video, audio)
\end{trivlist}
\section{Installation}
diff --git a/Master/texmf-dist/tex/latex/media9/media9.sty b/Master/texmf-dist/tex/latex/media9/media9.sty
index cf51703e513..c690316b564 100644
--- a/Master/texmf-dist/tex/latex/media9/media9.sty
+++ b/Master/texmf-dist/tex/latex/media9/media9.sty
@@ -38,16 +38,14 @@
\RequirePackage{l3regex}
\RequirePackage{l3keys2e}
\RequirePackage{xparse}
-\RequirePackage{ifpdf}
\RequirePackage{atbegshi}
\RequirePackage{atenddvi}
-\RequirePackage{tikz}
-\def\g@mix@date@tl{2015/08/18}
-\def\g@mix@version@tl{0.58}
+\def\g@mix@date@tl{2015/10/28}
+\def\g@mix@version@tl{0.59}
-\def\g@mix@liiikerneldate{2015/07/14}
-\def\g@mix@liiipkgdate{2015/07/14}
+\def\g@mix@liiikerneldate{2015/09/27}
+\def\g@mix@liiipkgdate{2015/09/27}
\ProvidesExplPackage{media9}{\g@mix@date@tl}{\g@mix@version@tl}
{acrobat-9/X compatible media}
@@ -82,18 +80,6 @@
\tex_endinput:D
}
-%testing for PDF output
-\bool_new:N\g_mix_pdfoutput_bool
-\bool_gset_false:N\g_mix_pdfoutput_bool
-\ifpdf \bool_gset_true:N\g_mix_pdfoutput_bool \fi
-
-%pdfTeX version check
-\pdftex_if_engine:T{
- \int_compare:nT{\pdftexversion<130}{
- \msg_interrupt:nnn{media9~error}{pdfTeX,~version~>=~1.30~required.}{}
- }
-}
-
%package options
%unknown package option error message
@@ -102,7 +88,6 @@
perhaps~it~is~spelled~incorrectly.
}
-\bool_new:N\g_mix_pkgbigfiles_bool
\bool_new:N\g_mix_pkgattach_bool
\bool_new:N\g_mix_dvipdfmx_bool
\bool_new:N\g_mix_pkgdraft_bool
@@ -133,17 +118,16 @@
%floating window settings
\group_begin:
-\char_set_lccode:nn{`\+}{`\@}
-\tl_to_lowercase:n{
- \group_end:
- \cs_new:Npn\mix_parse_windowedarg:w#1+#2+#3\q_stop{
- \tl_if_blank:nF{#1}{\tl_gset:Nn\g_mix_winsize_tl{#1}}
- \tl_if_blank:nF{#2}{\tl_gset:Nn\g_mix_winpos_tl{#2}}
- }
- \cs_new:Nn\mix_parse_windowedarg:N{
- \exp_after:wN\mix_parse_windowedarg:w#1++\q_stop
- }
+\char_set_catcode_other:n{`\@}
+\cs_new_protected:Npn\mix_parse_windowedarg:w#1@#2@#3\q_stop{
+ \tl_if_blank:nF{#1}{\tl_gset:Nn\g_mix_winsize_tl{#1}}
+ \tl_if_blank:nF{#2}{\tl_gset:Nn\g_mix_winpos_tl{#2}}
+}
+\cs_new_protected:Nn\mix_parse_windowedarg:N{
+ \exp_after:wN\mix_parse_windowedarg:w#1@@\q_stop
}
+\group_end:
+
\cs_new:Npn\mix_parse_winsizearg:w#1x#2\q_stop{
\str_if_eq:nnTF{#1}{default}{
\tl_gset:Nx\tl_mix_fltwd{
@@ -157,12 +141,20 @@
}
\keys_define:nn{media9}{
- dvipdfmx .bool_gset:N = \g_mix_dvipdfmx_bool,
- xetex .bool_gset:N = \g_mix_dvipdfmx_bool,
+ xetex .code:n = {
+ \PassOptionsToPackage{xetex}{pdfbase}
+ \PassOptionsToPackage{xetex}{ocgbase}
+ },
+
+ dvipdfmx .code:n = {
+ \PassOptionsToPackage{dvipdfmx}{pdfbase}
+ \PassOptionsToPackage{dvipdfmx}{ocgbase}
+ \bool_gset_true:N\g_mix_dvipdfmx_bool
+ },
bigfiles .choice:,
- bigfiles / true .code:n = {\bool_gset_true:N\g_mix_pkgbigfiles_bool},
- bigfiles / false .code:n = {\bool_gset_false:N\g_mix_pkgbigfiles_bool},
+ bigfiles / true .code:n = {\PassOptionsToPackage{bigfiles}{pdfbase}},
+ bigfiles / false .code:n = {},
bigfiles .default:n = {true},
draft .choice:,
@@ -323,7 +315,26 @@
}
}
\ProcessKeysOptions{media9}
-\xetex_if_engine:T{\bool_gset_true:N\g_mix_dvipdfmx_bool}
+\sys_if_engine_xetex:T{\bool_gset_true:N\g_mix_dvipdfmx_bool}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage{pdfbase}
+%aliases for commands from pdfbase.sty
+\cs_new_eq:NN\mix_pdfobj:nnn \pbs_pdfobj:nnn
+\cs_new_eq:NN\mix_pdfannot:nnnn\pbs_pdfannot:nnnn
+\cs_new_eq:NN\mix_pdflink:nn \pbs_pdflink:nn
+\cs_new_eq:NN\mix_pdfxform:n \pbs_pdfxform:n
+\cs_new_eq:NN\mix_pdfximage:n \pbs_pdfximage:n
+\cs_new_eq:NN\mix_pdfcatalog:n \pbs_pdfcatalog:n
+\cs_new_eq:NN\mix_pdfbdc:nn \pbs_pdfbdc:nn
+\cs_new_eq:NN\mix_pdfemc: \pbs_pdfemc:
+
+\cs_set_eq:NN\mix_pdflastobj: \pbs_pdflastobj:
+\cs_set_eq:NN\mix_pdflastann: \pbs_pdflastann:
+\cs_set_eq:NN\mix_pdflastxform: \pbs_pdflastxform:
+\cs_set_eq:NN\mix_pdflastximage:\pbs_pdflastximage:
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage{ocgbase} %OCG generating and configuration macros
\box_new:N\l_mix_poster_box
\dim_new:N\g_mix_wd_dim
@@ -358,18 +369,14 @@
Line~\msg_line_number: :~
File~`#1'~not~found.}{Make~sure~file~`#1'~exists~and~is~readable!}
-\pdftex_if_engine:TF{
+\sys_if_engine_pdftex:TF{
%\pdfmdfivesum is used for hashing object references of embedded files
\cs_new:Nn\mix_filemdfivesum:n{\pdfmdfivesum~file~{#1}}
- \cs_new:Nn\mix_filesize:n{\pdffilesize{#1}}
- \cs_new:Nn\mix_filedump:nnn{\pdffiledump~offset~#1~length~#2~{#3}}
\cs_new:Nn\mix_unescapehex:n{(\pdfunescapehex{#1})}
}{
- \luatex_if_engine:TF{
+ \sys_if_engine_luatex:TF{
\RequirePackage{pdftexcmds}
\cs_new:Nn\mix_filemdfivesum:n{\pdf@filemdfivesum{#1}}
- \cs_new:Nn\mix_filesize:n{\pdf@filesize{#1}}
- \cs_new:Nn\mix_filedump:nnn{\pdf@filedump{#1}{#2}{#3}}
\cs_new:Nn\mix_unescapehex:n{<#1>}
}{
\cs_new:Nn\mix_filemdfivesum:n{#1}
@@ -380,7 +387,7 @@
\cs_new:Npn\mix@newkey#1#2{\tl_gset:cx{#1}{#2}}
%macros for writing global defs to \jobname.aux
-\msg_set:nnn{media9}{rerun}{Rerun~to~get~media~labels~right!}
+\msg_set:nnn{media9}{rerun}{Rerun~to~get~internal~references~right!}
\msg_set:nnn{media9}{undefined~reference}{
Line~\msg_line_number: :~Media~reference~`#1'~not~defined.
}
@@ -392,7 +399,7 @@
\msg_set:nnn{media9}{multiple~labels}{There~were~multiply-defined~labels!}
\cs_gset:Nn\mix_keytoaux_now:nn{
- \iow_now:Nx\@auxout{\token_to_str:N\mix@newkey{#1}{#2}}
+ \iow_now:Nx\@mainaux{\token_to_str:N\mix@newkey{#1}{#2}}
\bool_if:nT{
% !\cs_if_exist_p:c{#1} || !\str_if_eq_x_p:nn{\tl_use:c{#1}}{#2}
!\cs_if_exist:cTF{#1}{
@@ -408,7 +415,7 @@
}
}
\cs_gset:Nn\mix_keytoaux_shipout:nn{
- \iow_shipout_x:Nx\@auxout{\token_to_str:N\mix@newkey{#1}{#2}}
+ \iow_shipout_x:Nx\@mainaux{\token_to_str:N\mix@newkey{#1}{#2}}
\cs_if_exist:cF{#1}{
\cs_if_exist:NF\g_mix_rerunwarned_tl{
\tl_new:N\g_mix_rerunwarned_tl
@@ -514,7 +521,7 @@
%excessive DVI resolution message
\group_begin:
\char_set_catcode_active:N\+\let+\space
-\tl_gset:Nx\g_mix_dpiwarning_tl{
+\cs_new:Nx\mix_dpiwarning:{
{Resolution~1200~gt~VResolution~1200~gt~or~product~(Ghostscript)~
search~{pop~pop~pop~true}{pop~false}ifelse~and~{
(\token_to_str:N\n
@@ -538,525 +545,40 @@
}
\group_end:
-%macros for adding AcroForm and OCProperties dicts to PDF Catalog
-\tl_if_exist:cF{@anim@fields}{\tl_gset:cn{@anim@fields}{}}%takes Field object refs
+%adding AcroForm dict to PDF Catalog
+\tl_if_exist:cF{@anim@fields}{\tl_new:c{@anim@fields}}%takes Field object refs
\tl_if_exist:cF{Acro@Form@added}{ %AcroForm dict
\AtEndDvi{
\tl_if_empty:NF\@anim@fields{
\mix_pdfobj:nnn{}{array}{\@anim@fields}
\mix_pdfcatalog:n{
- /AcroForm~<</Fields~\g_mix_pdflastobj_tl/NeedAppearances~false>>}
+ /AcroForm~<</Fields~\mix_pdflastobj:/NeedAppearances~false>>}
}
}
\tl_gset:cn{Acro@Form@added}{}
}
-\tl_if_exist:cF{@ocgbase@ocgs}{\tl_gset:cn{@ocgbase@ocgs}{}} %takes ocg object refs
-\tl_if_exist:cF{@ocgbase@offocgs}{\tl_gset:cn{@ocgbase@offocgs}{}}
-\tl_if_exist:cF{@ocgbase@ocgorder}{\tl_gset:cn{@ocgbase@ocgorder}{}}
-\tl_if_exist:cF{oc@props@added}{
- \AtEndDvi{
- \tl_if_empty:NF\@ocgbase@ocgs{
- \mix_pdfobj:nnn{}{array}{\@ocgbase@ocgs}
- \tl_gset:Nx\g_mix_ocgarray_tl{\g_mix_pdflastobj_tl}
- \tl_if_empty:NTF\@ocgbase@offocgs{
- \tl_gset:Nn\g_mix_offocgentry_tl{}
- }{
- \mix_pdfobj:nnn{}{array}{\@ocgbase@offocgs}
- \tl_gset:Nx\g_mix_offocgentry_tl{/OFF~\g_mix_pdflastobj_tl}
- }
- \tl_if_empty:NTF\@ocgbase@ocgorder{
- \tl_gset:Nn\g_mix_ocgorderentry_tl{}
- }{
- \mix_pdfobj:nnn{}{array}{\@ocgbase@ocgorder}
- \tl_gset:Nx\g_mix_ocgorderentry_tl{/Order~\g_mix_pdflastobj_tl}
- }
- \mix_pdfcatalog:n{
- /OCProperties~<<
- /OCGs~\g_mix_ocgarray_tl
- /D~<<
- /AS~[
- <</Event/View /Category[/View] /OCGs~\g_mix_ocgarray_tl>>
- <</Event/Print /Category[/Print] /OCGs~\g_mix_ocgarray_tl>>
- <</Event/Export/Category[/Export]/OCGs~\g_mix_ocgarray_tl>>
- ]
- /BaseState/ON~\g_mix_offocgentry_tl
- \g_mix_ocgorderentry_tl~/ListMode/VisiblePages
- >>
- >>
- }
- }
- }
- \tl_gset:cn{oc@props@added}{}
-}
\cs_new:Nn\mix_insert_btnocg:{%OCG for play button overlay
- \mix_pdfobj:nnn{}{dict}{
- /Type/OCG/Name~(MediaPlayButton\int_use:N\g_mix_rmcnt_int)
- /Usage<<
- /Print<</PrintState/OFF>>
- /Export<</ExportState/OFF>>
- >>
- }
- \tl_gput_right:Nx\@ocgbase@ocgs{\space\g_mix_pdflastobj_tl}
- \tl_gput_right:Nx\@ocgbase@offocgs{\space\g_mix_pdflastobj_tl}
- \tl_gset:Nx\g_mix_btnocg_tl{\g_mix_pdflastobj_tl}
+ \ocgbase_new_ocg:xxx{MediaPlayButton\int_use:N\g_mix_rmcnt_int}{
+ /Print<</PrintState/OFF>>/Export<</ExportState/OFF>>
+ }{off}
+ \tl_gset:Nx\g_mix_btnocg_tl{\ocgbase_last_ocg:}
}
-%commands for creating PDF objects, annots etc.
-\bool_if:NTF\g_mix_pdfoutput_bool{
- %helper func to remove `0 R' part from pdf obj reference
- \cs_new:Npn\mix_reftonum:w #1~0~R {#1}
- \cs_new:Nn\mix_pdfobj:nnn{
- % #1: predefined obj ref to be used with the current obj; may be empty
- % #2: type of object (dict|array|stream|fstream)
- % #3: content (key-value, file, string); if #3 && #1 are both empty, an
- % object reference will be reserved for later use
- \tl_clear:N\l_mix_usenum_tl
- \tl_if_blank:oF{#1}{
- \tl_set:Nx\l_mix_usenum_tl{useobjnum~\exp_after:wN \mix_reftonum:w #1}
- }
- \bool_if:nTF{\tl_if_blank_p:o{#1}&&\tl_if_blank_p:o{#3}}{
- \pdfobj~reserveobjnum
- }{
- \str_case:nn{#2}{
- {dict}{\immediate\pdfobj~\l_mix_usenum_tl~{<<#3>>}}
- {array}{\immediate\pdfobj~\l_mix_usenum_tl~{[#3]}}
- {stream}{\immediate\pdfobj~\l_mix_usenum_tl~stream~{#3}}
- {fstream}{\immediate\pdfobj~\l_mix_usenum_tl~stream~file~{#3}}
- }
- }
- \tl_gset:Nx\g_mix_pdflastobj_tl{\the\pdflastobj\space 0~R}
- }
-
- \cs_new:Nn\mix_pdfannot:nnnn{
- % #1:width, #2:height, #3:depth, #4:content (key-value)
- \immediate\pdfannot~width~#1~height~#2~depth~#3 {#4}
- \tl_gset:Nx\g_mix_pdflastann_tl{\int_use:c{pdflastannot}~0~R}
- }
-
- \cs_new:Nn\mix_pdflink:nn{% #1:dict, #2:text
- \immediate\pdfstartlink~user~{#1}#2\pdfendlink
- }
-
- \cs_new:Nn\mix_pdfxform:n{%#1:savebox number
- \immediate\pdfxform~resources~{\the\pdfpageresources}~#1
- \tl_gset:Nx\g_mix_pdflastxform_tl{\int_use:c{pdflastxform}~0~R}
- }
-
- \cs_new:Nn\mix_pdfximage:n{%#1:bitmap file name
- \bool_if:nTF{
- \str_if_eq_p:Vn\l_mix_ext_tl{png}
- ||\str_if_eq_p:Vn\l_mix_ext_tl{jpg}
- ||\str_if_eq_p:Vn\l_mix_ext_tl{jpeg}
- ||\str_if_eq_p:Vn\l_mix_ext_tl{jbig2}
- ||\str_if_eq_p:Vn\l_mix_ext_tl{jb2}
- }{
- \immediate\pdfximage{#1}
- \tl_gset:Nx\g_mix_pdflastximage_tl{\int_use:c{pdflastximage}~0~R}
- }{
- \msg_error:nnnnn{media9}{wrong~image~resource}{#1}{pdftex}{
- png,~jpeg~and~jbig2
- }
- }
- }
-
+%output mode dependent command definitions
+\sys_if_output_pdf:TF{
\cs_new:Nn\mix_ndname:n{%#1:HEX encoded string
%converted to binary UTF16BE using \pdfunescapehex (pdfTeX only)
\tl_set:Nn\l_mix_ndname_tl{\mix_unescapehex:n{#1}}
}
-
- \cs_new:Nn\mix_pdfcatalog:n{\pdfcatalog{#1}}
-
- %marked content BDC/EMC operators
- \int_new:N\g_mix_oc_int % object ID
- \cs_new:Nn\mix_pdfbdc:nn{ % #1: tag, #2: prop. dict obj ID
- \pdfliteral~direct~{#1/rm@oc\int_use:N\g_mix_oc_int\space BDC}
- \tl_if_empty:NTF\@anim@ocmap{
- \tl_gset:cx{@anim@ocmap}{/rm@oc\int_use:N\g_mix_oc_int\space#2}
- }{
- \tl_gput_right:cx{@anim@ocmap}{~/rm@oc\int_use:N\g_mix_oc_int\space#2}
- }
- \group_begin:
- \tl_set:Nx\l_mix_temp_tl{\group_end:
- \global\pdfpageresources{\the\pdfpageresources
- /Properties<<\@anim@ocmap>>
- }
- }\l_mix_temp_tl
- \int_gincr:N\g_mix_oc_int
- }
- \tl_if_exist:cF{@anim@ocmap}{
- \tl_gset:cn{@anim@ocmap}{}
- \AtBeginShipout{\tl_gset:cn{@anim@ocmap}{}}
- }
- \cs_new:Nn\mix_pdfemc:{\pdfliteral~direct~{EMC}}
}{
- %pgf + transparency related settings
- \bool_new:N\g_mix_pgfloaded_bool
- \bool_gset_false:N\g_mix_pgfloaded_bool
- \AtBeginDocument{
- \@ifpackageloaded{pgf}{\bool_gset_true:N\g_mix_pgfloaded_bool}{}
- }
- \int_new:N\g_mix_obj_int % object ID
\bool_if:NTF\g_mix_dvipdfmx_bool{ %dvipdfmx/XeTeX
- \cs_new:Nn\mix_pdfobj:nnn{
- % #1: predefined obj ref to be used with the current obj; may be empty
- % #2: type of object (dict|array|stream|fstream)
- % #3: content (key-value, file, string); if #3 && #1 are both empty, an
- % object reference will be reserved for later use
- \tl_if_blank:oTF{#1}{
- \tl_set:Nx\l_mix_usenum_tl{@mix@obj\int_use:N\g_mix_obj_int}
- \int_gincr:N\g_mix_obj_int
- }{
- \tl_set:Nx\l_mix_usenum_tl{#1}
- }
- \tl_if_blank:oF{#3}{
- \str_case:nn{#2}{
- {dict}{\special{pdf:obj~\l_mix_usenum_tl\space<<#3>>}}
- {array}{\special{pdf:obj~\l_mix_usenum_tl\space[#3]}}
- {stream}{\special{pdf:stream~\l_mix_usenum_tl\space(#3)}}
- {fstream}{
- \message{<#3>}
- \special{pdf:fstream~\l_mix_usenum_tl\space(#3)}
- }
- }
- }
- \tl_gset_eq:NN\g_mix_pdflastobj_tl\l_mix_usenum_tl
- }
-
- \cs_new:Nn\mix_pdfannot:nnnn{
- % #1:width, #2:height, #3:depth, #4:content (key-value)
- \special{pdf:ann~@mix@obj\int_use:N\g_mix_obj_int\space
- width~#1\space
- height~#2\space
- depth~#3~<<#4>>
- }
- \tl_gset:Nx\g_mix_pdflastann_tl{@mix@obj\int_use:N\g_mix_obj_int}
- \int_gincr:N\g_mix_obj_int
- }
-
- \cs_new:Nn\mix_pdflink:nn{% #1:dict, #2:text
- \special{pdf:bann~<<#1>>}#2\special{pdf:eann}
- }
-
- \cs_new:Nn\mix_pdfxform:n{%#1:savebox number
- \special{pdf:bxobj~@mix@obj\int_use:N\g_mix_obj_int\space
- width\space \dim_use:N\box_wd:N#1\space
- height\space\dim_use:N\box_ht:N#1\space
- depth\space \dim_use:N\box_dp:N#1
- }
- \begin{picture}(0,0)\put(0,0){\box_use:N #1}\end{picture}
- \bool_if:NT\g_mix_pgfloaded_bool{ % transparency et al. for PGF
- \tl_set:Nn\l_mix_temp_tl{}
- \ifpgf@sys@pdf@extgs@exists
- \tl_set:Nn\l_mix_temp_tl{/ExtGState~@pgfextgs}
- \fi
- \ifpgf@sys@pdf@patterns@exists
- \tl_put_right:Nn\l_mix_temp_tl{/Pattern~@pgfpatterns}
- \fi
- \ifpgf@sys@pdf@colorspaces@exists
- \tl_put_right:Nn\l_mix_temp_tl{/ColorSpace~@pgfcolorspaces}
- \fi
- \tl_if_blank:VF\l_mix_temp_tl{
- \special{pdf:put~@resources~<<\l_mix_temp_tl>>}
- }
- }
- \special{pdf:exobj}
- \tl_gset:Nx\g_mix_pdflastxform_tl{@mix@obj\int_use:N\g_mix_obj_int}
- \int_gincr:N\g_mix_obj_int
- }
-
- \cs_new:Nn\mix_pdfximage:n{%#1:bitmap file name
- \bool_if:nTF{
- \str_if_eq_p:Vn\l_mix_ext_tl{png}
- ||\str_if_eq_p:Vn\l_mix_ext_tl{jpg}
- ||\str_if_eq_p:Vn\l_mix_ext_tl{jpeg}
- }{
- \special{pdf:image~@mix@obj\int_use:N\g_mix_obj_int\space
- %move initial display off the page
- matrix~0.000001~0~0~0.000001~-1000000~-1000000~(#1)}
- \tl_gset:Nx\g_mix_pdflastximage_tl{@mix@obj\int_use:N\g_mix_obj_int}
- \int_gincr:N\g_mix_obj_int
- }{
- \msg_error:nnnnn{media9}{wrong~image~resource}{#1}{dvipdfmx/xetex}{
- png~and~jpeg
- }
- }
- }
-
\cs_new:Nn\mix_ndname:n{%#1:HEX encoded UTF16BE string
\tl_set:Nn\l_mix_ndname_tl{<#1>}
}
-
- \cs_new:Nn\mix_pdfcatalog:n{\special{pdf:put~@catalog~<<#1>>}}
-
- %marked content BDC/EMC operators
- \int_new:N\g_mix_oc_int % object ID
- \cs_new:Nn\mix_pdfbdc:nn{
- \special{pdf:code~#1/rm@oc\int_use:N\g_mix_oc_int\space BDC}
- \special{pdf:put~@resources~<<
- /Properties~<</rm@oc\int_use:N\g_mix_oc_int\space#2>>>>}
- \int_gincr:N\g_mix_oc_int
- }
- \cs_new:Nn\mix_pdfemc:{\special{pdf:~code~EMC}}
}{
- % dvips
- \bool_new:N\g_mix_powerdot_bool %to cope with some powerdot oddity
- \@ifclassloaded{powerdot}{\bool_gset_true:N\g_mix_powerdot_bool}{}
-
- \@ifpackageloaded{hyperref}{}{
- %define `?pdfmark' operator as in file hdvips.def from package `hyperref'
- \special{!~
- systemdict~/pdfmark~known
- {
- userdict~/?pdfmark~systemdict~/exec~get~put
- }{
- userdict~/?pdfmark~systemdict~/pop~get~put~
- userdict~/pdfmark~systemdict~/cleartomark~get~put
- }
- ifelse~
- }
- }
-
- \bool_if:NT\g_mix_pkgbigfiles_bool{
- \special{psfile=\jobname.m9}
- %open auxiliary file \jobname.m9 for writing hex encoded streams of the
- %files to be embedded. This file is inserted into PS during dvips run
- \iow_new:N\g_mix_mstreams_stream
- \iow_open:Nn\g_mix_mstreams_stream{\jobname.m9}
- \iow_now:Nn\g_mix_mstreams_stream{
- /M9D~1~dict~def~M9D~begin
- /o{mark/_objdef}bind~def/O{/type/stream/OBJ~pdfmark}bind~def
- /m~systemdict/mark~get~def
- /P{/ASCIIHexDecode~filter/PUT~pdfmark}bind~def
- /C{/CLOSE~pdfmark}bind~def~end
- }
- }
-
%determine DVI resolution and output warning message if too big
- %\AtBeginDocument{\special{ps:\g_mix_dpiwarning_tl}}
- \AtEndDvi{\special{ps:\g_mix_dpiwarning_tl}}
-
- \cs_new:Nn\mix_pdfobj:nnn{
- % #1: predefined obj ref to be used with the current obj; may be empty
- % #2: type of object (dict|array|stream|fstream)
- % #3: content (key-value, file, string); if #3 && #1 are both empty, an
- % object reference will be reserved for later use
- \tl_clear:N\l_mix_usenum_tl
- \tl_if_blank:oTF{#1}{
- \tl_set:Nx\l_mix_usenum_tl{{mix@obj\int_use:N\g_mix_obj_int}}
- \int_gincr:N\g_mix_obj_int
- }{
- \tl_set:Nx\l_mix_usenum_tl{#1}
- }
- \tl_if_blank:oF{#3}{
- \bool_if:nTF{
- \g_mix_pkgbigfiles_bool &&
- \str_if_eq_p:nn{#2}{fstream}
- }{
- \iow_now:Nx\g_mix_mstreams_stream{
- M9D~begin~o\l_mix_usenum_tl O
- }
- }{
- \special{ps:~mark~/_objdef~\l_mix_usenum_tl\space/type
- \str_case:nn{#2}{
- {dict}{/dict}
- {array}{/array}
- {stream}{/stream}
- {fstream}{/stream}
- }~
- /OBJ~pdfmark~
- }
- }
- \str_case:nn{#2}{
- {dict}{\special{ps:~mark~\l_mix_usenum_tl~<<#3>>/PUT~pdfmark~}}
- {array}{
- \special{ps:~mark~\l_mix_usenum_tl~0~[#3]/PUTINTERVAL~pdfmark~}
- }
- {stream}{\special{ps::[nobreak]~mark~\l_mix_usenum_tl~(#3)/PUT~pdfmark~}}
- {fstream}{
- \tl_set:Nn\l_mix_offset_tl{0}
- \tl_set:Nx\l_mix_fsize_tl{\mix_filesize:n{#3}}
- \message{<#3}
- %embed file in chunks of 32768 Bytes into PS as chunks of
- %65536 Bytes of HEX code
- \bool_while_do:nn{
- \int_compare_p:n{\l_mix_offset_tl<\l_mix_fsize_tl}
- }{
- \bool_if:NTF\g_mix_pkgbigfiles_bool{
- \iow_now:Nx\g_mix_mstreams_stream{
- m\l_mix_usenum_tl
- (\mix_filedump:nnn{\l_mix_offset_tl}{32767}{#3})P
- }
- }{
- \special{ps:~
- mark~
- \l_mix_usenum_tl~
- (\mix_filedump:nnn{\l_mix_offset_tl}{32767}{#3})~
- /ASCIIHexDecode~filter~/PUT~
- pdfmark~
- }
- }
- \tl_set:Nx\l_mix_offset_tl{\int_eval:n{\l_mix_offset_tl+32767}}
- \message{.}
- }
- \message{>}
- \bool_if:NTF\g_mix_pkgbigfiles_bool{
- \iow_now:Nx\g_mix_mstreams_stream{
- m\l_mix_usenum_tl~C~end
- }
- }{
- \special{ps:~
- mark~\l_mix_usenum_tl~/CLOSE~pdfmark~
- }
- }
- }
- }
- }
- \tl_gset_eq:NN\g_mix_pdflastobj_tl\l_mix_usenum_tl
- }
-
- \cs_new:Nn\mix_pdfannot:nnnn{
- \hbox_set:Nn\l_tmpa_box{
- \box_move_down:nn{#3}{
- \hbox_to_zero:n{
- \special{ps:~currentpoint~/mix@lly~exch~def~/mix@llx~exch~def}
- }
- }
- \skip_horizontal:n{#1}
- \box_move_up:nn{#2}{
- \hbox_to_zero:n{
- \special{ps:~currentpoint~/mix@ury~exch~def~/mix@urx~exch~def}
- }
- }
- }
- \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
- \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
- \box_set_dp:Nn\l_tmpa_box{\c_zero_dim}
- \box_use_clear:N\l_tmpa_box
- \special{ps:~
- mark~
- /_objdef~{mix@obj\int_use:N\g_mix_obj_int}
- /Rect~[mix@llx~mix@lly~mix@urx~mix@ury]
- #4
- /ANN~pdfmark~
- }
- \tl_gset:Nx\g_mix_pdflastann_tl{{mix@obj\int_use:N\g_mix_obj_int}}
- \int_gincr:N\g_mix_obj_int
- }
-
- \cs_new:Nn\mix_pdflink:nn{% #1:dict, #2:text
- \cs_if_exist:NTF\pdfmark{
- \pdfmark[#2]{pdfmark=/ANN,Raw={#1}}
- }{
- \hbox_set:Nn\l_tmpb_box{#2}
- \mix_pdfannot:nnnn{
- \dim_use:N\box_wd:N\l_tmpb_box}{
- \dim_use:N\box_ht:N\l_tmpb_box}{
- \dim_use:N\box_dp:N\l_tmpb_box
- }{#1}
- \box_use_clear:N\l_tmpb_box
- }
- }
-
- \cs_new:Nn\mix_pdfxform:n{%#1:savebox number
- %mark bbox of box#1
- \hbox_set:Nn\l_tmpa_box{
- \box_move_down:nn{\box_dp:N #1}{
- \hbox_to_zero:n{
- \special{ps:~currentpoint~/mix@lly~exch~def~/mix@llx~exch~def}
- }
- }
- \skip_horizontal:n{\box_wd:N #1}
- \box_move_up:nn{\box_ht:N #1}{
- \hbox_to_zero:n{
- \special{ps:~currentpoint~/mix@ury~exch~def~/mix@urx~exch~def}
- }
- }
- }
- \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
- \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
- \box_set_dp:Nn\l_tmpa_box{\c_zero_dim}
- \box_use_clear:N\l_tmpa_box
- %define some length values in current PS coordinate units
- \hbox_set:Nn\l_tmpa_box{
- \special{ps:~currentpoint~/origin@y~exch~def~/origin@x~exch~def}
- \skip_horizontal:n{72.27pt}
- \box_move_up:nn{72.27pt}{
- \hbox_to_zero:n{
- \special{ps:~
- currentpoint~origin@y~exch~sub~/one@inch@y~exch~def~
- origin@x~sub~/one@inch@x~exch~def
- }
- }
- }
- }
- \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
- \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
- \box_use_clear:N\l_tmpa_box
- \special{ps:~
- gsave~
- %translate graphics to upper left page corner
- \bool_if:NF\g_mix_powerdot_bool{
- {
- mix@llx~neg~mix@ury~neg~translate~
- one@inch@x~DVImag~div~neg~one@inch@y~DVImag~div~neg~translate
- }?pdfmark~
- }
- %distill graphics into XObject
- mark~
- /_objdef~{mix@obj\int_use:N\g_mix_obj_int}
- /BBox~[mix@llx~mix@lly~mix@urx~mix@ury]
- /BP~pdfmark~
- {
- isls{%landscape mode (powerdot, geometry /w landscape option)
- /mix@dxdy~{
- mix@urx~mix@llx~sub~abs~
- mix@ury~mix@lly~sub~abs~div
- }~bind~def
- /mix@dydx~{1~mix@dxdy~div}~bind~def
- /mix@cx~{mix@urx~mix@llx~add~2~div}~bind~def
- /mix@cy~{mix@ury~mix@lly~add~2~div}~bind~def
- % graphics needs to be rescaled for some reason ...
- [mix@dxdy~0~0~mix@dydx~1~mix@dxdy~sub~mix@cx~mul~
- 1~mix@dydx~sub~mix@cy~mul]~concat
- %... rotated by 270 degrees ...
- [0~-1~1~0~mix@cx~mix@cy~sub~mix@cx~mix@cy~add]~concat
- %... and flipped around vertical axis
- [-1~0~0~1~mix@llx~mix@urx~add~0]~concat
- }{% flip around horizontal axis in portrait mode
- [1~0~0~-1~0~mix@lly~mix@ury~add]~concat
- }ifelse
- }?pdfmark~
- }
- \begin{picture}(0,0)\put(0,0){\box_use:N #1}\end{picture}
- \special{ps:~mark~/EP~pdfmark~grestore}
- \tl_gset:Nx\g_mix_pdflastxform_tl{{mix@obj\int_use:N\g_mix_obj_int}}
- \int_gincr:N\g_mix_obj_int
- }
-
- %Image XObject
- \cs_new:Nn\mix_pdfximage:n{%#1:bitmap file name
- \bool_if:nTF{
- \str_if_eq_p:Vn\l_mix_ext_tl{ps}
- ||\str_if_eq_p:Vn\l_mix_ext_tl{eps}
- }{
- \special{ps:~
- mark~/_objdef~{mix@obj\int_use:N\g_mix_obj_int}~/NI~pdfmark~
- }
- \special{psfile=#1~hsize=0~vsize=0}
- \special{ps:~
- {
- 0~0~1~[1~0~0~1~0~0]~{}~image~%empty dummy, in case #1 is not
- }?pdfmark~ %a valid raster image file
- }
- \tl_gset:Nx\g_mix_pdflastximage_tl{{mix@obj\int_use:N\g_mix_obj_int}}
- \int_gincr:N\g_mix_obj_int
- }{
- \msg_error:nnxxx{media9}{wrong~image~resource}{#1}{dvips}{
- Postscript~(ps/eps)~with~bitmapped~content
- }
- }
- }
+ \AtEndDvi{\special{ps:\mix_dpiwarning:}}
%3DNode name
\cs_new:Nn\mix_ndname:n{%#1:HEX encoded unicode string
@@ -1068,15 +590,6 @@
%converted to binary UTF16BE by ps2pdf
\tl_set:Nn\l_mix_ndname_tl{mix@unicode}
}
-
- \cs_new:Nn\mix_pdfcatalog:n{
- \special{ps:~mark~{Catalog}~<<#1>>~/PUT~pdfmark}
- }
-
- %marked content BDC/EMC operators for playbutton ocg;
- %require Ghostscript v. >= 9.15
- \cs_new:Nn\mix_pdfbdc:nn{\special{ps:~mark~#1~#2~/BDC~pdfmark}}
- \cs_new:Nn\mix_pdfemc:{\special{ps:~mark~/EMC~pdfmark}}
}
}
@@ -1092,7 +605,7 @@
\bool_if:NTF\l_mix_url_bool{
\cs_if_exist:cF{url_#1}{
\mix_pdfobj:nnn{}{dict}{/FS/URL/F(#1)}
- \tl_gset:cx{url_#1}{\g_mix_pdflastobj_tl}
+ \tl_gset:cx{url_#1}{\mix_pdflastobj:}
}
%every new url should be added to assets tree of the current annot
\cs_if_exist:cF{url_\int_use:c{g_mix_rmcnt_int}_#1}{
@@ -1123,7 +636,7 @@
\cs_if_exist:cF{imgXobj_\mix_filemdfivesum:n{\l_mix_file_tl}}{
\mix_pdfximage:n{\l_mix_file_tl}
\tl_gset:cx{imgXobj_\mix_filemdfivesum:n{\l_mix_file_tl}}{
- \g_mix_pdflastximage_tl
+ \mix_pdflastximage:
}
}
%create fake FileSpec for current file name if not yet existent
@@ -1144,7 +657,7 @@
\cs_if_exist:cF{fileEmb_\mix_filemdfivesum:n{\l_mix_file_tl}}{
\mix_pdfobj:nnn{}{fstream}{\l_mix_file_tl}
\tl_gset:cx{fileEmb_\mix_filemdfivesum:n{\l_mix_file_tl}}{
- \g_mix_pdflastobj_tl
+ \mix_pdflastobj:
}
}
%create FileSpec for current file name if not yet existent
@@ -1153,13 +666,13 @@
/Type/Filespec/F~(#1)%/UF~(#1)
/EF~<</F~\tl_use:c{fileEmb_\mix_filemdfivesum:n{\l_mix_file_tl}}>>
}
- \tl_gset:cx{fileSpec_#1}{\g_mix_pdflastobj_tl}
+ \tl_gset:cx{fileSpec_#1}{\mix_pdflastobj:}
\bool_if:NT\g_mix_usrattach_bool{
\mix_pdfannot:nnnn{0pt}{0pt}{0pt}{
/Contents~(media~resource)
/F~2\cs_if_exist_use:N
/Subtype/FileAttachment
- /FS~\g_mix_pdflastobj_tl
+ /FS~\mix_pdflastobj:
}
}
}
@@ -1331,32 +844,62 @@
\ExplSyntaxOff
\newdimen\mix@btn@dim
\def\g@mix@pbtn@fancy@tl#1#2{% width, total height
- \mix@btn@dim=\dimexpr\baselineskip*3\relax%
- \ifdim#1<\mix@btn@dim\mix@btn@dim=#1\fi%
- \ifdim#2<\mix@btn@dim\mix@btn@dim=#2\fi%
- \tikz[x=\mix@btn@dim,y=\mix@btn@dim,transparency group]{%
- \shade [opacity=\ifdim#2>\dimexpr\baselineskip*6\relax0.6\else0\fi,
- shading angle=-180,even odd rule]
- (-\dimexpr#1/2\relax,-0.5) rectangle (\dimexpr#1/2\relax,0.5)
- (0,0) circle (0.4);
- \shade [ball color=gray,opacity=0.6] (0,0) circle (0.4);
- \fill [color=white,opacity=0.6] %triangle
- (-0.152,0.224)--(-0.152,-0.224)--+(30:0.4844)--cycle;
- }%
+ \ifdefined\tikz%
+ \mix@btn@dim=\dimexpr\baselineskip*3\relax%
+ \ifdim#1<\mix@btn@dim\mix@btn@dim=#1\fi%
+ \ifdim#2<\mix@btn@dim\mix@btn@dim=#2\fi%
+ \tikz[x=\mix@btn@dim,y=\mix@btn@dim,transparency group]{%
+ \shade [opacity=\ifdim#2>\dimexpr\baselineskip*6\relax0.6\else0\fi,
+ shading angle=-180,even odd rule]
+ (-\dimexpr#1/2\relax,-0.5) rectangle (\dimexpr#1/2\relax,0.5)
+ (0,0) circle (0.4);
+ \shade [ball color=gray,opacity=0.6] (0,0) circle (0.4);
+ \fill [color=white,opacity=0.6] %triangle
+ (-0.152,0.224)--(-0.152,-0.224)--+(30:0.4844)--cycle;
+ }%
+ \else%
+ \ifcsname g_mix_rerunwarned_tl\endcsname\else%
+ \expandafter\gdef\csname g_mix_rerunwarned_tl\endcsname{}%
+ \AtEndDocument{\csname msg_warning:nn\endcsname{media9}{rerun}}%
+ \fi%
+ \fi%
+ \ifdefined\mix@AtEnd@Doc\else%
+ \@bsphack\protected@write\@mainaux{}{%
+ \string\ifdefined\string\mix@AtEnd@Doc\string\else%
+ \string\AtBeginDocument{\string\RequirePackage{tikz}}%
+ \string\fi%
+ }\@esphack%
+ \gdef\mix@AtEnd@Doc{}%
+ \fi%
}
\def\g@mix@pbtn@plain@tl#1#2{% width, total height
- \mix@btn@dim=\dimexpr\baselineskip*3\relax%
- \ifdim#1<\mix@btn@dim\mix@btn@dim=#1\fi%
- \ifdim#2<\mix@btn@dim\mix@btn@dim=#2\fi%
- \tikz[x=\mix@btn@dim,y=\mix@btn@dim,transparency group]{%
- \fill [opacity=\ifdim#2>\dimexpr\baselineskip*6\relax0.5\else0\fi,
- color=gray,even odd rule]
- (-\dimexpr#1/2\relax,-0.5) rectangle (\dimexpr#1/2\relax,0.5);
- (0,0) circle (0.4);
- \fill [color=black,opacity=0.5] (0,0) circle (0.4);
- \fill [color=white,opacity=0.8]
- (-0.152,0.224)--(-0.152,-0.224)--+(30:0.4844)--cycle;
- }%
+ \ifdefined\tikz%
+ \mix@btn@dim=\dimexpr\baselineskip*3\relax%
+ \ifdim#1<\mix@btn@dim\mix@btn@dim=#1\fi%
+ \ifdim#2<\mix@btn@dim\mix@btn@dim=#2\fi%
+ \tikz[x=\mix@btn@dim,y=\mix@btn@dim,transparency group]{%
+ \fill [opacity=\ifdim#2>\dimexpr\baselineskip*6\relax0.5\else0\fi,
+ color=gray,even odd rule]
+ (-\dimexpr#1/2\relax,-0.5) rectangle (\dimexpr#1/2\relax,0.5);
+ (0,0) circle (0.4);
+ \fill [color=black,opacity=0.5] (0,0) circle (0.4);
+ \fill [color=white,opacity=0.8]
+ (-0.152,0.224)--(-0.152,-0.224)--+(30:0.4844)--cycle;
+ }%
+ \else%
+ \ifcsname g_mix_rerunwarned_tl\endcsname\else%
+ \expandafter\gdef\csname g_mix_rerunwarned_tl\endcsname{}%
+ \AtEndDocument{\csname msg_warning:nn\endcsname{media9}{rerun}}%
+ \fi%
+ \fi%
+ \ifdefined\mix@AtEnd@Doc\else%
+ \@bsphack\protected@write\@mainaux{}{%
+ \string\ifdefined\string\mix@AtEnd@Doc\string\else%
+ \string\AtBeginDocument{\string\RequirePackage{tikz}}%
+ \string\fi%
+ }\@esphack%
+ \gdef\mix@AtEnd@Doc{}%
+ \fi%
}
\ExplSyntaxOn
@@ -1369,7 +912,7 @@
\cs_if_exist:NF\g_mix_appearance_tl{
\hbox_set:Nn\l_mix_poster_box{\phantom{\rule{1pt}{1pt}}}
\mix_pdfxform:n{\l_mix_poster_box}
- \tl_gset:Nx\g_mix_appearance_tl{\g_mix_pdflastxform_tl}
+ \tl_gset:Nx\g_mix_appearance_tl{\mix_pdflastxform:}
}
\mix_reset:
\mix_uribegin: %treat URI characters correctly
@@ -1418,12 +961,12 @@
}
}
\mix_pdfobj:nnn{}{dict}{
- /Type/Filespec/EF~<</F~\g_mix_pdflastobj_tl>>/F~(btnoff)%/UF~(btnoff)
+ /Type/Filespec/EF~<</F~\mix_pdflastobj:>>/F~(btnoff)%/UF~(btnoff)
}
- \tl_gset:Nx\g_mix_assets_tl{(btnoff)~\g_mix_pdflastobj_tl}
- \tl_set:Nx\l_mix_scripts_tl{~\g_mix_pdflastobj_tl~}
+ \tl_gset:Nx\g_mix_assets_tl{(btnoff)~\mix_pdflastobj:}
+ \tl_set:Nx\l_mix_scripts_tl{~\mix_pdflastobj:~}
%enforce plain playbutton overlay for XeTeX
- \xetex_if_engine:T{\tl_gset:Nn\g_mix_usrpbtn_tl{plain}}
+ \sys_if_engine_xetex:T{\tl_gset:Nn\g_mix_usrpbtn_tl{plain}}
}
%embed main asset
\mix_uribegin:
@@ -1499,7 +1042,7 @@
\tl_set_eq:NN\l_mix_nr_tl\g_mix_nrdflt_tl
\mix_view:n{Default}
- \tl_set:Nx\l_mix_dfltview_tl{\g_mix_pdflastobj_tl}
+ \tl_set:Nx\l_mix_dfltview_tl{\mix_pdflastobj:}
}
\mix_pdfobj:nnn{}{dict}{
@@ -1520,24 +1063,24 @@
}
}
\tl_if_empty:NF\g_mix_usrlabel_tl{
- \mix_keytoaux_now:nn{main@\g_mix_usrlabel_tl}{\g_mix_pdflastobj_tl}
+ \mix_keytoaux_now:nn{main@\g_mix_usrlabel_tl}{\mix_pdflastobj:}
}
\mix_pdfobj:nnn{}{dict}{
/Type/RichMediaConfiguration
/Subtype/\g_mix_mainassetsub_tl
- /Instances~[\g_mix_pdflastobj_tl]
+ /Instances~[\mix_pdflastobj:]
}
\mix_pdfobj:nnn{}{dict}{
/Type/RichMediaContent
/Assets~<</Names~[\g_mix_assets_tl]>>
- /Configurations~[\g_mix_pdflastobj_tl]
+ /Configurations~[\mix_pdflastobj:]
\bool_if:nT{
\g_mix_iiid_bool && !(\tl_if_empty_p:V\l_mix_iiidviewarray_tl)
}{
/Views~[\l_mix_iiidviewarray_tl]
}
}
- \tl_set:Nx\l_mix_content_tl{\g_mix_pdflastobj_tl}
+ \tl_set:Nx\l_mix_content_tl{\mix_pdflastobj:}
\bool_if:nT{
\g_mix_iiid_bool && \str_if_eq_p:Vn\g_mix_playtpe_tl{Oscillating}
}{
@@ -1600,14 +1143,14 @@
>>
/Deactivation~<</Condition\g_mix_deact_tl>>
}
- \tl_set:Nx\l_mix_settings_tl{\g_mix_pdflastobj_tl}
+ \tl_set:Nx\l_mix_settings_tl{\mix_pdflastobj:}
\tl_if_empty:NF\g_mix_usrlabel_tl{
\tl_gset_eq:NN\g_mix_label_tl\g_mix_usrlabel_tl
}
% #1:width, #2:height, #3:depth, #4:content (key-value)
\mix_pdfannot:nnnn{\g_mix_wd_tl}{\g_mix_ht_tl}{\g_mix_dp_tl}{
/Subtype/RichMedia
- /F~4\cs_if_exist_use:N\fxocg@insert@OC
+ /F~4\cs_if_exist_use:N\ocgxii@insert@OC
/BS~<</W~0/S/S>>
/Contents~(media~embedded~by~media9~[\g_mix_version_tl~(\g_mix_date_tl)])
/NM~(\g_mix_label_tl)
@@ -1616,7 +1159,7 @@
/RichMediaContent~\l_mix_content_tl
}
\tl_if_empty:NF\g_mix_usrlabel_tl{
- \mix_keytoaux_now:nn{ann@\g_mix_usrlabel_tl}{\g_mix_pdflastann_tl}
+ \mix_keytoaux_now:nn{ann@\g_mix_usrlabel_tl}{\mix_pdflastann:}
\mix_keytoaux_shipout:nn{page@\g_mix_usrlabel_tl}{
\noexpand\the\g@mix@page@int}
}
@@ -1656,9 +1199,9 @@
/FT/Btn/Ff~65537/F~2
/BS~<</W~0>>
/T~(fd@\g_mix_label_tl)
- /AA~<</PO~\g_mix_pdflastobj_tl~/PV~\g_mix_pdflastobj_tl>>
+ /AA~<</PO~\mix_pdflastobj:~/PV~\mix_pdflastobj:>>
}
- \tl_gput_right:Nx\@anim@fields{\space\g_mix_pdflastann_tl\space}
+ \tl_gput_right:Nx\@anim@fields{\space\mix_pdflastann:\space}
\hbox_overlap_right:n{\box_use:N\l_mix_poster_box}
\str_if_eq_x:nnTF{\g_mix_usrpbtn_tl}{none}{
\hbox_to_wd:nn{\g_mix_wd_tl}{
@@ -1689,21 +1232,17 @@
%environment \mix_uribegin: ... \mix_uriend: to sanitize possibly
%active chars in URLs (RFC 2396), path specifications and JavaScript
\group_begin:
-\char_set_catcode_active:N\~
-\cs_new:Npn\mix_uribegin:{
+\char_set_catcode_other:n{`\~}
+\cs_new_protected_nopar:Npn\mix_uribegin:{
\group_begin:
- %code contributed by E. Gregorio
- \tl_map_inline:nn{.:;?!/"'*+,->=<$@][)(^_`|~}{
- \group_begin:
- \char_set_lccode:nn{`\~}{`##1}
- \tl_to_lowercase:n{\group_end:\cs_set:Npn~}{\token_to_str:N##1}
+ %code contributed by J. Wright
+ \tl_map_inline:nn{.:;?!/"'*+,->=<$@([])^_`|~}{
+ \cs_set_nopar:Npx\__mix_tmp:w{\token_to_str:N##1}
+ \char_set_active_eq:NN##1\__mix_tmp:w
+ }
+ \tl_map_inline:nn{\#\&\%\\\{\}}{
+ \cs_set_nopar:Npx##1{\token_to_str:N##1}
}
- \cs_set:Npn\#{\token_to_str:N\#}
- \cs_set:Npn\&{\token_to_str:N\&}
- \cs_set:Npn\%{\token_to_str:N\%}
- \cs_set:Npn\\{\token_to_str:N\\}
- \cs_set:Npn\{{\token_to_str:N\{}
- \cs_set:Npn\}{\token_to_str:N\}}
}
\group_end:
\cs_set_eq:NN\mix_uriend:\group_end:
@@ -2581,7 +2120,7 @@
\tl_set:Nx\l_mix_xname_tl{View~\int_use:N\l_mix_viewcnt_int}
}
\mix_view:n{\l_mix_xname_tl}
- \tl_put_right:Nx\l_mix_iiidviewarray_tl{~\g_mix_pdflastobj_tl}
+ \tl_put_right:Nx\l_mix_iiidviewarray_tl{~\mix_pdflastobj:}
\tl_set:Nn\l_mix_level_tl{\c_minus_one}
}
@@ -2599,7 +2138,7 @@
}
}
- \tl_put_right:Nx\l_mix_naarray_tl{~\g_mix_pdflastobj_tl}
+ \tl_put_right:Nx\l_mix_naarray_tl{~\mix_pdflastobj:}
\tl_set:Nn\l_mix_level_tl{\c_zero}
}
{2}{ %CROSSSECT
@@ -2611,7 +2150,7 @@
\l_mix_csop_tl\l_mix_cspv_tl\l_mix_cspc_tl
\l_mix_csic_tl\l_mix_csiv_tl
}
- \tl_put_right:Nx\l_mix_saarray_tl{~\g_mix_pdflastobj_tl}
+ \tl_put_right:Nx\l_mix_saarray_tl{~\mix_pdflastobj:}
\tl_set:Nn\l_mix_cscount_tl{\c_one}
}
\tl_set:Nn\l_mix_level_tl{\c_zero}
@@ -2658,14 +2197,14 @@
overface .code:n = {
\hbox_set:Nn\l_mix_poster_box{#1}
\mix_pdfxform:n{\l_mix_poster_box}
- \tl_gset:Nx\g_mix_overbtn_tl{\g_mix_pdflastxform_tl}
+ \tl_gset:Nx\g_mix_overbtn_tl{\mix_pdflastxform:}
},
overface .value_required:n = {true},
downface .code:n = {
\hbox_set:Nn\l_mix_poster_box{#1}
\mix_pdfxform:n{\l_mix_poster_box}
- \tl_gset:Nx\g_mix_downbtn_tl{\g_mix_pdflastxform_tl}
+ \tl_gset:Nx\g_mix_downbtn_tl{\mix_pdflastxform:}
},
downface .value_required:n = {true},
@@ -2708,7 +2247,7 @@
>>
}
}
- \tl_gput_right:Nx\g_mix_btnactions_tl{~\g_mix_pdflastobj_tl}
+ \tl_gput_right:Nx\g_mix_btnactions_tl{~\mix_pdflastobj:}
}
}{
\msg_warning:nnx{media9}{undefined~reference}{\l_tmpa_tl}
@@ -2759,7 +2298,7 @@
>>
}
}
- \tl_gput_right:Nx\g_mix_btnactions_tl{~\g_mix_pdflastobj_tl}
+ \tl_gput_right:Nx\g_mix_btnactions_tl{~\mix_pdflastobj:}
}
}{
\msg_warning:nnx{media9}{undefined~reference}{\l_tmpa_tl}
@@ -2807,7 +2346,7 @@
}
annotRM['\l_tmpa_tl'].activated=true;
)
- \tl_if_blank:VF\l_tmpb_tl{/Next~\g_mix_pdflastobj_tl}
+ \tl_if_blank:VF\l_tmpb_tl{/Next~\mix_pdflastobj:}
}
}
\bool_if:nT{
@@ -2815,7 +2354,7 @@
!\str_if_eq_x_p:nn{\tl_use:c{ann@\l_tmpa_tl}}{draft}||
!\tl_if_blank_p:V\l_tmpb_tl
}{
- \tl_gput_right:Nx\g_mix_btnactions_tl{~\g_mix_pdflastobj_tl}
+ \tl_gput_right:Nx\g_mix_btnactions_tl{~\mix_pdflastobj:}
}
},
jsaction .value_required:n = {true},
@@ -2849,11 +2388,11 @@
\tl_set:Nx\depth {\dim_use:N\box_dp:N\l_mix_poster_box}
\bool_if:NTF\g_mix_btndraft_bool{\box_use:N\l_mix_poster_box}{
\mix_pdfxform:n{\l_mix_poster_box}
- \tl_set:Nx\g_mix_normalbtn_tl{\g_mix_pdflastxform_tl}
- \bool_if:nT{ %dummy Widget for fixocgx, AR seems to need it
-% \cs_if_exist_p:N\fxocg@insert@OC && !\tl_if_blank_p:V\fxocg@insert@OC
- !\cs_if_exist:NTF\fxocg@insert@OC{
- \tl_if_blank_p:V\fxocg@insert@OC
+ \tl_set:Nx\g_mix_normalbtn_tl{\mix_pdflastxform:}
+ \bool_if:nT{ %dummy Widget for ocgx2, AR seems to need it
+% \cs_if_exist_p:N\ocgxii@insert@OC && !\tl_if_blank_p:V\ocgxii@insert@OC
+ !\cs_if_exist:NTF\ocgxii@insert@OC{
+ \tl_if_blank_p:V\ocgxii@insert@OC
}{
\c_true_bool
}
@@ -2863,7 +2402,7 @@
/Subtype/Widget
/T~(mbtn@\int_use:N\g_mix_mbtncnt_int)
\tl_if_empty:NF\g_mix_tooltip_tl{/TU~(\g_mix_tooltip_tl)}
- /FT/Btn/Ff~65536\cs_if_exist_use:N\fxocg@insert@OC
+ /FT/Btn/Ff~65536\cs_if_exist_use:N\ocgxii@insert@OC
\tl_if_empty:NTF\g_mix_downbtn_tl{/H/I}{/H/P}
/AP~<<
/N~\g_mix_normalbtn_tl
@@ -2882,11 +2421,15 @@
\tl_if_empty:NF\g_mix_btnactions_tl{/Next~[\g_mix_btnactions_tl]}
>>
}
- \tl_gput_right:Nx\@anim@fields{\g_mix_pdflastann_tl\space}
+ \tl_gput_right:Nx\@anim@fields{\mix_pdflastann:\space}
\hbox_to_wd:nn{\width}{
\vrule~width~\c_zero_dim~height~\height~depth~\depth\hss
}
\int_gincr:N\g_mix_mbtncnt_int
+ \cs_if_exist:NF\g_mix_dpiwarned_tl{
+ \tl_new:N\g_mix_dpiwarned_tl
+ \AtEndDvi{\special{ps::[nobreak]\mix_dpiwarning:}}
+ }
}
\group_end:
}
diff --git a/Master/texmf-dist/tex/latex/media9/pdfbase.sty b/Master/texmf-dist/tex/latex/media9/pdfbase.sty
new file mode 100644
index 00000000000..b736a571417
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/media9/pdfbase.sty
@@ -0,0 +1,635 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% pdfbase.sty
+%
+% driver independent access to low-level pdf features
+%
+% Copyright 2015--\today, Alexander Grahn
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Support package for media9 and ocgx2.
+%
+% This package implements commands for the creation of PDF Objects,
+% Form XObjects, Image XObjects, annotations, links, marked content (BDC/EMC)
+% and for manipulating the PDF catalog.
+%
+% Supported workflows:
+%
+% pdflatex, lualatex
+% latex-->dvips-->ps2pdf or Distiller
+% latex-->dvipdfmx
+% xelatex
+%
+%
+% Package options:
+%
+% xetex,
+% dvipdfmx,
+% bigfiles (for embedding large files as stream objects; only relevant for
+% dvips mode, ignored otherwise)
+%
+% Commands defined:
+%
+% \pbs_pdfobj:nnn
+% #1: predefined PDF object ID to be used for the current obj; may be empty
+% #2: type of object (dict|array|stream|fstream)
+% #3: content (dict [key-value], string, file); if #3 && #1 are both empty,
+% an object reference will be reserved for later use as #1
+%
+% \pbs_pdflastobj:
+% inserts ID of PDF object created/processed during most recent call of
+% \pbs_pdfobj:nnn
+%
+% --------
+%
+% \pbs_pdfannot:nnnn
+% #1: width, #2: height, #3: depth, #4: dict (key-value)
+%
+% \pbs_pdflastann:
+% inserts ID of PDF object created during most recent call of
+% \pbs_pdfannot:nnnn
+%
+% --------
+%
+% \pbs_pdflink:nn
+% #1: dict (key-value), #2: text
+%
+% --------
+%
+% \pbs_pdfxform:n
+% #1: savebox number
+%
+% \pbs_pdflastxform:
+% inserts ID of PDF object created during most recent call of
+% \pbs_pdfxform:n
+%
+% --------
+%
+% \pbs_pdfximage:n
+% #1: bitmap file name
+%
+% \pbs_pdflastximage:
+% inserts ID of PDF object created during most recent call of
+% \pbs_pdfximage:n
+%
+% --------
+%
+% \pbs_pdfcatalog:n
+% #1: dict (key-value)
+%
+% --------
+%
+% marked content BDC/EMC operators
+% \pbs_pdfbdc:nn ... \pbs_pdfemc:
+% #1: tag, #2: properties dict obj ID
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://mirrors.ctan.org/help/Catalogue/licenses.lppl.html
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is A. Grahn.
+
+\RequirePackage{expl3}
+\RequirePackage{l3keys2e}
+\RequirePackage{atbegshi}
+
+\def\g@pbs@date@tl{2015/10/28}
+\def\g@pbs@version@tl{0.1}
+
+\ProvidesExplPackage{pdfbase}{\g@pbs@date@tl}{\g@pbs@version@tl}
+{driver independent access to low-level PDF features}
+
+%wrong image file type for Image XObject generation
+\msg_set:nnn{pdfbase}{wrong~image~resource}{
+ Image~resource~file\\~~'#1'\\has~wrong~type.\\\\
+ Driver~#2~only~accepts~files~of~type\\#3\\
+ as~image~resources.
+}
+
+%pdfTeX version check
+\sys_if_engine_pdftex:T{
+ \int_compare:nT{\pdftexversion<130}{
+ \msg_interrupt:nnn{pdfbase~error}{pdfTeX,~version~>=~1.30~required.}{}
+ }
+}
+
+%package options
+
+%unknown package option error message
+\msg_set:nnnn{pdfbase}{unknown~package~option}{Unknown~package~option~`#1'.}{
+ Package option~'#1'~is~unknown;\\
+ perhaps~it~is~spelled~incorrectly.
+}
+
+\bool_new:N\g_pbs_pkgbigfiles_bool
+\bool_new:N\g_pbs_dvipdfmx_bool
+
+\keys_define:nn{pdfbase}{
+ xetex .bool_gset:N = \g_pbs_dvipdfmx_bool,
+ dvipdfmx .bool_gset:N = \g_pbs_dvipdfmx_bool,
+
+ bigfiles .choice:,
+ bigfiles / true .code:n = {\bool_gset_true:N\g_pbs_pkgbigfiles_bool},
+ bigfiles / false .code:n = {\bool_gset_false:N\g_pbs_pkgbigfiles_bool},
+ bigfiles .default:n = {true},
+
+ unknown .code:n = {
+ \msg_error:nnx{pdfbase}{unknown~package~option}{\l_keys_key_tl}
+ }
+}
+\ProcessKeysOptions{pdfbase}
+\sys_if_engine_xetex:T{\bool_gset_true:N\g_pbs_dvipdfmx_bool}
+
+%commands for creating PDF objects, annots etc.
+\sys_if_output_pdf:TF{
+ %helper func to remove `0 R' part from pdf obj reference
+ \cs_new:Npn\pbs_reftonum:w #1~0~R {#1}
+ \cs_new:Nn\pbs_pdfobj:nnn{
+ \tl_clear:N\l_pbs_usenum_tl
+ \tl_if_blank:oF{#1}{
+ \tl_set:Nx\l_pbs_usenum_tl{useobjnum~\exp_after:wN \pbs_reftonum:w #1}
+ }
+ \bool_if:nTF{\tl_if_blank_p:o{#1}&&\tl_if_blank_p:o{#3}}{
+ \pdfobj~reserveobjnum
+ }{
+ \str_case:nn{#2}{
+ {dict}{\immediate\pdfobj~\l_pbs_usenum_tl~{<<#3>>}}
+ {array}{\immediate\pdfobj~\l_pbs_usenum_tl~{[#3]}}
+ {stream}{\immediate\pdfobj~\l_pbs_usenum_tl~stream~{#3}}
+ {fstream}{\immediate\pdfobj~\l_pbs_usenum_tl~stream~file~{#3}}
+ }
+ }
+ \tl_gset:Nx\g_pbs_pdflastobj_tl{\the\pdflastobj\space 0~R}
+ }
+
+ \cs_new:Nn\pbs_pdfannot:nnnn{
+ \immediate\pdfannot~width~#1~height~#2~depth~#3 {#4}
+ \tl_gset:Nx\g_pbs_pdflastann_tl{\int_use:c{pdflastannot}~0~R}
+ }
+
+ \cs_new:Nn\pbs_pdflink:nn{
+ \immediate\pdfstartlink~user~{#1}#2\pdfendlink
+ }
+
+ \cs_new:Nn\pbs_pdfxform:n{
+ \immediate\pdfxform~resources~{\the\pdfpageresources}~#1
+ \tl_gset:Nx\g_pbs_pdflastxform_tl{\int_use:c{pdflastxform}~0~R}
+ }
+
+ \cs_new:Nn\pbs_pdfximage:n{
+ \filename@parse{#1}
+ \tl_set:Nx\l_pbs_ext_tl{\tl_lower_case:n{\filename@ext}}
+ \bool_if:nTF{
+ \str_if_eq_p:Vn\l_pbs_ext_tl{png}
+ ||\str_if_eq_p:Vn\l_pbs_ext_tl{jpg}
+ ||\str_if_eq_p:Vn\l_pbs_ext_tl{jpeg}
+ ||\str_if_eq_p:Vn\l_pbs_ext_tl{jbig2}
+ ||\str_if_eq_p:Vn\l_pbs_ext_tl{jb2}
+ }{
+ \immediate\pdfximage{#1}
+ \tl_gset:Nx\g_pbs_pdflastximage_tl{\int_use:c{pdflastximage}~0~R}
+ }{
+ \msg_error:nnnnn{pdfbase}{wrong~image~resource}{#1}{pdftex}{
+ png,~jpeg~and~jbig2
+ }
+ }
+ }
+
+ \cs_new:Nn\pbs_pdfcatalog:n{\pdfcatalog{#1}}
+
+ \int_new:N\g_pbs_oc_int % object ID
+ \cs_new:Nn\pbs_pdfbdc:nn{
+ \pdfliteral~direct~{#1/rm@oc\int_use:N\g_pbs_oc_int\space BDC}
+ \tl_if_empty:NTF\@anim@ocmap{
+ \tl_gset:cx{@anim@ocmap}{/rm@oc\int_use:N\g_pbs_oc_int\space#2}
+ }{
+ \tl_gput_right:cx{@anim@ocmap}{~/rm@oc\int_use:N\g_pbs_oc_int\space#2}
+ }
+ \group_begin:
+ \tl_set:Nx\l_pbs_temp_tl{\group_end:
+ \global\pdfpageresources{\the\pdfpageresources
+ /Properties<<\@anim@ocmap>>
+ }
+ }\l_pbs_temp_tl
+ \int_gincr:N\g_pbs_oc_int
+ }
+ \tl_if_exist:cF{@anim@ocmap}{
+ \tl_gset:cn{@anim@ocmap}{}
+ \AtBeginShipout{\tl_gset:cn{@anim@ocmap}{}}
+ }
+ \cs_new:Nn\pbs_pdfemc:{\pdfliteral~direct~{EMC}}
+}{
+ %pgf + transparency related settings
+ \bool_new:N\g_pbs_pgfloaded_bool
+ \bool_gset_false:N\g_pbs_pgfloaded_bool
+ \AtBeginDocument{
+ \@ifpackageloaded{pgf}{\bool_gset_true:N\g_pbs_pgfloaded_bool}{}
+ }
+ \int_new:N\g_pbs_obj_int % object ID
+ \bool_if:NTF\g_pbs_dvipdfmx_bool{ %dvipdfmx/XeTeX
+ \cs_new:Nn\pbs_pdfobj:nnn{
+ \tl_if_blank:oTF{#1}{
+ \tl_set:Nx\l_pbs_usenum_tl{@pbs@obj\int_use:N\g_pbs_obj_int}
+ \int_gincr:N\g_pbs_obj_int
+ }{
+ \tl_set:Nx\l_pbs_usenum_tl{#1}
+ }
+ \tl_if_blank:oF{#3}{
+ \str_case:nn{#2}{
+ {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(#3)}}
+ {fstream}{
+ \message{<#3>}
+ \special{pdf:fstream~\l_pbs_usenum_tl\space(#3)}
+ }
+ }
+ }
+ \tl_gset_eq:NN\g_pbs_pdflastobj_tl\l_pbs_usenum_tl
+ }
+
+ \cs_new:Nn\pbs_pdfannot:nnnn{
+ \special{pdf:ann~@pbs@obj\int_use:N\g_pbs_obj_int\space
+ width~#1\space
+ height~#2\space
+ depth~#3~<<#4>>
+ }
+ \tl_gset:Nx\g_pbs_pdflastann_tl{@pbs@obj\int_use:N\g_pbs_obj_int}
+ \int_gincr:N\g_pbs_obj_int
+ }
+
+ \cs_new:Nn\pbs_pdflink:nn{
+ \special{pdf:bann~<<#1>>}#2\special{pdf:eann}
+ }
+
+ \cs_new:Nn\pbs_pdfxform:n{
+ \special{pdf:bxobj~@pbs@obj\int_use:N\g_pbs_obj_int\space
+ width\space \dim_use:N\box_wd:N#1\space
+ height\space\dim_use:N\box_ht:N#1\space
+ depth\space \dim_use:N\box_dp:N#1
+ }
+ \begin{picture}(0,0)\put(0,0){\box_use:N #1}\end{picture}
+ \bool_if:NT\g_pbs_pgfloaded_bool{ % transparency et al. for PGF
+ \tl_set:Nn\l_pbs_temp_tl{}
+ \ifpgf@sys@pdf@extgs@exists
+ \tl_set:Nn\l_pbs_temp_tl{/ExtGState~@pgfextgs}
+ \fi
+ \ifpgf@sys@pdf@patterns@exists
+ \tl_put_right:Nn\l_pbs_temp_tl{/Pattern~@pgfpatterns}
+ \fi
+ \ifpgf@sys@pdf@colorspaces@exists
+ \tl_put_right:Nn\l_pbs_temp_tl{/ColorSpace~@pgfcolorspaces}
+ \fi
+ \tl_if_blank:VF\l_pbs_temp_tl{
+ \special{pdf:put~@resources~<<\l_pbs_temp_tl>>}
+ }
+ }
+ \special{pdf:exobj}
+ \tl_gset:Nx\g_pbs_pdflastxform_tl{@pbs@obj\int_use:N\g_pbs_obj_int}
+ \int_gincr:N\g_pbs_obj_int
+ }
+
+ \cs_new:Nn\pbs_pdfximage:n{
+ \filename@parse{#1}
+ \tl_set:Nx\l_pbs_ext_tl{\tl_lower_case:n{\filename@ext}}
+ \bool_if:nTF{
+ \str_if_eq_p:Vn\l_pbs_ext_tl{png}
+ ||\str_if_eq_p:Vn\l_pbs_ext_tl{jpg}
+ ||\str_if_eq_p:Vn\l_pbs_ext_tl{jpeg}
+ }{
+ \special{pdf:image~@pbs@obj\int_use:N\g_pbs_obj_int\space
+ %move initial display off the page
+ matrix~0.000001~0~0~0.000001~-1000000~-1000000~(#1)}
+ \tl_gset:Nx\g_pbs_pdflastximage_tl{@pbs@obj\int_use:N\g_pbs_obj_int}
+ \int_gincr:N\g_pbs_obj_int
+ }{
+ \msg_error:nnnnn{pdfbase}{wrong~image~resource}{#1}{dvipdfmx/xetex}{
+ png~and~jpeg
+ }
+ }
+ }
+
+ \cs_new:Nn\pbs_pdfcatalog:n{\special{pdf:put~@catalog~<<#1>>}}
+
+ \int_new:N\g_pbs_oc_int % object ID
+ \cs_new:Nn\pbs_pdfbdc:nn{
+ \special{pdf:code~#1/rm@oc\int_use:N\g_pbs_oc_int\space BDC}
+ \special{pdf:put~@resources~<<
+ /Properties~<</rm@oc\int_use:N\g_pbs_oc_int\space#2>>>>}
+ \int_gincr:N\g_pbs_oc_int
+ }
+ \cs_new:Nn\pbs_pdfemc:{\special{pdf:~code~EMC}}
+ }{
+ % dvips
+ \bool_new:N\g_pbs_powerdot_bool %to cope with some powerdot oddity
+ \@ifclassloaded{powerdot}{\bool_gset_true:N\g_pbs_powerdot_bool}{}
+
+ \sys_if_engine_pdftex:TF{
+ \cs_new:Nn\pbs_filesize:n{\pdffilesize{#1}}
+ \cs_new:Nn\pbs_filedump:nnn{\pdffiledump~offset~#1~length~#2~{#3}}
+ }{
+ \sys_if_engine_luatex:T{
+ \RequirePackage{pdftexcmds}
+ \cs_new:Nn\pbs_filesize:n{\pdf@filesize{#1}}
+ \cs_new:Nn\pbs_filedump:nnn{\pdf@filedump{#1}{#2}{#3}}
+ }
+ }
+
+ \@ifpackageloaded{hyperref}{}{
+ %define `?pdfmark' operator as in file hdvips.def from package `hyperref'
+ \special{!~
+ systemdict~/pdfmark~known
+ {
+ userdict~/?pdfmark~systemdict~/exec~get~put
+ }{
+ userdict~/?pdfmark~systemdict~/pop~get~put~
+ userdict~/pdfmark~systemdict~/cleartomark~get~put
+ }
+ ifelse~
+ }
+ }
+
+ \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
+ \iow_new:N\g_pbs_mstreams_stream
+ \iow_open:Nn\g_pbs_mstreams_stream{\jobname.pbsdat}
+ \iow_now:Nn\g_pbs_mstreams_stream{
+ /M9D~1~dict~def~M9D~begin
+ /o{mark/_objdef}bind~def/O{/type/stream/OBJ~pdfmark}bind~def
+ /m~systemdict/mark~get~def
+ /P{/ASCIIHexDecode~filter/PUT~pdfmark}bind~def
+ /C{/CLOSE~pdfmark}bind~def~end
+ }
+ }
+
+ \cs_new:Nn\pbs_pdfobj:nnn{
+ \tl_clear:N\l_pbs_usenum_tl
+ \tl_if_blank:oTF{#1}{
+ \tl_set:Nx\l_pbs_usenum_tl{{pbs@obj\int_use:N\g_pbs_obj_int}}
+ \int_gincr:N\g_pbs_obj_int
+ }{
+ \tl_set:Nx\l_pbs_usenum_tl{#1}
+ }
+ \tl_if_blank:oF{#3}{
+ \bool_if:nTF{
+ \g_pbs_pkgbigfiles_bool &&
+ \str_if_eq_p:nn{#2}{fstream}
+ }{
+ \iow_now:Nx\g_pbs_mstreams_stream{
+ M9D~begin~o\l_pbs_usenum_tl O
+ }
+ }{
+ \special{ps:~mark~/_objdef~\l_pbs_usenum_tl\space/type
+ \str_case:nn{#2}{
+ {dict}{/dict}
+ {array}{/array}
+ {stream}{/stream}
+ {fstream}{/stream}
+ }~
+ /OBJ~pdfmark~
+ }
+ }
+ \str_case:nn{#2}{
+ {dict}{\special{ps:~mark~\l_pbs_usenum_tl~<<#3>>/PUT~pdfmark~}}
+ {array}{
+ \special{ps:~mark~\l_pbs_usenum_tl~0~[#3]/PUTINTERVAL~pdfmark~}
+ }
+ {stream}{\special{ps::[nobreak]~mark~\l_pbs_usenum_tl~(#3)/PUT~pdfmark~}}
+ {fstream}{
+ \tl_set:Nn\l_pbs_offset_tl{0}
+ \tl_set:Nx\l_pbs_fsize_tl{\pbs_filesize:n{#3}}
+ \message{<#3}
+ %embed file in chunks of 32768 Bytes into PS as chunks of
+ %65536 Bytes of HEX code
+ \bool_while_do:nn{
+ \int_compare_p:n{\l_pbs_offset_tl<\l_pbs_fsize_tl}
+ }{
+ \bool_if:NTF\g_pbs_pkgbigfiles_bool{
+ \iow_now:Nx\g_pbs_mstreams_stream{
+ m\l_pbs_usenum_tl
+ (\pbs_filedump:nnn{\l_pbs_offset_tl}{32767}{#3})P
+ }
+ }{
+ \special{ps:~
+ mark~
+ \l_pbs_usenum_tl~
+ (\pbs_filedump:nnn{\l_pbs_offset_tl}{32767}{#3})~
+ /ASCIIHexDecode~filter~/PUT~
+ pdfmark~
+ }
+ }
+ \tl_set:Nx\l_pbs_offset_tl{\int_eval:n{\l_pbs_offset_tl+32767}}
+ \message{.}
+ }
+ \message{>}
+ \bool_if:NTF\g_pbs_pkgbigfiles_bool{
+ \iow_now:Nx\g_pbs_mstreams_stream{
+ m\l_pbs_usenum_tl~C~end
+ }
+ }{
+ \special{ps:~
+ mark~\l_pbs_usenum_tl~/CLOSE~pdfmark~
+ }
+ }
+ }
+ }
+ }
+ \tl_gset_eq:NN\g_pbs_pdflastobj_tl\l_pbs_usenum_tl
+ }
+
+ \cs_new:Nn\pbs_pdfannot:nnnn{
+ \hbox_set:Nn\l_tmpa_box{
+ \box_move_down:nn{#3}{
+ \hbox_to_zero:n{
+ \special{ps:~currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def}
+ }
+ }
+ \skip_horizontal:n{#1}
+ \box_move_up:nn{#2}{
+ \hbox_to_zero:n{
+ \special{ps:~currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def}
+ }
+ }
+ }
+ \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
+ \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
+ \box_set_dp:Nn\l_tmpa_box{\c_zero_dim}
+ \box_use_clear:N\l_tmpa_box
+ \special{ps:~
+ mark~
+ /_objdef~{pbs@obj\int_use:N\g_pbs_obj_int}
+ /Rect~[pbs@llx~pbs@lly~pbs@urx~pbs@ury]
+ #4
+ /ANN~pdfmark~
+ }
+ \tl_gset:Nx\g_pbs_pdflastann_tl{{pbs@obj\int_use:N\g_pbs_obj_int}}
+ \int_gincr:N\g_pbs_obj_int
+ }
+
+ \cs_new:Nn\pbs_pdflink:nn{
+ \cs_if_exist:NTF\pdfmark{
+ \pdfmark[#2]{pdfmark=/ANN,Raw={#1}}
+ }{
+ \hbox_set:Nn\l_tmpb_box{#2}
+ \pbs_pdfannot:nnnn{
+ \dim_use:N\box_wd:N\l_tmpb_box}{
+ \dim_use:N\box_ht:N\l_tmpb_box}{
+ \dim_use:N\box_dp:N\l_tmpb_box
+ }{#1}
+ \box_use_clear:N\l_tmpb_box
+ }
+ }
+
+ \cs_new:Nn\pbs_pdfxform:n{
+ %mark bbox of box#1
+ \hbox_set:Nn\l_tmpa_box{
+ \box_move_down:nn{\box_dp:N #1}{
+ \hbox_to_zero:n{
+ \special{ps:~currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def}
+ }
+ }
+ \skip_horizontal:n{\box_wd:N #1}
+ \box_move_up:nn{\box_ht:N #1}{
+ \hbox_to_zero:n{
+ \special{ps:~currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def}
+ }
+ }
+ }
+ \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
+ \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
+ \box_set_dp:Nn\l_tmpa_box{\c_zero_dim}
+ \box_use_clear:N\l_tmpa_box
+ %define some length values in current PS coordinate units
+ \hbox_set:Nn\l_tmpa_box{
+ \special{ps:~currentpoint~/origin@y~exch~def~/origin@x~exch~def}
+ \skip_horizontal:n{72.27pt}
+ \box_move_up:nn{72.27pt}{
+ \hbox_to_zero:n{
+ \special{ps:~
+ currentpoint~origin@y~exch~sub~/one@inch@y~exch~def~
+ origin@x~sub~/one@inch@x~exch~def
+ }
+ }
+ }
+ }
+ \box_set_wd:Nn\l_tmpa_box{\c_zero_dim}
+ \box_set_ht:Nn\l_tmpa_box{\c_zero_dim}
+ \box_use_clear:N\l_tmpa_box
+ \special{ps:~
+ gsave~
+ %translate graphics to upper left page corner
+ \bool_if:NF\g_pbs_powerdot_bool{
+ {
+ pbs@llx~neg~pbs@ury~neg~translate~
+ one@inch@x~DVImag~div~neg~one@inch@y~DVImag~div~neg~translate
+ }?pdfmark~
+ }
+ %distill graphics into XObject
+ mark~
+ /_objdef~{pbs@obj\int_use:N\g_pbs_obj_int}
+ /BBox~[pbs@llx~pbs@lly~pbs@urx~pbs@ury]
+ /BP~pdfmark~
+ {
+ isls{%landscape mode (powerdot, geometry /w landscape option)
+ /pbs@dxdy~{
+ pbs@urx~pbs@llx~sub~abs~
+ pbs@ury~pbs@lly~sub~abs~div
+ }~bind~def
+ /pbs@dydx~{1~pbs@dxdy~div}~bind~def
+ /pbs@cx~{pbs@urx~pbs@llx~add~2~div}~bind~def
+ /pbs@cy~{pbs@ury~pbs@lly~add~2~div}~bind~def
+ % graphics needs to be rescaled for some reason ...
+ [pbs@dxdy~0~0~pbs@dydx~1~pbs@dxdy~sub~pbs@cx~mul~
+ 1~pbs@dydx~sub~pbs@cy~mul]~concat
+ %... rotated by 270 degrees ...
+ [0~-1~1~0~pbs@cx~pbs@cy~sub~pbs@cx~pbs@cy~add]~concat
+ %... and flipped around vertical axis
+ [-1~0~0~1~pbs@llx~pbs@urx~add~0]~concat
+ }{% flip around horizontal axis in portrait mode
+ [1~0~0~-1~0~pbs@lly~pbs@ury~add]~concat
+ }ifelse
+ }?pdfmark~
+ }
+ \begin{picture}(0,0)\put(0,0){\box_use:N #1}\end{picture}
+ \special{ps:~mark~/EP~pdfmark~grestore}
+ \tl_gset:Nx\g_pbs_pdflastxform_tl{{pbs@obj\int_use:N\g_pbs_obj_int}}
+ \int_gincr:N\g_pbs_obj_int
+ }
+
+ \cs_new:Nn\pbs_pdfximage:n{
+ \filename@parse{#1}
+ \tl_set:Nx\l_pbs_ext_tl{\tl_lower_case:n{\filename@ext}}
+ \bool_if:nTF{
+ \str_if_eq_p:Vn\l_pbs_ext_tl{ps}
+ ||\str_if_eq_p:Vn\l_pbs_ext_tl{eps}
+ }{
+ \special{ps:~
+ mark~/_objdef~{pbs@obj\int_use:N\g_pbs_obj_int}~/NI~pdfmark~
+ }
+ \special{psfile=#1~hsize=0~vsize=0}
+ \special{ps:~
+ {
+ 0~0~1~[1~0~0~1~0~0]~{}~image~%empty dummy, in case #1 is not
+ }?pdfmark~ %a valid raster image file
+ }
+ \tl_gset:Nx\g_pbs_pdflastximage_tl{{pbs@obj\int_use:N\g_pbs_obj_int}}
+ \int_gincr:N\g_pbs_obj_int
+ }{
+ \msg_error:nnxxx{pdfbase}{wrong~image~resource}{#1}{dvips}{
+ Postscript~(ps/eps)~with~bitmapped~content
+ }
+ }
+ }
+
+ \cs_new:Nn\pbs_pdfcatalog:n{
+ \special{ps:~mark~{Catalog}~<<#1>>~/PUT~pdfmark}
+ }
+
+ %marked content BDC/EMC operators
+ %require Ghostscript v. >= 9.15
+ \cs_new:Nn\pbs_pdfbdc:nn{
+ \cs_if_exist:NF\g_pbs_gsoldwarned_tl{
+ \tl_new:N\g_pbs_gsoldwarned_tl
+ \AtEndDvi{\special{ps::[nobreak]\pbs_gsoldwarning:}}
+ }
+ \special{ps:~mark~#1~#2~/BDC~pdfmark}
+ }
+ \cs_new:Nn\pbs_pdfemc:{\special{ps:~mark~/EMC~pdfmark}}
+ }
+}
+\cs_new:Nn\pbs_pdflastobj:{\g_pbs_pdflastobj_tl}
+\cs_new:Nn\pbs_pdflastann:{\g_pbs_pdflastann_tl}
+\cs_new:Nn\pbs_pdflastxform:{\g_pbs_pdflastxform_tl}
+\cs_new:Nn\pbs_pdflastximage:{\g_pbs_pdflastximage_tl}
+
+\group_begin:
+\char_set_catcode_active:N\+\let+\space
+\cs_new:Nx\pbs_gsoldwarning:{
+ {product~(Ghostscript)~search~{pop~pop~pop~true}{pop~false}ifelse~
+ revision~915~lt~and~{
+ (\token_to_str:N\n
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n
+ @@++++++++++Warning:+Ghostscript+too+old!+++++++++++@@\token_to_str:N\n
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n
+ @@++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+Ghostscript+version+>=+9.15.+required!+++++++++++@@\token_to_str:N\n
+ @@+PDF+features+such+as+Layers+(OCGs)+may+not+work.+@@\token_to_str:N\n
+ @@++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+Get+current+version+from+++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+http://www.ghostscript.com/download++++++++++++++@@\token_to_str:N\n
+ @@++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n)
+ print}~if}~?pdfmark
+}
+\group_end: