1

I add some image annotation into signed PDF file,but i don't want the annotation visiable in Acrobat Reader's signature sider bar.How can i do this? First, i open a signed PDF file with iTextsharp,then add some annotation to show pictures,finaly add a signature into PDF.so,i used PdfStamper.CreateSignature make a PdfStamper,and insert pictures to all PDF pages but add a signature at last page with them.This is my code:

    pdfStamper = PdfStamper.CreateSignature(pdfReader, signedPdf, '\0', null, true);

    ... some else code to get bitmap and rectangle ...

    PdfAppearance pdfApp = PdfAppearance.CreateAppearance(pdfStamper.Writer, (float)(db.Width * 0.82), (float)(db.Height * 0.82));
    pdfApp.AddImage(img, (float)(db.Width * 0.75), 0, 0, (float)(db.Height * 0.75), 0, 0);

    PdfAnnotation pdfAnnot = new PdfAnnotation(pdfStamper.Writer, imgLocation);
    pdfAnnot.SetAppearance(PdfName.N, pdfApp);
    pdfAnnot.Flags = PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_READONLY;
    pdfAnnot.Put(PdfName.SUBTYPE, PdfName.IMAGE);

    pdfStamper.AddAnnotation(pdfAnnot, index);//add image annotation to PDF file but not last page

    ... some else code to add a signature field at last page ...

    pdfStamper.Close();
    signedPdf.Close();

When it's done, some "Annotation Created" can be see in Acrobat Reader's signature sider bar,i want make it invisiable,can someone help me?

mkl
  • 90,588
  • 15
  • 125
  • 265
Yinxf
  • 57
  • 4
  • What you want to do is against the purpose of the Signatures Panel: That panel is explicitly meant to show any changes done to a previously signed document. Thus, even if you find a way to add an image without that addition showing up there, don't be surprised if it suddenly does show up there after the next Adobe Reader update. – mkl Mar 16 '20 at 11:28
  • Other than annotations, are there any other ways to put an image anywhere on a PDF page and make sure that the signature is valid?I've tried using an empty signature field, which also has the problem of displaying unwanted information, and too many empty signature fields can cause PDF files to open very slowly. – Yinxf Mar 16 '20 at 11:57
  • See [this answer](https://stackoverflow.com/a/16711745/1729265) for allowed and disallowed changes to signed PDFs. Essentially if allowed at all, the only way to add an image to a signed PDF is in some annotation. Which annotation suits you best, whether a form field widget annotation or some other one, you have to decide for your use case, but you should expect any change to a signed PDF to show up in the signature panel. – mkl Mar 16 '20 at 16:55
  • Try a button form field - there you can also add an image. But I fear like MKL said the change will apear there anyhow... – Lonzak Mar 17 '20 at 08:46
  • Reply Lonzak:I've tried it.The result is not satisfactory. – Yinxf Mar 17 '20 at 09:30

0 Answers0