voyent
Decrypt Automatic  XML
Forum Index -> ICEpdf General
Author Message
keviinkwok

Joined: 30/May/2019 13:37:29
Messages: 6
Offline


I wonder to how to decrypt pdf by password?
i need to decrypt a pdf when i open it without asking any password.
can you give me a solution for this problem ?

Thankyou
patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


The swing viewer RI will popup dialog if a password is required to decrypt and view the file. However I'm guessing you would like to do this programatically and you can find some more info here, https://www.icesoft.org/wiki/display/PDF/Implementing+a+SecurityCallback

[Email]
keviinkwok

Joined: 30/May/2019 13:37:29
Messages: 6
Offline


Thankyou for your answer.
But i have tried the code and the results of the document are not open.
Can you give me a example how to use the code ? maybe i use it wrong
[Thumb - Capture 2.PNG]
 Filename Capture 2.PNG [Disk] Download
 Description Result
 Filesize 4 Kbytes
 Downloaded:  386 time(s)

[Thumb - Capture 3.PNG]
 Filename Capture 3.PNG [Disk] Download
 Description Code
 Filesize 24 Kbytes
 Downloaded:  357 time(s)

patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


Could you post a some more source code of how your are using out API. It looks like you are using JFrame and likely our component example?
[Email]
keviinkwok

Joined: 30/May/2019 13:37:29
Messages: 6
Offline


yes im using java for my program, and i use two library to process the pdf (icepdf-viewer-4.3.3.jar and icepdf-core-4.3.3.jar).

if i using this code (see picture 1) i can use it normally.
but when I want to open PDF which has an open password automatically (the password is set into the program) I even experience problems (the picture 2 is on next reply).
[Thumb - Capture 6.PNG]
 Filename Capture 6.PNG [Disk] Download
 Description Library
 Filesize 3 Kbytes
 Downloaded:  372 time(s)

 Filename Capture 5.PNG [Disk] Download
 Description picture 1
 Filesize 28 Kbytes
 Downloaded:  0 time(s)

keviinkwok

Joined: 30/May/2019 13:37:29
Messages: 6
Offline


the next picture
[Thumb - Capture 8.PNG]
 Filename Capture 8.PNG [Disk] Download
 Description picture 2
 Filesize 30 Kbytes
 Downloaded:  369 time(s)

[Thumb - Capture 7.PNG]
 Filename Capture 7.PNG [Disk] Download
 Description picture 2
 Filesize 33 Kbytes
 Downloaded:  387 time(s)

keviinkwok

Joined: 30/May/2019 13:37:29
Messages: 6
Offline


.
patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


Since you are already using the SwingController a securityCallback handler is already setup for you, there should be no need to sit it directly on the doucment class.

When the file is opened in the viewer there should be a dialog that will show up to allow the user to type in a password. You are using a pretty old version of the library which may not support the documents encryption level. I would recommend updating to at least version 5, current is 6.3.x.

If you have a publicly viewable test file, I can try it and let you know if there is any problems decrypting the file.
[Email]
keviinkwok

Joined: 30/May/2019 13:37:29
Messages: 6
Offline


ok I will try to change the version of the library that I use.
for example, I will send one pdf file that has a password.
 Filename Jurnal-protected.pdf [Disk] Download
 Description password : 123456
 Filesize 114 Kbytes
 Downloaded:  353 time(s)

patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1982
Offline


I tried the field with the 6.3.3-SNAPSHOT and it loaded fine in our viewer reference implementation. Keep me posted if you getting working on your end.
[Email]
 
Forum Index -> ICEpdf General
Go to:   
Powered by JForum 2.1.7ice © JForum Team