1

I'm trying to rotate PDF signature appearance(text and image) with iText 5.5 (Java Plugin). I'm signing a PDF and displaying some text(layer 2) with background image(layer 0). I want to rotate each page signature appearance by using PdfAnnotation. Can anyone help me out to fix that or can share the code how can we achieve this using iText 5?

For instance

PdfAnnotation freeText = PdfAnnotation.createFreeText(
            appearance.stamper.getWriter(),
            new Rectangle(x1, y1, x2, y2),
            "Sample Text",
            appearance.getAppearance())
    freeText.setRotate(45)
    appearance.stamper.addAnnotation(freeText, pageNumber)

My problem is that I want rotate signature appearance with dynamic rotation value.

Mohd Amir
  • 11
  • 2
  • Please explain more clearly. When you talk about PDF signature appearances, do you mean what the `PdfSignatureAppearance` class is all about or do you not mean the visualization of a digital signature? – mkl Sep 06 '18 at 16:24
  • My problem is pdf signature is rotating according to page rotation. for instance if first page of pdf in portrait mode so signature is displaying in correct form but then second page is in landscape mode so signature is rotating in page orientation (means landscape). I want display signature with fixed orientation whatever the page is in landscape or portrait. – Mohd Amir Sep 08 '18 at 09:09
  • According to the current pdf specification a signature must have only a single appearance if it has any at all, i.e. it must show on a single page only. A signature with multiple appearances may cause any kind of issues. That been said, if one ignores that specification requirement, it is possible to associate multiple appearances with a single signature. Depending on how you do so, though, the appearance might fit perfectly on one page and not at all on the next. To allow analyzing this, please share your pivotal code and a sample pdf with which one can observe the issue. – mkl Sep 08 '18 at 09:23
  • Hi @mkl I'm trying to display signature appearance on specific page with stamper annotation. It working fine if the pdf have all pages in portrait mode. But in my case I've a PDF which have 2 pages in landscape mode and 3rd page in portrait mode so signature appearance is rotating in third page. you can see the pdf signature in third page https://drive.google.com/open?id=1WoeYtpAZvdvUTkhiJwQoA-O-TBZLFV7j This is the code snippet which I've tried to display this signature. – Mohd Amir Dec 02 '18 at 10:36
  • But i tried to display signature on 1st page in same pdf it's working fine https://drive.google.com/open?id=1bZxVj6M7YcfMXayeePd5nitY6-M4BgY2 – Mohd Amir Dec 02 '18 at 10:40
  • @mkl Can you help me out that how can we display signature appearance in portrait mode only in 3rd page https://drive.google.com/file/d/1WoeYtpAZvdvUTkhiJwQoA-O-TBZLFV7j/view? – Mohd Amir Dec 02 '18 at 10:49
  • I used the simple pdfFormField for for set appearance location pdfFormField.setWidget(new Rectangle(20, 80,20, 120, null) pdfFormField.put(PdfName.SUBTYPE, PdfName.WIDGET) pdfFormField.put(PdfName.AP, xobject1) appearance.stamper.addAnnotation(pdfFormField, 3 (page number))` – Mohd Amir Dec 02 '18 at 10:55
  • I don't really understand the code sniplets you show, they are too much out-of-context. Apparently, though, you set the appearance streams manually. In that case you can also set the **Matrix** entry of the appearance XObject to a rotation of your choice. – mkl Dec 04 '18 at 12:48

0 Answers0