IronBarcode How-Tos .NET Stamp Barcode PDF How to Stamp Barcodes on PDFs Hairil Hasyimi Bin Omar Updated:July 28, 2025 How to Stamp Barcodes on PDF Documents in C# Download C# library to stamp barcode on PDF Create a barcode with a specified barcode type and value Specify the barcode size Utilize the StampToExistingPdfPage method to stamp the barcode on a single PDF page Use the StampToExistingPdfPages method to stamp the barcode on multiple PDF pages Start using IronBarcode in your project today with a free trial. First Step: Start for Free Stamp Barcode on Existing PDF Page Apart from exporting barcodes as PDF, one of the most popular functionalities in IronBarcode is the ability to stamp the GeneratedBarcode directly onto a user's existing PDF document. The following code snippet demonstrates how to do this. :path=/static-assets/barcode/content-code-examples/how-to/StampBarcodeOnExistingPdfPage.cs using IronBarCode; GeneratedBarcode myBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Code128, 200, 100); myBarcode.StampToExistingPdfPage("pdf_file_path.pdf", x: 200, y: 100, 3, "password"); Imports IronBarCode Private myBarcode As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Code128, 200, 100) myBarcode.StampToExistingPdfPage("pdf_file_path.pdf", x:= 200, y:= 100, 3, "password") $vbLabelText $csharpLabel From the code snippet above, we simply call the StampToExistingPdfPage() method with a GeneratedBarcode object to stamp the object onto the PDF document. Below are the parameters used in this method: pdfFilePath: A System.String representing the path of the PDF document in memory. x: A System.Int32 representing the horizontal position on the PDF page in pixels. y: A System.Int32 representing the vertical position on the PDF page in pixels. pageNumber: A System.Int32 indicating the PDF page to stamp. Note this value is 1-indexed, so the first page is represented as 1. password: A System.String for a password required to open the PDF. This is optional and only used for password-protected PDFs. Users can leave this argument blank if the PDF is not password-protected. Running the code snippet above will stamp the GeneratedBarcode immediately into the PDF document without an intermediate document saving step. Stamp Barcode on Multiple PDF Pages Sometimes, the same barcode is needed to be stamped on multiple pages rather than on one page. Instead of looping the above method to stamp the same barcode on multiple pages, users can use the StampToExistingPdfPages() method from the GeneratedBarcode class to do this directly. The following code snippet demonstrates how this method can be used. :path=/static-assets/barcode/content-code-examples/how-to/StampBarcodeOnMultiplePdfPages.cs using IronBarCode; using System.Collections.Generic; GeneratedBarcode myBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Code128, 200, 100); List<int> pages = new List<int>(); pages.Add(1); pages.Add(2); pages.Add(3); myBarcode.StampToExistingPdfPages("pdf_file_path.pdf", x: 200, y: 100, pages, "password"); Imports IronBarCode Imports System.Collections.Generic Private myBarcode As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Code128, 200, 100) Private pages As New List(Of Integer)() pages.Add(1) pages.Add(2) pages.Add(3) myBarcode.StampToExistingPdfPages("pdf_file_path.pdf", x:= 200, y:= 100, pages, "password") $vbLabelText $csharpLabel Below are the parameters used in this method: pdfFilePath: A System.String representing the path of the PDF document in memory. x: A System.Int32 representing the horizontal position on the PDF page in pixels. y: A System.Int32 representing the vertical position on the PDF page in pixels. pageNumbers: An IEnumerable comprising the PDF pages to stamp. Note these values are 1-indexed, so the first page of a PDF is represented as 1. password: A System.String for a password required to open the PDF. This is optional and only used for password-protected PDFs. Users can leave this argument blank if the PDF is not password-protected. Frequently Asked Questions How can I stamp barcodes on PDF documents in C#? You can stamp barcodes on PDF documents in C# by using the IronBarcode library. First, download the library from NuGet, create a barcode with specified parameters, and then use the StampToExistingPdfPage or StampToExistingPdfPages method to apply the barcode onto the PDF pages. What method should I use to stamp a barcode on a single PDF page? To stamp a barcode on a single PDF page, use the StampToExistingPdfPage method from the IronBarcode library. This method requires parameters like the PDF file path, x and y coordinates for the position, the page number, and an optional password for protected PDFs. How do I stamp a barcode on multiple pages of a PDF? To stamp a barcode on multiple PDF pages, use the StampToExistingPdfPages method. This allows you to specify multiple page numbers and automatically stamps the barcode on each of these pages without needing to loop through them manually. Can I stamp barcodes on password-protected PDFs? Yes, you can stamp barcodes on password-protected PDFs using IronBarcode. You need to provide the password as an optional parameter when using either the StampToExistingPdfPage or StampToExistingPdfPages methods. What parameters are needed to stamp a barcode on a PDF? The parameters required include pdfFilePath for the document path, x and y for the position, pageNumber for the target page, and an optional password for accessing a protected PDF. Do I need to save the PDF after stamping a barcode with IronBarcode? Yes, after stamping the barcode, you should save the modified PDF document using the SaveAs method to ensure the changes are retained. How can I download the library for stamping barcodes on PDFs? The library for stamping barcodes on PDFs can be downloaded from the NuGet package manager. Search for the IronPdf package at nuget.org/packages/IronPdf. What types of barcodes can I create with IronBarcode? IronBarcode allows you to create various types of barcodes, such as QR codes, Code 128, and UPC, among others. You can specify the barcode type when generating the barcode. Is it possible to position a barcode precisely on a PDF page? Yes, you can precisely position a barcode on a PDF page by specifying the x and y coordinates in pixels, which determine the horizontal and vertical location on the page. Hairil Hasyimi Bin Omar Chat with engineering team now Software Engineer Like all great engineers, Hairil is an avid learner. He’s refining his knowledge of C#, Python, and Java, using that knowledge to add value to team members across Iron Software. Hairil joined the Iron Software team from Universiti Teknologi MARA in Malaysia, where he graduated with a Bachelor's degree ...Read More Ready to Get Started? Free NuGet Download Total downloads: 1,818,593 View Licenses