This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other Open Source Projects and the fly likes java program to password protect a signed pdf file using itext pdfstamper Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "java program to password protect a signed pdf file using itext pdfstamper " Watch "java program to password protect a signed pdf file using itext pdfstamper " New topic
Author

java program to password protect a signed pdf file using itext pdfstamper

pavithra murthy
Ranch Hand

Joined: Feb 06, 2009
Posts: 56
please could anyone help me out ...i have written this code for digitally signing pdf. here
when i compile the code works fine but after running and entering a user id i get an exception

D:\password>java EncryptPDF
USERNAME:PASSWORD
Please enter your username
shiva
pavithra: pvm4kor
shompa: sos5kor
shiva: snk3kor
passwordsnk3kor
hello
Exception in thread "main" java.io.IOException: Bad user password
at com.lowagie.text.pdf.PdfReader.readDecryptedDocObj(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readDocObj(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readPdf(Unknown Source)
at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
at EncryptPDF.main(EncryptPDF.java:85)




thanks in advance ...
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

on line 85, I think you need to supply your user password:



according to the API, (http://1t3xt.info/api/com/lowagie/text/pdf/PdfReader.html) this should work:

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

Moving to Other Open Source Projects.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
pavithra murthy
Ranch Hand

Joined: Feb 06, 2009
Posts: 56
hello friend ,

i modified the program and put the password in PDFReader . but that exception is not going ..bad user password...but however i am getting the protected signed pdf ....but am getting signature in only one pdf..
please could you help me out ..

Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

pavithra murthy wrote:i modified the program and put the password in PDFReader . but that exception is not going ..bad user password...but however i am getting the protected signed pdf ....but am getting signature in only one pdf..
please could you help me out ..


Hi I'm not clear on which error you are seeing now. Could you post the error output?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java program to password protect a signed pdf file using itext pdfstamper