How to print to PDF from a windows command line?

I have a gazillion editable PDF files. I would like to make them non editable by printing to PDF. How can I do it on the windows command line? My ultimate goal is to make PDF non editable and do this en masse. I found out that printing to PDF does make it non editable, but I am open to other options.

asked Jun 2, 2019 at 0:44 866 6 6 gold badges 13 13 silver badges 26 26 bronze badges

Is your goal to make them non-editable using an automated process or to do it specifically by printing to a PDF?

Commented Jun 2, 2019 at 1:32 Printing to PDF will not stop the file being edited. This smells like an XY problem Commented Jun 2, 2019 at 10:59 Commented Nov 20, 2020 at 22:03

3 Answers 3

Very easy to use SumatraPDF portable to regenerate via Microsoft PDF since I support SumatraPDF and have to explain why it may not be what you expect, or really need.

Printing PDF as Image based PDF will bloat them horribly and introduce the need for compression. That compression will then be a temptation to degrade to a lower quality slower speed of rendering.

PDF is designed to be fast as lighter line vectors rather than drawing dot by dot.

Once converted to Images you cannot go back except run via automated OCR. Actually that is very good these days at replacing those bloated images so they can be deleted to get a faster read/editable file.

A secondary issue is that Microsoft Print to PDF can be run unattended as long as the format is fixed to say just landscape OR portrait. Thus often not good for files that include both or variable page sizes.

Others suggest you use settings to protect the file usage , well forget that. Most PDF viewers are editors of forms and comments thus to add to a PDF it needs to be unprotected and Adobe manage that aspect, but most other viewers simply ignore that management need.

answered Jul 6, 2023 at 3:01 885 1 1 gold badge 4 4 silver badges 13 13 bronze badges

You can use Adobe Acrobat Pro to print to PDF. Adobe Acrobat Pro also allows you to perform batch processing, so you can batch print to PDF.

enter image description here

Disclaimer: at the time I write this post (2019-06-01), I work for Adobe.

answered Jun 2, 2019 at 5:15 Franck Dernoncourt Franck Dernoncourt 22k 56 56 gold badges 215 215 silver badges 364 364 bronze badges

Hmm. You work for Adobe and yet you are asking Adobe questions here? superuser.com/questions/1443955/…. You should be answering them! :)

Commented Jun 2, 2019 at 10:55 @DavidPostill I wish this automatically made me an expert of all Adobe products :-) Commented Jun 2, 2019 at 18:04

In order for a PDF to not be editable, it must be secured with encryption using a PDF editor; even then, if the PDF is Printed to PDF, the encryption and/or its digital signature does not go with it (printing can be restricted when securing, but often this creates more problems than it solves)

If the issue is wanting to make locally stored PDFs non-editable, ACLs would be used to restrict a user's ability to modify the file itself:

::# Set PDF file or directory variable: Set PDF="%UserProfile%\Path\to\PDF" ::# Remove inheritance: Icacls %PDF% /c /t /Inheritance:d ::# Remove all users, including Owner: ::# If file/directory is outside of %UserProfile%: TakeOwn /F %PDF% Icacls %PDF% /c /t /Remove:g "Authenticated Users" BUILTIN\Administrators BUILTIN Everyone System %UserName% Users ::# Set Read & execute permissions for User: Icacls %PDF% /c /t /Grant:r %UserName%:RX ::# Verify: Icacls %PDF% ::# Remove Variable: set "PDF=" 
# Set PDF file or directory variable: New-Variable -Name Key -Value "$env:UserProfile\path\to\PDF" # Remove Inheritance: Icacls $PDF /c /t /Inheritance:d # Remove all users, including Owner: # If file/directory is outside of $env:UserProfile: TakeOwn /F $PDF Icacls $PDF /c /t /Remove:g "Authenticated Users" BUILTIN\Administrators BUILTIN Everyone System $env:UserName Users # Set Read & execute permissions for User: Icacls $PDF /c /t /Grant:r $env:UserName:RX # Verify: Icacls $PDF # Remove Variable: Remove-Variable -Name PDF