using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZXing;
using ZXing.QrCode;
namespace QR_GEN.Controllers
{
public class CodGenController : Controller
{
// GET: CodGen
public ActionResult Index()
{
return View();
}
///
/// Restituisce un QR code dato valore
///
///
/// Altezza immagine
/// Larghezza immagine
///
public ActionResult QR(string id, int hSize = 600, int wSize = 600)
{
BarcodeFormat formato = BarcodeFormat.QR_CODE;
return utils.getImage2D(ref id, hSize, wSize, formato);
}
///
/// Restituisce un DataMatrix code dato valore
///
///
/// Altezza immagine
/// Larghezza immagine
///
public ActionResult DataMatrix(string id, int hSize = 300, int wSize = 600)
{
BarcodeFormat formato = BarcodeFormat.DATA_MATRIX;
return utils.getImage2D(ref id, hSize, wSize, formato);
}
///
/// Restituisce un Aztec code dato valore
///
///
/// Altezza immagine
/// Larghezza immagine
///
public ActionResult Aztec(string id, int hSize = 600, int wSize = 600)
{
BarcodeFormat formato = BarcodeFormat.AZTEC;
return utils.getImage2D(ref id, hSize, wSize, formato);
}
///
/// Restituisce un Aztec code dato valore
///
///
/// Altezza immagine
/// Larghezza immagine
///
public ActionResult Pdf417(string id, int hSize = 300, int wSize = 600)
{
BarcodeFormat formato = BarcodeFormat.PDF_417;
return utils.getImage2D(ref id, hSize, wSize, formato);
}
///
/// Restituisce un Code39 1D dato valore
///
///
/// mostrare valore SOLO come codice (false --> testo sotto)
/// Altezza immagine
///
public ActionResult code39(string id, bool pureBarcode = false, int hSize = 70)
{
BarcodeFormat formato = BarcodeFormat.CODE_39;
return utils.getImage(id, hSize, formato, pureBarcode);
}
///
/// Restituisce un Code128 1D dato valore
///
///
/// mostrare valore SOLO come codice (false --> testo sotto)
/// Altezza immagine
///
public ActionResult Code128(string id, bool pureBarcode = false, int hSize = 70)
{
BarcodeFormat formato = BarcodeFormat.CODE_128;
return utils.getImage(id, hSize, formato, pureBarcode);
}
}
}