Barcode.GetRequiredSize

Returns the size required to display the full barcode.

public Size GetRequiredSize(float horizontalDpi, float verticalDpi)

Parameters

horizontalDpi
Single

Resolution of barcode image.

verticalDpi
Single

Horizontal and vertical resolution of barcode image.

Returns

Size

A value representing the required size.

Licensing Info

This method is a DynamicBarcode Creator feature. One of the following is required for non-evaluation usage:

Examples

The following example will show how to get size required to display the full barcode.

using System;
using System.Drawing;

using ceTe.DynamicBarcode.Creator;

class MyClass
{ 
    static void Main()
    {
        // Create a barcode object.
        Codabar barcode = new Codabar("A1234A", 100);
        
        // Get the SizeF object which contains Height and Width of a barcode.
        SizeF size = barcode.GetRequiredSize(96, 96);
        float width = size.Width;
        float height = size.Height;

        // Draw barcode image.
       barcode.Draw(@"C:\barcode.png", 96, ImageFormat.Png);
    }
}

See Also

Size
Barcode
ceTe.DynamicBarcode.Creator