Locklizard
  • Products
    • DRM software
      • Safeguard PDF Security
      • Safeguard Enterprise
      • DRM Software Features
        • Restrict PDF use
        • Watermark PDF
        • Expire PDF
        • Revoke PDF
        • Disable Print
        • Track PDF
    • Secure PDF Viewers
      • Viewer Overview
      • Viewer Demo
      • Web Viewer
      • USB Viewer
    • Add-ons
      • All Add-ons
      • Web Publisher
      • Safeguard Portable USB
      • Ecommerce API
      • Command Line
      • Own Branding
      • Custom Email
    • Purchase & Pricing
    • Book a Demo
  • Solutions
    • Industry sectors
      • All Industries
      • Auctions
      • Engineering
      • Government
      • Healthcare
      • Libraries
      • Mergers & Acquisitions
      • Publishing Ebooks
      • Publishing Media
      • Publishing Standards
      • Membership Associations
      • Reports & Analysis
      • Tax Advisors
      • Training & Education
    • Vertical sectors
      • All Sectors
      • Board Documents
      • Internal Company Use
      • Large Publishers
      • Small Publishers
    • Business processes
      • Processes Overview
      • Secure Document Sharing
      • Sell Documents Securely
      • Document Retention
      • Prevent Document Leakage
      • Internal Document Control
      • Regulatory Compliance
      • Secure PDF Forms
      • Secure Data Rooms
      • Data Room Security
      • Application Integration
    • Business benefits
    • Regulatory compliance
      • Compliance Overview
      • NIST & DFAR Compliance
  • Downloads
    • Free 15 day trial
    • Viewers
      • Windows Viewer
      • Mac Viewer
      • iOS Viewer
      • Android Viewer
    • Writers
    • Manuals
  • Support
    • Support
    • FAQs
    • Guides
    • Videos
    • White papers
  • About Us
    • Contact us
    • Our customers
      • Customer Overiew
      • Case Studies
      • Testimonials
    • Our technology
      • What is DRM?
    • Blog
    • Why Locklizard?
      • Competitors
      • PDF DRM protection
      • Password protect PDF
      • Product Awards
  • Click to open the search input field Click to open the search input field Search
  • Menu Menu

How to sanitize, optimize, compress & secure PDF files

in Blog, Document Security, DRM, PDF Security

Why & how to remove PDF metadata, JavaScript, & hidden information.

How to use PDF sanitization, optimization, and compression options, to reduce file size, increase performance and security.

When you share a secure PDF, it is not just the visible information you need to worry about.  Every PDF comes with metadata describing who the author of the document is, when it was created, and when it was last modified.  This information can be used to trace the file back to its creator, which is not ideal if you want to protect the identity of your employees.  Additionally, some PDFs contain annotations, JavaScript, blank pages, attachments, and hidden information that you may not want distributed with its final draft.

In this guide, we’ll be exploring:

  1. How to sanitize PDFs to improve security
  2. How to optimize PDF files to reduce file size
  3. How to compress a PDF (images) to reduce file size
  4. Adobe vs Locklizard PDF security
  5. The best choice for PDF sanitization and protection

several ways to remove this information to ensure that you do not inadvertently share sensitive or private information.  We’ll also cover ways to optimize and compress your PDFs before distribution to reduce file size and increase their load times and responsiveness.  Adobe Acrobat and Locklizard Safeguard both offer PDF sanitization, optimization, and compression options, to reduce file size, but one provides much better protection for sharing PDF files.

How to sanitize PDFs to improve security

Sanitize PDF files with Adobe Acrobat

Acrobat Pro comes with a “remove hidden information” feature that is designed to remove sensitive metadata from your PDF files.  It is found by pressing the “Sanitize” button in the toolbar while using the “Redact” tool.  Adobe’s sanitization removes PDF metadata, embedded files, JavaScript, unreferenced data, hidden layers and comments, etc.

You can also scan your document for metadata and selectively hide content/metadata to meet your use case.

Using Online PDF Sanitizers

