Barcode.GetRequiredSize
Returns the size required to display the full barcode.
public Size GetRequiredSize(float horizontalDpi, float verticalDpi)
Function GetRequiredSize(horizontalDpi As Single, verticalDpi As Single) As Size
Parameters
- horizontalDpi
- Single
Resolution of barcode image.
- verticalDpi
- Single
Horizontal and vertical resolution of barcode image.
Returns
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:
- An active DynamicPDF Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicBarcode Creator selected.
- A DynamicBarcode Creator for .NET v2.X Developer license.
Examples
The following example will show how to get size required to display the full barcode.Imports System
Imports System.Drawing
Imports ceTe.DynamicBarcode.Creator
Module MyModule
Sub Main()
' Create a barcode object.
Dim barcode As Codabar = New Codabar("A1234A", 100)
' Get the SizeF object which contains Height and Width of a barcode.
Dim size As SizeF = barcode.GetRequiredSize(96, 96)
Dim width As Single = size.Width
Dim height As Single = size.Height
' Draw barcode image.
barcode.Draw("C:\barcode.png", 96, ImageFormat.Png)
End Sub
End Module
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);
}
}