How to unlock a locked PDF

Evening. This is an annoying question, I apologise in advance but I already ran a search here and looked on Google (which is quite unhelpful since google’s solution is to buy an app to do it for you!).

I have a recurring problem with downloading to DT some PDFs which are locked. It’s an annoying government dept who uploaded a batch of historic scans in locked PDFs (I assume in error), so I’m going to keep running into this problem sporadically, and I know others on here have had this issue too with locked PDFs.

There is a trick to writing a fresh version of the PDF that isn’t locked, and I’ve done it before successfully (in the last month, annoyingly!), but I cannot remember how I did it. I thought last time I followed instructions I’d found here, but I can’t find them!

Details:

  • Preview can open the PDF, but DT (and another PDF app I use) cannot open them without a password.

  • Exporting to a new PDF carries over the “lock” so that doesn’t work.

  • Print to PDF is disabled for the PDF so I cannot “print” a new version.

  • I don’t know if it matters, but so you’re aware in this case the PDFs are scans so there is no OCR at present. Last time I did the OCR afterwards once the file was in DT.

I know this will be really simple and it’s driving me mad; does anyone know how to do this so you can get the file into DT and annotate it?

Did you try to export the PDF as a new one using Preview.app? Or to print the PDF into a new PDF, also using Preview.app?

I did, I didn’t say what app I’d tried using when I listed what I’d done above but it was all in Preview, I can’t open the pdf in anything else I have.

there are a lot of posts and explanations here. search “edit pdf”.

Here’s one tip for encrypted PDFs. The tldr is that the loopholes for exporting from locked PDFs are slowly getting filled in.

monterey encrypted pdf workaround

3 Likes

Is there (still) an option encrypt in the save or export dialog, and have you unchecked it?

Ahhh @SlickSlack has solved the mystery! An update in OS Monterey has removed the workarounds that previously worked in Preview! We also have a solution for now because Apple have disabled the function in Preview, but haven’t disabled the same functions in Safari!

So, all you need to do is open the pdf in a browser and you can print to pdf from there, producing a “clean” version that isn’t locked. I’ve tried it with my pdf this morning and it works!

We win for now (until Apple get wise to this and also disable the function in browsers :slightly_frowning_face:).

3 Likes

Locking - I don’t understand some aspects of the security. If the PDF can be viewed by a particular user, either with or without a password, the user can transcribe the PDF. If the user has the means to get cleartext displayed in some fashion, any further locks are convenience things, not security.

Might as well let the user do whatever he wants.

Well, all I can say is that “being locked” is not necessarily the same as “reported locked” in PDF land.

depends on how the pdf was created and the quality of the pdf viewer. it is well known, as I understand, that PDF security can be hacked. i do not know details. and the viewers can “give up” if they decide the PDF is locked (rightly or wrongly).

I suppose that Adobe invented the concept when copy protection was all the rage. Same with their Adobe ID protection for e-books: Never protected anything agains determined users but gave the management a warm, fuzzy feeling about having “protected” their IP.

1 Like

And gave others the attractive task of figuring out ways around it :wink:

2 Likes

I think this may be akin to putting a fence around your garden. Anybody can hop over it, but it is apparent that they shouldn’t.

I don’t know the language so I might be using it incorrectly, but at present there seem to be two levels of locking.

There are locked files like my PDFs, where you can view the file in Preview or a browser but not save it or do anything useful without a password (and as mentioned in my case these are files of public record and were presumably created like this in error). PDFs with copyright restrictions also fall in this in my experience (and it’s very annoying, if I buy a book as a PDF it’s probably because I want to add notes and move it to my own files!).

The second are PDFs that appear to be “properly” locked in that Preview and browsers cannot provide a view unless the password is provided. It probably makes sense that this function exists and this state at least seems to match other password-protected files, in that you can’t do anything at all until the password is entered. I’ve never tried to get round this (not had a need to) but I assume it’s like locked Word docs and if you lose the password the file is useless as there’s no way back in (not that I’ve done that before…. :roll_eyes:).

1 Like

Blanc, it should be possible to unlock PDFs with this test script. If it works (i.e. an unlocked PDF is written to the desktop) then setting the output path to the input path should overwrite the locked PDF. Not sure but I think I tested it back then.

If that works it should be possible to unlock PDFs via script in DEVONthink.

(I’m not looking into this again, but maybe someone wants to test it. If overwriting a given path with an unlocked PDF works then there still might be some other problem (e.g. loss of PDF metadata), otherwise I don’t know why I didn’t post a full script)

1 Like

You’re welcome to hop into my garden any day :slight_smile: Thanks Pete! I’d actually bookmarked that script but it had slipped my mind. I will implement it promptly.

1 Like

A quick test shows the script doesn’t work on macOS 12.3.1 when run from Script Editor; a PDF is created, but it remains password protected.

If you open a password protected PDF in Preview, select File > Save As, click on Permissions…, select all permissions, provide a (new) owner password (any), and then save the PDF, open the new PDF, select File > Edit permissions, enter the owner password, select Apply, then select File > Print… you will actually be able to print the PDF to DT

1 Like

Ahh, still on 10.14 over here. Thanks!

I found this at Adobe about a macOS Mojave error:
" Note:
In macOS Mojave (v10.14), when you try to print a document to PDF using the System Print Dialog > Save As Adobe PDF, the following error message is displayed: “This workflow contains the action Save As Adobe PDF, which is provided by a third party. Third party actions must be explicitly enabled.”
To resolve this error, see [Error in saving as Adobe PDF | macOS Mojave 10.14 google: “adobe-error-save-as-adobe-pdf-macos-mojave-10-14”

I am pretty sure, though, that “print as PDF” on Mac makes a low rez copy. [so no good for high rez printing]
It’s PDF but at screen capture rez. So, that process is useful at times, but not if you want to preserve images (and perhaps parts of the original PDF such as embedded profiles of those images as well as other attributes)
MAYBE it’s good that Acrobat’s PDF security protects images etc? copyright ;~}

The idea of locking PDF’s was I guess, as well as for security / copyright, to preserve document integrity - often in a print workflow. A final PDF is made and should be tamper proof.
And, of course, locking is used to preserve copyright of text content (so it can’t simply be copy/pasted into a new doc of some type.

If I make an instruction PDF and distribute it, I’d like to dissuade others from simply ripping my text, yeah they could type it out - for sure.)
I see this is about a public doc so copyright likely does not apply in any meaningful way].

Here’s another method I found from “Timberland Regional Library”
I’d think it’ll be at reduced resolution too.

  1. In Google Chrome, open the PDF file.

  2. Navigate to File → Print.

  3. When the print screen comes up, click Change to choose a different output destination.

  4. When the Select a destination dialog pops up, choose “Save as PDF”.

  5. You’ll be returned to the print preview screen again. This time, click the Save button.

  6. After the Save As… dialog box comes up, leave the defaults in place and click Save.

  7. When it’s done processing, minimize Chrome and double-click the newly created PDF to open it in Adobe Reader.

  8. Navigate to File → Print and click the Print button. This will send your password protected PDF to a printer. You may then choose to log in to any print release station to release the job.

I hope this helps
neil barstow, colourmanagement net :: adobe community expert/forum volunteer:: co-author: ‘getting colour right’
google me “neil barstow colourmanagement” for lots of free articles on colour management

While that may be true in some cases (ie when printing images) it is not so in general. PDF supports resolution independent vector graphics, and that’s probably what is used when printing (for example) HTML.