Another option is online PDF sanitizer/redaction apps. A number of companies offer these, including SmallPDF, DigiParser, iLovePDF, AvePDF, and more. These web apps use essentially the same process as Acrobat but are free and a bit more user-friendly. However, they have some drawbacks:

  • You must upload an unprotected PDF to their server, which you do not have control or visibility over and cannot verify the security of.
  • Some tools may retain your sensitive files temporarily or even indefinitely.
  • They usually run trackers and ads or limit functionality to a certain file size or number of sanitizations.
  • When it comes to redaction, some online tools only cover text with a black box rather than deleting it. Users can delete the boxes in a PDF editor to view your original content.
  • Most ools don’t let you customize which metadata you want to remove. They are all or nothing.
  • Naturally, you need an internet connection. A fast one if you are uploading large PDFs.

For these reasons, online santizers should be used sparingly.

How to remove all metadata and hidden links from a PDF document

If you don’t have Adobe Acrobat installed then Locklizard customers can use our PDF DRM software to remove sensitive hidden content.  By default, Locklizard automatically removes metadata and JavaScript from your document for security reasons, so we advise you to leave these options checked.  However, you can customize which hidden elements you’d like to remove in its optimization settings.  You can choose whether to:

  • Remove Annotations
  • Remove Attachments
  • Remove Metadata
  • Remove JavaScript
  • Remove Blank Pages

The entire process takes just a few seconds and is very intuitive:

  1. Right-click the PDF and choose “Make secure PDF”
  2. Tick “Optimize PDF” and press the cog icon next to it.
  3. Tick the sanitization options you’d like to apply.
  4. Press the “Publish” button at the bottom of the window.

Does Print to PDF remove metadata?

Another way to remove metadata is to print to file drivers, also known as “Print to PDF”. However, you should be aware that while this removes some metadata, it does not remove all of it. In our test PDF, using Microsoft Print to PDF still displayed the following in its metadata:

  • The name of the user who printed to PDF (author)
  • The PDF title
  • The date and time at which the PDF was printed
  • The PDF file driver used (producer)
  • Any dynamic stamps (including ones that identify the stamper)
  • Any signatures
  • Page size
  • Page rot
  • Number of pages
  • PDF version
  • File size
  • Number of images

In comparison, a sanitized PDF only displayed signatures, page size, page rot, number of pages, file size, and PDF version. It removed stamps, the author, the producer, and the PDF title.

How to optimize PDF files to reduce file size

PDF optimization involves removing elements that do not affect the appearance of the document to reduce the file size, improve load times, and increase responsiveness.  This is particularly important if you plan to distribute protected PDF files for use with the Locklizard Secure Web Viewer and/or Android and OS devices which may have limited resources.

Optimizing a PDF is achieved by removing duplicate and unused elements.  The savings you can achieve will depend on how many of these elements your PDF file has and how impactful they are.  A simple PDF file consisting purely of text stands to gain less from optimization than a large, 100-page document with links, images, etc.

You can optimize PDF files in both Adobe Acrobat Pro and Locklizard Safeguard.

Optimize PDF with Adobe Acrobat Pro

PDF optimization in Adobe Acrobat is achieved by selecting the “Compress a PDF > Advanced Optimization” in the sidebar.

The “Discard Objects”, “Discard User Data” and “Clean Up” sections all contain options to reduce the file size of your PDF documents.

Optimize a PDF with Locklizard Safeguard

Optimizing a PDF with Locklizard Safeguard is just as easy:

  1. Right-click the PDF and choose “Make secure PDF”
  2. Tick “Optimize PDF” and press the cog icon next to it.
  3. Tick the optimization options you’d like to apply.

    There are several PDF optimization options that increase performance and reduce the file size of your PDF documents.  In the ‘Resources’ section select the following:

    • Remove unused objects:  Removes resources that aren’t used in the document’s pages, such as objects that are not deleted along with a page when it is removed.
    • Remove unused streams:  When images are removed from pages but not removed from page resources, it can result in useless, left-over streams.  This option analyzes page contents to determine which resource streams are used and deletes the ones that aren’t.
    • Link duplicate streams:  Sometimes documents contain several different resource streams (for example images) which are identical.  This may happen when a document is concatenated with itself and the resultant document will contain two independent copies of the same resource stream.  This option analyzes all resource streams and compares them.  If some streams are duplicated, they are merged.

    You should also select the sanitize PDF options in the ‘Additional section’ to remove them as well:

    • Remove annotations
    • Remove attachments
    • Remove metadata
    • Remove JavaScript – Safeguard secure Viewer does not process custom JavaScript so you should remove it as it will just use up unecessary space
    • Remove blank pages

    The more items you remove, the more quickly your PDF files will load.

  4. Press the “Publish” button at the bottom of the window.

    When you publish your DRM-protected PDF, Safeguard Writer will take a second or two to apply these changes to your document.

   How to compress a PDF (images) to reduce file size

