Bertrand
I assume you want to ‘auto’ install the pdtk onto machines. I did this a few
years ago(wanted to provide a way to secure PDFS before the option was
available from 4D.
this is what i did
1) in my application resources folder i created a folder called additions and
in there put the pdftk.mpkg
..because i was only using this for pdf encrption nothing happens unless you
want to encrpyt a PDF
in my encyption code is for look for a preference that I am storing in a table
this stores in BLOB..the preferences gives them defaults for whether the they
want to prevent copying(from documents), editing o documents, printing of
documents, and a whether to set a user password for documents, and also the
owner password to set(all documents generated were to get the same owner
password). The preferences could be over-ridden when producing a document
b) look to check the path:
$Path:=System folder
$Pos:=Position(":";$Path)
$Path:=Substring($Path;1;$pos)
$Path:=$Path+"opt"+":"+"pdflabs:pdftk:bin"+":"+"pdftk"
$PathPosix:=Replace string($Path;":";"/")
$IsaPath:=Test path name($Path)
this tells us if pdftk is already installed
if it is not installed then this
$script_folder_path_t:=Get 4D folder(Current resources folder)+"additions:"
$script_file_path_t:=$script_folder_path_t+"Pdftk.mpkg"
$path_system_t:=Replace string($script_file_path_t;":";"/") //the POSIX
separator
$target_volume_t:=Substring($path_system_t;1;Position("/";$path_system_t)-1)
$system_folder_t:=System folder(System) //take care of the /Volumes/ syntax
$boot_volume_t:=Substring($system_folder_t;1;Position(":";$system_folder_t)-1)
$script_file_path_t:=Choose($boot_volume_t=$target_volume_t;Substring($path_system_t;Position("/";$path_system_t));"/Volumes/"+$path_system_t)
LAUNCH EXTERNAL PROCESS("open "+$script_file_path_t)
installed the package-of course this assumes they have rights to install things
on the computer
the rest of the code took the already created PDF and using the posix path of
it and the preferences etc
$command:=$PathPosix+" "+$DocName+" output "+$Before+$DocName2+" owner_pw
"+$PasswordOwner+$PasswordUser+" allow "+$Prevent2+$Prevent+$Prevent3
SET ENVIRONMENT VARIABLE("_4D_OPTION_CURRENT_DIRECTORY";$PathName)
LAUNCH EXTERNAL PROCESS($Command)
(prevent 2 is printing, prevent 3 is editing and prevent is copying
I have put a copy of the code in my dropbox
https://www.dropbox.com/s/j7vb6b6jgrfg5xq/DB_ControlDataFilePath.txt?dl=0
<https://www.dropbox.com/s/j7vb6b6jgrfg5xq/DB_ControlDataFilePath.txt?dl=0>
if has a few subcalls-all pretty standard things that should be self explanitory
> On 15 Jan 2017, at 19:15, Bertrand SOUBEYRAND <[email protected]> wrote:
>
>
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************