Forum moved here!

Home / Open protected pdf silent by command line

oengenheiro

Hello,

Is there any parameter I can use to open a protected pdf that I know the password?

kjk

Unfortunately it’s not possible to provide a password from cmd-line. You’ll be asked for password when Sumatra tries to open the file.

GitHubRulesOK

@oengenheiro

there arey 2 solutions

1. there iS AN OPTION TO STORE PASSWORDS IN THE SumatraPDF-settings.txt FILE

a whitespace separated list of passwords to try when opening a password protected document
(passwords containing spaces must be quoted) (introduced in version 2.4)

IF YOU REPLACE A COPY OF THE INI from the command line prior to opening the file by command line it may work, the SumatraPDF-settings.txt could be stored in a secured zip and deleted afterward if you dont want others to see the plaintext however you still need to supply the password for extracting from zip

1. if you first open the file sumatra pdf will ask if you wish to store the password and will keep the pasword in the SumatraPDF-settings.txt file encrypted for that path\filename e.g. for test123 you will see under “filestates” a line such as

 DecryptionKey = 7486a20913ab1c6920675702c3b7c0b7251cdbe84c957c5031cd301679816ee100000000000000000000000000000000


again if you store / replace the SumatraPDF-settings.txt file as required at runtime then SumatraPDF will apply that entry for that given path\filename , if you need a more general solution you will need to use a program to manipulate those entries

SumatraPeter

Does sound like a feature worth adding though IMO.

oengenheiro

Great solution!! Thanks!