PDF creation with password
It looks like https://plugins.craftcms.com/super-pdf might do what you're asking for although I've not used this plugin.
Check out the docs here:
https://docs.amiciinfotech.com/craft-cms/super-pdf/backend/config
Search for password on that page to see what it offers.
Good luck.
-John Morton