Files are here:
https://drive.google.com/drive/folders/1jo4g-ElaMB15Hh1lW9B04DxWKSXramvL?usp=sharing

The error is "widget annotation not nested inside a Form structure element".

What I suspect: each annotation needs a /StructParent number, and these numbers must be in the Parent tree and in the K tree. The best would be to have a compliant file so that we can see what needs to be done.

I did something like that here:
https://stackoverflow.com/questions/79083813/how-to-add-the-annotation-tag-in-tagged-pdf-using-pdfbox

However your case is even more difficult, you have to do it while signing and make sure that the changes are included in the incremental save.




Tilman



Am 29.04.2026 um 15:20 schrieb Dietrich, Neonila:

Hello again,

Unfortunately, we are not allowed us to use file-sharing services in our company.

If you know of another way to send the files to the community, please let us know.

Thanks for your support

Neonila Dietrich
Developer
--
*Governikus GmbH & Co. **KG*
Hochschulring 4
28359 Bremen, Germany

Telefon: +49 421 204 95 - 0
E-Mail: [email protected]
www.governikus.de <https://www.governikus.de/>

*Von:*Tilman Hausherr <[email protected]>
*Gesendet:* Mittwoch, 29. April 2026 14:36
*An:* [email protected]
*Betreff:* Re: PDF-UA-compliance error by creating of signature fields in pdfbox version higher than 2.0.31

ACHTUNG:Diese E-Mail stammt von einem externen Absender. Bitte vermeide es, Anhänge oder externe Links zu öffnen.

Hi,

Please upload the files to a sharehoster that doesn't require registration.

Are you saying that it did work with 2.0.30 ? If so, then include these as well.

Tilman

Am 29.04.2026 um 14:31 schrieb Dietrich, Neonila:

    Hello pdfbox community,

    since Apache PDFBox version 2.0.31, we are not able to generate
    PDF-UA-compliant signature fields. We are attaching a code snippet
    that we use to create visible signature fields. Please let me know
    what I need to change in this code so that the PDF document
    remains PDF-UA-compliant. We verify PDF-UA compliance by using the
    PAC APP ( https://www.axes4.com/de <https://www.axes4.com/de> )

    Two sample documents are attached to this email: original and
    result with signatures fields.

    /** used with pdfbox 2.0.36 */

      public static void main(String[] args)

      {

        File inputFile = new File("PDF_UA_original.pdf");

        File outputFile = new File("result.pdf");

        float xPos = 50;

        float yStart = 600;

        float width = 200;

        float high = 50;

        float distance = 70;

        try (PDDocument doc = PDDocument.load(inputFile))

        {

    PDDocumentCatalog documentCatalog = doc.getDocumentCatalog();

          PDPageTree allPages = documentCatalog.getPages();

          PDPage pdPage = allPages.get(0);

          PDAcroForm acroForm = documentCatalog.getAcroForm();

          if (acroForm == null)

          {

            acroForm = new PDAcroForm(doc);

    documentCatalog.setAcroForm(acroForm);

          }

          for ( int i = 0 ; i < 4 ; i++ )

          {

    PDSignatureField pdSignatureField = new PDSignatureField(acroForm);

    pdSignatureField.setPartialName("SigField_" +
    UUID.randomUUID().toString());

    pdSignatureField.setAlternateFieldName("Alt_" +
    pdSignatureField.getPartialName());

            float currentY = yStart - (i * distance);

            PDRectangle rectangle = new PDRectangle(xPos, currentY,
    width, high);

    PDAnnotationWidget widget = pdSignatureField.getWidgets().get(0);

    widget.setRectangle(rectangle);

    PDAppearanceDictionary pdAppearanceDictionary = new
    PDAppearanceDictionary();

    PDAppearanceStream appearanceStream = new PDAppearanceStream(doc);

    pdAppearanceDictionary.setNormalAppearance(appearanceStream);

    widget.setAppearance(pdAppearanceDictionary);

    widget.setPage(pdPage);

    acroForm.getFields().add(pdSignatureField);

    pdPage.getAnnotations().add(widget);

    pdPage.getCOSObject().setNeedToBeUpdated(true);

    doc.getSignatureFields().add(pdSignatureField);

          }

          doc.save( outputFile );

        }

        catch (Exception e)

        {

    e.printStackTrace();

        }

      }

    Best regards,

    Thank you very much for your support

    Neonila Dietrich
    Developer
    --
    *Governikus GmbH & Co. **KG*
    Hochschulring 4
    28359 Bremen, Germany

    Telefon: +49 421 204 95 - 0
    E-Mail: [email protected]
    www.governikus.de <https://www.governikus.de/>

    Governikus steht in Grossbuchstaben in einem Dunkelblau. Unter den
    Buchstaben K, U und S ist jeweils ein blauer Kreis, der vom K zum
    S jeweils dunkler wird.

    Hauptsitz: Hochschulring 4, 28359 Bremen
    Geschäftsstellen: Universitätsstr. 2, 10117 Berlin |
    Herwarthstraße 1, 50672 Köln | Bahnhofstraße 14 (Krämerloft),
    99084 Erfurt | Klostersteige 17, 87435 Kempten (Allgäu)

    Standort Governikus ITU GmbH: Jakobikirchhof 8, 20095 Hamburg

    Governikus GmbH & Co. KG
    Aufsichtsratsvorsitzende: Carola Heilemann-Jeschke
    Geschäftsführer: Dr. Stephan Klein, Hartje Bruns
    Amtsgericht Bremen HRA 22041 | St.-Nr. 60/100/04568 | USt-ID
    DE203827312

    Persönlich haftende Gesellschafterin:
    Governikus Bremen GmbH
    Geschäftsführer: Dr. Stephan Klein, Hartje Bruns Amtsgericht
    Bremen HRB 18756

    ****************************************************

    Ammersee Communication Days | 05.+ 06.05.2026 | Kloster Andechs |
    Ammersee Communication Days
    <https://www.governikus.de/events/ammersee-communication-days-2026/>
    12. Zukunftskongress Staat & Verwaltung I 09.-10.06.2026 I Berlin
    I 12. Zukunftskongress Staat & Verwaltung
    <https://www.governikus.de/events/12-zukunftskongress-staat-verwaltung/>
    d.velop SUMMIT I 09.-11.06.2026 | Meerbusch | d-velop SUMMIT
    <https://www.governikus.de/events/d-velop-summit-2026/>
    Merseburger Digitaltage I 26. + 27.08.2026 | Merseburg
    |Merseburger Digitaltage
    <https://www.governikus.de/events/merseburger-digitaltage-2026/>
    SCCON | 13. - 15.10.2026 | Berlin | SCCON
    <https://www.governikus.de/events/smart-country-convention-2026/>

    Keine Neuigkeiten mehr verpassen? Abonnieren Sie hier
    <https://www.governikus.de/newsletteranmeldung/>unseren Newsletter.
    Mehr Hintergrundinformationen zu aktuellen Technologien und
    Lösungen lesen Sie außerdem in unserem Blog
    <https://www.governikus.de/wissen/blog/>.




    ---------------------------------------------------------------------

    To unsubscribe, e-mail:[email protected]

    For additional commands, e-mail:[email protected]

Reply via email to