diff options
author | Norbert Preining <norbert@preining.info> | 2021-06-18 03:01:13 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-06-18 03:01:13 +0000 |
commit | 3ecc00c27119bc47ba26b518b7d26c00b69599df (patch) | |
tree | db60a75c06403ca74ed76bc3339d80958159ae3e /macros/latex/contrib/docassembly | |
parent | 5f3280db1e6f333f79e9930e5609d3f5175d5af7 (diff) |
CTAN sync 202106180301
Diffstat (limited to 'macros/latex/contrib/docassembly')
32 files changed, 1815 insertions, 0 deletions
diff --git a/macros/latex/contrib/docassembly/README.md b/macros/latex/contrib/docassembly/README.md new file mode 100644 index 0000000000..56dd576cc8 --- /dev/null +++ b/macros/latex/contrib/docassembly/README.md @@ -0,0 +1,23 @@ +docassembly +Dated: 2021-06-11 +Author: D. P. Story + +Targeted audience: LaTeX authors who love their pdflatex, lualtex, xelatex, +or dvips -> ps2pdf workflow, who also own Acrobat Pro application. + +The docassembly package defines the docassembly environment in which +JavaScript code can be written to execute once and only once the newly +created PDF in the Acrobat application. The package also defines a series of +helper commands to execute security restricted JavaScript methods. Using +these security restricted commands, you can place watermarks on the document, +attached files, import icons and sounds, insert pages, extract pages, send +email, and so on. All these methods I have used for years through the aeb_pro +package, which generally restricted to a dvips -> distiller workflow. Now, +these methods are available to all those who own Acrobat, no matter what PDF +creator used. + +Now, I simply must get back to my retirement. + +D. P. Story +dpstory@acrotex.net + diff --git a/macros/latex/contrib/docassembly/aeb_pro.js b/macros/latex/contrib/docassembly/aeb_pro.js new file mode 100644 index 0000000000..5dbfe4d53a --- /dev/null +++ b/macros/latex/contrib/docassembly/aeb_pro.js @@ -0,0 +1,177 @@ +/* + AEB Pro Document Assembly Methods + + Copyright (C) 2012 -- 2021 AcroTeX.Net + D. P. Story + http://www.acrotex.net + + Version 1.6.1 + + v1.6.1 aebCreateTemplate now returns an object + v1.6 Added aebAddWatermarkFromText, aebLaunchURL + v1.5 Added aebCertifyInvisibleSign +*/ + +if ( typeof aebTrustedFunctions == "undefined") { + aebTrustedFunctions = app.trustedFunction( function ( doc, oFunction, oArgs ) + { + app.beginPriv(); + var retn = oFunction( oArgs, doc ); + app.endPriv(); + return retn; + }); +} +aebAddWatermarkFromFile = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + var Msg=function(e){return (aebAddWatermarkFromFile.msg==undefined)?("Add Watermark from File Error: " + e.toString()):aebAddWatermarkFromFile.msg;} + app.beginPriv(); + try { doc.addWatermarkFromFile(oArgs); } catch(e) {console.println(Msg(e));} + app.endPriv(); + aebAddWatermarkFromFile.msg=undefined; +}); +aebAddWatermarkFromText = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return doc.addWatermarkFromText(oArgs); + app.endPriv(); +}); +aebImportIcon = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return doc.importIcon(oArgs); + app.endPriv(); +}); +aebInsertPages = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + var Msg=function(e){return (aebInsertPages.msg==undefined)?("Insert Pages Error: " + e.toString()):aebInsertPages.msg;} + app.beginPriv(); + try { doc.insertPages(oArgs); } catch(e) {console.println(Msg(e));} + app.endPriv(); + aebInsertPages.msg=undefined; +}) +aebAppOpenDoc = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + var Msg=function(e){return (aebAppOpenDoc.msg==undefined)?("App Open Doc Error: " + e.toString()):aebAppOpenDoc.msg;} + app.beginPriv(); + try { return app.openDoc(oArgs); } catch(e) {console.println(Msg(e));} + app.endPriv(); + aebAppOpenDoc.msg=undefined; + return retn; +}) +aebImportTextData = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return doc.importTextData(oArgs); + app.endPriv(); +}); +aebImportSound = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return doc.importSound(oArgs); + app.endPriv(); +}); +aebSaveAs = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + app.execMenuItem("Save"); + app.endPriv(); +}); +aebDocSaveAs = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + var Msg=function(e){return (aebDocSaveAs.msg==undefined)?("Doc SaveAs Error: " + e.toString()):aebDocSaveAs.msg;} + app.beginPriv(); + try { + return doc.saveAs(oArgs); + } catch(e){console.println(Msg(e));} + app.endPriv(); + aebDocSaveAs.msg=undefined; + +}); +aebExtractPages = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return doc.extractPages(oArgs); + app.endPriv(); +}); +aebMailDoc = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return doc.mailDoc(oArgs); + app.endPriv(); +}); +aebImportDataObject = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return doc.importDataObject(oArgs); + app.endPriv(); +}); +aebSignatureSign = app.trustPropagatorFunction( function ( oArgs, field ) +{ + app.beginPriv(); + return field.signatureSign(oArgs); + app.endPriv(); +}); +aebSecurityHandlerLogin = app.trustPropagatorFunction( function ( oArgs, securityHandler ) +{ + app.beginPriv(); + return securityHandler.login(oArgs); + app.endPriv(); +}); +aebTimestampSign = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return doc.timestampSign(oArgs); + app.endPriv(); +}); +aebSecurityGetHandler = app.trustPropagatorFunction( function ( oArgs, security ) +{ + app.beginPriv(); + return security.getHandler(oArgs); + app.endPriv(); +}); +aebAppGetPath = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return app.getPath(oArgs); + app.endPriv(); + return retn; +}); +aebSignatureSetSeedValue = app.trustPropagatorFunction( function ( oArgs, field ) +{ + app.beginPriv(); + return field.signatureSetSeedValue( oArgs ) + app.endPriv(); +}); +aebCertifyInvisibleSign = app.trustPropagatorFunction( function ( oArgs, field ) +{ + app.beginPriv(); + return field.certifyInvisibleSign( oArgs ) + app.endPriv(); +}); +aebAddIcon=app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + doc.addIcon(oArgs); + app.endPriv(); +}); +aebCreateTemplate = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + var Msg=function(e){return (aebCreateTemplate.msg==undefined)?("Create Template Error: " + e.toString()):aebCreateTemplate.msg;} + app.beginPriv(); + try { return doc.createTemplate(oArgs); } catch(e) {console.println(Msg(e));} + app.endPriv(); + aebCreateTemplate.msg=undefined; + +}) +aebBrowseForDoc=app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + var retn = app.browseForDoc(oArgs); + app.endPriv(); +}); +aebLaunchURL=app.trustPropagatorFunction ( function ( oArgs ) +{ + app.beginPriv(); + var retn = app.launchURL(oArgs); + app.endPriv(); +}); diff --git a/macros/latex/contrib/docassembly/docassembly.dtx b/macros/latex/contrib/docassembly/docassembly.dtx new file mode 100644 index 0000000000..53bf22dae8 --- /dev/null +++ b/macros/latex/contrib/docassembly/docassembly.dtx @@ -0,0 +1,510 @@ +%\iffalse +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% 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. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%</copyright> +%<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01] +%<package>\ProvidesPackage{docassembly} +%<package> [2021/06/11 v1.0 docassembly: Post PDF creation assembly (dps)] +%<*driver> +\documentclass{ltxdoc} +\usepackage{amstext} +\usepackage[colorlinks,hyperindex=false]{hyperref} +\pdfstringdefDisableCommands{\let\\\textbackslash} +\def\CMD#1{\textbackslash{#1}}\def\EXCL{!} +\let\opt\texttt \let\app\textsf \let\pkg\textsf \let\env\texttt +\OnlyDescription % comment out for implementation details +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\bgroup\ttfamily +\gdef\brpr#1{\char123\relax#1\char125\relax}\egroup +\let\darg\brpr +\let\env\texttt +\let\opt\texttt +\let\app\textsf +\let\uif\textsf +\def\visispace{\symbol{32}} +\def\ameta#1{\ensuremath{\langle\textit{\texttt{#1}}\rangle}} +\def\meta#1{\textsl{\texttt{#1}}} +\def\SUB#1{\ensuremath{{}_{\mbox{\scriptsize\ttfamily#1}}}} +\let\tops\texorpdfstring +\makeatletter +\let\@latex@warning@no@line\@gobble +\renewcommand{\paragraph} + {\@startsection{paragraph}{4}{0pt}{6pt}{-3pt} + {\normalfont\normalsize\bfseries}} +\makeatother +\InputIfFileExists{aebdocfmt.def}{\PackageInfo{docassembly}{Inputting aebdocfmt.def}} + {\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro}\let\setupFullwidth\relax + \PackageInfo{docassembly}{aebdocfmt.def cannot be found}} +\begin{document} + \GetFileInfo{docassembly.sty} + \title{The \pkg{docassembly} package} + \author{D. P. Story\\ + Email: \texttt{dpstory@acrotex.net}} + \date{processed \today} + \maketitle + \tableofcontents + \DocInput{docassembly.dtx} +\IfFileExists{\jobname.ind}{\newpage\setupFullwidth\par\PrintIndex}{\paragraph*{Index} The index goes here. Execute + \[\texttt{makeindex -s gind.ist -o docassembly.ind docassembly.idx}\] on the command line and recompile + \texttt{docassembly.dtx}.} +\IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of changes goes here.\\Execute + \[\texttt{makeindex -s gglo.ist -o docassembly.gls docassembly.glo}\] on the command line and recompile + \texttt{docassembly.dtx}.} +\end{document} +%</driver> +% \fi +% \MakeShortVerb{|} +% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{docassembly}{Inputting aebdonotindex.def}} +% {\PackageInfo{docassembly}{cannot find aebdonotindex.def}} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \section{Introduction} +% +% The \pkg{docassembly} package provides access some security related features of the +% Acrobat JavaScript API. +% The content of this package was extracted from \pkg{aeb\_pro} +% so these important and useful methods can be available to document authors that own +% \app{Acrobat}, but enjoy the use of \app{pdflatex}, \app{xelatex}, \app{lualatex}, +% \app{ps2pdf}, or (in the worst case scenario) \app{Adobe Distiller} as PDF creators. +% \begin{center} +% \fbox{\begin{minipage}{.67\linewidth} +% \textbf{Important:} Run for your lives! This package requires +% \app{Adobe Acrobat}! Run! Do not look back!. However, if it makes you feel better, +% you can use any of the usual +% PDF creators (\app{pdflatex}, \app{lualatex}, \app{xelatex}, \app{dvips \texttt{->} ps2pdf}, +% or even the much hated \app{dvips \texttt{->} Adobe Distiller}). +% \end{minipage}} +% \end{center} +% This package requires \pkg{insdljs}, which loads \pkg{hyperref}. It also requires +% the successful installation of the file \texttt{aeb\_pro.js}, which is distributed +% with this package, as well as with the \pkg{aeb\_pro} package. Version 1.6.1 of +% \texttt{aeb\_pro.js} is required.\footnote{If you already have \pkg{aeb\_pro} installed on your +% system, be sure you have Version 1.6.1 of \texttt{aeb\_pro.js}, if not, use the version +% of \texttt{aeb\_pro.js} that comes with \pkg{docassembly}.} Installation of \texttt{aeb\_pro.js} +% is covered in \texttt{docs/install\_jsfiles.pdf}. +% +% \changes{v1.0}{2021/06/11}{First publication version of this package} +% +% \section{Documentation} +% +% The documentation of this file is minimal. Most of +% the ``teaching'' of how to use the methods supported by this package is contained +% in the demo files. +% +% The package defines one environment, the \env{docassembly} environment, and several +% ``helper'' commands that are used within the \env{docassembly} environment. Refer +% to \hyperref[s:DAM]{Section~\ref*{s:DAM}} for details. +% +% +% \paragraph*{Installation of \texttt{aeb\_pro.js}.} This file is essential to the +% correct functioning of this package. It is important, therefore, to correctly +% install it. Follow the instructions of \texttt{docs/install\_jsfiles.pdf}. +% +% \paragraph*{Demo files.} Demo files are contained in the \texttt{examples} folder. +% They illustrate all the security restricted methods of this package. +% Most of the demo files have a minimal preamble. +% Several of the files also uses \pkg{eforms}, since form fields +% are used in those demo files. +% +% \paragraph*{End this package early.} +% If \pkg{aeb\_pro} is already loaded, terminate this package early +% since \pkg{aeb\_pro} contains the content of this package already. +% \begin{macrocode} +\@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\! +% \end{macrocode} +% \section{Package requirements} +% Require \pkg{insdljs} for this little exercise. +% \begin{macrocode} +\RequirePackage{insdljs} +\execJSOn +% \end{macrocode} +% +% \section{Document Assembly Methods}\label{s:DAM} +% Special ``helper'' commands and one environment are defined to take advantage of \app{Acrobat}'s extensive +% library of security restricted methods. It is assumed the document author has properly +% installed \texttt{aeb\_pro.js}. +% +% \subsection{The \texttt{docassembly} environment} +% +% \begin{environment}{docassembly} +% This is a wrapper environment for the \texttt{execJS} environment of the +% \textsf{insDLJS} Package. Place JavaScript lines in this environment and +% the script will execute one time after the PDF has been created and opened +% in \app{Acrobat Pro} for the first time. +% \begin{macrocode} +\newenvironment{docassembly}{\execJS{docassembly}}{\endexecJS} +% \end{macrocode} +% \end{environment} +% \subsection{Supported Assembly JS API} +% +% These are convenience commands -- called JavaScript helper commands -- to +% executing security restricted JavaScript. The JS methods are defined in the +% \texttt{aeb\_pro.js} file, kept as folder JavaScript. These commands are +% executed in a verbatim environment where `\verb!\!' is still the escape +% character. Each of the JavaScript helper commands expects a left +% parenthesis `\texttt{(}' following the command name \emph{on the +% same line} as the command name.\footnote{This requirement is consistent with JavaScript function usage.} +% See the example below for correct usage. +%\begin{verbatim} +%\begin{docassembly} +%\addWatermarkFromFile({ +% bOnTop:false, +% cDIPath:"/C/AcroTeX/AcroPackages/ManualBGs/Manual_BG_Print_AeB.pdf" +%}); +%\end{docassembly} +%\end{verbatim} +% For each of the methods below, see the \textsl{JavaScript for Acrobat API Reference}. +% +%\medskip\noindent The command \cs{theDocObject} is normally set to \texttt{this}, meaning +% the current document. You may need to set it to some other doc object if you are trying to +% access a doc object other than the current one. +% The following are support commands for changing \cs{theDocObject} +% from within the \texttt{docassembly} environment. +% \begin{macro}{\chngDocObjectTo} +% All the JavaScript helper commands use \cs{theDocObject}, which is defined to be the \texttt{this} +% object. To change it within the \env{docassembly} environment is difficult. The next command +% aids in that problem. +% \begin{macrocode} +\let\ap@mrk\@empty +\def\ap@gobtocomma#1,{} +\providecommand\chngDocObjectTo[2]{% + \def#1##1\ap@mrk{#2,\ap@gobtocomma##1}} +% \end{macrocode} +% \end{macro} +% The above defines a new command given by \texttt{\#1}. The command has one argument which is all content +% up to the terminating mark \cs{ap@mrk}. The trick to removing \cs{thisDocObject} and replacing it with +% \texttt{\#2}, in the above definition, we insert `\texttt{(\#2}' followed by \cs{ap@gobtocomma}, which absorbs +% \cs{thisDocObject,} (absorbs everything through the first comma), followed by all content (\texttt{\#\#1}); +% the second \cs{@gobble} absorbs the left +% parenthesis that opens the argument. +% \begin{macrocode} +\def\ap@TF{aebTrustedFunctions} +% \end{macrocode} +% An example of usage of \cs{chngDocObject} is \verb~\chngDocObjectTo{\newDO}{doc}~ +% expanded above the \texttt{docassembly} environment. Later, we can say, +%\begin{verbatim} +% \chngDocObjectTo{\newDO}{doc} +% \begin{docassembly} +% ... +% \docSaveAs\newDO({ cPath: _path }); +% ... +% \end{docassembly} +%\end{verbatim} +%That is, it is placed immediately after any of the commands below that uses \cs{theDocObject}. +% \begin{macro}{\theDocObject} +% This command is used in the definition of all JavaScript helper commands, as seen in the +% definition of \cs{DeclareJSHelper} below. It is set to the doc object \texttt{this}. It can +% be changed using \cs{chngDocObjectTo}, as described above. +% \begin{macrocode} +\def\theDocObject{this} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\DeclareJSHelper} +% A general purpose command for defining what I am calling JavaScript helper commands. +% \begin{macrocode} +\providecommand\DeclareJSHelper[2]{% + \def#1##1({\ap@TF(##1\theDocObject,#2,\ap@mrk}} +% \end{macrocode} +% For example, we declare |\DeclareJSHelper{\docSaveAs}{aebDocSaveAs}| below, the declaration defines a new command, +% \cs{docSaveAs}: +%\begin{verbatim} +% \def\docSaveAs#1({\ap@TF(#1\theDocObject,aebDocSaveAs,\ap@mrk}} +%\end{verbatim} +% Note that the argument of \cs{docSaveAs} is delimited by the left parenthesis, thus \texttt{\#1} is everything through that opening +% parenthesis. This approach allows more flexibility in the definition, there can be spaces following the +% command name |\docSaveAs ({path: _path})|, for example. +% \end{macro} +% \begin{macro}{\retnAbsPathAs} +% Several methods require an absolute path to the current folder. The code is, +%\begin{verbatim} +%var _path=this.path; +%var pos=_path.lastIndexOf("/"); +%_path=_path.substring(0,pos); +%\end{verbatim} +%We simplify this code for the document author in the form of the +%command \cs{rtnAbsPathAs(\ameta{js-var});}, where \ameta{js-var} is a JavaScript +%variable that will hold the absolute path to the current folder; eg, |\rtnAbsPathAs(_path);| +%expands to the above code. +% \begin{macrocode} +\def\retnAbsPathAs(#1){var #1=this.path;^^J% + var pos=#1.lastIndexOf("/");^^J% + #1=#1.substring(0,pos)} +% \end{macrocode} +% \end{macro} +% We new begin the documentation of the ``helper'' commands. For documentation +% of the arguments of these commands, refer to the \textsl{\href{https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/documentation.html}{JavaScript${}^{\text{\textsc{tm}}}$ for Acrobat${}^{\text{\copyright}}$ API Reference}}. +% \subsubsection{\tops{\protect\cs}{\textbackslash}{addWatermarkFromFile}} +% \begin{macro}{\addWatermarkFromFile} +% This is the method \texttt{\textsl{Doc}.addWatermarkFromFile}.\\ +% \textbf{Demo file:} \texttt{watermark-file.tex} +% \begin{macrocode} +\DeclareJSHelper{\addWatermarkFromFile}{aebAddWatermarkFromFile} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{addWatermarkFromText}} +% \begin{macro}{\addWatermarkFromText} +% This is the method \texttt{\textsl{Doc}.addWatermarkFromText}.\\ +% \textbf{Demo file:} \texttt{watermark-text.tex} +% \begin{macrocode} +\DeclareJSHelper{\addWatermarkFromText}{aebAddWatermarkFromText} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{importIcon}} +% \begin{macro}{\importIcon} +% This is the method \texttt{\textsl{Doc}.importIcon}.\\ +% \textbf{Demo file:} \texttt{import-icons.tex} +% \begin{macrocode} +\DeclareJSHelper{\importIcon}{aebImportIcon} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{importSound}} +% \begin{macro}{\importSound} +% This is the method \texttt{\textsl{Doc}.importSound}.\\ +% \textbf{Demo file:} \texttt{import-sound.tex} +% \begin{macrocode} +\DeclareJSHelper{\importSound}{aebImportSound} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{appopenDoc}} +% \begin{macro}{\appopenDoc} +% This is the method \texttt{app.openDoc}. Opens a document and return +% a \texttt{Doc} object.\\ +% \textbf{Demo file:} \texttt{open-doc.tex} +% \begin{macrocode} +\DeclareJSHelper{\appopenDoc}{aebAppOpenDoc} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{docSaveAs}} +% \begin{macro}{\docSaveAs} +% This is the method \texttt{\textsl{Doc}.saveAs}. Saves a PDF or converts a PDF +% to another format to a specified path.\\ +% \textbf{Demo file:} \texttt{doc-saveas.tex} +% \begin{macrocode} +\DeclareJSHelper{\docSaveAs}{aebDocSaveAs} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{insertPages}} +% \begin{macro}{\insertPages} +% This is the method \texttt{\textsl{Doc}.insertPages}.\\ +% \textbf{Demo file:} \texttt{insert-pages.tex} +% \begin{macrocode} +\DeclareJSHelper{\insertPages}{aebInsertPages} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{extractPages}} +% \begin{macro}{\extractPages} +% This is the method \texttt{\textsl{Doc}.extractPages}.\\ +% \textbf{Demo file:} \texttt{extract-pages.tex} +% \begin{macrocode} +\DeclareJSHelper{\extractPages}{aebExtractPages} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{createTemplate}} +% \begin{macro}{\createTemplate} +% This is the method \texttt{\textsl{Doc}.createTemplate}. This is a feature that I had great +% hopes for. With templates, you can create hidden pages that can be made visible (in \app{AA}); +% once a template is created, it can be spawned and deleted in \uif{AR}. +% \begin{macrocode} +\DeclareJSHelper{\createTemplate}{aebCreateTemplate} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{importDataObject}} +% \begin{macro}{\importDataObject} +% This is the method \texttt{\textsl{Doc}.importDataObject}, used to attach files to a PDF; alternately, +% \cs{attachFile} is a more intuitive name for the operation performed.\DescribeMacro +% \attachFile\\ +% \textbf{Demo file:} \texttt{attach-files.tex} +% \begin{macrocode} +\DeclareJSHelper{\importDataObject}{aebImportDataObject} +\DeclareJSHelper{\attachFile}{aebImportDataObject} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{executeSave}} +% \begin{macro}{\executeSave} +% To save the document, use at the \emph{end of the doc assembly environment}. Usage: +% \verb!\executeSave()!. The \cs{@gobble} used below absorbs the comma that is placed immediately +% after the second argument by \cs{DeclareJSHelper}. +% \begin{macrocode} +\DeclareJSHelper{\executeSave}{aebSaveAs,"Save"\@gobble} +% \end{macrocode} +% \end{macro} +% \subsubsection{\tops{\protect\cs}{\textbackslash}{mailDoc}} +% \begin{macro}{\mailDoc} +% This is the method \texttt{\textsl{Doc}.mailDoc}. +% Attach the current PDF and email it someone. Must have a default mail client +% registered by \app{Acrobat} under \uif{Edit \texttt> Preferences \texttt> Mail Accounts}.\\ +% \textbf{Demo file:} \texttt{mail-doc.tex} +% \begin{macrocode} +\DeclareJSHelper{\mailDoc}{aebMailDoc} +% \end{macrocode} +% \end{macro} +% \subsubsection{Signature related commands} +% \textbf{Demo files:} \texttt{sign.tex}, \texttt{certifyinvisible.tex}\par\medskip +% \noindent +% The \cs{sigInfo} command is used for entering signing formation into what will +% become an object. \cs{signatureSign} takes no arguments, but uses the info +% entered by \cs{sigInfo}. An example is +%\begin{verbatim} +%\begin{docassembly} +%\sigInfo{ +% cSigFieldName: "sigOfDPS", +% ohandler: security.PPKLiteHandler, +% cert: "<name>.pfx", password: "<password>", +% oInfo: { location: "Niceville, FL", +% reason: "I am approving this document", +% contactInfo: "dpstory@acrotex.net", +% appearance: "My Signature" } +%}; +%\signatureSign +%\end{docassembly} +%\end{verbatim} +% \begin{macro}{\sigInfo} +% The \cs{sigInfo} command is a latex interface to creating the +% \texttt{oSigInfo} object. +% \begin{macrocode} +\newcommand{\sigInfo}{var oSigInfo=} +\def\sigFieldObj(#1){var oSigField=this.getField(#1)} +% \end{macrocode} +% \end{macro} +% For the \cs{signatureSetSeedValue}, the field object is required. +% This function assumes that the JavaScript variable \texttt{oSigField} +% is the field object. For examle, +%\begin{verbatim} +%\begin{docassembly} +%\sigFieldObj("sigOfDPS"); +%\signatureSetSeedValue({ +% lockDocument:true, +% appearanceFilter:"My Signature", +% reasons: ["This is a reason", "This is a better reason"], +% flags:0x80|0x100|0x8 +%}); +%\end{docassembly} +%\end{verbatim} +% The \texttt{signatureSetSeedValue()} method seeds a signature field with various default values +% available to the signer. +%\begin{verbatim} +%\begin{docassembly} +%var sv={ +% mdp: "defaultAndComments", +% reasons: ["This is a reason", "This is a better reason"], +% flags:0x80|0x100|0x8 +%}; +%\sigFieldObj("sigOfDPS"); +%\signatureSetSeedValue(sv); +%\end{docassembly} +%\end{verbatim} +% \begin{macro}{\signatureSetSeedValue} +% This is the \texttt{\textsl{Field}.signatureSetSeedValue} method. The field name +% is passed to this method through the \texttt{cSigFieldName} property of the \texttt{oSigField} object. +% \begin{macrocode} +\def\signatureSetSeedValue#1{% + \ap@TF( oSigField, aebSignatureSetSeedValue, } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\signatureSign} +% This is the \texttt{\textsl{Field}.signatureSign} method. The field name +% is passed to this method through the \texttt{cSigFieldName} property of the \texttt{oSigField} object. +% The function \cs{signatureSign} takes the info in the \texttt{oSigInfo} object, +% gets the security handler object, logs into the handler, calls +% \texttt{signatureSetSeedValue} if the \texttt{sv} property is in the +% \texttt{oSigInfo} object, and signs the field. +% +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\certifyInvisibleSign} +% This is the \texttt{\textsl{Doc}.certifyInvisibleSign} method. +% This command uses the trusted version of \texttt{certifyInvisibleSign} to sign. The command +% requires that \cs{sigInfo} is populated appropriately. +%\begin{verbatim} +%\begin{docassembly} +%\sigInfo{ +% cert: "<name>.pfx", +% password: "<password>", +% cLegalAttest: "Certified using JavaScript", +% bUI:false, +% oInfo: { +% location: "Niceville, FL", +% reason: "I am certifying this document", +% mdp: "defaultAndComments", +% } +%}; +%\certifyInvisibleSign +%\end{docassembly} +%\end{verbatim} +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\da@restoreCats +%</package> +% \end{macrocode} +% \Finale +\endinput diff --git a/macros/latex/contrib/docassembly/docassembly.ins b/macros/latex/contrib/docassembly/docassembly.ins new file mode 100644 index 0000000000..b028064e05 --- /dev/null +++ b/macros/latex/contrib/docassembly/docassembly.ins @@ -0,0 +1,59 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright 2021 D. P. Story +%% +%% This file is part of the AcroTeX eDucation Bundle (AeB). +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 of this license or (at your option) any +%% later version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\filedate{2021/06/11} +\def\batchfile{docassembly.ins} + +\input docstrip +\ifx\generate\undefined + \Msg{**********************************************} + \Msg{*} + \Msg{* This installation requires docstrip} + \Msg{* version 2.4 or later.} + \Msg{*} + \Msg{* An older version of docstrip has been input} + \Msg{*} + \Msg{**********************************************} + \errhelp{Move or rename old docstrip.tex and get a newer one.} + \errmessage{Old docstrip in input path} + \batchmode + \csname @@end\endcsname\end +\fi + +\keepsilent +\askforoverwritefalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\preamble +\endpreamble + +\generate{% + \file{docassembly.sty}{\from{docassembly.dtx}{copyright,package}} +} + +\Msg{***************************************************************} +\Msg{*} +\Msg{* \space To finish the installation you have to copy the files } +\Msg{*} +\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX} +\Msg{*} +\Msg{***************************************************************} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput diff --git a/macros/latex/contrib/docassembly/docs/docassembly.pdf b/macros/latex/contrib/docassembly/docs/docassembly.pdf Binary files differnew file mode 100644 index 0000000000..a343c72fb4 --- /dev/null +++ b/macros/latex/contrib/docassembly/docs/docassembly.pdf diff --git a/macros/latex/contrib/docassembly/docs/install_jsfiles.pdf b/macros/latex/contrib/docassembly/docs/install_jsfiles.pdf Binary files differnew file mode 100644 index 0000000000..53d92d55d4 --- /dev/null +++ b/macros/latex/contrib/docassembly/docs/install_jsfiles.pdf diff --git a/macros/latex/contrib/docassembly/docs/install_jsfiles.tex b/macros/latex/contrib/docassembly/docs/install_jsfiles.tex new file mode 100644 index 0000000000..6c46402905 --- /dev/null +++ b/macros/latex/contrib/docassembly/docs/install_jsfiles.tex @@ -0,0 +1,325 @@ +\documentclass{article} +\usepackage[fleqn]{amsmath} +% +% the driver line is not necessary if you +% have aebpro.cfg configured to your driver. +% +\usepackage[web]{aeb_pro} +\usepackage{eforms} +\usepackage[altbullet]{lucidbry} +\usepackage{pifont} + +\usepackage{fancyvrb} + +\makeatletter +\renewcommand{\paragraph} + {\@startsection{paragraph}{4}{0pt}{6pt}{-3pt} + {\normalfont\normalsize\bfseries}} +\renewcommand{\subparagraph} + {\@startsection{subparagraph}{5}{\parindent}{6pt}{-3pt}% + {\normalfont\normalsize\bfseries}} +\makeatother + +\mathindent\parindent + +\def\AEBP{\app{AeB Pro}} +\def\AEB{\app{AeB}} +\def\app#1{\textsf{#1}} +\def\amtIndent{\parindent} +\def\meta#1{$\langle\textit{\texttt{#1}}\rangle$} +\def\SC#1{{\small#1}} +\def\PDF{\SC{PDF}} +\let\opt\texttt +\let\pkg\textsf + +\def\copyGetPath{\qquad\pushButton[\TU{Copy app.getPath to console} +\CA{getPath}\A{\JS{console.show();\r +console.println('\\napp.getPath("user");'); +}}]{cpyGtPth}{}{11bp}} + +\def\copyGetPathJS{\qquad\pushButton[\TU{Copy app.getPath to console} +\CA{getPath}\A{\JS{console.show();\r +console.println('\\napp.getPath("user", "javascript");'); +}}]{cpyGtPthJS}{}{11bp}} + +%\reversemarginpar +\def\jsSupInstr{How to install JavaScript support files} +\title{\jsSupInstr} +\author{D. P. Story} +\version{1.0} + +\chngDocObjectTo{\newDO}{doc} +\begin{docassembly} +var titleOfManual="How to install JavaScript files"; +var manualfilename="Manual_BG_Print_jsfiles.pdf"; +var manualtemplate="Manual_BG_Brown.pdf"; // Blue, Green, Brown +var _pathToBlank="C:/Users/Public/Documents/ManualBGs/"+manualtemplate; +var doc; +var buildIt=false; +if ( buildIt ) { + console.println("Creating new " + manualfilename + " file."); + doc = \appopenDoc({cPath: _pathToBlank, bHidden: true}); + var _path=this.path; + var pos=_path.lastIndexOf("/"); + _path=_path.substring(0,pos)+"/"+manualfilename; + \docSaveAs\newDO ({ cPath: _path }); + doc.closeDoc(); + doc = \appopenDoc({cPath: manualfilename, oDoc:this, bHidden: true}); + f=doc.getField("ManualTitle"); + f.value=titleOfManual; + doc.flattenPages(); + \docSaveAs\newDO({ cPath: manualfilename }); + doc.closeDoc(); +} else { + console.println("Using the current "+manualfilename+" file."); +} +\retnAbsPathAs(_path); +_path += "/"+manualfilename; +var _path=this.path; +var pos=_path.lastIndexOf("/"); +_path=_path.substring(0,pos)+"/"+manualfilename; +\addWatermarkFromFile({ + bOnTop:false, + bOnPrint:false, + cDIPath:_path +}); +\executeSave(); +\end{docassembly} + +\begin{document} + +\maketitle + +\begin{center} + \fcolorbox{blue}{white}{\begin{minipage}{.75\linewidth} + \textbf{\textcolor{red}{Note:}} These are the installation instructions + for Folder JavaScript files \texttt{aeb.js} and \texttt{aeb\_pro.js}. The \pkg{docassembly} package + uses \texttt{aeb\_pro.js}, so follow these instructions.\medskip + \end{minipage}} +\end{center} + +\section{Introduction} + + +\noindent +Because some of the \app{Acrobat} JavaScript methods have security +restrictions, they can be only executed in the console window, or as part +of a batch sequence, or from the JavaScript folder reserved by +\app{Acrobat} for that use. The developer (of {\LaTeX} packages or {\PDF} +form documents) may want to use these restricted JavaScript methods as +part of document assembly. To use the restricted methods, they must be +called from the user JavaScript folder. The scripts are contained in a +\SC{JS} file that \app{Acrobat} reads when it first starts up. + +In this article, we provide detailed steps for locating the user +JavaScript folder. For {\AEB} and {\AEBP}, the files \texttt{aeb.js} and +\texttt{aeb\_pro.js} are placed in the folder. Other JavaScript files may +be placed in the folder as well, for example, the \texttt{config.js} file +is one that is commonly used for general purposes. + +Before we get started, if you are using a version of \app{Acrobat} prior +to version~8.1, you need not read any further. The security restrictions +described below were not in effect for those versions. + +\section{Installing the JavaScript support files} + +The functionality of {\AEB} and {\AEBP} depends, to some extent, on the +proper installation of their JavaScript support files. +\begin{itemize} + \item \AEB: For authors using the $\app{dvips}+\app{Acrobat Distiller}$ + workflow, \texttt{aeb.js} is required; this file is not used by + \app{pdflatex} or \app{xelatex} users. + + \item \AEBP: For authors using the $\app{dvips}+\app{Acrobat + Distiller}$ workflow, \texttt{aeb\_pro.js} is required; for authors + that prefer \app{pdflatex}, \app{lualatex}, or \app{xelatex} as the + {\PDF} creator \emph{and who own} the \app{Acrobat} application, + the \texttt{aeb\_pro.js} is required with the \opt{useacrobat} + option of \AEBP. When using the \opt{nopro} option of \AEBP, the + JavaScript file \texttt{aeb\_pro.js} is not used. + +\end{itemize} +The placement of the JavaScript files has changed over the years and is a +function of the version number \meta{ver}. Start \app{Acrobat} and open the +console debugger window by pressing \texttt{Ctrl+J} (for \app{Windows OS}) +or \texttt{Cmd+J} (for \app{Mac OS}). Now execute the code +\texttt{app.getPath("user")} in the console window. To do this, press the +\textsf{getPath} button provided below, which copies the necessary code to +the console window. +\begin{equation} +\begin{minipage}{.8\linewidth} +\begin{Verbatim}[commandchars={!~@}] +app.getPath("user");!copyGetPath +\end{Verbatim} +\end{minipage}\label{display:getPath} +\end{equation} +Now, with the cursor on the line containing the script, press the +\texttt{Ctrl+Enter} (for \app{Windows OS}) or \texttt{Cmd+Enter} (for +\app{Mac~OS}) key. This will execute the JavaScript and return the `root' +path to the user's application data for \app{Acrobat}. + +The rest of the instructions depend on your operating system, +\app{Windows} or \app{Mac}. + +\subsection{For users of \app{Windows OS}} + +There are several cases, jump to the numbered paragraph that describes your +version (\meta{ver}) of \app{Acrobat}. + +%/C/Users/D. P. Story/AppData/Roaming/Adobe/Acrobat/11.0 +%/C/Users/D. P. Story/AppData/Roaming/Adobe/Acrobat/Privileged/11.0/JavaScripts + +\def\Stepi{\ding{182}\enspace} +\def\Stepii{\ding{183}\enspace} +\def\Stepiii{\ding{184}\enspace} + +\paragraph*{{\Stepi}For $\boldmath\text{\meta{ver}}$, $\boldmath 8.1 \le +\text{\meta{ver}} < 10.1.1$.} For the \app{Windows OS}, executing the script +in display~\eqref{display:getPath} returns a string of the +form:\footnote{This string is for \app{Windows OS} beyond \app{WinXP}.} +\begin{equation} +\begin{minipage}{.8\linewidth} +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/C/Users/!meta(username)/AppData/Roaming/Adobe/Acrobat/!meta(ver) +\end{Verbatim} +\end{minipage}\label{display:path} +\end{equation} +Navigate to this folder location. The correct location for the \SC{JS} +files is in the \texttt{JavaScripts} subfolder. If the folder does not +exist, create it. The final path for the JavaScript support files is then +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/C/Users/!meta(username)/AppData/Roaming/Adobe/ + Acrobat/!meta(ver)/JavaScripts +\end{Verbatim} +Finally, copy \texttt{aeb.js} (and \texttt{aeb\_pro.js}, if applicable) +into this folder. Close \app{Acrobat}, the next time \app{Acrobat} +is started, it will read in the \SC{JS} files. + +\paragraph*{{\Stepii}For $\boldmath\text{\meta{ver}}$, $\boldmath10.1.1 \le +\text{\meta{ver}} < 12$.} For these versions of \app{Acrobat} security has +have tightened up even more; the \texttt{JavaScripts} folder is now a +subfolder of a special \texttt{Privileged} folder. Execute +\texttt{app.getPath("user")} in the console window, as in +display~\eqref{display:getPath}. The method brings back a string similar to +the one in display~\eqref{display:path}. The correct path is obtained by +simply inserting \texttt{Privileged} into the path in +display~\eqref{display:path}, between \texttt{Acrobat} and \meta{ver}, as +displayed below. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/C/Users/!meta(username)/AppData/Roaming/Adobe/ + Acrobat/!textbf(Privileged)/!meta(ver)/JavaScripts +\end{Verbatim} +But this is a mere description of the correct location, the path must +exist! The path must be created, if it does not already exist. + +Navigate to the folder, one folder above the path shown in +display~\eqref{display:path}, that is, navigate to, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/C/Users/!meta(username)/AppData/Roaming/Adobe/Acrobat/ +\end{Verbatim} +If a \texttt{Privileged} folder exists, enter into it; otherwise, create +it, then enter it. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/C/Users/!meta(username)/AppData/Roaming/Adobe/Acrobat/Privileged +\end{Verbatim} +Now create a folder named \meta{ver}, unless it already exists, and enter +it. The version is always the major release \texttt{8.0}, \texttt{9.0}, +\texttt{10.0}, or \texttt{11.0}. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/C/Users/!meta(username)/AppData/Roaming/Adobe/ + Acrobat/Privileged/!meta(ver) +\end{Verbatim} +Finally, create the \texttt{JavaScript} folder, unless it already exists, +to obtain the final path to the user folder JavaScripts: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/C/Users/!meta(username)/AppData/Roaming/Adobe/ + Acrobat/Privileged/!meta(ver)/JavaScripts +\end{Verbatim} +Copy \texttt{aeb.js} (and \texttt{aeb\_pro.js}, if applicable) into this +folder. Close \textsf{Acrobat}, the next time \textsf{Acrobat} is started, +it will read in the \SC{JS} files. + +\paragraph*{{\Stepiii}For $\boldmath\text{\meta{ver}}$, $\boldmath +\text{\meta{ver}} > 12 $.} Beginning with the next major version following +version~11, Adobe changed its versioning scheme. There are now two tracks, +\emph{subscription} and \emph{classic} (also called \emph{perpetual}). For +subscription, the version, as I understand it, will always be \texttt{DC} +(Document Cloud), and for the classic, for which you've purchased a +\emph{perpetual license}, the \meta{ver} is a calendar year. The first +classic version is \texttt{2015}, the next one is most likely \texttt{2017}, +since major releases occur about every two years. + +Execute the code of display~\eqref{display:getPath} by pressing the button +provided to obtain a path of the form, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/C/Users/!meta(username)/AppData/Roaming/Adobe/Acrobat/DC +\end{Verbatim} +for the subscription license or, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/C/Users/!meta(username)/AppData/Roaming/Adobe/Acrobat/2015 +\end{Verbatim} +for the classic (or perpetual) license. Of course, this last path is for +the first classic version. + +Now, to obtain the path to the \texttt{JavaScripts} folder, follow the +instructions for numbered paragraph \ding{183}, but with \meta{ver} equal +to either \texttt{DC} or \texttt{2015} (a calendar year). + +%/C/Users/D. P. Story/AppData/Roaming/Adobe/Acrobat/Privileged/11.0/JavaScripts + +\subsection{For users of \app{Mac OS}} + +\app{Mac OS} does not have the security restrictions that \app{Windows OS} +does, as described in paragraphs \ding{183} and \ding{184}. + +Follow the instructions of paragraph \ding{182}, by first pressing the button +provided in display~\eqref{display:getPath}, then, in the console window, +execute this script as described in the paragraph following +display~\eqref{display:getPath}. After working through \ding{182}, one +obtains any of the following paths depending on the version (\meta{ver}) you +are using:\medskip + +\noindent +For $\text{\meta{ver}} = \texttt{8.0}, \texttt{9.0}, \texttt{10.0}, +\texttt{11.0}$: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/Users/!meta(user)/Library/Application\ Support/Adobe/ + Acrobat/!meta(ver)/JavaScripts +\end{Verbatim} +\medskip + +\noindent +For $\text{\meta{ver}} > 12$, the path is, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/Users/!meta(user)/Library/Application\ Support/Adobe/ + Acrobat/DC/JavaScripts +\end{Verbatim} +for a subscription license, and, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/Users/!meta(user)/Library/Application\ Support/Adobe/ + Acrobat/2015/JavaScripts +\end{Verbatim} +or more generally, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +/Users/!meta(user)/Library/Application\ Support/Adobe/ + Acrobat/!meta(year)/JavaScripts +\end{Verbatim} +for the perpetual license. + +In all cases, if the \texttt{JavaScripts} folder does not exist, it must +be created. Copy any \SC{JS} support files into the \texttt{JavaScripts} +folder. The script files are read the next time \app{Acrobat} is started. + +\section{Testing the placement of the JavaScript support files} + +Assuming you have successfully followed the instructions and created the +\texttt{JavaScripts} folder, test the validity of what you have done by +closing \app{Acrobat} then opening it again. Open the console window +(\texttt{Ctrl+J} or \texttt{Cmd+J}, for \app{Mac OS}) and execute this +command in the console window: +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars={!~@}] +app.getPath("user","javascript");!quad!copyGetPathJS +\end{Verbatim} +If you have followed the instructions, the return string should read the +complete path to the \texttt{JavaScripts} folder. +\end{document} diff --git a/macros/latex/contrib/docassembly/examples/attach-files.tex b/macros/latex/contrib/docassembly/examples/attach-files.tex new file mode 100644 index 0000000000..6bec57abdd --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/attach-files.tex @@ -0,0 +1,31 @@ +\documentclass{article} +\usepackage{docassembly} +\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseAttachments} + +% Look in the Adobe Acrobat JavaScript manual under the doc.importDataObject to see all the possible parameters. +\begin{docassembly} +% Or use \attachFile instead of \importDataObject +var retn = \importDataObject({ + cName: "job", + cDIPath: "\jobname.tex" +}); +% The next line creates a meaningful description of the attachment +if (retn) this.getDataObject("job").description="Source file for this PDF"; +% You can have more than one file attachments +var retn = \attachFile({ + cName: "AdobeDon", + cDIPath: "graphics/AdobeDon.pdf" +}); +% The next line creates a meaningful description of the attachment +if (retn) this.getDataObject("AdobeDon").description="The one and only AdobeDon"; +% ... +\executeSave(); +\end{docassembly} + +\begin{document} + +\lipsum[1-30] + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/docassembly/examples/certifyinvisible.pdf b/macros/latex/contrib/docassembly/examples/certifyinvisible.pdf Binary files differnew file mode 100644 index 0000000000..d00c77048d --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/certifyinvisible.pdf diff --git a/macros/latex/contrib/docassembly/examples/certifyinvisible.tex b/macros/latex/contrib/docassembly/examples/certifyinvisible.tex new file mode 100644 index 0000000000..b4205b7165 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/certifyinvisible.tex @@ -0,0 +1,151 @@ +\documentclass[12pt]{article} +\usepackage{eforms} +\usepackage{docassembly} +\usepackage{fancyvrb} + +\hypersetup{pdfpagemode=UseNone} + +\newcommand{\cs}[1]{\texttt{\char`\\#1}} + +\pagestyle{empty} +\parskip\medskipamount +\parindent0pt + +% Do not compile until you have a digital ID and password +% Actually, you can compile, but do not bring the PDF into Acrobat until you have a digital ID and password. +% You can view the PDF in other PDF viewers such as SumatraPDF. +\begin{docassembly} +\sigInfo{ + cert: "<name>.pfx", + password: "<password>", + oInfo: { + location: "AcroTeX Central, FL", + reason: "I am certifying this document", + mdp: "defaultAndComments", + contactInfo: "dpspeaker@talking@edu" + } +}; +\certifyInvisibleSign +\end{docassembly} + +\begin{document} + + +%\maketitle + +\hfill\smash{\raisebox{-\baselineskip}{March 23, 2009}} + +\begin{tabular}{@{}ll} +To: &Honorable Barrister Maxwell Frimpong\\ +From: &D. P. Speaker\\ +Subject: &On Business Proposal\\ +\end{tabular} + +\vspace{2\baselineskip} + +Dear Mr.\ Frimpong; + +Thank you for thinking of me concerning an ``important business proposal'' in +your recent and brief email to me on March 23, 2009. Recovering \$12,000,000 +(twelve million Us dollars) in claims sounds intriguing and exciting to me. +Such a large amount of money would certainly come in handy in these tough +times. Yet, regrettably, I must decline your kind offer; though I am in +retirement, I am, none-the-less, quite busy lately sorting my button +collection and don't really have the time to pick up all this easy money. + +Thank you again, Barrister Frimpong, for your offer. Please keep me +in mind should future opportunities arise. + + +\vspace{2\baselineskip} + +Best regards,\\ +\sigField{sigOfDPS}{2.5in}{4\baselineskip}\\[3pt] +Dr.\ D. P. Speaker\\ +Department of Rhetoric\\ +Talking University\\ +Talkville, FL 12345\\ +\texttt{dpspeaker@talking.edu} + +\newpage + +\section{Creating and Signing a Certified Invisible Signature} + +The \textsf{docassembly} package can create a \emph{certified invisible +signature}. You create an certified invisible signature either through the +user-interface of \textsf{Acrobat} or programmatically using JavaScript. With +JavaScript (and \textsf{docassembly}, a trusted version of the +\texttt{\textsl{Doc}.certifyInvisibleSign()} method is used to certify the +document. The certification can be seen by opening the Signature panel +(part of the left-hand panel system of the user-interface). + +Also included is an approval signature, as usual, at the end of the letter. Open +this PDF and sign using your own digital ID. Signing should not invalidate +the certification. + +The certify invisible sign is done within the \texttt{docassembly} +environment, the script follows: +\begin{Verbatim}[xleftmargin=20pt,fontsize=\small] +\begin{docassembly} +\sigInfo{ + cert: "<name>.pfx", password: "<password>", + oInfo: { + location: "AcroTeX Central, FL", + reason: "I am certifying this document", + mdp: "defaultAndComments", + contactInfo: "dpspeaker@talking.edu" + } +}; +\certifyInvisibleSign +\end{docassembly} +\end{Verbatim} +The setup is similar to certify sign, but without the key +\texttt{cSigFieldName}, used to specify a particular field to be signed. +An invisible signature field \emph{is created and signed} using the method +\texttt{\textsl{Doc}.certifyInvisibleSign()}. + + +The \cs{sigInfo} contains the usual property list, excluding +\texttt{cSigFieldName}. The command \cs{certifyInvisibleSign} +uses the information in this object and calls the trusted version +of \texttt{\textsl{Doc}.certifyInvisibleSign()}, which is defined in +\texttt{aeb\_pro.js}. + +Additional information on signatures is found at the +\textbf{Acrobat Developer Center}.\footnote{\url{http://www.adobe.com/go/acrobat_developer}} +Refer to the \emph{JavaScript for Acrobat API Reference}, also found at the \textbf{Acrobat Developer Center}, +for details on these methods and their parameters. Adobe is +notorious for moving its reference documents and renaming them, year after +year. Good luck searching the Adobe web site for the references you need. + +\section{Compiling this file} + +In the preamble of this document, the \texttt{docassembly} environment is found: +\begin{Verbatim}[xleftmargin=20pt,fontsize=\small] +\begin{docassembly} +\sigInfo{ + cert: "<name>.pfx", password: "<password>", + oInfo: { + location: "AcroTeX Central, FL", + reason: "I am certifying this document", + mdp: "defaultAndComments", + contactInfo: "dpspeaker@talking.edu" + } +}; +\certifyInvisibleSign +\end{docassembly} +\end{Verbatim} +To compile this document yourself, you need to create a digital ID using +\textsf{Acrobat}. Replace \texttt{<name>} with the file name of your digital +ID. and of course replace \texttt{<password>} with the password you selected +when you created your digital ID. Modify the \texttt{oInfo} property as +designed. + + +Now, back to my retirement. + +\end{document} + +References: Try +Digital Signatures Workflow Guide +http://www.adobe.com/devnet-docs/acrobatetk/tools/DigSig/index.html diff --git a/macros/latex/contrib/docassembly/examples/create-templates.tex b/macros/latex/contrib/docassembly/examples/create-templates.tex new file mode 100644 index 0000000000..62694179a6 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/create-templates.tex @@ -0,0 +1,66 @@ +\documentclass{article} +\usepackage{xcolor} +\usepackage{docassembly} +\usepackage{eforms} +\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseNone,colorlinks} + +\begin{defineJS}{\ADActn} +if (typeof tmplObj != "object") + tmplObj=this.getTemplate("AdobeDon"); +tmplObj.spawn({ + nPage: 0, + bOverlay:false, + oXObject: tmplObj +}); +\end{defineJS} +\begin{defineJS}{\contActn} +if (typeof tmplObjSpawn != "object") { + var tmplObjSpawn=this.getTemplate("myStory"); + tmplObjSpawn.spawn({ + nPage: this.pageNum+1, + bOverlay:false, + oXObject: tmplObjSpawn + }); + this.pageNum++; +} +\end{defineJS} + +% Look in the Adobe Acrobat JavaScript manual under the Doc.createTemplate to see all the possible parameters. +\begin{docassembly} +\insertPages({ + nPage: -1, + cPath: "graphics/AdobeDon-btn.pdf" +}); +var tmplObj=\createTemplate({cName: "AdobeDon", nPage: 0}); +tmplObj.hidden=true; +\insertPages({ + nPage: -1, + cPath: "resources/myStory.pdf" +}); +var tmplObj1=\createTemplate({cName: "myStory", nPage: 0}); +tmplObj1.hidden=true; +\executeSave(); +\end{docassembly} + +\begin{document} + +\noindent +\pushButton[\CA{View author}\AAmouseup{\ADActn}]{vTmpl}{}{11bp}\medskip + +\noindent +\lipsum[1-4]\medskip + +\noindent +Write a short history of your life. Press the \textsf{Continue} link if you need more space for your story, and then continue on the +next page.\medskip + +\noindent +\textField[\Ff\FfMultiline]{myStory}{\linewidth}{3\baselineskip}\\[6bp]\null +\hfill\setLink[\A{\JS{\contActn}}\linktxtcolor{red}]{Continue on next page as needed} + +\newpage +\noindent\lipsum[5-10] + +\end{document} diff --git a/macros/latex/contrib/docassembly/examples/doc-saveas.tex b/macros/latex/contrib/docassembly/examples/doc-saveas.tex new file mode 100644 index 0000000000..38df5985fa --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/doc-saveas.tex @@ -0,0 +1,27 @@ +\documentclass{article} +\usepackage{docassembly} +\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseNone} + +% Look in the Adobe Acrobat JavaScript manual under the doc.saveAs() to see all the possible parameters. +\begin{docassembly} +% save a copy of this PDF for the archives +var retn=\docSaveAs({ + cPath: "\jobname-copy.pdf", + bCopy: true +}); +% This method can also be used to make conversions, for example, you can save a PDF as a PNG +% Here, we make a PNG image of each page in this document. +var retn=\docSaveAs({ + cConvID: "com.adobe.acrobat.png", + cPath: "\jobname.png" +}); +\executeSave(); +\end{docassembly} + +\begin{document} + +\lipsum[1-30] + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/docassembly/examples/extract-pages.tex b/macros/latex/contrib/docassembly/examples/extract-pages.tex new file mode 100644 index 0000000000..7cfc1af7d7 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/extract-pages.tex @@ -0,0 +1,24 @@ +\documentclass{article} +\usepackage{docassembly} +\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseNone} + +% Look in the Adobe Acrobat JavaScript manual under the doc.extractPages to see all the possible parameters. +% nStart and nEnd are 0-based page numbers, so nStart:1 and nEnd:2 extracts pages 2 and 3 +\begin{docassembly} +\retnAbsPathAs(_path); +_path += "/extracted-pages.pdf"; +\extractPages({ + nStart: 1, + nEnd: 2, + cPath: _path +}); +\executeSave(); +\end{docassembly} + +\begin{document} + +\lipsum[1-30] + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/docassembly/examples/graphics/AdobeDon-btn.pdf b/macros/latex/contrib/docassembly/examples/graphics/AdobeDon-btn.pdf Binary files differnew file mode 100644 index 0000000000..7ec1ff9880 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/graphics/AdobeDon-btn.pdf diff --git a/macros/latex/contrib/docassembly/examples/graphics/AdobeDon.pdf b/macros/latex/contrib/docassembly/examples/graphics/AdobeDon.pdf Binary files differnew file mode 100644 index 0000000000..2968aa40b7 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/graphics/AdobeDon.pdf diff --git a/macros/latex/contrib/docassembly/examples/graphics/AdobeDonIcon.pdf b/macros/latex/contrib/docassembly/examples/graphics/AdobeDonIcon.pdf Binary files differnew file mode 100644 index 0000000000..284f3d8c09 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/graphics/AdobeDonIcon.pdf diff --git a/macros/latex/contrib/docassembly/examples/graphics/AeB_Logo.pdf b/macros/latex/contrib/docassembly/examples/graphics/AeB_Logo.pdf Binary files differnew file mode 100644 index 0000000000..c41d81c44c --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/graphics/AeB_Logo.pdf diff --git a/macros/latex/contrib/docassembly/examples/graphics/girl.pdf b/macros/latex/contrib/docassembly/examples/graphics/girl.pdf Binary files differnew file mode 100644 index 0000000000..4ab32d829a --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/graphics/girl.pdf diff --git a/macros/latex/contrib/docassembly/examples/graphics/man1.pdf b/macros/latex/contrib/docassembly/examples/graphics/man1.pdf Binary files differnew file mode 100644 index 0000000000..1072158851 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/graphics/man1.pdf diff --git a/macros/latex/contrib/docassembly/examples/graphics/scot.pdf b/macros/latex/contrib/docassembly/examples/graphics/scot.pdf Binary files differnew file mode 100644 index 0000000000..3133d053b6 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/graphics/scot.pdf diff --git a/macros/latex/contrib/docassembly/examples/import-icons.tex b/macros/latex/contrib/docassembly/examples/import-icons.tex new file mode 100644 index 0000000000..147839fa29 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/import-icons.tex @@ -0,0 +1,56 @@ +\documentclass{article} +\usepackage{docassembly} +\usepackage{eforms} +\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseNone} + +% Look in the Adobe Acrobat JavaScript manual under the doc.importIcon to see all the possible parameters. +\begin{docassembly} + var retn=\importIcon({cName:"A man",cDIPath:"graphics/man1.pdf"}); + if ( retn < 0 ) console.println("The file man1.pdf could not be opened or is invalid"); + var retn=\importIcon({cName:"A girl",cDIPath:"graphics/girl.pdf"}); + if ( retn < 0 ) console.println("The file girl.pdf could not be opened or is invalid"); + var retn=\importIcon({cName:"A scotsman",cDIPath:"graphics/scot.pdf"}); + if ( retn < 0 ) console.println("The file scot.pdf could not be opened or is invalid"); + var retn=\importIcon({cName:"AdobeDon",cDIPath:"graphics/AdobeDonIcon.pdf"}); + if ( retn < 0 ) console.println("The file AdobeDonIcon.pdf could not be opened or is invalid"); +\executeSave(); +\end{docassembly} + +\begin{document} + +\begin{defineJS}{\cycleJS} +if (typeof indexIcon == "undefined") var indexIcon=0; +var oIconName=this.icons[indexIcon].name; +var f=this.getField("iconContainer"); +var oIcon=this.getIcon(oIconName); +f.buttonPosition=position.iconTextV; +f.buttonSetIcon(oIcon); +f.buttonSetCaption(oIconName); +indexIcon = (indexIcon+1) \% (this.icons.length); +\end{defineJS} +% define a clear button feature, it clears the button iconContainer +% so it no longer displays an icon; pressing the Cycle button resumes +% the display as before. +\begin{defineJS}{\clearJS} +f=this.getField("iconContainer") +// save +var sv=f.buttonPosition; +var cptn=f.buttonGetCaption(); +// clear +f.buttonPosition=position.textOnly; +f.buttonSetCaption(""); +\end{defineJS} + +\begin{center}\Large\bfseries +A slide show of Icons and Photos +\end{center} + +\begin{center} +\pushButton[\BG{}\TP{2}\S{S}]{iconContainer}{100bp}{100bp}\vcgBdry[6bp] +\pushButton[\CA{Cycle}\AAmouseup{\cycleJS}]{cycleBtn}{}{11bp}\cgBdry[3bp] +\pushButton[\CA{Clear}\AAmouseup{\clearJS}]{clearBtn}{}{11bp} +\end{center} +\end{document} + diff --git a/macros/latex/contrib/docassembly/examples/import-sound.tex b/macros/latex/contrib/docassembly/examples/import-sound.tex new file mode 100644 index 0000000000..19f7be117c --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/import-sound.tex @@ -0,0 +1,24 @@ +\documentclass{article} +\usepackage{docassembly} +\usepackage{eforms} +%\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseNone} + +% Look in the Adobe Acrobat JavaScript manual under the doc.importSound to see all the possible parameters. +\begin{docassembly} +\importSound({cName: "StarTrek", cDIPath: "sounds/trek.wav" }); +\executeSave(); +\end{docassembly} + +\begin{document} + + +\begin{center} +\pushButton[\CA{Star Trek}\S{S}\W{0}\AAmouseup{% + var s = this.getSound("StarTrek");\r + s.play(); +}]{stSound}{}{11bp} + +\end{center} +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/docassembly/examples/insert-pages.tex b/macros/latex/contrib/docassembly/examples/insert-pages.tex new file mode 100644 index 0000000000..eedbaab1e7 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/insert-pages.tex @@ -0,0 +1,20 @@ +\documentclass{article} +\usepackage{docassembly} +\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseNone} + +% Review doc.insertPages in the Acrobat JavaScript reference +\begin{docassembly} +\insertPages({ + nPage: this.numPages-1, + cPath: "graphics/AdobeDon.pdf" +}); +\executeSave(); +\end{docassembly} + +\begin{document} + +\lipsum[1-30] + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/docassembly/examples/mail-doc.tex b/macros/latex/contrib/docassembly/examples/mail-doc.tex new file mode 100644 index 0000000000..6240c9459c --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/mail-doc.tex @@ -0,0 +1,31 @@ +\documentclass{article} +\usepackage{docassembly} +\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseNone} + +% Look in the Adobe Acrobat JavaScript manual under the doc.mailDoc to see all the possible parameters. +\begin{docassembly} +% Prior to sending this document, you can attach files this this PDF +% Refer to attach-files.tex +var retn = \attachFile({ + cName: "AdobeDon", + cDIPath: "graphics/AdobeDon.pdf" +}); +% The next line creates a meaningful description of the attachment +if (retn) this.getDataObject("AdobeDon").description="The one and only AdobeDon"; +\executeSave(); +\mailDoc({ + bUI: false, + cTo: "dpstory@hotmail.com", + cSubject: "I'm testing things out", + cMsg: "Good to hear from you again Don. I'm emailing this PDF, attached, for your review." +}); +%\executeSave(); +\end{docassembly} + +\begin{document} + +\lipsum[1-30] + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/docassembly/examples/open-doc.tex b/macros/latex/contrib/docassembly/examples/open-doc.tex new file mode 100644 index 0000000000..4b861b795e --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/open-doc.tex @@ -0,0 +1,34 @@ +\documentclass{article} +\usepackage{docassembly} +\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseNone} + +% Look in the Adobe Acrobat JavaScript manual under the app.openDoc() to see all the possible parameters. +\begin{docassembly} +% Open supportDoc.pdf, but hide it +var doc=\appopenDoc({ + oDoc: this, + cPath: "resources/supportDoc.pdf", + bHidden: true +}); +console.clear(); console.show(); +console.println("Opening " + doc.documentFileName); +% Get the field object, for the text field that has title of "Name" +console.println("Getting the field value of \"Name\""); +var f=doc.getField("Name"); +% Show the value of that text field and display it in the console +console.println("The value of \"Name\" is "+f.value); +% Close the hidden doc +console.println("Closing " + doc.documentFileName); +doc.closeDoc(); +% Save the current document +console.println("Saving the current document " + this.documentFileName); +\executeSave(); +\end{docassembly} + +\begin{document} + +\lipsum[1-30] + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/docassembly/examples/resources/myStory.pdf b/macros/latex/contrib/docassembly/examples/resources/myStory.pdf Binary files differnew file mode 100644 index 0000000000..a4549d217f --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/resources/myStory.pdf diff --git a/macros/latex/contrib/docassembly/examples/resources/supportDoc.pdf b/macros/latex/contrib/docassembly/examples/resources/supportDoc.pdf Binary files differnew file mode 100644 index 0000000000..c34ac72fe4 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/resources/supportDoc.pdf diff --git a/macros/latex/contrib/docassembly/examples/sign.pdf b/macros/latex/contrib/docassembly/examples/sign.pdf Binary files differnew file mode 100644 index 0000000000..b1fdef0f15 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/sign.pdf diff --git a/macros/latex/contrib/docassembly/examples/sign.tex b/macros/latex/contrib/docassembly/examples/sign.tex new file mode 100644 index 0000000000..0581f1ebc5 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/sign.tex @@ -0,0 +1,206 @@ +% C:\Users\dpstory\AppData\Roaming\Adobe\Acrobat\Beta\Security\DonStory.pfx +\documentclass[12pt]{article} +\usepackage{eforms} +\usepackage{docassembly} +\usepackage{fancyvrb} + +\hypersetup{pdfpagemode=UseNone} + + +\newcommand{\cs}[1]{\texttt{\char`\\#1}} + +\pagestyle{empty} +\parskip\medskipamount +\parindent0pt + +% Do not compile until you have a digital ID and password +% Actually, you can compile, but do not bring the PDF into Acrobat until you have a digital ID and password. +% You can view the PDF in other PDF viewers such as SumatraPDF. +\begin{docassembly} +\sigInfo{ + cSigFieldName: "sigOfDPS", + cert: "D_P_Speaker.pfx", + password: "password", + oInfo: { + location: "AcroTeX Central, FL", + reason: "I am approving this document for distribution", + contactInfo: "dpspeaker@talking.edu", + appearance: "My Signature" +% appearance: "My Image" + } +}; +\signatureSign +\end{docassembly} + +\begin{document} + + +%\maketitle + +\hfill\smash{\raisebox{-\baselineskip}{March 23, 2009}} + +\begin{tabular}{@{}ll} +To: &Honorable Barrister Maxwell Frimpong\\ +From: &D. P. Speaker\\ +Subject: &On Business Proposal\\ +\end{tabular} + +\vspace{2\baselineskip} + +Dear Mr.\ Frimpong; + +Thank you for thinking of me concerning an ``important business proposal'' in +your recent and brief email to me on March 23, 2009. Recovering \$12,000,000 +(twelve million US dollars) in claims sounds intriguing and exciting to me. +Such a large amount of money would certainly come in handy in these tough +times. Yet, regrettably, I must decline your kind offer; though I am in +retirement, I am, none-the-less, quite busy lately sorting my button +collection, and don't really have the time to pick up all this easy money. + +Thank you again, Barrister Frimpong, for your offer. Please keep me +in mind should future opportunities arise. + + +\vspace{2\baselineskip} + +Best regards,\\ +\sigField{sigOfDPS}{2.5in}{4\baselineskip}\\[3pt] +Dr.\ D. P. Speaker\\ +Department of Rhetoric,\\ +Talking University\\ +Talkville, FL 12345\\ +\texttt{dpspeaker@talking.edu} + + +\newpage + +\section{Creating and Signing a Signature Field} + +The \textsf{eforms} package can create a signature field with the \cs{sigField} command, and +using the \textsf{aeb\_pro} package with its \texttt{docassembly} environment, can also sign the field +from a {\LaTeX} source. + +The {\LaTeX} code for creating the signature field of this document is +\begin{Verbatim}[xleftmargin=20pt,fontsize=\small] +Best regards,\\ +\sigField{sigOfDPS}{2.5in}{4\baselineskip}\\[3pt] +Dr.\ D. P. Speaker\\ +Department of Rhetoric,\\ +Talking University\\ +Talkville, FL 12345\\ +\texttt{dpspeaker@talking.edu} +\end{Verbatim} +The \cs{sigField} command appears in the second line, and uses the usual +syntax for form fields, as defined in the \textsf{eforms} package. +Here's what the field looks like when it is unsigned. + +\sigField{sigOfDPS1}{2.5in}{4\baselineskip} + +Once the field is created, it can be signed using the Acrobat or Adobe +Reader (version 10.0.1 or later) user interface. + +A signature field may also be signed programmatically from the {\LaTeX} +source file using AeB Pro. The first signature field of this document +was automatically signed when the newly created PDF is brought into +Acrobat. +\begin{Verbatim}[xleftmargin=20pt,fontsize=\footnotesize] +\begin{docassembly} +\sigInfo{ + cSigFieldName: "sigOfDPS", + cert: "<name>.pfx", password: "<password>", + oInfo: { + location: "AcroTeX Central, FL", + reason: "I am approving this document for distribution", + contactInfo: "dpspeaker@talking.edu", + appearance: "My Signature" } +}; +\signatureSign +\end{docassembly} +\end{Verbatim} +The script above was used to programmatically sign the signature field +with field name of \texttt{sigOfDPS}. The value of the \texttt{password} +key to protect my secrets. The first command, \cs{sigInfo}, creates an +JavaScript object, \texttt{oSigInfo}. The command \cs{signatureSign} uses +the information in this object to sign the field designated by the +\texttt{cSigFieldName} property. + +The general syntax of the argument of \cs{sigInfo} is displayed below. +\def\meta#1{$\langle\textsl{\texttt{#1}}\rangle$} +\begin{Verbatim}[xleftmargin=20pt,fontsize=\footnotesize,commandchars={!()}] +\sigInfo{ + cSigFieldName: "!meta(sigFldName)", + oHandler: !meta(securityHandlerObj), + path2Cert: !meta(path), + cert: "!meta(certName).pfx", + password: "!meta(password)", + bUI: true|false; + oInfo: { + !meta(various properties) + } +} +\end{Verbatim} +The first five keys are used by AeB Pro to build the proper information +needed sign the field. +\begin{description} + \item[\normalfont\texttt{cSigFieldName} (required)] The + name of the signature field to be signed. + \item[\normalfont\texttt{oHandler} (optional)] The security + handler to be used. If this key is not present, + \texttt{security.PPKLiteHandler} is used. + \item[\normalfont\texttt{path2Cert} (optional)] The + device-independent path to the PFX file to be used. If not + present, AeB Pro uses the name provided by the \texttt{cert} key + and builds the path to where Acrobat normally saves digital IDs. + \item[\normalfont\texttt{cert} (optional)] The name of the digital + ID to be used for signing. Optional if \texttt{path2Cert} is + provided, required otherwise. + \item[\normalfont\texttt{password} (required)] The password for the PFX file + provided, necessary to login to the security handler (\texttt{oHandler}). + \item [\normalfont\texttt{bUI} (optional)] A Boolean, if + \texttt{true} the security handler displays the user interface + when signing. The default is \texttt{false}. + \item[\normalfont\texttt{oInfo} (optional)] The \texttt{oInfo} property key is + one that appears in the argument property list of the + \texttt{\textsl{Field}.signatureSign()} method. It is passed to + the argument of this JavaScript method. See the documentation of + \texttt{\textsl{Field}.signatureSign()} in the + \emph{JavaScript for Acrobat API Reference} for more information. +\end{description} + +Additional information on signatures is found at the +\textbf{Acrobat Developer Center}.\footnote{\url{http://www.adobe.com/go/acrobat_developer}} +Refer to the \emph{JavaScript for Acrobat API Reference}, also found at the \textbf{Acrobat Developer Center}, +for details on these methods and their parameters. Adobe is +notorious for moving its reference documents and renaming them, year after +year. Good luck searching the Adobe web site for the references you need. + +\section{Compiling this file} + +In the preamble of this document, the \texttt{docassembly} environment is found: +\begin{Verbatim}[xleftmargin=20pt,fontsize=\small] +\begin{docassembly} +\sigInfo{ + cert: "<name>.pfx", password: "<password>", + oInfo: { + location: "AcroTeX Central, FL", + reason: "I am certifying this document", + mdp: "defaultAndComments", + contactInfo: "dpspeaker@talking.edu" + } +}; +\certifyInvisibleSign +\end{docassembly} +\end{Verbatim} +To compile this document yourself, you need to create a digital ID using +\textsf{Acrobat}. Replace \texttt{<name>} with the file name of your digital +ID. and of course replace \texttt{<password>} with the password you selected +when you created your digital ID. Modify the \texttt{oInfo} property as +designed. + + +Now, back to my retirement. + +\end{document} + +Digital Signatures Workflow Guide +http://www.adobe.com/devnet-docs/acrobatetk/tools/DigSig/index.html diff --git a/macros/latex/contrib/docassembly/examples/sounds/trek.wav b/macros/latex/contrib/docassembly/examples/sounds/trek.wav Binary files differnew file mode 100644 index 0000000000..b8d9e65dd8 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/sounds/trek.wav diff --git a/macros/latex/contrib/docassembly/examples/watermark-file.tex b/macros/latex/contrib/docassembly/examples/watermark-file.tex new file mode 100644 index 0000000000..c7b9f10f42 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/watermark-file.tex @@ -0,0 +1,25 @@ +\documentclass{article} +\usepackage{docassembly} +\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseNone} + +% Look in the Adobe Acrobat JavaScript manual under the addWatermarkFromFile to see all the possible parameters. +\begin{docassembly} +\retnAbsPathAs(_path); +_path += "/graphics/AeB_Logo.pdf"; +\addWatermarkFromFile({ + bOnTop:false, + bOnPrint:false, + nOpacity: 0.2, + nRotation: 90, + cDIPath:_path +}); +\executeSave(); +\end{docassembly} + +\begin{document} + +\lipsum[1-30] + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/docassembly/examples/watermark-text.tex b/macros/latex/contrib/docassembly/examples/watermark-text.tex new file mode 100644 index 0000000000..4b4c123bc2 --- /dev/null +++ b/macros/latex/contrib/docassembly/examples/watermark-text.tex @@ -0,0 +1,26 @@ +\documentclass{article} +\usepackage{docassembly} +\usepackage{lipsum} + +\hypersetup{pdfpagemode=UseNone} + +% Look in the Adobe Acrobat JavaScript manual under the addWatermarkFromText to see all the possible parameters. +\begin{docassembly} +\addWatermarkFromText({ + cText: "Confidential", + aColor: color.red, + nFontSize: 72, + cFont:font.HelvB, + bOnTop:false, + bOnPrint:false, + nOpacity: 0.2, + nRotation: 45 +}); +\executeSave(); +\end{docassembly} + +\begin{document} + +\lipsum[1-30] + +\end{document}
\ No newline at end of file |