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.
ComPDFKit 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 numbers.
Add Bates numbers
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 the Bates number:
CPDFDocument document = CPDFDocument.InitWithFilePath("filePath");
CPDFBates bates = document.GetBates();
bates.SetText(0, @"<<#3#5#Prefix-#-Suffix>>");
byte[] color = { 255, 0, 0 };
bates.SetTextColor(0, color);
bates.SetFontSize(0,14);
bates.SetPages("0-" + (document.PageCount - 1));
bates.Update();Bates numbers Regular Expression Explanation
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."
Remove Bates numbers
The steps to remove Bates numbers are as follows:
This example shows how to remove the Bates numbers:
CPDFHeaderFooter headerFooter = document.GetHeaderFooter();
headerFooter.Clear();