Chapter 6. PDF417 ActiveX Reference

Many programming environments support the use of ActiveX objects. We have tested the Morovia PDF417 ActiveX with Visual Basic, Visual C++, Internet Explorer, Microsoft Word, Excel, Access and IIS programs. The object can be used as a control embedded in a VB form or a dialog, or be used at background for image creation and printing purposes. The PDF417 ActiveX object can also be inserted into Microsoft Office documents and many other ActiveX-aware programs.

6.1. Specification

Table 6.1. PDF417 Control Specification

Prog IDMorovia.PDF417Control
ClassID{89C50E31-CBFE-4AF3-B36F-DFD8FE60ACD0}
Licensedno
File namePDF417Ctrl.dll
InterfaceIPDF417Control
Interface ID{F6FC2671-7888-4DDB-8DAF-A6544C205546}

6.2. Properties

Table 6.2. List of PDF417 Control Properties

NameDescription
AspectRatioReturns or sets a value for the overall height to width ratio of PDF417 symbols generated.
BackColorSpecifies the background color for the control.
ColsReturns or sets a value for the number of codeword columns in PDF417 symbols generated.
CompactPDFReturns or sets a value that determines whether to generate the compact version of all PDF417 symbols generated.
ForeColorSpecifies the foreground color for the control.
ModuleWidthSpecifies the width of a module (the smallest unit in a PDF417 barcode).
PictureReturns a snapshot of the drawing in Windows Enhanced Metafile Format (EMF).
RowsReturns or sets a value for the maximum number of codeword rows in all PDF417 barcodes generated.
SecurityLevelReturns or sets a value for security level used in all PDF417 barcodes generated.
TargetDPISpecifies the value of DPI when exporting the images to vector graphics.
TextSpecifies the data to encode.
YHeightReturns or sets a value that reflects the height of the module vs. the width in all PDF417 barcodes generated.

Table 6.3. List of PDF417 Control Methods

NameDescription
CopyToClipboardPlace the drawing to clipboard in EMF format.
GetActualAtrributesRetrieves the actual values of atrtibutes in the PDF417 barcodes generated.
ExportImageVectorExport image to a file in vector graphics format specified (EMF, EPS or SVG).
ExportImageRasterExport image to a file in raster graphics fromat specified (PNG or BMP).

6.3. AspectRatio Property

Description

Returns or sets a value for the overall height to width ratio of PDF417 symbols generated.

Syntax

object.ActualVersion = [Number] 

Remarks

The AspectRatio determines the overall shape of the PDF417 symbol and is defined as the overall height to width ratio. Higher values for the Aspect Ratio (greater than 1) produce tall, thin PDF417 bar codes and small values (greater than zero and less than 1) produce short, wide bar codes. A value of 1 produces approximately square bar codes.

Generaly speaking, a lower AspectRatio produces more space-efficient barcodes.

Setting the value to 0 allows the program to select a size that produces the least number of codewords, under the constraints of Rows and Cols specified.

The default value is 0.0 (automatic selection).

6.4. BackColor, ForeColor Properties

Description

BackColor - returns or sets the background color of the control.

ForeColor - returns or sets the foreground color of the control.

Syntax

object.BackColor[= Color]
object.ForeColor[= Color] 

Remarks

For open systems we strongly recommend to set the background color to solid white (0xFFFFFF) and foreground color to black (0x000000). Note: barcode requires decent contrast between the foreground color and the background color in order to be readable. Always test the readability thoroughly when you select a color pair different from black and white.

6.5. Cols Property

Syntax

object.Cols = Number

Description

Returns or sets a value for the number of codeword columns in PDF417 symbols generated.

Remarks

When the value is 0, the program selects one that produces the least number of codewords.

The default value is 0.

6.6. CompactPDF Property

Syntax

object.CompactPDF = Boolean

Description

Returns or sets a value that determines whether to generate the compact version of PDF417 symbols.

Remarks

PDF417 standard specifies a compact version, with the stop pattern reduced to a single terminating bar. Compact version symbols should only be used in a clean and controlled environment.

The default value for this property is FALSE.

6.7. ModuleWidth Property

Description

Returns or sets a value that determines the width of a single module in the PDF17 symbols generated.

