I am wondering if there is an install or registration that I need to do for the ZXing dll's on the server.
Below is the code I am using for the Barcode handler.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing.Imaging;
using System.IO;
using System.Web;
using ZXing;
using ZXing.Common;
using ZXing.PDF417;
namespace InvoiceManager
{
/// <summary>
/// Summary description for BCHandler
/// </summary>
public class BCHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
try
{
//begin the 8 lines o' magic
string urlToQRify = context.Server.UrlDecode(context.Request.QueryString["u"].Replace("|", "&"));
var qrWriter = new BarcodeWriter();
qrWriter.Format = BarcodeFormat.PDF_417;
qrWriter.Options = new EncodingOptions() { Height = 125, Width = 1024, Margin = 0 };
//I like to make them large. You can resize them with CSS later
using (var bitmap = qrWriter.Write(urlToQRify))
{
using (var stream = new MemoryStream())
{
context.Response.ContentType = "image/jpeg";
bitmap.Save(context.Response.OutputStream, ImageFormat.Jpeg);
}
}
}
catch
{
}
finally
{
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}