IronSoftware
  • Products
    for .NET Java
    Create, read, and edit PDFs
    for .NET
    Image to text in 127 languages
    for .NET
    Read and write QR & Barcodes
    for .NET
    No Office Interop required
    for .NET
    Extract structured data from websites
    5 for the Price of 2 All 5 .NET product licenses from $1498 Save 60% with Iron Suite Iron Suites - Donate $50
  • Open Source
    for .NET
    System.Drawing.Common Replacement
  • About Us
  • Contact Us

205 N. Michigan Ave. Chicago, IL 60611, USA +1 (312) 500-3060

Join Iron Slack

  • Home
  • Licensing
  • EULA
  • Support & Update Extensions
  • License Upgrades
  • Get Started
  • Features
  • Code Examples
  • Tutorials
  • How-Tos
  • Troubleshooting
  • Product Updates
  • API Reference
  • Search
  • Free NuGet Download
Iron Barcode Library for C# .NET Iron Barcode Library for C# .NET
  • Home
  • Licensing
    • Licensing
    • EULA
    • Support & Update Extensions
    • License Upgrades
  • Docs
    • Search
    • Get Started
    • Features
    • Code Examples
    • Tutorials
    • How-Tos
    • Troubleshooting
    • Product Updates
    • API Reference
    • Search
  • Search
  • Free NuGet Download Total downloads: 383,423
Message's icon
IronBarcode
Code Examples
  1. IronBarcode
  2. Code Examples
  3. Save Barcode
IronBarcode
Free for development from NuGet

Install with NuGet nuget.org/packages/BarCode

PM > Install-Package BarCode

Explore the Docs

  • Get Started
  • Features
  • Code Examples
    • Reading Barcodes in C# / .NET
    • C# Barcode Image Generator
    • C# QR Code Generator
    • License Keys
    • Setup on macOS
    • Setup on Azure
    • Setup on Docker
    • Setup on Linux
    • Using IronBarcode with Blazor
    • Troubleshooting Guides
      • Apply a license key in IronBarcode
      • Support Barcode Formats
      • Barcode not Recognized
      • False Positives
      • Engineering Request​ - IronBarcode
      • GS1-128
    • Exception Messages
      • IronBarcode - Alternative to System.Drawing.Common
    • Common Questions
      • IronBarcode - Security CVE
    • Product Release Notes
      • IronBarCode v2022.10.9871
      • IronBarCode v2022.9.8982
      • IronBarCode v2022.8.8024
      • IronBarcode v2022.7.7345
      • IronBarcode v2022.5.5918
      • IronBarcode v2022.3.0
      • IronBarcode v2021.12.21
      • IronBarcode v2021.11.0
    • Changelog
  • API Reference
Barcode Quickstart
Read Barcode Read Barcodes Asyncronously Set Barcode Reader Options Imperfect Barcodes and Image Correction Set PDF Barcode Reader Options
Create Barcode Create QR Code Save Barcode Style Barcode Style QR Code

Save Barcode

using IronBarCode;
using System.Drawing;

// BarcodeWriter.CreateBarcode creates a GeneratedBarcode which can be styled and exported as an Image object or File
GeneratedBarcode MyBarCode = BarcodeWriter.CreateBarcode("Any Number, String or Binary Value", BarcodeWriterEncoding.Code128);

// And save the Barcode as any image format:
MyBarCode.SaveAsImage("MyBarCode.png");
MyBarCode.SaveAsGif("MyBarCode.gif");
MyBarCode.SaveAsHtmlFile("MyBarCode.html");
MyBarCode.SaveAsJpeg("MyBarCode.jpg");
MyBarCode.SaveAsPdf("MyBarCode.Pdf");
MyBarCode.SaveAsPng("MyBarCode.png");
MyBarCode.SaveAsTiff("MyBarCode.tiff");
MyBarCode.SaveAsWindowsBitmap("MyBarCode.bmp");

// You may also choose to use Barcode as a native .NET object:
Image MyBarCodeImage = MyBarCode.Image;
Bitmap MyBarCodeBitmap = MyBarCode.ToBitmap();

// Saving the barcode as an HTML file or as tags:
MyBarCode.SaveAsHtmlFile("MyBarCode.Html");
string ImgTagForHTML = MyBarCode.ToHtmlTag();
string DataURL = MyBarCode.ToDataUrl();

// Save the barcode as a new PDF,
MyBarCode.SaveAsPdf("MyBarCode.Pdf");

// Or Stamp it in any position on any page of an existing PDF:
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 200, 50, 1);  // position 200x50 on page 1

// Or multiple pages of an encrypted PDF
MyBarCode.StampToExistingPdfPages("ExistingPDF.pdf", 200, 50, new[] { 1, 2, 3 }, "Password123"); // With password as Password123

// PDF Stream Example:
using (System.IO.Stream PdfStream = MyBarCode.ToPdfStream())
{
    // Stream barcode image output also works for GIF, JPEG, PDF, PNG, BMP and TIFF
}

// PNG Byte Array Example:
byte[] PngBytes = MyBarCode.ToPngBinaryData();
Imports IronBarCode
Imports System.Drawing

' BarcodeWriter.CreateBarcode creates a GeneratedBarcode which can be styled and exported as an Image object or File
Private MyBarCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("Any Number, String or Binary Value", BarcodeWriterEncoding.Code128)

' And save the Barcode as any image format:
MyBarCode.SaveAsImage("MyBarCode.png")
MyBarCode.SaveAsGif("MyBarCode.gif")
MyBarCode.SaveAsHtmlFile("MyBarCode.html")
MyBarCode.SaveAsJpeg("MyBarCode.jpg")
MyBarCode.SaveAsPdf("MyBarCode.Pdf")
MyBarCode.SaveAsPng("MyBarCode.png")
MyBarCode.SaveAsTiff("MyBarCode.tiff")
MyBarCode.SaveAsWindowsBitmap("MyBarCode.bmp")

