Ejemplo n.º 1
2
 // Convert QR Code back to URL
 private void btnConvert_Click(object sender, EventArgs e)
 {
     QRCodeDecoder decoder = new QRCodeDecoder();
     MessageBox.Show(decoder.decode(new QRCodeBitmapImage(pbQR.Image as Bitmap)));
 }
Ejemplo n.º 2
0
        public Dictionary <string, string> LerVariosQRCode(string caminhoPDF, string diretorio)
        {
            Dictionary <string, string> output = new Dictionary <string, string>();

            caminhos = ImageConvertor.ConvertPDFToImage(new PdfReader(caminhoPDF), diretorio, new PdfReader(caminhoPDF).NumberOfPages).ToList();
            MessagingToolkit.QRCode.Codec.QRCodeDecoder dec = new MessagingToolkit.QRCode.Codec.QRCodeDecoder();
            try
            {
                foreach (var caminho in caminhos)
                {
                    try
                    {
                        Bitmap bitmap = new Bitmap(System.Drawing.Image.FromFile(caminho));
                        output.Add(caminho, dec.decode(new MessagingToolkit.QRCode.Codec.Data.QRCodeBitmapImage(bitmap)));
                        bitmap.Dispose();
                        GC.SuppressFinalize(bitmap);
                    }
                    catch (Exception)
                    {
                        continue;
                    }
                }
                return(output);
            }
            finally
            {
                GC.SuppressFinalize(dec);
                GC.SuppressFinalize(output);

                File.Delete(caminhoPDF);
            }
        }
Ejemplo n.º 3
0
 public static Store ReadImage(Bitmap file)
 {
     using (file)
     {
         MessagingToolkit.QRCode.Codec.QRCodeDecoder decoder = new MessagingToolkit.QRCode.Codec.QRCodeDecoder();
         string res = decoder.decode(new QRCodeBitmapImage(file));
         return(JsonConvert.DeserializeObject <Store>(res));
     }
 }