Test in production without watermarks.
Works wherever you need it to.
Get 30 days of fully functional product.
Have it up and running in minutes.
Full access to our support engineering team during your product trial
In this tutorial, we explore how to generate barcodes and export them to PDF using the Iron Barcode library. First, ensure Iron Barcode is installed in your project via the NuGet package manager. Begin by including the Iron Barcode namespace in your program. Then, create a new barcode instance using the barcode writer's create method, passing in a URL and encoding type. After generating the barcode, you have multiple export options: save directly as a PDF, export as binary data for database storage or network transmission, or as a stream for integration into larger data streams. Running the project results in a PDF file that encapsulates the generated barcode, representing the input URL. This PDF can be printed or embedded into other documents. The tutorial concludes by encouraging viewers to subscribe for more tutorials and offering a 30-day free trial of the software. For more details, follow the link in the description.
// Ensure Iron Barcode is installed in the project using NuGet package manager.
using IronBarCode;
public class BarcodeExample
{
public static void Main()
{
// Create a barcode from a URL
var barcode = BarcodeWriter.CreateBarcode("https://example.com", BarcodeEncoding.QRCode);
// Export the barcode to a PDF file
barcode.SaveAsPdf("barcode.pdf");
// Additionally, the barcode can be exported as binary data or a stream if needed
byte[] barcodeBinary = barcode.ToBinaryData();
using (var stream = barcode.ToStream())
{
// Integrate the barcode into larger data streams or save it to the desired location
}
}
}
// Ensure Iron Barcode is installed in the project using NuGet package manager.
using IronBarCode;
public class BarcodeExample
{
public static void Main()
{
// Create a barcode from a URL
var barcode = BarcodeWriter.CreateBarcode("https://example.com", BarcodeEncoding.QRCode);
// Export the barcode to a PDF file
barcode.SaveAsPdf("barcode.pdf");
// Additionally, the barcode can be exported as binary data or a stream if needed
byte[] barcodeBinary = barcode.ToBinaryData();
using (var stream = barcode.ToStream())
{
// Integrate the barcode into larger data streams or save it to the desired location
}
}
}
' Ensure Iron Barcode is installed in the project using NuGet package manager.
Imports IronBarCode
Public Class BarcodeExample
Public Shared Sub Main()
' Create a barcode from a URL
Dim barcode = BarcodeWriter.CreateBarcode("https://example.com", BarcodeEncoding.QRCode)
' Export the barcode to a PDF file
barcode.SaveAsPdf("barcode.pdf")
' Additionally, the barcode can be exported as binary data or a stream if needed
Dim barcodeBinary() As Byte = barcode.ToBinaryData()
Using stream = barcode.ToStream()
' Integrate the barcode into larger data streams or save it to the desired location
End Using
End Sub
End Class
Further Reading: How to Export Barcodes as PDF