Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created November 12, 2015 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/66ebe3bae38972820642 to your computer and use it in GitHub Desktop.
Save bjoerntx/66ebe3bae38972820642 to your computer and use it in GitHub Desktop.
protected void Page_Load(object sender, EventArgs e)
{
// create a new TXBarcodeControl
TXTextControl.Barcode.TXBarcodeControl barcode =
new TXTextControl.Barcode.TXBarcodeControl();
barcode.CreateControl();
// set the barcode type and size
barcode.BarcodeType = TXTextControl.Barcode.BarcodeType.MicroPDF;
barcode.UpperTextLength = 40;
barcode.Width = 500;
// set the text from the QueryString
barcode.Text = Request.QueryString["text"];
// save the barcode to an image MemoryStream
MemoryStream stream = new MemoryStream();
barcode.SaveImage(stream, System.Drawing.Imaging.ImageFormat.Png);
// send back the image
Response.Clear();
Response.ContentType = "image/png";
Response.BinaryWrite(stream.ToArray());
Response.Flush();
Response.Close();
Response.End();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment