summaryrefslogtreecommitdiff
path: root/texmf-dist/tex/latex/docassembly/docassembly.sty
blob: 50c4b8aa950397efc83941ba6ad6d24412f597d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
%%
%% This is file `docassembly.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% docassembly.dtx  (with options: `copyright,package')
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% docassembly.sty package,                             %%
%% Copyright (C) 2021  D. P. Story                      %%
%%   dpstory@acrotex.net                                %%
%%                                                      %%
%% This program can redistributed and/or modified under %%
%% the terms of the LaTeX Project Public License        %%
%% Distributed from CTAN archives in directory          %%
%% macros/latex/base/lppl.txt; either version 1.2 of    %%
%% the License, or (at your option) any later version.  %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1997/12/01]
\ProvidesPackage{docassembly}
 [2021/06/19 v1.2 docassembly: Post PDF creation assembly (dps)]
\@ifpackageloaded{aeb_pro}{\PackageInfo{docassembly}
  {aeb_pro detected, early exit from\MessageBreak
   the docassembly package}\endinput}{}
\edef\da@restoreCats{%
    \catcode`\noexpand\"=\the\catcode`\"\relax
    \catcode`\noexpand\,=\the\catcode`\,\relax
    \catcode`\noexpand\(=\the\catcode`\(\relax
    \catcode`\noexpand\!=\the\catcode`\!\relax
}
\@makeother\"\@makeother\,\@makeother\(\@makeother\!
\RequirePackage{insdljs}
\execJSOn
\IfFileExists{acrotex-js.sty}{\let\reqpkg\relax}
  {\PackageWarningNoLine{docassembly}
   {The acrotex-js package is required.\MessageBreak
    Before continuing, install this package,\MessageBreak
    read the documentation, and place\MessageBreak
    aeb_pro.js in the expected folder}
    \def\reqpkg{\usepackage{acrotex-js}[2021/06/19]}
  }
\reqpkg
\newenvironment{docassembly}{\execJS{docassembly}}{\endexecJS}
\let\ap@mrk\@empty
\def\ap@gobtocomma#1,{}
\providecommand\chngDocObjectTo[2]{%
    \def#1##1\ap@mrk{#2,\ap@gobtocomma##1}}
\def\ap@TF{aebTrustedFunctions}
\def\theDocObject{this}
\providecommand\DeclareJSHelper[2]{%
    \def#1##1({\ap@TF(##1\theDocObject,#2,\ap@mrk}}
\def\retnAbsPathAs(#1){var #1=this.path;^^J%
  var pos=#1.lastIndexOf("/");^^J%
  #1=#1.substring(0,pos)}
\DeclareJSHelper{\addWatermarkFromFile}{aebAddWatermarkFromFile}
\DeclareJSHelper{\addWatermarkFromText}{aebAddWatermarkFromText}
\DeclareJSHelper{\importIcon}{aebImportIcon}
\DeclareJSHelper{\importSound}{aebImportSound}
\DeclareJSHelper{\appopenDoc}{aebAppOpenDoc}
\DeclareJSHelper{\docSaveAs}{aebDocSaveAs}
\DeclareJSHelper{\insertPages}{aebInsertPages}
\DeclareJSHelper{\extractPages}{aebExtractPages}
\DeclareJSHelper{\createTemplate}{aebCreateTemplate}
\DeclareJSHelper{\importDataObject}{aebImportDataObject}
\DeclareJSHelper{\attachFile}{aebImportDataObject}
\DeclareJSHelper{\executeSave}{aebSaveAs,"Save"\@gobble}
\DeclareJSHelper{\mailDoc}{aebMailDoc}
\newcommand{\sigInfo}{var oSigInfo=}
\def\sigFieldObj(#1){var oSigField=this.getField(#1)}
\def\signatureSetSeedValue#1{%
    \ap@TF( oSigField, aebSignatureSetSeedValue, }
\begin{defineJS}[\makecmt\%\dfnJSCR{^^J}]{\signatureSign}
if ( typeof oSigInfo.oHandler=="undefined" )
  oSigInfo.oHandler=security.PPKLiteHandler;
var engine=aebTrustedFunctions( security,%
aebSecurityGetHandler, oSigInfo.oHandler );
var path2Cert = (typeof oSigInfo.path2Cert == "undefined") ? %
aebTrustedFunctions( this, aebAppGetPath,%
{cCategory:"user"} )+"/Security"+"/"+oSigInfo.cert : %
oSigInfo.path2Cert;
aebTrustedFunctions( engine, aebSecurityHandlerLogin,%
{ cPassword: oSigInfo.password, cDIPath: path2Cert});
var oSigField = this.getField(oSigInfo.cSigFieldName);
oSigInfo.oInfo.password=oSigInfo.password;
if ( typeof oSigInfo.sv!="undefined" ) {
  for (var o in oSigInfo.sv )
    oSigInfo.oInfo[o]=oSigInfo.sv[o];
}
var oSigArgs={ oSig: engine, oInfo: oSigInfo.oInfo };
if ( typeof oSigInfo.cLegalAttest!="undefined" )
  oSigArgs.cLegalAttest=oSigInfo.cLegalAttest;
if ( typeof oSigInfo.cDIPath!="undefined")
  oSigArgs.cDIPath=oSigInfo.cDIPath;
if ( typeof oSigInfo.bUI!="undefined")
  oSigArgs.bUI=oSigInfo.bUI;
aebTrustedFunctions( oSigField, aebSignatureSign, oSigArgs );
\end{defineJS}
\begin{defineJS}[\makecmt\%\dfnJSCR{^^J}]{\certifyInvisibleSign}
if ( typeof oSigInfo.oHandler=="undefined" )
  oSigInfo.oHandler=security.PPKLiteHandler;
var engine=aebTrustedFunctions( security, %
aebSecurityGetHandler, oSigInfo.oHandler );
var path2Cert=aebTrustedFunctions( this, aebAppGetPath, %
{cCategory:"user"} )+"/Security"+"/"+oSigInfo.cert;
aebTrustedFunctions( engine, aebSecurityHandlerLogin, %
{ cPassword: oSigInfo.password, cDIPath: path2Cert});
oSigInfo.oInfo.password=oSigInfo.password;
var oSigArgs={ oSig: engine, oInfo: oSigInfo.oInfo };
if ( typeof oSigInfo.cLegalAttest!="undefined" )
  oSigArgs.cLegalAttest=oSigInfo.cLegalAttest;
if ( typeof oSigInfo.cDIPath!="undefined")
  oSigArgs.cDIPath=oSigInfo.cDIPath;
if ( typeof oSigInfo.bUI!="undefined")
  oSigArgs.bUI=oSigInfo.bUI;
aebTrustedFunctions( this, aebCertifyInvisibleSign, oSigArgs );
\end{defineJS}
\da@restoreCats
\endinput
%%
%% End of file `docassembly.sty'.