Set Field Comb Number
Contents
[
Hide
]
The comb number defines how the field’s content is split into equally spaced boxes, often used for PIN codes, serial numbers, or other fixed-length input fields. The code opens an existing PDF, sets the comb number for a field, and saves the modified document.
The FormEditor class provides the ‘set_field_comb_number’ method to define the number of boxes (characters) in a form field.
- Open an existing PDF form.
- Creates a FormEditor object.
- Set the comb number of a field named “PIN” to 5.
- Save the updated document.
from io import FileIO
import sys
from os import path
import aspose.pdf as ap
import aspose.pydrawing as ap_pydrawing
import aspose.pdf.facades as pdf_facades
sys.path.append(path.join(path.dirname(__file__), ".."))
from config import set_license, initialize_data_dir
def set_field_comb_number(infile, outfile):
# Open document
doc = ap.Document(infile)
# Create FormEditor object
form_editor = pdf_facades.FormEditor(doc)
# Set field comb number to 5
form_editor.set_field_comb_number("PIN", 5)
# Save updated document
form_editor.save(outfile)