Macro(?) to remove a known password from a document

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

User avatar
siSINka
User
Posts: 42
Joined: Sun Apr 07, 2019 11:55 am

Macro(?) to remove a known password from a document

Post by siSINka »

I often receive many *pdf documents, password protected to open them. The password is the same for all documents. I want to remove the password to open all documents and save the documents without the password.

The procedure using "Document - Security Properties - Security Method: No Security - OK - OK - Save Document" is tedious because I have to repeat it over and over for each document.

I'd like to simplify it somehow (the same operation, removing the password for all already opened documents), ideally by clicking on some new icon or command in the menu.

Any tips? Thanks in advance!

I use a similar function (record macro) in Excel when I want to copy parts of one sheet to another, for example, one by one. I would also like to see some such function (recording the sequence of menu commands) in PDF-XChange Editor.
User avatar
Jordan - PDF XChange
Site Admin
Posts: 252
Joined: Mon Jul 03, 2023 3:10 pm

Re: Macro(?) to remove a known password from a document

Post by Jordan - PDF XChange »

Hello siSINka,

One way to approach this is to use the PDF Tools - Secure PDF.

You can set it to No Security . PDF-Tools also has the option to store passwords, so this will save you a few more clicks:
image.png
Let me know if this is something that you can use.
You do not have the required permissions to view the files attached to this post.
Best regards,
Jordan
User avatar
siSINka
User
Posts: 42
Joined: Sun Apr 07, 2019 11:55 am

Re: Macro(?) to remove a known password from a document

Post by siSINka »

Thanks, but I don't have PDF Tools, only PDF-XChange Editor Plus (maintenance, last build).
Is there any way to solve this only in it?
User avatar
rakunavi
User
Posts: 1671
Joined: Sat Sep 11, 2021 5:04 am

Re: Macro(?) to remove a known password from a document

Post by rakunavi »

Hello siSINka,

With some scripting language, I think you can achieve something close to what you want to do, even with only the PDF-XChange Editor. Here is an example script for AutoHotkey v1.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

WinActivate, ahk_exe PDFXEdit.exe
WinWaitActive, ahk_exe PDFXEdit.exe,, 2
Loop
{
	Send, ^d
	WinWaitActive, Document Properties,, 2
	Send, {Home}{Down 2}{Tab}{Up}
	WinWaitActive, PDF-XChange Editor,, 1
	if (ErrorLevel)	{
		Send, !o
		break
	}
	Send, Y!o
	WinWaitClose, Document Properties,, 2
	Send, ^s
	sleep, 250
	Send, ^{Tab}
	sleep, 250
}
The video shows how the script is registered in Launch Applications and executed from there.

  • Animation.gif
As you can see, this is just a script that describes the manual procedure. Therefore, even minor things such as a shortcut key being different from the default or a UI language other than English will cause the script to behave unexpectedly.

You will need to have at least enough skill to understand the content and modify the code according to the situation, not only for AutoHotkey, but also for other applications.

Best regards,
rakunavi

- PDF-XChange Editor PRO Version: 10.6.0 build 396
- OS Version: Windows 11 Pro / Home 24H2 Build 26100.3775
- PC Model: GMKtec Nucbox M7 Pro with HUION Kamvas Pro 19 / Lenovo IdeaPad C340-15IWL
You do not have the required permissions to view the files attached to this post.
TOP desires for PDFXCE
forum.pdf-xchange.com/viewtopic.php?t=39665 LassoTool
forum.pdf-xchange.com/viewtopic.php?t=38554 CmtGarbled
forum.pdf-xchange.com/viewtopic.php?t=37353 FulScrMultiMon
forum.pdf-xchange.com/viewtopic.php?t=41002 DisableTouchSelect
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10998
Joined: Wed Jan 03, 2018 6:52 pm

Re: Macro(?) to remove a known password from a document

Post by Daniel - PDF-XChange »

Hello, rakunavi

Thank you for the suggestion, The Editor is not designed with the intent for use of batch processing, but instead for detailed single document editing, or specific manual processes.
As such, @siSINka, if what Rakunavi suggested here does not work for your needs, that I am sorry to say you will likely need to consider an upgrade to the PDF-Xchange PRO bundle. This includes a copy of the Editor Plus, as well as Tools and the "Standard" printer, so you would not lose any functionality from the upgrade, though you would need to uninstall the current software, and download the PRO installer instead.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com