ZC300 Barcode Print Error

// Expert user has replied.
A Anedeor Dofcoo 3 years 6 months ago
129 1 0

Hello, I have some problem with LINK-OS SDK: I can't print Barcodes!
The others elements (Image, Text, Shape) were printed, but when I try to print a Barcode it print my method parameters (DrawBarcode) on the card!

This is my C# code (taked from GitHub - Zebra/LinkOS-PCCard-Samples at ConnectAndPrint_ZXPSeries1and3_C#  and GitHub - Zebra/LinkOS-PCCard-Samples at CenterBarcode_ZXPSeries3_C# ):

            int errValue;   // value of 0 indicates no errors            msg = string.Empty;            try            {                if (InitGraphics(_asciiEncoder.GetBytes(drvName), out errValue) == 0)                {                    msg = "Printing InitGraphics Error code: " + errValue.ToString();                    return;                }                int rotation = 0; // origin lower left and no rotation                int barcodeType = 0; // Code 39                int barcodeWidthRatio = 2; // narrow bar = 2 dots, wide bar = 5 dots                int barcodeMultiplier = 2; // {2..9}                int barcodeHeight = 75; // 75 dots                int textUnder = 1; // true                string barcodeData = "123456789";                //To calculate the full length of a Code 39 bar code:                //L = [(C+2) (3R + 7) - 1] X Where                 //L = Length of bar code                //C = Number of characters                //R = Ratio of wide-to-narrow bars                //X = Number of dots times 0.0033 inches per dot (0.08847 mm per dot); for the 5:2 ratio, X = Dots times 2                //See ZXP3 SDK Manual for the forumulas used to calcuate the length of other barcode types.                // Calculate the length of the barcode                int C = barcodeData.Length;                double R = 5.0 / 2.0;                int X = 2;                int length = (int)((C + 2) * (3 * R + 7) - 1) * X;                int startX = (int)Math.Floor((CARD_WIDTH - length) / 2.0); //Center barcode horizontally                int startY = (int)Math.Floor(((CARD_HEIGHT - barcodeHeight) / 2.0) + barcodeHeight); //Center barcode vertically                // Sends Barcode data to the Monochrome Buffer                if (DrawBarcode(startX, startY, rotation, barcodeType, barcodeWidthRatio, barcodeMultiplier, barcodeHeight, textUnder, _asciiEncoder.GetBytes(barcodeData), out errValue) == 0)                {                    msg = "Printing DrawBarcode Error: " + errValue.ToString();                    return;                }               // Prints the Graphics Buffer (Front Side)                if (PrintGraphics(out errValue) == 0)                {                    msg = "Printing PrintGraphics Error code: " + errValue.ToString();                    return;                }            }            catch (Exception ex)            {                msg += "PrintJob threw exception " + ex.ToString();            }            finally            {                // Starts the printing process and releases the Graphics Buffer                if (CloseGraphics(out errValue) == 0)                {                    msg = "Printing CloseGraphics Error: " + errValue.ToString();                }            }
Please help!

Please Register or Login to post a reply

1 Replies

M Manuel Caicedo-Rivera

Hi Anedeor,

In the link below there is a sample code that you can use for printing barcodes with ZC300 card printer.

http://techdocs.zebra.com/link-os/2-14/pc_card_net/content/html/517e61b…

Please, be aware that the SDK that you are referencing (ZXP1/3) in your post is not compatible with ZC300. Please, review the following webinar to understand how to work with the new ZC300 card printers.

Also, in the link below you can download the right version of Link-OS SDK for the ZC300 card printer. The folder that you should use for your development is called PC-Card-.Net, then select demos folder.

Link-OS Multiplatform SDK | Zebra

Thanks,

MC

CONTACT
Can’t find what you’re looking for?