title: Does PDFBox allow to remove one field from AcroForm?
body: <p>I am using Apache <a href="https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox/2.0.8" rel="nofollow noreferrer">PDFBox 2.0.8</a>  and trying to remove one field. But can not find the way to do it, like I can do with iText:     <code>PdfStamper.getAcroFields().removeField("signature3")</code>.</p>
  
  <p>What I am tying to do. Initially I have template PDF with 3 Digital Signatures. In some cases I need just 2 signatures, so it this case I need to remove 3rd signature from the template. And seems like I can't do it with PDFBox, close thing I found is flattening this field, but that problem is if a flatten particular PDField (not whole form, but just one field) - all other signatures are loosing their functionality, looks like they are getting flattened as well.
  Here is code that does it:</p>
  
  <pre><code>PDDocument document = PDDocument.load(file);
  PDDocumentCatalog documentCatalog = document.getDocumentCatalog();
  PDAcroForm acroForm = documentCatalog.getAcroForm();
  
  List&lt;PDField&gt; flattenList = new ArrayList&lt;&gt;();
  for (PDField field : acroForm.getFieldTree()) {
      if (field instanceof PDSignatureField &amp;&amp; "signature3".equals(field.getFullyQualifiedName())) {
          flattenList.add(field);
      }
  }
  
  acroForm.flatten(flattenList, true);
  document.save(dest);        
  document.close();
  </code></pre>