Syntax

object.ModuleWidth[= String] 

Remarks

The real estate unit of a PDF417 symbol, the module, is always rectangular. This property sets the width of the rectangle. It affects the overall symbol size.

The default value for ModuleSize is 20 mils. The property can be any numbers between 1 and 100.

This property is a string, and accepts the following units: mil, himetric, mm, cm, pt and inch. For example, 0.01cm and 1mm are all valid. If no measure unit is specified, unit of mil (which is 1/1000th inch) is assumed.

6.8. Picture Property

Description

Readonly property. Returns a snapshot of the drawing in Windows Enhanced Metafile Format (EMF).

Syntax

object.Picture

Remarks

The Picture property provides a convenient method to retrieve the drawing without first saving it to disk. The picture object contains an enhanced metafile handle which can be passed to clipboard or played on a device.

The included VB6, VC++ and C# examples use this property to retrieve an EMF handle and play it on the target printer to print the barcode.

6.9. Rows Property

Description

Readonly property. Returns the number of rows requested.

Syntax

object.Rows

Remarks

Set the number of rows required for PDF417 barcodes generated. 0 means automatic.

6.10. SecurityLevel Property

Description

Specifies the security leve in the PDF417 barcode generated.

Syntax

object.SecurityLevel = Number

Remarks

In PDF417 symbols security level is selectable and ranges between 0 and 8. Specifying 9 for automatic selection based on the amount of data encoded. The value is considered "minimum" by our software, as it will increase the security level if the size constraint allows. To retrieve the actual value of the security level, use GetActualAttributes method.

6.11. TargetDPI Property

Specifies the resolution of the target printer, applicable during exporting vector graphics.

Syntax

object.TargetDPI = Number 

Remarks

Whe producing small sizes of barcodes, especailly on lowe resolution printers, lengths must be align to the boundary of pixels in order to retain high quality. The ActiveX control adjusts the drawing units automaticaly based on this property when exporting vector graphics images.

6.12. Text Property

Specifies the Data to be encoded into the PDF417 symbol.

Description

Returns or sets a string for the message to be encoded.

Syntax

object.Text[= String] 

Remarks

6.13. YHeight Property

Specifies the ratio of height of a module vs. its width.

Description

Returns or sets the y-height in the PDF417 barcode generated.

Syntax

object.YHeight[= Double] 

Remarks

For better decodability, this value should be greater than 3.0.

6.14. CopyToClipboard Method

Copies the PDF417 image into the system clipboard, in EMF format.

Syntax

obj.CopyToClipboard 

Description

Use this method to place a copy of barcode image to the clipboard, so that you can either retrieve it immediately in your application, or other applications such as Microsoft Word.

6.15. ExportImageRaster Method

Description

Exports the current drawing to a disk file, in raster image format (PNG or BMP).

Syntax

obj.ExportImageRaster(filename, pixelsPerModule, imageType)

Parameters

filename

[in] filename. A string that corresponds to the file to be written.

pixelsPerModule

[in] Number of pixels per module.

imageType

[in] Image type. The current version supports two raster image formats:

  • 0 - PNG

  • 4 - BMP

6.16. ExportImageVector Method

Description

Exports the current drawing to a disk file, in raster image format (EMF, SVG and EPS).

Syntax

obj.ExportImageVector(filename, imageType) 

Parameters

filename

[in] filename. A string that corresponds to the file to be written.

imageType

[in] Image type. The current version supports two three image formats:

  • 1 - SVG

  • 2 - EMF

  • 3 - EPS

6.17. GetActualAttributes Method

Description

Retrieves the actual values of atrtibutes in the PDF417 barcodes generated.

Syntax

obj.GetActualAttributes(numRows, numCols, securityLevel, aspectRatio) 

Parameters

numRows

[out] The actual number of rows in the barcode generated.

numCols

[out] The actual number of cols in the barcode generated.

securityLevel

[out] The actual security level in the barcode generated.

aspectRatio

[out] The actual aspect ratio of the barcode generated.

Remarks

You can specify exact values to Rows, Cols, SecurityLevel and AspectRatio, or leave one or more of them to be determined by the program. Use this method to retrieve the actual value in the barcode generated.