Decrypt PDF using password hard coded

47 views
Skip to first unread message

Bradley Gough

unread,
Jan 16, 2017, 1:03:56 PM1/16/17
to PDFTron WebViewer
I am using PDFTron to create a PDF Reader and I am trying to open PDF files that have been encrypted with the password "test". I am trying to make it so the user doesn't have to type the password in themselves in the password dialog box. Instead I would like to pass "test" in the code itself and then for it to open the document (Skip the password dialog box). I am handling security of the viewer in a different way so it isn't a problem me passing the password in the code itself.

Thanks,

Brad

Justin Jung

unread,
Jan 17, 2017, 3:47:48 PM1/17/17
to PDFTron WebViewer
Hello Brad,
You can add the following code to config.js to load a pdf document with a password instantly.
For future reference, this answer was found in PDFTron WebViewer Forum (https://groups.google.com/d/msg/pdfnet-webviewer/D_W5FT_I_cc/JDL2qa-ICgAJ)

$(document).on('viewerLoaded', function() {
  readerControl
.getPassword = function(callback) {
    callback
('enter password here');
  
};
});

Justin Jung
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages