Stirling-PDF icon indicating copy to clipboard operation
Stirling-PDF copied to clipboard

PDF Mulltitool cannot delete pages from secured PDFs

Open rcjcarr opened this issue 1 year ago • 29 comments

When deleting pages from a secured PDF document using the PDF Multitool, Stirlinig PDF returns blank pages after execution/download.

rcjcarr avatar Sep 28 '23 00:09 rcjcarr

@rcjcarr I'm not sure that this is a bug. If the PDF is secured, you would need to remove the security to for the PDF to be manipulated.

Why not remove the password, remove the limits on permissions, and try again?

lawfulsoftware avatar Sep 28 '23 01:09 lawfulsoftware

Which Stirling-PDF tool can do this (remove security) ?

rcjcarr avatar Sep 28 '23 10:09 rcjcarr

Remove password

In the security section

Frooodle avatar Sep 28 '23 11:09 Frooodle

The 'Remove Password' feature is asking for a password, which I don't have. Just for some context, my PDF financial statements are 'secured' but I'm not quite sure if that means encrypted or otherwise just locked. I can use Windows PDF Manager to add/remove/re-order/combine pages on such 'secured' documents. After manipulation by PDF Manager I end up with an 'unsecured' document, which is fine. My guess is that these 'secured' PDFs are not encrypted but just somehow protected from easy tampering. I was just wondering if this functionality could be added to Stirling-PDF. Otherwise, I will need to fallback on PDF Manager to organize my financial statements (consolidate them by year usually).

rcjcarr avatar Sep 28 '23 15:09 rcjcarr

@rcjcarr The Remove Password feature does work so there isn't a bug however it is likely not the expected behaviour. In the interim, I suspect that the following services will remove the password for you so you can use Stirling to complete the task:

  • https://www.ilovepdf.com/unlock_pdf
  • https://smallpdf.com/unlock-pdf
  • https://tinywow.com/pdf/unlock

@Frooodle I suspect that this can be treated as feature requests as follows:

  • Enable the Remove Password module to remove the password without requiring the user to enter the password
  • Either return an error when trying to process a password protected document or pass it in the background through the improved Remove Password module and try again. If automatically running it through the Remove Password module is not possible, return an error that asks the user to manually run the document through the Remove Password module before trying again.

lawfulsoftware avatar Sep 28 '23 16:09 lawfulsoftware

Thanks for your comments. I'm not about to pass financial documents to a web-base service, so will keep using PDF Manager for now as it runs locally. Hopefully this functionality can be added to Stirling-PDF at some point. Love your app by the way; nice work.

rcjcarr avatar Sep 28 '23 16:09 rcjcarr

@rcjcarr I don't have any reason to suspect that the services are problematic. They deal with a large volume of files and the input and output are ephemeral. I do, however, understand your concerns.

I found this application which can be downloaded and seems to be fit for purpose: https://www.cisdem.com/pdf-password-remover.html

lawfulsoftware avatar Sep 28 '23 17:09 lawfulsoftware

Ok thanks for that. PDF Manager is inexpensive at $12.79 CAD (Microsoft App Store) so will keep using that for now. I'll keep the Cisdem solution on file. This latter seems more polished but costs $49.99 USD.

rcjcarr avatar Sep 28 '23 17:09 rcjcarr

I'm not sure if there is a timeline for implementing the ability to remove a password without knowing the password. Cisdem has a free trial which might bridge this gap.

@Frooodle Please let me know if you need help.

lawfulsoftware avatar Sep 28 '23 17:09 lawfulsoftware

One of the easier changes to do :) It should appear in the alpha tag for now until a release is made

Frooodle avatar Sep 28 '23 17:09 Frooodle

Ok thanks for that. PDF Manager is inexpensive at $12.79 CAD (Microsoft App Store) so will keep using that for now. I'll keep the Cisdem solution on file. This latter seems more polished but costs $49.99 USD.

Remember Stirling-PDF accepts donations! haha :)

Frooodle avatar Sep 28 '23 17:09 Frooodle

Wonderful; alpha tag version can now remove passwords! Well done.

rcjcarr avatar Sep 28 '23 18:09 rcjcarr

@Frooodle You work very quickly. Impressive!

Let me know if you need help with anything else. I have a script to import custom fonts. Do you want me to submit a PR?

lawfulsoftware avatar Sep 28 '23 18:09 lawfulsoftware

The only thing that I would add is automatic password removal when using the PDF-Multitool on secured PDFs. Otherwise this is a two-step process (1. Remove Password and 2. any function of PDF-multitool).

rcjcarr avatar Sep 28 '23 18:09 rcjcarr

@Frooodle You work very quickly. Impressive!

Let me know if you need help with anything else. I have a script to import custom fonts. Do you want me to submit a PR?

Depends how the script would function etc

Frooodle avatar Sep 28 '23 18:09 Frooodle

The only thing that I would add is automatic password removal when using the PDF-Multitool on secured PDFs. Otherwise this is a two-step process (1. Remove Password and 2. any function of PDF-multitool).

Agreed, makes sense I'll have it as a planned feature

Frooodle avatar Sep 28 '23 18:09 Frooodle

@Frooodle You work very quickly. Impressive! Let me know if you need help with anything else. I have a script to import custom fonts. Do you want me to submit a PR?

Depends how the script would function etc

The script allows the user to automatically fetch, extract, and install custom fonts. A tarball URI, specified by the user via an environment variable, serves as the source for these custom fonts.

The implementation offers two modes of font installation: 1) Ephemeral: Fonts are installed every time the container is deployed. 2) Persistent: Fonts are saved in a volume and updated only when a version number, specified via an environment variable, changes. This approach gives users granular control over font management and minimizes unnecessary downloads.

lawfulsoftware avatar Sep 28 '23 19:09 lawfulsoftware

I like it, environment controlled and customisable

I'm not sure about the 2 different modes as it might lead to over complications if its different types of config but if its just volume mapped vs not then yeah sounds good Make a PR and add documentation to readme!

Frooodle avatar Sep 28 '23 20:09 Frooodle

I will put something together.

lawfulsoftware avatar Sep 28 '23 20:09 lawfulsoftware

Wonderful; alpha tag version can now remove passwords! Well done.

@Frooodle I just deployed alpha to verify that this is complete and it appears that further work is required.

My test PDF requires a password to open; it is more than just a document restriction.

I received the following message when trying to remove the password: "The PDF Document is passworded and either the password was not provided or was incorrect"

I created a second test file that did not require a password when opening but imposed restrictions that were secured by a password. This password and the restrictions were successfully removed.

I think that pdfcrack and qpdf can be used together to break the password that prevents the file from opening. It is also possible to add two separate passwords to a PDF file: one to secure opening and the other to restrict how it is used. The solution would need to check for and handle both passwords.

lawfulsoftware avatar Sep 28 '23 20:09 lawfulsoftware

Handling owner and user password is weird because generally only user password is used within encryption layer Owner password is just extra setting not actually stopping anything unless software supports it

So focused on user Owner password support should be seperate feature not part of this one

Frooodle avatar Sep 28 '23 20:09 Frooodle

Also due to legal reasons I don't want password cracking as part of this application

Frooodle avatar Sep 28 '23 20:09 Frooodle

Also due to legal reasons I don't want password cracking as part of this application

Understandable. It would probably be necessary to explain on that page the difference between a password on open and a password that limits how the document can be used. People will otherwise think that a password is a password.

If it puts your mind at ease, ilovepdf.com supports password cracking.

lawfulsoftware avatar Sep 28 '23 21:09 lawfulsoftware

It's less legal and more corporate friendly reason and moral.

I want a application corporations and people don't feel bad to use

Frooodle avatar Sep 28 '23 21:09 Frooodle

I can appreciate the last comment. It's just a shame that most software won't allow combining secured PDFs into one big file, i.e., won't allow users from merging their own yearly financial statements in one big file.

rcjcarr avatar Sep 28 '23 22:09 rcjcarr

I am sure that there are companies with employees who set passwords on PDF files and later departed the company without telling anyone the password. In any event, they are much more likely to find a service such as ilovepdf.com before they find Stirling and spend the time required to deploy it. I suppose that the companies that need this feature could also create their own container to include that functionality.

lawfulsoftware avatar Sep 28 '23 22:09 lawfulsoftware

I can appreciate the last comment. It's just a shame that most software won't allow combining secured PDFs into one big file, i.e., won't allow users from merging their own yearly financial statements in one big file.

I will add support for multi tool to support non passworded but still encrypted PDFs in future, its why i am keeping this ticket open

Frooodle avatar Sep 28 '23 22:09 Frooodle

ok sounds good.

rcjcarr avatar Sep 28 '23 22:09 rcjcarr

I just checked and multi tool is able to change pages from a secured PDF Can you please open the pdf in question with the stirling-pdf get-info-on-pdf function

And screenshot the encryption section? the pdf i tested on has image

Frooodle avatar Sep 29 '23 21:09 Frooodle

@rcjcarr

lawfulsoftware avatar Jan 05 '24 00:01 lawfulsoftware