summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/media9
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-03-11 23:41:08 +0000
committerKarl Berry <karl@freefriends.org>2016-03-11 23:41:08 +0000
commitab8ad0e726f90cebd120508ef6488481afd415a7 (patch)
treea495b7f42521d85a339acc04873228a351b415e0 /Master/texmf-dist/tex/latex/media9
parenteb4289c0948631c7e94b75f1917b4cc218ed58a7 (diff)
media9 (11mar16)
git-svn-id: svn://tug.org/texlive/trunk@40006 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/media9')
-rw-r--r--Master/texmf-dist/tex/latex/media9/media9.sty86
-rw-r--r--Master/texmf-dist/tex/latex/media9/pdfbase.sty275
2 files changed, 203 insertions, 158 deletions
diff --git a/Master/texmf-dist/tex/latex/media9/media9.sty b/Master/texmf-dist/tex/latex/media9/media9.sty
index ce20f2c5ded..eef2b39b15e 100644
--- a/Master/texmf-dist/tex/latex/media9/media9.sty
+++ b/Master/texmf-dist/tex/latex/media9/media9.sty
@@ -41,8 +41,8 @@
\RequirePackage{atbegshi}
\RequirePackage{atenddvi}
-\def\g@mix@date@tl{2016/02/25}
-\def\g@mix@version@tl{0.65}
+\def\g@mix@date@tl{2016/03/11}
+\def\g@mix@version@tl{0.67}
\def\g@mix@liiikerneldate{2015/09/27}
\def\g@mix@liiipkgdate{2015/09/27}
@@ -143,17 +143,21 @@
\keys_define:nn{media9}{
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 = {\PassOptionsToPackage{bigfiles}{pdfbase}},
+ bigfiles / true .code:n = {
+ \@ifpackageloaded{pdfbase}{
+ \bool_gset_true:N\g_pbs_pkgbigfiles_bool
+ }{
+ \PassOptionsToPackage{bigfiles}{pdfbase}
+ }
+ },
bigfiles / false .code:n = {},
bigfiles .default:n = {true},
@@ -322,8 +326,9 @@
%aliases for commands from pdfbase.sty
\cs_set_eq:NN\mix_pdfobj:nnn \pbs_pdfobj:nnn
\cs_set_eq:NN\mix_pdfannot:nnnn\pbs_pdfannot:nnnn
+\cs_set_eq:NN\mix_appendtofields:n\pbs_appendtofields:n
\cs_set_eq:NN\mix_pdflink:nn \pbs_pdflink:nn
-\cs_new:Nn\mix_pdfxform:n{\pbs_pdfxform:nn{1}{#1}}
+\cs_new:Nn\mix_pdfxform:n{\pbs_pdfxform:nnn{1}{1}{#1}}
\cs_set_eq:NN\mix_pdfximage:n \pbs_pdfximage:n
\cs_set_eq:NN\mix_pdfcatalog:n \pbs_pdfcatalog:n
@@ -534,46 +539,6 @@
as~image~resources.
}
-%excessive DVI resolution message
-\group_begin:
-\char_set_catcode_active:N\+\let+\space
-\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
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n
- @@++++Warning:+DVI+resolution+greater+than+1200+dpi!+++++@@\token_to_str:N\n
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n
- @@+++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
- @@+Media+button+faces+may+be+poorly+scaled+or+invisible++@@\token_to_str:N\n
- @@+in+the+PDF+output.++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
- @@+++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
- @@+Dvips+should+be+called+either+without+option+`-Ppdf':+@@\token_to_str:N\n
- @@+++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
- @@+++dvips+\c_job_name_tl\token_to_str:N\n
- @@+++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
- @@+or+with+a+different+resolution+setting:+++++++++++++++@@\token_to_str:N\n
- @@+++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
- @@+++dvips+-Ppdf+-D1200+\c_job_name_tl\token_to_str:N\n
- @@+++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n)
- print}~if}~?pdfmark
-}
-\group_end:
-
-%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~\mix_pdflastobj:/NeedAppearances~false>>}
- }
- }
- \tl_gset:cn{Acro@Form@added}{}
-}
-
\cs_new:Nn\mix_insert_btnocg:{%OCG for play button overlay
\ocgbase_new_ocg:nnn{MediaPlayButton\int_use:N\g_mix_rmcnt_int}{
/Print<</PrintState/OFF>>/Export<</ExportState/OFF>>
@@ -593,12 +558,6 @@
\tl_set:Nn\l_mix_ndname_tl{<#1>}
}
}{
- %determine DVI resolution and output warning message if too big
- \cs_if_exist:NF\g_mix_dpiwarned_tl{
- \tl_new:N\g_mix_dpiwarned_tl
- \AtEndDvi{\special{ps::[nobreak]\mix_dpiwarning:}}
- }
-
%3DNode name
\cs_new:Nn\mix_ndname:n{%#1:HEX encoded unicode string
\special{ps:~
@@ -674,7 +633,7 @@
%remaining file types in 3D context and any file type in case of Flash
%context will be embedded as ordinary fstreams;
\cs_if_exist:cF{fileEmb_\mix_filemdfivesum:n{\l_mix_file_tl}}{
- \mix_pdfobj:nnn{}{fstream}{\l_mix_file_tl}
+ \mix_pdfobj:nnn{}{fstream}{{}{\l_mix_file_tl}}
\tl_gset:cx{fileEmb_\mix_filemdfivesum:n{\l_mix_file_tl}}{
\mix_pdflastobj:
}
@@ -973,10 +932,12 @@
\bool_if:nF{\str_if_eq_p:Vn\g_mix_usrpbtn_tl{none}}{
%attach script that switches off play button overlay upon activation
\mix_pdfobj:nnn{}{stream}{
- var~ocgs=host.getOCGs(host.pageNum);
- for(var~i=0;i<ocgs.length;i++){
- if(ocgs[i].name=='MediaPlayButton\int_use:N\g_mix_rmcnt_int'){
- ocgs[i].state=false;
+ {}{
+ var~ocgs=host.getOCGs(host.pageNum);
+ for(var~i=0;i<ocgs.length;i++){
+ if(ocgs[i].name=='MediaPlayButton\int_use:N\g_mix_rmcnt_int'){
+ ocgs[i].state=false;
+ }
}
}
}
@@ -1221,7 +1182,7 @@
/T~(fd@\g_mix_label_tl)
/AA~<</PO~\mix_pdflastobj:~/PV~\mix_pdflastobj:>>
}
- \tl_gput_right:Nx\@anim@fields{\space\mix_pdflastann:\space}
+ \mix_appendtofields:n{\mix_pdflastann:}
\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}{
@@ -1232,17 +1193,14 @@
\cs_gset_eq:Nc\mix_pbtn:NN{g@mix@pbtn@\g_mix_usrpbtn_tl @tl}
%\hbox_set:Nn\l_mix_pbtn_box{\mix_pbtn:NN\g_mix_wd_tl\g_mix_tt_tl}
\sbox\l_mix_pbtn_box{\mix_pbtn:NN\g_mix_wd_tl\g_mix_tt_tl}
-% \pbs_pdfxform:nn{0}{\l_mix_pbtn_box}
\box_move_down:nn{\g_mix_dp_tl}{
\hbox_to_wd:nn{\g_mix_wd_tl}{
\vbox_to_ht:nn{\g_mix_tt_tl}{
\vss
\ocgbase_oc_bdc:n{\g_mix_btnocg_tl}
\box_use:N\l_mix_pbtn_box
-% \pbs_pdfrefxform:n{\pbs_pdflastxform:}
\ocgbase_oc_emc:
}
-% \hss
}
}
}
@@ -2448,15 +2406,11 @@
\tl_if_empty:NF\g_mix_btnactions_tl{/Next~[\g_mix_btnactions_tl]}
>>
}
- \tl_gput_right:Nx\@anim@fields{\mix_pdflastann:\space}
+ \mix_appendtofields:n{\mix_pdflastann:}
\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
index 8cdca8f00dd..55b559089ad 100644
--- a/Master/texmf-dist/tex/latex/media9/pdfbase.sty
+++ b/Master/texmf-dist/tex/latex/media9/pdfbase.sty
@@ -8,8 +8,6 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% 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.
@@ -21,7 +19,6 @@
% latex-->dvipdfmx
% xelatex
%
-%
% Package options:
%
% xetex,
@@ -33,39 +30,52 @@
%
% \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
+% #2: type of object ( dict | array | stream | fstream )
+% #3: if #2==
+% `dict' then PDF key-value dictionary
+% `stream' then
+% {stream attributes as PDF key-value dictionary}{content string}
+% `fstream' then
+% {stream attributes as PDF key-value dictionary}{file name}
+%
+% 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
+% inserts object 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)
+% #1: width, #2: height, #3: depth, #4: dictionary (key-value)
%
% \pbs_pdflastann:
-% inserts ID of PDF object created during most recent call of
+% inserts object ID of PDF object created during most recent call of
% \pbs_pdfannot:nnnn
%
% --------
%
-% \pbs_pdflink:nn
-% #1: dict (key-value), #2: text
+% \pbs_appendtofields:n
+% #1 object ID of PDF annotation; annotations of /Subtype/Widget
+% should be appended to the /Fields array of the global /AcroForm dictionary
%
% --------
%
-% \pbs_pdfxform:nn
-% #1: used as PDF annotation appearance ? (1|0)
-% #2: savebox number
+% \pbs_pdflink:nn
+% #1: dictionary (key-value), #2: text
+%
+% --------
%
+% \pbs_pdfxform:nnn
+% #1: add pgf/tikz transparency, shading etc. resources? (1|0)
+% #2: used as PDF annotation appearance? (1|0)
+% #3: savebox number
% creates PDF Form XObject from savebox content
%
% \pbs_pdflastxform:
-% inserts ID of PDF Form XObject created during most recent call of
-% \pbs_pdfxform:nn
+% inserts object ID of PDF Form XObject created during most recent call of
+% \pbs_pdfxform:nnn
%
% \pbs_pdfrefxform:n
% #1: xform object ID
@@ -75,22 +85,25 @@
% --------
%
% \pbs_pdfximage:n
-% #1: bitmap file name
+% #1: bitmap image file name
+% creates PDF Image XObject from /bitmap/ file for use as bitmap resource
+% in 3D context
%
% \pbs_pdflastximage:
-% inserts ID of PDF Image XObject created during most recent call of
+% inserts object ID of PDF Image XObject created during most recent call of
% \pbs_pdfximage:n
%
% --------
%
% \pbs_pdfcatalog:n
-% #1: dict (key-value)
+% #1: dictionary (key-value)
%
% --------
%
% marked content BDC/EMC operators
-% \pbs_pdfbdc:nn ... \pbs_pdfemc:
-% #1: tag, #2: properties dict obj ID
+% \pbs_pdfbdc:nn ...
+% ... \pbs_pdfemc:
+% #1: tag, #2: properties dictionary obj ID
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -112,8 +125,8 @@
\RequirePackage{atbegshi}
\RequirePackage{atenddvi}
-\def\g@pbs@date@tl{2016/02/25}
-\def\g@pbs@version@tl{0.5}
+\def\g@pbs@date@tl{2016/03/11}
+\def\g@pbs@version@tl{0.7}
\ProvidesExplPackage{pdfbase}{\g@pbs@date@tl}{\g@pbs@version@tl}
{driver independent access to low-level PDF features}
@@ -159,7 +172,11 @@
\ProcessKeysOptions{pdfbase}
\sys_if_engine_xetex:T{\bool_gset_true:N\g_pbs_dvipdfmx_bool}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%commands for creating PDF objects, annots etc.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\cs_new:Nn\pbs_first_of_two:nn{#1}
+\cs_new:Nn\pbs_second_of_two:nn{#2}
\sys_if_output_pdf:TF{
%helper func to remove `0 R' part from pdf obj reference
\cs_new_nopar:Nn\pbs_reftonum:n{\_pbs_reftonum:f{#1}}
@@ -179,8 +196,12 @@
\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}}
+ {stream}{\immediate\pdfobj~\l_pbs_usenum_tl~stream~
+ attr{\pbs_first_of_two:nn#3}~{\pbs_second_of_two:nn#3}
+ }
+ {fstream}{\immediate\pdfobj~\l_pbs_usenum_tl~stream~
+ attr{\pbs_first_of_two:nn#3}~file~{\pbs_second_of_two:nn#3}
+ }
}
}
\tl_gset:Nx\g_pbs_pdflastobj_tl{\the\pdflastobj\space 0~R}
@@ -195,14 +216,14 @@
\immediate\pdfstartlink~user~{#1}#2\pdfendlink
}
- \cs_new_nopar:Nn\pbs_pdfxform:nn{
- \int_compare:nT{#1>\c_zero}{\immediate}
- \pdfxform~resources~{\the\pdfpageresources}~#2
+ \cs_new_nopar:Nn\pbs_pdfxform:nnn{ % #1 not used
+ \int_compare:nT{#2>\c_zero}{\immediate}
+ \pdfxform~resources~{\the\pdfpageresources}~#3
\tl_gset:Nx\g_pbs_pdflastxform_tl{\int_use:c{pdflastxform}~0~R}
}
\cs_new:Nn\pbs_pdfrefxform:n{% #1: xform obj ID
- \begin{picture}(0,0)\put(0,0){\pdfrefxform\pbs_reftonum:n{#1}}\end{picture}
+ \hbox_to_zero:n{\smash{\pdfrefxform\pbs_reftonum:n{#1}}\hss}
}
\cs_new_nopar:Nn\pbs_pdfximage:n{
@@ -224,15 +245,9 @@
}
}
- \cs_new_nopar:Nn\pbs_pdfrefximage:n{% #1: xform obj ID
- \hbox_overlap_right:n{
- \vbox_to_zero:n{\vss\pdfrefximage\pbs_reftonum:n{#1}}
- }
- }
-
\cs_new_nopar:Nn\pbs_pdfcatalog:n{\pdfcatalog{#1}}
- \int_new:N\g_pbs_oc_int % object ID for marked content Properties
+ \int_new:N\g_pbs_oc_int %object ID for marked content Properties
\cs_new_nopar:Nn\pbs_pdfbdc:nn{
\pdfliteral~page~{#1/rm@oc\int_use:N\g_pbs_oc_int\space BDC}
@@ -278,7 +293,7 @@
\AtBeginDocument{
\@ifpackageloaded{pgf}{\bool_gset_true:N\g_pbs_pgfloaded_bool}{}
}
- \int_new:N\g_pbs_obj_int % object ID
+ \int_new:N\g_pbs_obj_int %object ID
\bool_if:NTF\g_pbs_dvipdfmx_bool{ %dvipdfmx/XeTeX
\cs_new_nopar:Nn\pbs_pdfobj:nnn{
\tl_if_blank:oTF{#1}{
@@ -291,10 +306,14 @@
\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)}}
+ {stream}{\special{pdf:stream~\l_pbs_usenum_tl\space
+ (\pbs_second_of_two:nn#3)<<\pbs_first_of_two:nn#3>>
+ }}
{fstream}{
- \message{<#3>}
- \special{pdf:fstream~\l_pbs_usenum_tl\space(#3)}
+ \message{<\pbs_second_of_two:nn#3>}
+ \special{pdf:fstream~\l_pbs_usenum_tl\space
+ (\pbs_second_of_two:nn#3)<<\pbs_first_of_two:nn#3>>
+ }
}
}
}
@@ -303,9 +322,9 @@
\cs_new_nopar: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>>
+ width~\dim_eval:n{#1}\space
+ height~\dim_eval:n{#2}\space
+ depth~\dim_eval:n{#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
@@ -315,16 +334,17 @@
\special{pdf:bann~<<#1>>}#2\special{pdf:eann}
}
- \cs_new_nopar:Nn\pbs_pdfxform:nn{
+ \cs_new_nopar:Nn\pbs_pdfxform:nnn{ % #2 not used
\begin{picture}(0,0)
\put(0,0){
\special{pdf:bxobj~@pbs@obj\int_use:N\g_pbs_obj_int\space
- width\space \dim_use:N\box_wd:N#2\space
- height\space\dim_use:N\box_ht:N#2\space
- depth\space \dim_use:N\box_dp:N#2
+ width\space \dim_use:N\box_wd:N#3\space
+ height\space\dim_use:N\box_ht:N#3\space
+ depth\space \dim_use:N\box_dp:N#3
}
- \box_use:N#2
- \bool_if:NT\g_pbs_pgfloaded_bool{ % transparency et al. for PGF
+ \box_use:N#3
+ %transparency et al. for PGF
+ \bool_if:nT{\int_compare_p:n{#1>\c_zero} && \g_pbs_pgfloaded_bool}{
\tl_set:Nn\l_pbs_temp_tl{}
\ifpgf@sys@pdf@extgs@exists
\tl_set:Nn\l_pbs_temp_tl{/ExtGState~@pgfextgs}
@@ -368,11 +388,9 @@
}
}
- \cs_gset_eq:NN\pbs_pdfrefximage:n\pbs_pdfrefxform:n
-
\cs_new_nopar:Nn\pbs_pdfcatalog:n{\special{pdf:put~@catalog~<<#1>>}}
- \int_new:N\g_pbs_oc_int % object ID
+ \int_new:N\g_pbs_oc_int %object ID
\cs_new_nopar:Nn\pbs_pdfbdc:nn{
\special{pdf:code~#1/rm@oc\int_use:N\g_pbs_oc_int\space BDC}
\special{pdf:put~@resources~<<
@@ -381,7 +399,7 @@
}
\cs_new_nopar:Nn\pbs_pdfemc:{\special{pdf:~code~EMC}}
}{
- % dvips
+ %dvips
\bool_new:N\g_pbs_powerdot_bool %to cope with some powerdot oddity
\@ifclassloaded{powerdot}{\bool_gset_true:N\g_pbs_powerdot_bool}{}
@@ -421,6 +439,7 @@
/o{mark/_objdef}bind~def/O{/type/stream/OBJ~pdfmark}bind~def
/m~systemdict/mark~get~def
/P{/ASCIIHexDecode~filter/PUT~pdfmark}bind~def
+ /PP{/PUT~pdfmark}bind~def
/C{/CLOSE~pdfmark}bind~def~end
}
}
@@ -457,11 +476,14 @@
{array}{
\special{ps:~mark~\l_pbs_usenum_tl~0~[#3]/PUTINTERVAL~pdfmark~}
}
- {stream}{\special{ps::[nobreak]~mark~\l_pbs_usenum_tl~(#3)/PUT~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~
+ }}
{fstream}{
\tl_set:Nn\l_pbs_offset_tl{0}
- \tl_set:Nx\l_pbs_fsize_tl{\pbs_filesize:n{#3}}
- \message{<#3}
+ \tl_set:Nx\l_pbs_fsize_tl{\pbs_filesize:n{\pbs_second_of_two:nn#3}}
+ \message{<\pbs_second_of_two:nn#3}
%embed file in chunks of 32768 Bytes into PS as chunks of
%65536 Bytes of HEX code
\bool_while_do:nn{
@@ -470,13 +492,17 @@
\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
+ (\pbs_filedump:nnn{\l_pbs_offset_tl}{32767}{
+ \pbs_second_of_two:nn#3
+ })P
}
}{
\special{ps:~
mark~
\l_pbs_usenum_tl~
- (\pbs_filedump:nnn{\l_pbs_offset_tl}{32767}{#3})~
+ (\pbs_filedump:nnn{\l_pbs_offset_tl}{32767}{
+ \pbs_second_of_two:nn#3
+ })~
/ASCIIHexDecode~filter~/PUT~
pdfmark~
}
@@ -484,16 +510,18 @@
\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<<\pbs_first_of_two:nn#3>>PP~
m\l_pbs_usenum_tl~C~end
}
}{
\special{ps:~
+ mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>~/PUT~pdfmark~
mark~\l_pbs_usenum_tl~/CLOSE~pdfmark~
}
}
+ \message{>}
}
}
}
@@ -543,20 +571,33 @@
}
}
- \cs_new_nopar:Nn\pbs_pdfxform:nn{
- %mark bbox of box#2
+ \msg_set:nnn{pdfbase}{content~too~large}{
+ Line~\msg_line_number: :\\
+ Content~exceeds~paper~size~(width~and/or~height)\\
+ of~the~document~and~may~be~clipped~in~the~final\\
+ output.
+ }
+
+ \cs_new_nopar:Nn\pbs_pdfxform:nnn{ % #1 not used
+ \bool_if:nT{
+ \dim_compare_p:n{\box_wd:N#3>\paperwidth} ||
+ \dim_compare_p:n{\box_ht:N#3+\box_dp:N#3>\paperheight}
+ }{
+ \msg_warning:nn{pdfbase}{content~too~large}
+ }
+ %mark bbox of box#3
\group_begin:
\dim_set:Nn\unitlength{1pt}
\begin{picture}(0,0)
%mark BBox of the graphics
- \put(0,-\dim_to_decimal:n{\box_dp:N#2}){
+ \put(0,-\dim_to_decimal:n{\box_dp:N#3}){
\special{ps:
currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def~
}
}
\put(
- \dim_to_decimal:n{\box_wd:N#2},
- \dim_to_decimal:n{\box_ht:N#2}
+ \dim_to_decimal:n{\box_wd:N#3},
+ \dim_to_decimal:n{\box_ht:N#3}
){
\special{ps:
currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def~
@@ -598,8 +639,8 @@
/_objdef~{pbs@obj\int_use:N\g_pbs_obj_int}
/BBox~[pbs@llx~pbs@lly~pbs@urx~pbs@ury]
/BP~pdfmark~
- % operations needed if used as annotation appearance
- \int_compare:nT{#1>\c_zero}{
+ \int_compare:nT{#2>\c_zero}{
+ %operations needed if used as annotation appearance
{
isls{%landscape mode (powerdot, geometry /w landscape option)
/pbs@dxdy~{
@@ -609,23 +650,41 @@
/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 ...
+ %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
+ }{%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#2}\end{picture}
+ \begin{picture}(0,0)\put(0,0){\box_use:N#3}\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
+ \int_compare:nTF{#2>\c_zero}{
+ %Form XObjects for use as annotation appearances require that
+ %dvips generated PostScript to be further precessed with ps2pdf
+ %may not have the exaggerated dpi resolution resulting from dvips
+ %option `-Ppdf'.
+ \tl_if_exist:NF\g_pbs_dpiwarned_tl{
+ \tl_new:N\g_pbs_dpiwarned_tl
+ \AtEndDvi{\special{ps::[nobreak]\pbs_dpiwarning:}}
+ }
+ }{%Form XObject to be inserted using \SP pdfmark:
+ %The /SP pdfmark for placement of Form XObjects works reliably only
+ %since gs-9.14. As gs-9.14 had some other TeX-related issues, we
+ %require 9.15.
+ \tl_if_exist:NF\g_pbs_gsoldwarned_tl{
+ \tl_new:N\g_pbs_gsoldwarned_tl
+ \AtEndDvi{\special{ps::[nobreak]\pbs_gsoldwarning:}}
+ }
+ }
}
\cs_new_nopar:Nn\pbs_pdfrefxform:n{% #1: xform obj ID
@@ -663,15 +722,6 @@
}
}
- \cs_new_nopar:Nn\pbs_pdfrefximage:n{% #1: ximage obj ID
- %not implemented; how to insert an image XObject with pdfmarks?
- %\special{ps:~
- % gsave~
- % mark~#1~/SP~pdfmark~
- % grestore~
- %}
- }
-
\cs_new_nopar:Nn\pbs_pdfcatalog:n{
\special{ps:~mark~{Catalog}~<<#1>>~/PUT~pdfmark}
}
@@ -679,38 +729,79 @@
%marked content BDC/EMC operators
%require Ghostscript v. >= 9.15
\cs_new_nopar:Nn\pbs_pdfbdc:nn{
+ \special{ps:~mark~#1~#2~/BDC~pdfmark}
\tl_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_nopar:Nn\pbs_pdfemc:{\special{ps:~mark~/EMC~pdfmark}}
}
}
+
\cs_new_nopar:Nn\pbs_pdflastobj:{\g_pbs_pdflastobj_tl}
\cs_new_nopar:Nn\pbs_pdflastann:{\g_pbs_pdflastann_tl}
\cs_new_nopar:Nn\pbs_pdflastxform:{\g_pbs_pdflastxform_tl}
\cs_new_nopar:Nn\pbs_pdflastximage:{\g_pbs_pdflastximage_tl}
+%adding AcroForm dict to PDF Catalog
+\tl_new:N\g_pbs_fields_tl %takes object IDs of Fields (aka annots with
+\tl_if_exist:NF\g_pbs_acroFormAdded_tl{ % /Subtype/Widget)
+ \AtEndDvi{
+ \tl_if_empty:NF\g_pbs_fields_tl{
+ \pbs_pdfobj:nnn{}{array}{\g_pbs_fields_tl}
+ \pbs_pdfcatalog:n{
+ /AcroForm~<</Fields~\pbs_pdflastobj:/NeedAppearances~false>>}
+ }
+ }
+ \tl_new:N\g_pbs_acroFormAdded_tl
+}
+\cs_new_nopar:Nn\pbs_appendtofields:n{
+ \tl_gput_right:Nx\g_pbs_fields_tl{#1\space}
+}
+
\group_begin:
\char_set_catcode_active:N\+\let+\space
\cs_new_nopar: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)
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\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
+ @@+++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+Various+advanced+PDF+features+such+as+Layers+(OCGs)+@@\token_to_str:N\n
+ @@+and+animations+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:
+\cs_new_nopar:Nx\pbs_dpiwarning:{
+ {Resolution~1200~gt~VResolution~1200~gt~or~product~(Ghostscript)~
+ search~{pop~pop~pop~true}{pop~false}ifelse~and~{
+ (\token_to_str:N\n
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n
+ @@+++++Warning:+DVI+resolution+greater+than+1200+dpi!+++++@@\token_to_str:N\n
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n
+ @@++++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+PDF+Annotation+appearances+(buttons,+animation+frames)+@@\token_to_str:N\n
+ @@+may+be+poorly+scaled,+clipped+or+invisible.++++++++++++@@\token_to_str:N\n
+ @@++++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+Dvips+should+be+called+either+without+option+`-Ppdf':++@@\token_to_str:N\n
+ @@++++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+++dvips+\jobname\token_to_str:N\n
+ @@++++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+or+with+a+different+resolution+setting,+e.g.:++++++++++@@\token_to_str:N\n
+ @@++++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@+++dvips+-Ppdf+-D1200+\jobname\token_to_str:N\n
+ @@++++++++++++++++++++++++++++++++++++++++++++++++++++++++@@\token_to_str:N\n
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\token_to_str:N\n)
+ print}~if}~?pdfmark
+}
+\group_end: