PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
ComPDF provides a comprehensive API for adding, editing, and deleting Bates numbers in PDF documents, facilitating the management of user security information.
In a PDF document, only one Bates number can exist, and adding a new Bates number will overwrite the old Bates number.
The steps to add Bates numbers are as follows:
Retrieve the Bates numbers object from the document.
Set the properties for the Bates numbers to be added.
Update the Bates numbers in the document.
This example shows how to add Bates numbers:
let url = URL(fileURLWithPath: "File Path")
let document = CPDFDocument(url: url)
let bates = document?.bates()
bates?.setText("<<#3#5#Prefix-#-Suffix>>", at: 0)
bates?.setTextColor(UIColor.red, at: 0)
bates?.setFontSize(14.0, at: 0)
bates?.update()NSURL *url = [NSURL fileURLWithPath:@""];
CPDFDocument *document = [[CPDFDocument alloc] initWithURL:url];
CPDFBates *bates = document.bates;
[bates setText:@"<<#3#5#Prefix-#-Suffix>>" atIndex:0];
[bates setTextColor:[UIColor redColor] atIndex:0];
[bates setFontSize:14.0 atIndex:0];
[bates update];The regular expression for Bates numbers supports a specific format: <<#\d+#\d+#\w+#\w+>>
For example: When the text is set to "<<#3#1#ab#cd>>," the text displayed on the first page will be "ab001cd."
The steps to delete Bates numbers are as follows:
This example shows how to remove the Bates numbers:
let bates = document?.bates()
bates?.clear()CPDFBates *bates = document.bates;
[bates clear];