Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Unable To scan QR code on Invoice

Posted on by 73

Dear Team,

I have created below code to generate QR code and print on sales invoice. I'm working on business central cloud India localization. After scanning QR code on invoice, Getting error Message "Unable to verify Qr code as Digital signature is invalid". Can anyone suggest me how i can achieve this?

local procedure GenerateQRCode(SalInvHeader: Record "Sales Invoice Header"; SignQr: Text)
    var
        BarcodeSymbology2D: Enum "Barcode Symbology 2D";
        BarcodeFontProvider2D: Interface "Barcode Font Provider 2D";
        BarcodeString: Text;
        QRCode: Text;
        os: OutStream;
        Mystream: InStream;
        EinvoiceLedger: Record EInvoiceLedgerEntries;
        Os_iIN: OutStream;
        Is_iIN: InStream;
        TempBlob: Codeunit "Temp Blob";
        QRgenerator: Codeunit "QR Generator";

 


    begin


        QRCode := SignQr;
        TempBlob.CreateInStream(Is_iIN);
        QRgenerator.GenerateQRCodeImage(QRCode, TempBlob);

 

        SalInvHeader."QR Code".CreateOutStream(os);

 

        CopyStream(os,Is_iIN);
        SalInvHeader.Modify();

 

        EinvoiceLedger.Reset();
        EinvoiceLedger.SetRange("Document No", SalInvHeader."No.");
        if EinvoiceLedger.FindFirst() then begin
          // EinvoiceLedger.QR

 

                 QRCode := SignQr;
        TempBlob.CreateInStream(Is_iIN);
        QRgenerator.GenerateQRCodeImage(QRCode, TempBlob);

 

        EinvoiceLedger.QR.CreateOutStream(os);

 

        CopyStream(os,Is_iIN);
        EinvoiceLedger.Modify();
        end;

    end;

  • Suggested answer
    Gianfranco C. Profile Picture
    Gianfranco C. 370 on at
    RE: Unable To scan QR code on Invoice

    hi, I don't know what your codeunit 'QR Generator' does, but from the code you pasted, you could try cleaning the variables TempBLob , InStream, OutStream, before generating the second QrCode.

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

    Thanks & Regards,
    Gian

  • RE: Unable To scan QR code on Invoice

    Can anyone suggest for this

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans