existsField

Versionshinweise

21.1, 20.2.03, 20.1.10, 19.2.16

Code

boolean existsField(PdfDocument pdfDocument, String fieldName)

Beschreibung

Prüft, ob der angegebene Feldname in dem übergebenen PDF Dokument vorhanden ist. 

Parameter

  • pdfDocument
    Repräsentiert das PDF Dokument

  • fieldName
    Name des Feldes, welches im Dokument gesucht wird

Rückgabe

true - wenn ein Feld mit dem angegebenen Namen in der übergebenen PDF-Datei vorhanden ist, andernfalls false.

Beispiele

IPdfResult openResult = PdfUtils.openFile("C:\\Work\\myPDF.pdf");
...
PdfDocument pdfDocument = null;

try
{
  pdfDocument = pdfResult.getPdfDocument();
  if (PdfUtils.existsField(pdfDocument, "myRadioButton"))
  {
    String fieldType = PdfUtils.getFieldType(pdfDocument, "myRadioButton");
    ...
  }
} 
catch (Exception dpe)
{
  ScriptUtils.logException(dpe);
}
finally
{
 if (pdfDocument!=null)
 {
    PdfUtils.closePdf(pdfDocument);
 }
}