85 lines
2.8 KiB
C#
85 lines
2.8 KiB
C#
using System.Web.Mvc;
|
|
using ZXing;
|
|
|
|
namespace QR_GEN.Controllers
|
|
{
|
|
public class GenController : Controller
|
|
{
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// Restituisce un Aztec code dato valore
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public ActionResult Aztec(string id, int hSize = 600, int wSize = 600)
|
|
{
|
|
BarcodeFormat formato = BarcodeFormat.AZTEC;
|
|
return utils.getImage2D(ref id, hSize, wSize, formato);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Restituisce un Code128 1D dato valore
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <param name="showVal">mostrare valore + codice (true --> testo sotto)</param>
|
|
/// <returns></returns>
|
|
public ActionResult Code128(string id, int hSize = 75, bool showVal = true)
|
|
{
|
|
BarcodeFormat formato = BarcodeFormat.CODE_128;
|
|
return utils.getImage(id, hSize, formato, !showVal);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Restituisce un Code39 1D dato valore
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <param name="showVal">mostrare valore + codice (true --> testo sotto)</param>
|
|
/// <returns></returns>
|
|
public ActionResult code39(string id, int hSize = 75, bool showVal = true)
|
|
{
|
|
BarcodeFormat formato = BarcodeFormat.CODE_39;
|
|
return utils.getImage(id, hSize, formato, !showVal);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Restituisce un DataMatrix code dato valore
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public ActionResult DataMatrix(string id, int hSize = 300, int wSize = 600)
|
|
{
|
|
BarcodeFormat formato = BarcodeFormat.DATA_MATRIX;
|
|
return utils.getImage2D(ref id, hSize, wSize, formato);
|
|
}
|
|
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Restituisce un Aztec code dato valore
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public ActionResult Pdf417(string id, int hSize = 300, int wSize = 600)
|
|
{
|
|
BarcodeFormat formato = BarcodeFormat.PDF_417;
|
|
return utils.getImage2D(ref id, hSize, wSize, formato);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Restituisce un QR code dato valore
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public ActionResult QR(string id, int hSize = 600, int wSize = 600)
|
|
{
|
|
BarcodeFormat formato = BarcodeFormat.QR_CODE;
|
|
return utils.getImage2D(ref id, hSize, wSize, formato);
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |