1

When I am trying to generate a QR code from a web API in C# using QRCoder Package I cannot find QRCode in QRCode namespace in .NET 6

try
{
    //var res = awfait _qrGaneraterRepository.QRCodeGenerator(employeeSalaryGetId);

    QRCodeGenerator qrCodeGenerator = new QRCodeGenerator();
    QRCodeData qrCodeData = qrCodeGenerator.CreateQrCode(EmployeeSalaryGetId, QRCodeGenerator.ECCLevel.Q);
    QRCode qrCoder = new QRCode(qrCodeData);
    //using (QRCode qrCode = new QRCode(qrCodeData))
    //{
    //    Bitmap qrCodeImage = qrCode.GetGraphic(20);
    //}

    Image rqCodeImage = qrCoder.GetGraphic(20);

    var bytes = ImageToByteArray(rqCodeImage);
    return File(bytes, "image/tmp");

    //return res.Status ? StatusCode(StatusCodes.Status201Created, res) : StatusCode(StatusCodes.Status409Conflict, res);
}
  • This question is unanswerable in its current form. Read [ask] and have someone proofread your question. Then edit it into an acceptable form. – Robert Harvey Dec 27 '22 at 14:23
  • The following may be helpful: https://stackoverflow.com/questions/69206917/how-to-generate-pdf-one-page-one-row-from-datatable-using-itextsharp/69218085#69218085 and https://stackoverflow.com/questions/74352439/ironbarcode-stream-only/74353057#74353057 – Tu deschizi eu inchid Dec 27 '22 at 14:54
  • What `QRCoder package` are you talking about? – Panagiotis Kanavos Dec 27 '22 at 16:05
  • [This QRCoder package](https://www.nuget.org/packages/QRCoder/) was published a year ago and didn't change namespaces. Either you miss the package reference entirely or you're missing the `using QRCoder;` statement – Panagiotis Kanavos Dec 27 '22 at 16:12
  • If you can't get this to work, consider using the LEADTOOLS Barcode SDK, which support QR and many other types of barcodes, and is confirmed compatible with .NET 6. (Disclosure: I work for the SDK's vendor). There's [a .NET 6 tutorial here](https://leadtools.com/help/sdk/tutorials/dotnet-console-write-1d-and-2d-barcodes-to-an-image.html). If you would like to try it, there's [a free evaluation here](https://leadtools.com/downloads). – Amin Dodin Jan 19 '23 at 19:14

1 Answers1

3

Just downgrade to version 1.4.1 I had the same issue when using 1.4.3 This fixed the issue for me.

raf
  • 31
  • 2