I would say that there is a lot more involved in what you're asking.
Normally you just protect the document with password and apply editing and printing restrictions.
Protecting editing in such manner will prevent the users from accessing editing tools with Acrobat Pro DC for exapmle.
It will not prevent the document from having users save it to a postscript file format, printing to PDF, or flattening the protected file with web browsers or other types of PDF viewers.
If you're truly serious about PDF security, see below for more extensive about security:
That link above will open your eyes more to what you will be dealing with and give you an insight o how to tighten up your PDFs.
You can obfuscate the code.
"Protecting editing in such manner will prevent the users from accessing editing tools with Acrobat Pro DC for exapmle."
You are not serious, or you give bad advice 😉
"You can obfuscate the code."
This is the best way for the PDF form to be rejected by all antivirus and anti malware, as well as by Gmail and most email servers.
To "protect" my minified scripts I drown them in the mass, by adding dozens of unnecessary lines of code.