• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

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

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 22151
117
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Other Open Source Projects.
 
pavithra murthy
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic