lib/fillable-pdf.rb in fillable-pdf-0.1.0 vs lib/fillable-pdf.rb in fillable-pdf-0.1.1
- old
+ new
@@ -25,9 +25,29 @@
@form_fields = @pdf_stamper.getAcroFields
end
##
+ # Determines whether the form has any fields.
+ #
+ # @return true if form has fields, false otherwise
+ #
+ def has_fields?
+ num_fields > 0
+ end
+
+
+ ##
+ # Returns the total number of form fields.
+ #
+ # @return the number of fields
+ #
+ def num_fields
+ @form_fields.getFields.size
+ end
+
+
+ ##
# Retrieves the value of a field given its unique field name.
#
# @param [String] key the field name
#
# @return the value of the field
\ No newline at end of file