PDF compression is primarily focused on reducing the size of PDF media (images, videos, etc.) to lead to lower file size and improved user experience.  Unlike other optimizations, PDF compression is often lossy, with the quality of images and videos either marginally or drastically decreased depending on how much you decide to compress them.

How to compress a PDF with Adobe Acrobat

Adobe Acrobat PDF compression is achieved by pressing the “Optimize PDF” button in its sidebar and then selecting “Compress PDF” in the top bar.  This will output it using Adobe’s default settings or settings you chose previously.

For further control, you can additionally press “Advanced Optimization” and change the compression options in the “Images” section.  You can additionally adjust document structure compression options in the “Clean Up” section.

How to compress a PDF and secure it with Locklizard Safeguard

Locklizard Safeguard enables secure PDF compression through its combination of standard PDF optimization techniques and Digital Rights Management software.  As well as compressing your files to reduce PDF file size, Locklizard can make sure that only authorized users can open it and nobody can edit, screenshot, print, or copy it unless you say so.

Here’s how to compress a PDF and secure it:

  1. Right-click the PDF and choose “Make secure PDF”.
  2. Tick “Optimize PDF” and press the cog icon next to it.
  3. Tick “Compress Images” and enter a number for the quality.  A lower number means a worse-quality image, but a lower file size.  We recommend trying the default of 85 and seeing how you get on.
  4. Optionally, enter page numbers that you want to skip – for example, 1 for the title page.  You can separate pages by comma (6,8), enter a range of pages (11-15), or combine the methods (6,8, 11-15).
  5. Remove unused elements by selecting items in the ‘Resources’ and ‘Additional’ sections.  This will make your compressed PDF file even smaller.
  6. Press “OK” and choose the security options you want to apply to your PDF.  You can restrict printing and screenshots, add an expiry date or watermark, and more.
  7. Press “Publish” at the bottom of the window

Your secure, compressed PDF file will be output in the encrypted .PDC format.  Users will only be able to open it in the Safeguard Viewer application after installing a valid license file (generated by the Safeguard Admin system) on their PC.  As licenses are single-use (unless you choose otherwise) and the decryption keys it transfers cannot be moved, only authorized devices will be able to open the document.

As you can see from the image above, applying PDF compression can dramatically reduce the file size of image-heavy documents.

   Adobe vs Locklizard PDF security


If you are familiar with Adobe Acrobat, you will know that it offers its own security for compressed PDF files.  It is important to understand that Locklizard offers dramatically improved security when compared to Acrobat Pro.

Acrobat Pro uses password protection for security.  As we have covered in our blog on Adobe PDF encryption, passwords are not a secure mechanism.  The permissions password, which is supposed to stop editing and printing is trivial to remove using online tools.  The open password can be brute-forced or shared by an authorized user with others.  Even Adobe DRM cannot stop screenshots, which are one of the easiest ways for users to share information.

As Adobe cannot prevent editing or copying, adding a watermark to a PDF is also useless.  Users can either delete the watermark or copy the document contents to a new file with no watermark.  Though Acrobat does not have built-in expiry controls, any expiry plugins or document revocation are also useless, as users can simply make an unprotected copy of the PDF before it is revoked.

   The best choice for PDF sanitization and protection


Locklizard doesn’t just compress PDFs and make them uneditable – it gives document publishers modular control over how their documents can be used and who can use them.  With it, admins can:

  • Stop users copying and pasting text and images
  • Block screenshot grabbers
  • Prevent sharing by locking PDFs to devices
  • Revoke users and documents at any point, regardless of location
  • Expire documents on a fixed date, after a number of prints or views
  • Track document use, including how many times a document is opened or printed
  • Prevent printing of PDF files
  • Lock access to IP addresses and countries
  • Allow offline use with full security enforced
  • Use our API and command-line tools to automate PDF protection and user management

This flexibility, combined with robust compression, sanitization, and optimization features makes Locklizard a one-stop-shop for secure PDF publication and distribution.

To compress and secure your PDF without passwords and ensure permanent protection of your sensitive information or ebook, take a 15-day free trial of our DRM software.

   FAQs

What does it mean to sanitize a PDF?

