Last active
October 7, 2022 15:48
-
-
Save fluidum/593490065f93a445d5f2e7cab9fd2f65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set a PDF password as variable because it might contain special symbols and it will break shell if not quoted | |
PDF_PASSWORD='<space_holder>' | |
# qpdf utility will help removing encryption. https://qpdf.readthedocs.io/ | |
qpdf --decrypt --password="$PDF_PASSWORD" encrypted.pdf unencrypted.pdf | |
# Watermark can be removed PDF is not encrypted. | |
# One type of watermarks in PDF-s are detected by lines that contain string BaseEncoding and what we will remove below. | |
sed -i '/BaseEncoding/d' unencrypted.pdf | |
# Validate your new outcome if its watermark free or not. If not then keep researching your solution. | |
# Note: I noticed some cache issue when I had opened watermarked PDF previously in Windows 10 machine (new file was on another path). sha256sum was equal in Linux and Windows. In my case I uploaded file to sharepoint and watermark was successfully removed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment