GdPicture.NET.14
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 pixels. A value superior or equal to 4 is recommended.
The height of each row, in pixels. A value superior or equal to 10 is recommended.
Output parameter. The width, in pixels, required to render the PDF417 barcode.
Output parameter. The height, in pixels, required to render the PDF417 barcode.
Example





In This Topic
BarcodePDF417GetSize Method (GdPictureImaging)
In This Topic
Returns the size, in pixels, 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
public GdPictureStatus BarcodePDF417GetSize( 
   string Data,
   BarcodePDF417EncodingMode EncodingMode,
   ref BarcodePDF417ErrorCorrectionLevel ErrorCorrectionLevel,
   ref int Rows,
   ref int Cols,
   int QuietZone,
   int ModuleWidth,
   int RowHeight,
   out int Width,
   out int Height
)
public function BarcodePDF417GetSize( 
    Data: String;
    EncodingMode: BarcodePDF417EncodingMode;
   var  ErrorCorrectionLevel: BarcodePDF417ErrorCorrectionLevel;
   var  Rows: Integer;
   var  Cols: Integer;
    QuietZone: Integer;
    ModuleWidth: Integer;
    RowHeight: Integer;
   Out  Width: Integer;
   Out  Height: Integer
): GdPictureStatus; 
public function BarcodePDF417GetSize( 
   Data : String,
   EncodingMode : BarcodePDF417EncodingMode,
   ErrorCorrectionLevel : BarcodePDF417ErrorCorrectionLevel,
   Rows : int,
   Cols : int,
   QuietZone : int,
   ModuleWidth : int,
   RowHeight : int,
   Width : int,
   Height : int
) : GdPictureStatus;
public: GdPictureStatus BarcodePDF417GetSize( 
   string* Data,
   BarcodePDF417EncodingMode EncodingMode,
   ref BarcodePDF417ErrorCorrectionLevel ErrorCorrectionLevel,
   ref int Rows,
   ref int Cols,
   int QuietZone,
   int ModuleWidth,
   int RowHeight,
   [PARAMFLAG::Out] int Width,
   [PARAMFLAG::Out] int Height
) 
public:
GdPictureStatus BarcodePDF417GetSize( 
   String^ Data,
   BarcodePDF417EncodingMode EncodingMode,
   BarcodePDF417ErrorCorrectionLevel% ErrorCorrectionLevel,
   int% Rows,
   int% Cols,
   int QuietZone,
   int ModuleWidth,
   int RowHeight,
   [Out] int Width,
   [Out] int Height
) 

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 pixels. A value superior or equal to 4 is recommended.
RowHeight
The height of each row, in pixels. A value superior or equal to 10 is recommended.
Width
Output parameter. The width, in pixels, required to render the PDF417 barcode.
Height
Output parameter. The height, in pixels, 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