The following code is a tried and tested code for removing metadata of the PDF file that you plan to share externally with all. This could be a PDF version of the presentation or a Word document. Unless you do that information on all past versions of the file will be visible to the reader. This might not be your intent as this will pass on crucial information – violating your privacy.
Here is the code which is tried and tested. I took the help of ChatGPT but modified the code a little so that it could be used seamlessly. The purpose of sharing this code is to ensure that it remains a reference that we all can use when needed and do not have to reinvent the wheel again.