You can't merge encrypted files, and why would you want to, anyway? Once
the merged file is encrypted that's all that matters.
I need to set password for individual pdfs and need to unlock while merging.
It is possible that some other password protected pdf files are already existing in the folder. Password can vary also.
So you want to have both a secured merged file and secured individual files, right?
In that case, you should first merge the file, and then apply the security to both the merged file and the individual ones. That makes much more sense than applying and the removing the security.
We have different user actions:
1. Password protected files are placed in a network folder.
2. User selects 2 or more files from this folder and calls the merge function.
So we need to some how revoke the password.
I don't think that can be done with a script, but try asking over at the
Acrobat SDK forum.
The only part of the SDK that allows security to be set, or removed (if password is known) is the plug-in API. Not for scripting, not for an EXE.
Since the password would have to appear in the plug-in, this is inherently a security risk.
have a look at the well known commandline tool pdftk.exe.