It means to remove hidden information that may disclose confidential or sensitive information.  This differs from redaction which is the censoring or obscuring of a part of visible text for legal or security purposes.

What is hidden information in a PDF?

This could be metadata, links, images, layers and JavaScript that is executed when a certain action or event occurs.

What is the purpose of removing hidden information in a PDF?

The purpose of removing hidden information in a PDF is to:

  1. Prevent sensitive or confidential information being exposed
  2. Reduce the file size
  3. Optimize the PDF so it loads quicker
What is a PDF optimizer or PDF compressor?

A PDF optimizer or compressor is software used to reduce PDF file size by removing uncessary elements such as metadata, JavaScript, hidden information, etc., and by compressing images so that they take up less space.  Most PDF Editors provide compression and optimization functionality.

Why should I use PDF optimizer or PDF compressor software?

By optimizing a PDF using a compression tool you can create a smaller file for email, upload and download, and have it load quicker in a web browser.  Be aware that image quality of graphics in the document (jpg, png, etc.) will be reduced if you apply heavy compression.

Can you compress a PDF and secure it with Acrobat?

Yes, but if you use Adobe password protection to secure a PDF then users can remove the password and any restrictions to prevent editing, copying and printing.

You can use Adobe Acrobat to compress, sanitize and optimize PDF documents before securing them with Locklizard and/or use Locklizard to perform these functions when protecting a PDF.  Both products remove all metadata, JavaScript and other hidden information to reduce file size and increase performance.

If I remove JavaScript from PDF files will forms still work?

No, since JavaScript is used for PDF form functionality.  Locklizard only support basic forms functionality (custom user JavaScript is NOT supported) to prevent our Viewer being exposed to AcroForm vulnerabilties.  You can use Locklizard for secure PDF form submission without having to worry about malicious JavaScript being executed.

How do I mask confidential information in a PDF?

Use any PDF editor’s redact tool to mask out confidential content. Failing to do so will allow somebody to remove the mask using normal PDF editing tools.  Alternatively, use Locklizard Safeguard to sanitize a PDF when protecting it.

How do you compress an encrypted PDF?

If it has an open password then you need to remove that first.  You can then use either Adobe or a similar tool to compress it and reduce the file size.  This is also the case if you want to reduce the file size of a secured PDF.

If it is a Locklizard DRM encrypted PDF then you cannot compress it.  Only an unprotected PDF can be compressed during the encryption process.

If I optimize a PDF using Locklizard how much will it reduce the file size?

The amount the file size will be reduced by will depend on how much hidden information and unused functionality can be removed (JavaScript, PDF metadata, unused streams, etc.), and by the amount of compression you apply to images.

Tags: adobe acrobat, adobe acrobat security, compress pdf, encrypted pdf, optimize pdf, pdf compression, pdf drm, pdf encryption, pdf optimization, pdf protection, pdf sanitization, pdf security, pdf security restrctions, protect pdf, reduce file size pdf, remove hidden data, remove hidden information pdf, remove javascript, remove metadata, sanitize pdf, secure pdf, secured pdf, track google doc
Share this entry
  • Share on Facebook
  • Share on X
  • Share on WhatsApp
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Reddit
  • Share by Mail

Free Trial

“Fantastic product… outstanding support.”

“We would recommend Locklizard to others”

“The clear leader for PDF DRM protection”

“Our ebook sales have gone through the roof”

“Simple & secure – protects IPR from theft”

Trusted by:

Protect IPR

See why thousands of companies use Locklizard to safeguard their documents and increase revenue streams.

  • Our Customers
  • Customer Testimonials
  • Customer Case Studies
  • Locklizard vs Competitors

Latest Posts

  • Cloud Document Collaboration & Document SecurityFebruary 18, 2025 - 10:22 am
  • Stopping Screen Sharing & Recording of DocumentsJanuary 30, 2025 - 10:58 pm
  • ISO 9001 and Document SecurityJanuary 8, 2025 - 9:02 pm
  • How to expire links for file sharing and downloadsDecember 17, 2024 - 10:14 pm
  • Digital Libraries, Controlled Digital Lending & eBook DRMNovember 30, 2024 - 4:19 pm
PDF DRM Features
  • Protect PDF files
  • Stop PDF sharing
  • Stop PDF copying
  • Restrict PDF editing
  • Add PDF watermarks
  • Disable PDF printing
  • Stop screenshots
  • Expire PDF files
  • Revoke PDF files
  • Lock PDF to devices
  • Lock PDF to IP
  • Track PDF opens

