This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ...
 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
Sheriff
Posts: 21817
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Other Open Source Projects.
 
pavithra murthy
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Shiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!