GdPicture.NET Reference Guide
BarcodePDF417GetSize Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : BarcodePDF417GetSize Method
The data of the barcode to encode.
A member of the BarcodePDF417EncodingMode enumeration. The encoding mode.
A member of the BarcodePDF417ErrorCorrectionLevel enumeration. The error correction level.
Specifies the number of rows constituting the barcode. Use 0 for automatic computation (recommended) or a value in the range [3 - 90].
Specifies the number of columns constituting the barcode. Use 0 for automatic computation (recommended) or a value in the range [3 - 30].
The number of modules composing the quiet zone. The quiet zone defines the margin around the barcode. A value superior or equal to 4 is highly suggested.
The width of each module, in pixel. A value superior or equal to 4 is recommended.
The height of each row, in pixel. A value superior or equal to 10 is recommended.
Output parameter. The width, in pixel, required to render the PDF417 barcode.
Output parameter. The height, in pixel, required to render the PDF417 barcode.
Returns the size, in pixel, required to render a PDF417 barcode on a Bitmap.
Syntax
'Declaration
 
Public Function BarcodePDF417GetSize( _
   ByVal Data As String, _
   ByVal EncodingMode As BarcodePDF417EncodingMode, _
   ByRef ErrorCorrectionLevel As BarcodePDF417ErrorCorrectionLevel, _
   ByRef Rows As Integer, _
   ByRef Cols As Integer, _
   ByVal QuietZone As Integer, _
   ByVal ModuleWidth As Integer, _
   ByVal RowHeight As Integer, _
   ByRef Width As Integer, _
   ByRef Height As Integer _
) As GdPictureStatus

Parameters

Data
The data of the barcode to encode.
EncodingMode
A member of the BarcodePDF417EncodingMode enumeration. The encoding mode.
ErrorCorrectionLevel
A member of the BarcodePDF417ErrorCorrectionLevel enumeration. The error correction level.
Rows
Specifies the number of rows constituting the barcode. Use 0 for automatic computation (recommended) or a value in the range [3 - 90].
Cols
Specifies the number of columns constituting the barcode. Use 0 for automatic computation (recommended) or a value in the range [3 - 30].
QuietZone
The number of modules composing the quiet zone. The quiet zone defines the margin around the barcode. A value superior or equal to 4 is highly suggested.
ModuleWidth
The width of each module, in pixel. A value superior or equal to 4 is recommended.
RowHeight
The height of each row, in pixel. A value superior or equal to 10 is recommended.
Width
Output parameter. The width, in pixel, required to render the PDF417 barcode.
Height
Output parameter. The height, in pixel, required to render the PDF417 barcode.

Return Value

A member of the GdPictureStatus enumeration.
Example
Rendering a PDF417 barcode into a new image and saving the result into a png file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // String that have to be encoded into a barcode.
    string data = "PDF417 Barcode";
 
    BarcodePDF417EncodingMode encodingMode = BarcodePDF417EncodingMode.BarcodePDF417EncodingModeUndefined;
    // Level 0 to 8 are allowed, the number of error correction codewords is 2^(n+1).
    BarcodePDF417ErrorCorrectionLevel errorCorrectionLevel = BarcodePDF417ErrorCorrectionLevel.BarcodePDF417ErrorCorrectionLevelAuto;
    int moduleSize = 5;
    int fillColor = gdpictureImaging.ARGBI(255, 0, 0, 0);
    int backColor = gdpictureImaging.ARGBI(0, 255, 255, 255);
    int rows = 0, columns = 0; // Let the encoder choose the best ratio.
    int quietZone = 3; // 3 modules wide
 
    // Compute size (in pixels), required to render a PDF417 barcode.
    gdpictureImaging.BarcodePDF417GetSize(data, encodingMode, ref errorCorrectionLevel, ref rows, ref columns, quietZone, moduleSize, 17 * moduleSize, out int width, out int height);
 
    int imageID = gdpictureImaging.CreateNewGdPictureImage(width, height, 32, Color.White);
    gdpictureImaging.BarcodePDF417Write(imageID, data, encodingMode, errorCorrectionLevel, rows, columns, quietZone, moduleSize, 17 * moduleSize, 0, 0, 0, fillColor, backColor);
    gdpictureImaging.SaveAsPNG(imageID, "PDF417.png");
 
    // Release used resources.
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
BarcodePDF417Write(Int32,String,BarcodePDF417EncodingMode,BarcodePDF417ErrorCorrectionLevel,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Single,Int32,Int32) Method