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 a barcode on a PDF document in .NET? You can use the IronBarcode library to stamp a barcode on a PDF by utilizing the StampToExistingPdfPage method. First, create a PdfDocument from your existing file, then call the method with the GeneratedBarcode object and specify the position and page number. What is the StampToExistingPdfPage method used for? The StampToExistingPdfPage method is used to stamp a GeneratedBarcode onto a specific page of an existing PDF document at a defined position. Can I stamp a barcode on multiple pages of a PDF at once? Yes, you can stamp a barcode on multiple pages using the StampToExistingPdfPages method. This method allows you to specify multiple page numbers and apply the barcode to each of them. What parameters are required for stamping a barcode on a PDF page? The required parameters for the StampToExistingPdfPage method include pdfFilePath, x and y coordinates for position, pageNumber, and an optional password for password-protected PDFs. Is it possible to work with password-protected PDFs? Yes, IronBarcode can be used with password-protected PDFs. You need to provide the password as an optional parameter when creating the PdfDocument. What is the difference between stamping a barcode on a single page and multiple pages? The StampToExistingPdfPage method is used for stamping a barcode on a single page, while StampToExistingPdfPages allows you to stamp the barcode on multiple specified pages. How do I specify the position for stamping a barcode on a PDF? You specify the position for stamping a barcode by providing x and y coordinates in pixels, which determine the horizontal and vertical position on the PDF page. What barcode types can be created? IronBarcode supports creating various barcode types, including QR codes, Code 128, UPC, and many others. You can specify the type when creating a barcode. Do I need to save the PDF after stamping barcodes? Yes, after stamping the barcodes, you need to save the modified PDF document using the SaveAs method to retain the changes. Where can I download the library for PDF operations? You can download the IronPdf library from the NuGet package manager at nuget.org/packages/IronPdf. 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 in Chemical and Process Engineering. Ready to Get Started? Free NuGet Download Total downloads: 1,743,856 View Licenses