How To Guides

How to stop sharing screen
How to expire download links
How to sell study notes
How to print to PDF
How to protect Autocad files
How to protect a document
How to unlock a protected PDF
How to expire Excel files
How to watermark in Excel
How to protect Excel files
Save a Google Doc as PDF
How to share a PDF online
How to insert PDF into Word
How to edit a protected PDF
How to convert ePub to PDF
How to prevent PDF download
How to share Google Docs
How to prevent PDF download
Enforce do not copy distribute
Share sell PDF in WordPress
How to remove a watermark
How to add security to PDF
Publish digital publications
How to share a PDF as a link
How to timestamp a PDF
Insert PDF into Google Doc
How to convert Word to PDF
How to convert PDF to Word
Share securely in SharePoint
How to encrypt email in Gmail
How to encrypt PDF files
How to recall unsend an email
How to watermark PowerPoint
How to lock a Word document
How to santize PDF files
How to lock a Google doc
Prevent PDF security removal
Protect Word without password
Add a dynamic watermark
Password protect Google Doc
Add a watermark in Word
Make a PDF non editable
How to create a stamped PDF
How to prevent ebook piracy
Password protect a Word doc
How to protect a PDF securely
How to revoke document access
Change PDF security settings
How to disable printing of PDFs
Sell online courses securely
How to add security to a PDF
Encrypt a PDF without Acrobat
Share documents securely
How to prevent PDF sharing
Protect confidential documents
How to publish ebooks securely
How to restrict PDF editing
How to password protect a PDF
How to protect ebooks
How to sell Reports securely
How to make a PDF read only
How to send a PDF securely
How to watermark a PDF
How to lock a PDF from editing
How to encrypt a PDF
How to make a PDF expire
How to password protect a PDF
How to protect online courses
How to email a PDF securely

Try Safeguard today

Start protecting your PDF files and documents from sharing & piracy

PRODUCTS

DRM Software
Safeguard
Safeguard Enterprise

Add-ons

  • eCommerce API
  • Command Line
  • USB Protect
  • Web Publisher
  • Own Branding
  • Custom Email

Secure PDF Viewers

  • Web Viewer
  • USB Viewer

SECURITY FEATURES

Stop copying, editing, saving
Disable PDF Prints
Block Screenshots
Disable Copy Paste
Dynamic Watermarks
Expiry & Self Destruct
Revoke Documents
Device Locking
Location Locking
Track PDF Use

PRICING

Purchase & Pricing

RESOURCES

FAQs
Locklizard Blog
Knowledgebase
Security Guides
White Papers
Viewer Demo
Videos

DOWNLOADS

Secure Viewers

  • Windows
  • Mac OS X
  • iOS
  • Android

Writers
Product Manuals
FREE Trial

DOCUMENT SECURITY

Share Documents Securely
Protect Online Courses
Stop Ebook Piracy
Document Encryption
Secure PDF Distribution
Protect Confidential Documents
Ebook DRM

Protect PDF Files

  • PDF Copy Protection
  • Lock PDF files
  • Encrypt PDF
  • Secure PDF
  • PDF DRM

INDUSTRY SECTORS

Training & Elearning
Publishing Ebooks
Publishing Standards
Online Libraries
Membership Associations
Engineering
Government
Healthcare
Mergers & Acquisitions
Secure Reports From Theft

  ABOUT US

About Us

Our DRM Technology

  • What is DRM?

Customers

  • Case Studies
  • Testimonials

Locklizard vs Competitors

  • Secure Data Rooms

Company Brochure

  CONTACT

sales@locklizard.com
support@locklizard.com

Business Hours:
US: 8AM to 17.00PM EST
UK: 9AM to 17.30PM GMT

© Copyright 2004-2025 Locklizard Limited. All rights reserved.Privacy Policy|GDPR Policy|Cookie Policy|SITE MAP

Link to: How to Lock a Google Doc: stop sharing, editing, copying Link to: How to Lock a Google Doc: stop sharing, editing, copying How to Lock a Google Doc: stop sharing, editing, copyingLink to: What is DMCA protected & Copyright protection? Link to: What is DMCA protected & Copyright protection? What is DMCA protected & Copyright protection?
Scroll to top Scroll to top Scroll to top