Export Barcodes as HTML

C# + VB.Net: Export Barcodes as HTML Export Barcodes as HTML
using IronBarCode;


/*** EXPORTING BARCODES AS HTML FILES OR TAGS ***/

GeneratedBarcode MyBarCode = BarcodeWriter.CreateBarcode("1234567890", BarcodeWriterEncoding.Code128);

// Save as a stand-alone HTML file with no image assets required
MyBarCode.SaveAsHtmlFile("MyBarCode.html");

// Save as a stand-alone HTML image tag which can be served in HTML files, ASPX or MVC Views.  No image assets required, the tag embeds the entire image in its Src contents
string ImgTag = MyBarCode.ToHtmlTag();

// Turn the image into an Html/CSS Data URI.  https://en.wikipedia.org/wiki/Data_URI_scheme
string DataURI = MyBarCode.ToDataUrl();
Imports IronBarCode


'''* EXPORTING BARCODES AS HTML FILES OR TAGS **

Private MyBarCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("1234567890", BarcodeWriterEncoding.Code128)

' Save as a stand-alone HTML file with no image assets required
MyBarCode.SaveAsHtmlFile("MyBarCode.html")

' Save as a stand-alone HTML image tag which can be served in HTML files, ASPX or MVC Views.  No image assets required, the tag embeds the entire image in its Src contents
Dim ImgTag As String = MyBarCode.ToHtmlTag()

' Turn the image into an Html/CSS Data URI.  https://en.wikipedia.org/wiki/Data_URI_scheme
Dim DataURI As String = MyBarCode.ToDataUrl()

Iron Barcode has a very useful feature allowing barcodes to be exported as HTML that is self-contained, such that it has no associated image assets. Everything is contained within the HTML file.

We may export as an HTML file, HTML image tag or to a data URI.