' You may also choose to use Barcode as a native .NET object:
Dim MyBarCodeImage As Image = MyBarCode.Image
Dim MyBarCodeBitmap As Bitmap = MyBarCode.ToBitmap()

' Saving the barcode as an HTML file or as tags:
MyBarCode.SaveAsHtmlFile("MyBarCode.Html")
Dim ImgTagForHTML As String = MyBarCode.ToHtmlTag()
Dim DataURL As String = MyBarCode.ToDataUrl()

' Save the barcode as a new PDF,
MyBarCode.SaveAsPdf("MyBarCode.Pdf")

' Or Stamp it in any position on any page of an existing PDF:
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 200, 50, 1) ' position 200x50 on page 1

' Or multiple pages of an encrypted PDF
MyBarCode.StampToExistingPdfPages("ExistingPDF.pdf", 200, 50, { 1, 2, 3 }, "Password123") ' With password as Password123

' PDF Stream Example:
Using PdfStream As System.IO.Stream = MyBarCode.ToPdfStream()
	' Stream barcode image output also works for GIF, JPEG, PDF, PNG, BMP and TIFF
End Using

' PNG Byte Array Example:
Dim PngBytes() As Byte = MyBarCode.ToPngBinaryData()
Install-Package BarCode

Save Barcode

Previous Example
Next Example

Ready to get started? Version: 2023.1 just released

Start for Free Total downloads: 383,423
View Licenses >
Try IronBarcode for Free
Get Set Up in 5 Minutes
C# NuGet Library for PDF
Install with NuGet
Version: 2023.1
Install-Package BarCode
nuget.org/packages/BarCode/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronBarCode"
  3. Select the package and install
C# PDF DLL
Download DLL
Version: 2023.1
Download Now
Manually install into your project
  1. Download and unzip IronBarCode to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronBarCode.dll"
Licenses from $749

Have a question? Get in touch with our development team.

Now that you’ve downloaded IronBarcode
Want to deploy IronBarcode to a live project for FREE?
Not ready to buy?

Want to deploy IronBarcode to a live project for FREE?

What’s included?
30 days of fully-functional product
Test and share in a live environment
No restrictions in production
Get your free 30-day Trial Key instantly.
Thank you.
If you'd like to speak to our licensing team:
Schedule a call
Have a question? Get in touch with our development team.
No credit card or account creation required
Your Trial License Key has been emailed to you.
Not ready to buy?
Thank you.
View your license options:
Thank you.
If you'd like to speak to our licensing team:
View Licensing
Schedule a call
Have a question? Get in touch with our development team.
Have a question? Get in touch with our development team.
Want to deploy IronBarcode to a live project for FREE?
Not ready to buy?

Want to deploy IronBarcode to a live project for FREE?

What’s included?
30 days of fully-functional product
Test and share in a live environment
No restrictions in production
Get your free 30-day Trial Key instantly.
Thank you.
If you'd like to speak to our licensing team:
Schedule a call
Have a question? Get in touch with our development team.
No credit card or account creation required
Your Trial License Key has been emailed to you.
Not ready to buy?
Download IronBarcode free to apply
your Trial Licenses Key
Thank you.
If you'd like to speak to our licensing team:
Install with NuGet View Licenses
Schedule a call
Licenses from $749. Have a question? Get in touch.
Have a question? Get in touch with our development team.
Free 30-Day Trial Key

Fully-functional product, get the key instantly

IronBarcode for .NET

When you need to read, write, and style, QR & Barcodes, fast.

Search

Documentation

  • Code Examples
  • API Reference
  • How-Tos
  • Features
  • Credits
  • Blog
  • Product Brochure

Tutorials

  • Get Started
  • C# Barcode Image Generator
  • C# QR Code Generator
  • Reading Barcodes in C#

Licensing

  • Buy a License
  • Support Extensions
  • Resellers
  • License Keys
  • EULA

Try IronBarcode Free

  • Download on NuGet
  • Download DLL

  • 30-Day Trial License

When you need your PDF to look like HTML, fast.

Tesseract 5 OCR in the languages you need, We support 127+.

When you need to read, write, and style, QR & Barcodes, fast.

The Excel API you need, without the Office Interop hassle.

The power you need to scrape & output clean, structured data.

The complete .NET Suite for your office.

  • IRONSUITE
  • |
  • IRONPDF
  • IRONOCR
  • IRONBARCODE
  • IRONXL
  • IRONWEBSCRAPER
IronSoftware
205 N. Michigan Ave. Chicago, IL 60611 USA +1 (312) 500-3060
  • About Us
  • News
  • Careers
  • Contact Us
  • Join Iron Slack

Supporting Teamseas

Copyright © Iron Software LLC 2013-2023

  • Terms
  • Privacy

Thank you!

Your license key has been delivered to the email provided. Contact us

24-Hour Upgrade Offer:

Save 50% on a
Professional Upgrade

Go Professional to cover 10 developers
and unlimited projects.

hours

:

minutes

:

seconds

Upgrade to Professional

Upgrade

Professional

$600 USD

$299 USD


  • 10 developers
  • 10 locations
  • 10 projects
TODAY ONLY
Iron Suite

5 .NET Products for the Price of 2

IronPDF IronOCR IronXL IronBarcode IronWebscraper

Total Suite Value:

$7,192 USD

Upgrade price

TODAY
ONLY

$499 USD

After 24 Hrs

$1,098 USD