Class PdfBarcodeExtension
Represents the extension for exporting Barcode as image.
Inheritance
System.Object
PdfBarcodeExtension
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Imaging.NET.dll
Syntax
public static class PdfBarcodeExtension : Object
Methods
ToImage(PdfBidimensionalBarcode)
Generates an image for the barcode and returns it as a stream of data.
Declaration
public static Stream ToImage(this PdfBidimensionalBarcode barcode)
Parameters
Type | Name | Description |
---|---|---|
PdfBidimensionalBarcode | barcode |
Returns
Type |
---|
System.IO.Stream |
Examples
//Creates a new PDF data matrix barcode.
PdfDataMatrixBarcode barcode = new PdfDataMatrixBarcode();
//Set the barcode text.
barcode.Text = "Test";
//Set the dimension of the barcode.
barcode.XDimension = 5;
//Export the barcode as image.
Image img = barcode.ToImage();
//Save document to disk.
img.Save("barcode.png", ImageFormat.Png);
//Creates a new PDF data matrix barcode.
Dim barcode As PdfDataMatrixBarcode = New PdfDataMatrixBarcode()
//Set the barcode text.
barcode.Text = "Test"
//Set the dimension of the barcode.
barcode.XDimension = 5;
//Export the barcode as image.
Dim img As Image = barcode.ToImage()
//Save document to disk.
img.Save("barcode.png", ImageFormat.Png)
ToImage(PdfBidimensionalBarcode, SizeF)
Generates an image for the barcode with the specified size and returns it as a stream of data.
Declaration
public static Stream ToImage(this PdfBidimensionalBarcode barcode, SizeF size)
Parameters
Type | Name | Description |
---|---|---|
PdfBidimensionalBarcode | barcode | |
SizeF | size | The size of the image to generate. |
Returns
Type | Description |
---|---|
System.IO.Stream | A stream containing the generated barcode image. |
Examples
//Creates a new PDF data matrix barcode.
PdfDataMatrixBarcode barcode = new PdfDataMatrixBarcode();
//Set the barcode text.
barcode.Text = "Test";
//Set the dimension of the barcode.
barcode.XDimension = 5;
//Export the barcode as image.
Image img = barcode.ToImage(new SizeF(200,200));
//Save document to disk.
img.Save("barcode.png", ImageFormat.Png);
//Creates a new PDF data matrix barcode.
Dim barcode As PdfDataMatrixBarcode = New PdfDataMatrixBarcode()
//Set the barcode text.
barcode.Text = "Test"
//Set the dimension of the barcode.
barcode.XDimension = 5;
//Export the barcode as image.
Dim img As Image = barcode.ToImage(New SizeF(200, 200))
//Save document to disk.
img.Save("barcode.png", ImageFormat.Png)
ToImage(PdfUnidimensionalBarcode)
Generates an image for the barcode and returns it as a stream of data.
Declaration
public static Stream ToImage(this PdfUnidimensionalBarcode barcode)
Parameters
Type | Name | Description |
---|---|---|
PdfUnidimensionalBarcode | barcode |
Returns
Type |
---|
System.IO.Stream |
Examples
//Creates a new PdfCode11Barcode.
PdfCode11Barcode barcode = new PdfCode11Barcode();
//Set the barcode text.
barcode.Text = "00-74-23-90";
//Exporting barcode as image
Image img = barcode.ToImage();
//Save the image into Disk
img.Save("barcode.png", ImageFormat.Png);
//Creates a new PdfCode11Barcode.
Dim barcode As PdfCode11Barcode = New PdfCode11Barcode()
//Set the barcode text.
barcode.Text = "00-74-23-90"
//Exporting barcode as image
Dim img As Image = barcode.ToImage()
//Save document to disk.
img.Save("barcode.png", ImageFormat.Png)
ToImage(PdfUnidimensionalBarcode, SizeF)
Generates an image for the barcode with the specified size and returns it as a stream of data.
Declaration
public static Stream ToImage(this PdfUnidimensionalBarcode barcode, SizeF size)
Parameters
Type | Name | Description |
---|---|---|
PdfUnidimensionalBarcode | barcode | |
SizeF | size | The size of the image to generate. |
Returns
Type | Description |
---|---|
System.IO.Stream | A stream containing the generated barcode image. |
Examples
//Creates a new PdfCode11Barcode.
PdfCode11Barcode barcode = new PdfCode11Barcode();
//Set the barcode text.
barcode.Text = "00-74-23-90";
//Exporting barcode as image
Image img = barcode.ToImage(new SizeF(200,200));
//Save the image into Disk
img.Save("barcode.png", ImageFormat.Png);
//Creates a new PdfCode11Barcode.
Dim barcode As PdfCode11Barcode = New PdfCode11Barcode()
//Set the barcode text.
barcode.Text = "00-74-23-90"
//Exporting barcode as image
Dim img As Image = barcode.ToImage(New SizeF(200,200))
//Save document to disk.
img.Save("barcode.png", ImageFormat.Png)