This quick tutorial explains how to add Bates numbers to PDF using C#. You will learn the basic techniques for using PDF Bates numbering stamp using C# with the help of the given steps and a ready-to-run sample code. Further enhancements and code improvements will also be shared to create the desired output.
Steps to Insert Bates Numbers in PDF using C#
- Set the environment to use Aspose.PDF for .NET to add Bates numbering
- Load the license, set input/output PDF file paths, and load the input PDF into the Document object
- Set the Bates numbering parameters
- Loop through all the pages in the PDF
- Create a string for the Bates number and initialize the text stamp with this string
- Format the text stamp, set the text appearance, and add the stamp on the page
- Save the PDF with Bates numbering in it
These steps describe the development of a Bates labeling software using C# for the PDF files. Load the source PDF file, define the Bates numbering settings, and loop through all the pages in the PDF. For each page, instantiate the string for Bates numbering, create a text stamp, set the stamp formatting, and adjust the text appearance before adding the step to the target page in the PDF.
Code for Adding Bates Stamp to PDF using C#
This code explains the working of the PDF Bates numbering using C#. You may try using the PageNumberStamp instead of implementing the manual increment, use format strings for zero-padding and prefixes, and use the StartingNumber property to start the Bates value from any number. An option is also available to apply the Bates numbering on the selected pages by skipping TOC, covers, exhibits, etc.
This article has taught us the process to work with Bates numbering in PDF. To auto-fill. A PDF from the database, refer to the article Auto fill PDF form from database using C#.