Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9274197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:17:56+00:00 2026-06-18T16:17:56+00:00

I am getting this error while trying to digitally sign the PDF document. passing

  • 0

I am getting this error while trying to digitally sign the PDF document.
passing the two pdfs SOURCEPDF name and DESTINATIONPDF name(digitally SIGNED) pdf name.
after first digital signing on SOURCEPDF i get DESTINATIONPDF .
for second digital signing am using DESTINATIONPDF as a source pdf as well as destination pdf.

Here is my code

try
{
    for(int i=1;i<=signature_Count;i++)
    {
        if(i==1)
        {
            tmpPdfSource=sourcePdfPath;
        }else{
            this.tmpPdfSource=destinationPdfPath;
        }

        int pageNo=Integer.parseInt(ad.readXML(xmlString, rootName,"PageNo-"+i));
        String imageSource=ad.readXML(xmlString, rootName,"ImageSource-"+i);
        float llx=Float.parseFloat(ad.readXML(xmlString, rootName,"llx-"+i));
        float lly=Float.parseFloat(ad.readXML(xmlString, rootName,"lly-"+i));
        float urx=Float.parseFloat(ad.readXML(xmlString, rootName,"urx-"+i));
        float ury=Float.parseFloat(ad.readXML(xmlString, rootName,"ury-"+i));
        String signature=ad.readXML(xmlString, rootName,"SignatureName-"+i);

        File dest = new File(destinationPdfPath);
        KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
        ks.load(new Fil eInputStream(certificatePath), keystore_password.toCharArray());
        String alias = (String) ks.aliases().nextElement();
        PrivateKey pk = (PrivateKey) ks.getKey(alias,key_password.toCharArray());
        java.security.cert.Certificate[] chain = ks.getCertificateChain(alias);
        PdfReader reader = new PdfReader(tmpPdfSource);
        stamper = PdfStamper.createSignature(reader,new FileOutputStream(dest), '\0', null, true);
        PdfSignatureAppearance appearance = stamper.getSignatureAppearance();

        appearance.setCrypto(pk, chain, null,PdfSignatureAppearance.SELF_SIGNED);

        if (true)
        {
            appearance.setAcro6Layers(true);
            Image img=Image.getInstance(imageSource);
            appearance.setImage(img);
            appearance.setVisibleSignature(new com.itextpdf.text.Rectangle(llx, lly, urx, ury), pageNo, signature);
        }
    }//for
    stamper.close();
} catch (Exception e) {
    GenericLog gl=new  GenericLog();
    gl.writeWarning("Error Occured in SignPdfDocument ");
    gl.writeError(e);
    e.printStackTrace();
}

please Help me to FIX this error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:17:57+00:00Added an answer on June 18, 2026 at 4:17 pm

    I see the method setCrypto() which means you’re not using the latest version of iText; I also see the option PdfSignatureAppearance.SELF_SIGNED which means you’re creating a signature that doesn’t conform with today’s standards anymore.

    Would you please do yourself a favor and read the documentation?

    Also: you’re using the same file as the source and the destination? That’s impossible. You need at least to create a temporary file or create the file in memory, and then overwrite the existing one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
I keep getting this error while trying to modify some tables. Here's my code:
I'm new to AS3 and I'm getting this error while trying to implement OO
I am getting this error while i am trying to upload a database that
While trying to host the CLR, I keep getting this: error C2440: 'function' :
Getting this error while trying to erase the last element of a list. I
i am getting this error this afternoon while trying to upgrade to oracle apex
I'm getting this error in C# while trying to build an importer for a
While trying to play video using media player, I am getting this error: Unable
I am getting this error while trying to run an ajaxq call. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.