8.52. ExportImage Method

Description

Exports the image to a graphics file with the specified format. This allows other programs to use the barcode images generated.

Syntax

HRESULT mbxExportImage(HANDLE handle, 
    const char* lpszFileName, LONG imageFormat)
HRESULT mbxExportImage2(HANDLE handle, 
    IDispatch* pStream, LONG imageFormat)

Remarks

Exports the image into the file specified by the filename in a standard format. Barcode DLL supports the export to the following graphic formats:

Constant Value Description
mbxFormatBMP 0 Windows bitmap
mbxFormatJPG 1 JPEG
mbxFormatGIF 2 GIF
mbxFormatTIF 3 TIFF
mbxFormatPNG 5 PNG
mbxFormatEMF 6 EMF (Windows Enhanced MetaFile)
mbxFormatWMF 7 WMF (Windows MetaFile)

Use ExportImage to save the barcode image to a disk file or a Streamobject, with the specified graphic format. If the file already exists, the method overwrites the file.

When Barcode DLL exports to EMF format, the resolution of the default printer is used as the basis to create the barcode. If you use the EMF handle to print to a low resolution printer, set this printer as default before calling ExportImage.

When Barcode DLL exports to WMF format, a high resolution of 1440 dpi is assumed. A high resolution printer is needed to replay the WMF handle.

All other file formats are raster image format. The property RasterImageResoluton determines the resolution to use during the rasterization.

Note

The WMF file format does not contain frame size information. To find out the exact size, retrieve LabelHeight and LabelWidth from the object. The bitmap rendering process utilizes printer drivers. To avoid rounding errors between the drawing units (target resolution) and the device units (for text measurement), we recommend that you have the printer driver installed on the computer that creates the barcode image. For example, if you create bitmap images targeting a thermal printer (203 dpi), you should install such a printer driver on the computer you are working. During the ExportImage process, the printer driver is consulted to make sure that the bitmap created reflects the actual print out. You do not need to connect the printer to the computer. The barcode quality is ensured when RasterImageResolution is set to a value compatible with screen or an installed printer device.

See Also

Section 8.40, “RasterImageResolution Property”

Chapter 6, Working with low-resolution devices