LBarCode::Write

#include "ltwrappr.h"

L_INT LBarCode::Write(pBarCodeData, ulFlags = 0, pBarColor = NULL, pBarCode1D =  NULL, pBarCodePDF = NULL, pBarCodeDM =  NULL, pBarCodeQR = NULL, pBarCodeAztec = NULL, pBarCodeMaxi = NULL, pBarCodeMicroQR = NULL, lprcSize = NULL);

pBARCODEDATA pBarCodeData;

pointer to a BARCODEDATA structure

L_UINT32 ulFlags;

flags that indicate the function behavior

pBARCODECOLOR pBarColor;

pointer to a BARCODECOLOR structure

pBARCODE1D pBarCode1D;

pointer to a BARCODE1D structure

pBARCODEWRITEPDF pBarCodePDF;

pointer to a BARCODEWRITEPDF structure

pBARCODEWRITEDM pBarCodeDM;

pointer to a BARCODEWRITEDM structure

pBARCODEWRITEQR pBarCodeQR;

pointer to a BARCODEWRITEQR structure

pBARCODEWRITEAZTEC pBarCodeAztec;

pointer to a BARCODEWRITEAZTEC structure

pBARCODEWRITEMAXI pBarCodeMaxi;

pointer to a BARCODEWRITEMAXI structure

pBARCODEWRITEMICROQR pBarCodeMicroQR;

pointer to a BARCODEWRITEMICROQR structure

LPRECT lprcSize;

pointer to a RECT structure to be updated

Writes linear, PDF, PDF417, MicroPDF417, Data Matrix, QR, Aztec, Maxi and MicroQR barcode symbols over the bitmap.

Parameter Description
pBarCodeData Pointer to the BARCODEDATA structure that contains the barcode information to be written over the image.
ulFlags Flags that indicate the function behavior. You can combine values when appropriate, by using a bitwise OR ( | ). The following values are used only when you want to write Data Matrix or PDF barcodes. Pass 0 to use the default values, based on the type of barcode being written. Possible values are:
  Value Meaning
  BARCODE_TRUNCATE [0x0010] Write Truncated PDF417 symbols.
  BARCODE_MSGAPPEND [0x0020] Write the barcode symbol in the group mode. Used for PDF and MicroPDF.
  BARCODE_INITREADER [0x0040] This flag is for backward compatibility and is no longer used.
  BARCODE_DISABLE_COMPRESSOPN [0x0100] Write Data Matrix symbols without compression.
  BARCODE_COLROWASLIMITS [0x0080] Use column and row values as limits when a PDF or MicroPDF symbol is written.
  BARCODE_USECOLORS [0x0200] Write color barcode. The colors are used as the exact bar and space colors for searching for the barcode.
  BARCODE_TRANSPARENT [0x0400] Write barcodes with a transparent background. This is not recommended.
  BARCODE_JUSTIFYRIGHT [0x0010] Justify linear barcode symbols to the right side of the window described by BARCODEDATA.rcBarLocation.
  BARCODE_JUSTIFYHCENTER [0x0020] Justify linear barcode symbols to the horizontal center of the window described by BARCODEDATA.rcBarLocation.
  BARCODE_MICRO_PDF417_MODE128 [0x1000]If set, use the Function Code word for Code 128 emulation. Only used for MicroPDF417.
  BARCODE_MICRO_PDF417_LINKED [0x2000]If set, the MicroPDF417 barcode is linked to a linear symbol that is printed below it. Only used for MicroPDF417.
pBarColor Pointer to the BARCODECOLOR structure that contains the color information to be written over the image. Pass NULL to write barcode using the default colors.
pBarCode1D Pointer to the BARCODE1D structure that contains the information related to linear barcodes. Pass NULL to use the default or if you do not want to write a linear barcode.
pBarCodePDF Pointer to the BARCODEWRITEPDF structure that contains the information related to PDF417 and MicroPDF417 barcodes. Pass NULL to use the default or if you do not want to write a PDF or MicroPDF barcode.
pBarCodeDM Pointer to the BARCODEWRITEDM structure that contains the information related to Data Matrix barcodes. Pass NULL to use the default or if you do not want to write a Data Matrix barcode. The members of this structure are useful when you need to split the information among several different barcodes.
pBarCodeQR Pointer to the BARCODEWRITEQR structure that contains the information related to QR barcodes. Pass NULL to use the default or if you do not want to write a Data QR barcode.
pBarCodeAztec Pointer to the BARCODEWRITEAZTEC structure that contains the information related to Aztec barcodes. Pass NULL to use the default or if you do not want to write an Aztec barcode.
pBarCodeMaxi Pointer to the BARCODEWRITEMAXI structure that contains the information related to Maxi barcodes. Pass NULL to use the default or if you do not want to write a Maxi barcode.
pBarCodeMicroQR Pointer to the BARCODEWRITEMICROQR structure that contains the information related to MicroQR barcodes. Pass NULL to use the default or if you do not want to write a MicroQR barcode.
lprcSize Pointer to the RECT structure to be updated with the barcode size before writing the barcode over the bitmap. If the user passes a valid pointer, then the function will calculate the size of the barcode and will update this parameter with the barcode size. Pass NULL to write the barcode.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

While the LBarCode::Write function writes linear, PDF, MicroPDF, QR and Data Matrix barcodes.

The LBarCode::Write function will write the barcode symbol over the bitmap using the rectangle defined by the rcBarLocation member in pBarCodeData. However, if the bitmap has a region, this function will write the barcode using the region boundaries.

If the region is non-rectangular, the barcode will be written to the rectangle bounding the region and subsequently clipped to the given region. This might cause the resulting barcode to be unreadable.

If you set the ulFlags parameter to BARCODE_USECOLORS, then this function will use the pBarCodeColor parameter. Otherwise, the function will ignore it and use the default colors of black for bars and white for spaces.

Using colors does not apply for 1 bit per pixel images.

The BARCODE_USECOLORS and BARCODE_TRANSPARENT values are used with all barcode types.

Note: This function does not support BARCODE_1D_UCCEAN_128.

Linear barcodes are not supported in UNICODE.

This function replaces LBarCode::WriteExt.

For a table containing information useful when writing 1D barcode data, refer to https://www.leadtools.com/sdk/barcode/1d-chart.

Required DLLs and Libraries

LTBAR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LBarCode::LBarCode, LBarCode::Read, Class Members

Topics:

Programming with LEADTOOLS Barcode

 

Barcode Function Functions: Writing BarCodes

Example

For a complete sample code, refer to the BarCode demo.

L_INT LBarCode_WriteExample(LBitmapBase *pLeadBitmap)  
 
{ 
   L_INT nRet; 
 
   LBase::LoadLibraries(LT_ALL_LEADLIB);//make sure all libraries are loaded 
 
   LBarCode MyBarCode(pLeadBitmap);  
 
   if (MyBarCode.IsValid()) 
 
   { 
 
      BARCODEDATA BarCodeData;  
 
      BARCODE1D Bar1D;  
 
      BARCODECOLOR BarColor;  
 
      memset(&BarCodeData, 0, sizeof(BARCODEDATA));  
 
      memset(&Bar1D, 0, sizeof(BARCODE1D));  
 
      memset(&BarColor, 0, sizeof(BARCODECOLOR));  
 
      BarCodeData.uStructSize = sizeof(BARCODEDATA);  
 
      Bar1D.uStructSize = sizeof(BARCODE1D);  
 
      BarColor.uStructSize = sizeof(BARCODECOLOR);  
 
      BarCodeData.rcBarLocation.left = 50; // 1/2 inch 
 
      BarCodeData.rcBarLocation.top = 50; // 1/2 inch 
 
      BarCodeData.rcBarLocation.right = 200; // 2.0 inch (width = 1.5 inch)  
 
      BarCodeData.rcBarLocation.bottom = 100; // 1 inch (height = ½ inch)  
 
      BarCodeData.nUnits = BARCODE_SCANLINES_PER_PIXELS;  
 
      BarCodeData.ulType = BARCODE_1D_EAN_13;  
 
      BarCodeData.pszBarCodeData = "123456789012";    
 
      BarCodeData.nSizeofBarCodeData = (L_INT) strlen(BarCodeData.pszBarCodeData);  
 
      Bar1D.bErrorCheck = TRUE;  
 
      Bar1D.bOutShowText= TRUE;  
 
      BarColor.dwColorBar = RGB(0, 0, 255); 
 
      BarColor.dwColorSpace = RGB(255, 0, 0);  
 
      nRet = MyBarCode.Write(&BarCodeData, BARCODE_USECOLORS, &BarColor, &Bar1D, NULL, NULL, NULL, NULL);  
      if(nRet != SUCCESS) 
         return nRet; 
   } 
   else 
   { 
      return FAILURE; 
   } 
 
   return SUCCESS; 
} 

Help Version 20.0.2018.2.22
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Barcode C++ Class Library Help