我无法旋转已经有qrcode的扫描文档。 我正在检查qr代码但是当代码颠倒时 - 我无法翻页并尝试再次读取qr代码。我收到此错误消息:
exception of type 'com.google.zxing.readerexception' was thrown
using (var fullImg = new Bitmap(workGif))
{
var halfW = fullImg.Width/2;
var halfH = fullImg.Height / 2;
var bandImg = fullImg.Clone(new System.Drawing.Rectangle(0, 0, halfW, halfH), fullImg.PixelFormat);
if (Process(bandImg) == null)
{
page.Rotate = (page.Rotate + 180) % 360;
}
string QRinfo = Process(bandImg);
MessageBox.Show(QRinfo);
string[] qcode = QRinfo.Split('/');
string gid = qcode[qcode.Count() - 1];
Guid pgGuid = new Guid(gid);
MessageBox.Show(QRinfo);
var ar = dc.Assessments.FirstOrDefault(c => c.ID == pgGuid);
if (ar != null)
{
var p = inputDocument.Pages[pg];
string opdName = FILESTORELOCATION + pgGuid.ToString() + ".pdf";
PdfDocument opd = new PdfDocument(opdName);
opd.Pages.Add(p);
opd.Close();
ar.StoragePath = opdName;
ar.LastUploadedDT = DateTime.UtcNow;
ar.UploadedByUserID = uploadingUser;
dc.SubmitChanges();
}
}
这是我解码qr的过程:
public string Process(Bitmap bitmap)
{
var reader = new com.google.zxing.qrcode.QRCodeReader();
try
{
LuminanceSource source = new RGBLuminanceSource(bitmap, bitmap.Width, bitmap.Height);
var binarizer = new HybridBinarizer(source);
var binBitmap = new BinaryBitmap(binarizer);
return reader.decode(binBitmap).Text;
}
catch (Exception e)
{
return e.Message;
}
}