Generating barcode for SSRS report

Variant 1, based on parameters:
    BarcodeSetupId  barcodeSetupId;
    BarcodeSetup    barcodeSetup;
    Barcode         barcode;

    BarCodeString encodeBarcode(Str _barcodeValue)
    {
        if (barcodeSetup.validateBarcode(_barcodeValue))
        {
            barcode.string(true, _barcodeValue, BarcodeContentType::Item);
            barcode.encode();
        }
        else
        {
            throw(error(strfmt("@SYS41409", barcode.barcodeType(), _barcodeValue)));
        }
        return barcode.barcodeStr();
    }

    // Init barcode
    barcodeSetupId  = InventParameters::find().BarcodeSetupIdPick;
    barcodeSetup    = BarcodeSetup::find(barcodeSetupId);
    barcode         = barcodeSetup.barcode();
    if(barcodeSetup.BarcodeType != BarcodeType::NoBarcode)
    {
        // Check font parameters
        //barcodeSetup.FontName;
        //barcodeSetup.FontSize;
    }

    encodeBarcode("packing12345"); // encode string to barcode, should be printed at report to display barcode
Variant 2, specific barcode type:

    BarcodeCode128      barcode128 = BarcodeCode128::construct();

    barcode128.string(true, salesTable.ReturnItemNum);
    barcode128.encode();
    barcode128.barcodeStr(); // returns encoded string of barcode, should be printed at report to display barcode
    //barcode128.barcodeStrHR(); // returns human readable string
In SSRS report use relevant font at the control which should display barcode for case above BC C128 should be used.

If you experience problems with barcode appearence in PDF you can use following checklist:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3230449a-5e71-47e7-8bc9-3d5e8d024808/barcode-issue-in-exporting-to-pdf-in-ssrs-2008-r2?forum=sqlreportingservices


 

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units.
Join us.

Blog Tags