cete.dynamicpdf.pageelements.barcoding.qrcode
QrCode
- Namespace: ceTe.DynamicPDF.PageElements.BarCoding
- Assemblies: DynamicPDF.CoreSuite.dll
Represents a QR code.
public class QrCode : Dim2Barcode, ICoordinate, ISerializable
Public Class QrCode
Inherits Dim2Barcode
Implements ICoordinate, ISerializable
Inheritance: Object → PageElement → TaggablePageElement → Dim2Barcode → QrCode
Implements: ICoordinate, ISerializable
Examples
The following example will place a QR code on the page.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements.BarCoding
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create a QR Code
Dim qrCode As QrCode = New QrCode("QR code sample.", 100, 100)
' Add the QR code to the page
MyPage.Elements.Add(qrCode)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements.BarCoding;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add( page );
// Create a QR code
QrCode qrCode = new QrCode("QR code sample.", 100, 100);
// Add the QR code to the page
page.Elements.Add(qrCode);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
With some of the .Net runtimes (example: .Net Core 2.0), the Kanchi encoding will give the error "No data is available for encoding 932. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.". To resolve this error refer the user manual page Encoding Considerations.
Constructors
QrCode(Byte[], Single, Single)
Initializes a new instance of the QrCode class.
public QrCode(Byte[] value, float x, float y)
Public Sub New (value As Byte(), x As Single, y As Single)
Parameters
- value: Byte[]
The value of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
QrCode(Byte[], Single, Single, QrCodeErrorCorrectionLevel)
Initializes a new instance of the QrCode class.
public QrCode(Byte[] value, float x, float y, QrCodeErrorCorrectionLevel errorCorrectionLevel)
Public Sub New (value As Byte(), x As Single, y As Single, errorCorrectionLevel As QrCodeErrorCorrectionLevel)
Parameters
- value: Byte[]
The value of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- errorCorrectionLevel: QrCodeErrorCorrectionLevel
The error correction level of QR code.
QrCode(Byte[], Single, Single, QrCodeErrorCorrectionLevel, QrCodeVersion)
Initializes a new instance of the QrCode class.
public QrCode(Byte[] value, float x, float y, QrCodeErrorCorrectionLevel errorCorrectionLevel, QrCodeVersion version)
Public Sub New (value As Byte(), x As Single, y As Single, errorCorrectionLevel As QrCodeErrorCorrectionLevel, version As QrCodeVersion)
Parameters
- value: Byte[]
The value of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- errorCorrectionLevel: QrCodeErrorCorrectionLevel
The error correction level of QR code.
- version: QrCodeVersion
The version of QR code.
QrCode(Byte[], Single, Single, Single)
Initializes a new instance of the QrCode class.
public QrCode(Byte[] value, float x, float y, float xDimension)
Public Sub New (value As Byte(), x As Single, y As Single, xDimension As Single)
Parameters
- value: Byte[]
The value of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- xDimension: Single
The XDimension of QR code.
QrCode(Byte[], Single, Single, Single, QrCodeErrorCorrectionLevel)
Initializes a new instance of the QrCode class.
public QrCode(Byte[] value, float x, float y, float xDimension, QrCodeErrorCorrectionLevel errorCorrectionLevel)
Public Sub New (value As Byte(), x As Single, y As Single, xDimension As Single, errorCorrectionLevel As QrCodeErrorCorrectionLevel)
Parameters
- value: Byte[]
The value of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- xDimension: Single
The XDimension of the QR code.
- errorCorrectionLevel: QrCodeErrorCorrectionLevel
The error correction level of QR code.
QrCode(Byte[], Single, Single, Single, QrCodeErrorCorrectionLevel, QrCodeVersion)
Initializes a new instance of the QrCode class.
public QrCode(Byte[] value, float x, float y, float xDimension, QrCodeErrorCorrectionLevel errorCorrectionLevel, QrCodeVersion version)
Public Sub New (value As Byte(), x As Single, y As Single, xDimension As Single, errorCorrectionLevel As QrCodeErrorCorrectionLevel, version As QrCodeVersion)
Parameters
- value: Byte[]
The value of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- xDimension: Single
The XDimension of QR code
- errorCorrectionLevel: QrCodeErrorCorrectionLevel
The error correction level of QR code.
- version: QrCodeVersion
The version of QR code.
QrCode(String, Single, Single)
Initializes a new instance of the QrCode class.
public QrCode(string text, float x, float y)
Public Sub New (text As String, x As Single, y As Single)
Parameters
- text: String
The text of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
QrCode(String, Single, Single, QrCodeEncoding)
Initializes a new instance of the QrCode class.
public QrCode(string text, float x, float y, QrCodeEncoding encoding)
Public Sub New (text As String, x As Single, y As Single, encoding As QrCodeEncoding)
Parameters
- text: String
The text of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- encoding: QrCodeEncoding
The encoding type of QR code.
QrCode(String, Single, Single, QrCodeEncoding, QrCodeErrorCorrectionLevel)
Initializes a new instance of the QrCode class.
public QrCode(string text, float x, float y, QrCodeEncoding encoding, QrCodeErrorCorrectionLevel errorCorrectionLevel)
Public Sub New (text As String, x As Single, y As Single, encoding As QrCodeEncoding, errorCorrectionLevel As QrCodeErrorCorrectionLevel)
Parameters
- text: String
The text of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- encoding: QrCodeEncoding
The encoding type of QR code.
- errorCorrectionLevel: QrCodeErrorCorrectionLevel
The error correction level of QR code.
QrCode(String, Single, Single, QrCodeEncoding, QrCodeErrorCorrectionLevel, QrCodeVersion)
Initializes a new instance of the QrCode class.
public QrCode(string text, float x, float y, QrCodeEncoding encoding, QrCodeErrorCorrectionLevel errorCorrectionLevel, QrCodeVersion version)
Public Sub New (text As String, x As Single, y As Single, encoding As QrCodeEncoding, errorCorrectionLevel As QrCodeErrorCorrectionLevel, version As QrCodeVersion)
Parameters
- text: String
The text of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- encoding: QrCodeEncoding
The encoding type of QR code.
- errorCorrectionLevel: QrCodeErrorCorrectionLevel
The error correction level of QR code.
- version: QrCodeVersion
The version of QR code.
QrCode(String, Single, Single, Single)
Initializes a new instance of the QrCode class.
public QrCode(string text, float x, float y, float xDimension)
Public Sub New (text As String, x As Single, y As Single, xDimension As Single)
Parameters
- text: String
The text of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- xDimension: Single
The XDimension of QR code.
QrCode(String, Single, Single, Single, QrCodeEncoding)
Initializes a new instance of the QrCode class.
public QrCode(string text, float x, float y, float xDimension, QrCodeEncoding encoding)
Public Sub New (text As String, x As Single, y As Single, xDimension As Single, encoding As QrCodeEncoding)
Parameters
- text: String
The text of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- xDimension: Single
The XDimension of QR code.
- encoding: QrCodeEncoding
The encoding of QR code.
QrCode(String, Single, Single, Single, QrCodeEncoding, QrCodeErrorCorrectionLevel)
Initializes a new instance of the QrCode class.
public QrCode(string text, float x, float y, float xDimension, QrCodeEncoding encoding, QrCodeErrorCorrectionLevel errorCorrectionLevel)
Public Sub New (text As String, x As Single, y As Single, xDimension As Single, encoding As QrCodeEncoding, errorCorrectionLevel As QrCodeErrorCorrectionLevel)
Parameters
- text: String
The text of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- xDimension: Single
The XDimension of QR code.
- encoding: QrCodeEncoding
The encoding of QR code.
- errorCorrectionLevel: QrCodeErrorCorrectionLevel
The error correction level of QR code.
QrCode(String, Single, Single, Single, QrCodeEncoding, QrCodeErrorCorrectionLevel, QrCodeVersion)
Initializes a new instance of the QrCode class.
public QrCode(string text, float x, float y, float xDimension, QrCodeEncoding encoding, QrCodeErrorCorrectionLevel errorCorrectionLevel, QrCodeVersion version)
Public Sub New (text As String, x As Single, y As Single, xDimension As Single, encoding As QrCodeEncoding, errorCorrectionLevel As QrCodeErrorCorrectionLevel, version As QrCodeVersion)
Parameters
- text: String
The text of the QR code.
- x: Single
The X coordinate of the QR code.
- y: Single
The Y coordinate of the QR code.
- xDimension: Single
The XDimension of QR code.
- encoding: QrCodeEncoding
The encoding of QR code.
- errorCorrectionLevel: QrCodeErrorCorrectionLevel
The error correction level of QR code.
- version: QrCodeVersion
The version of QR code.
Properties
Angle
Gets or sets the angle of the barcode. (Inherited from Dim2Barcode)
public float Angle { get; set; }
Public Property Angle As Single
Property Value
Color
Gets or sets the Color for the barcode. (Inherited from Dim2Barcode)
public Color Color { get; set; }
Public Property Color As Color
Property Value
Fnc1
Gets or sets FNC1 mode.
public QrCodeFnc1 Fnc1 { get; set; }
Public Property Fnc1 As QrCodeFnc1
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
IgnoreMargins
Gets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property. (Inherited from PageElement)
public bool IgnoreMargins { get; set; }
Public Property IgnoreMargins As Boolean
Property Value
Examples
The following example will place the Label in the top-left of the page with IgnoreMargin
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page); // Create an Label and place it in page top left with margin ignored
Label label = new Label("I am placed in Page top left with margin ignored", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
label.IgnoreMargin=true; page.Elements.Add(label);
// Save the PDF
document.Draw(outputPath);
}
}
PixelsPerXDimension
Gets or Sets the pixels per XDimension (Inherited from Dim2Barcode)
public int PixelsPerXDimension { get; set; }
Public Property PixelsPerXDimension As Int32
Property Value
RelativeTo
Gets and sets placement of the page element on the page. (Inherited from PageElement)
public RelativeTo RelativeTo { get; set; }
Public Property RelativeTo As RelativeTo
Property Value
Examples
The following example will place the Label in the top-left of the page.
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page); // Create an Label and place it in page top left with margin
Label label = new Label("I am placed in Page top left with margin.", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
page.Elements.Add(label);
// Save the PDF
document.Draw(outputPath);
}
}
Tag
Gets or sets the tag of the taggable element. (Inherited from TaggablePageElement)
public Tag Tag { get; set; }
Public Property Tag As Tag
Property Value
TagOrder
Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)
public int TagOrder { get; set; }
Public Property TagOrder As Int32
Property Value
Version
Gets the QR code version.
public QrCodeVersion Version { get; }
Public Property Version As QrCodeVersion
Property Value
X
Gets or sets the X coordinate of the barcode. (Inherited from Dim2Barcode)
public float X { get; set; }
Public Property X As Single
Property Value
XDimension
Gets or sets the xDimension of the barcode. (Inherited from Dim2Barcode)
public float XDimension { get; set; }
Public Property XDimension As Single
Property Value
XDimensionMilliMeters
Gets or sets the XDimensionMilliMeters of the barcode. (Inherited from Dim2Barcode)
public float XDimensionMilliMeters { get; set; }
Public Property XDimensionMilliMeters As Single
Property Value
XDimensionMils
Gets or sets the XDimensionMils of the barcode. (Inherited from Dim2Barcode)
public float XDimensionMils { get; set; }
Public Property XDimensionMils As Single
Property Value
XDimensionsPerCentiMeter
Gets or sets the XDimensionsPerCentiMeter of the barcode. (Inherited from Dim2Barcode)
public float XDimensionsPerCentiMeter { get; set; }
Public Property XDimensionsPerCentiMeter As Single
Property Value
XDimensionsPerInch
Gets or sets the XDimensionsPerInch of the barcode. (Inherited from Dim2Barcode)
public float XDimensionsPerInch { get; set; }
Public Property XDimensionsPerInch As Single
Property Value
Y
Gets or sets the Y coordinate of the barcode. (Inherited from Dim2Barcode)
public float Y { get; set; }
Public Property Y As Single
Property Value
Methods
Draw(PageWriter)
Draws QR code to the given PageWriter object.
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the QR code output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetSymbolHeight()
Returns the height required to display the QR code.
public float GetSymbolHeight()
Function GetSymbolHeight() As Single
Returns
A value representing the required height.
GetSymbolWidth()
Returns the width required to display the QR code.
public float GetSymbolWidth()
Function GetSymbolWidth() As Single
Returns
A value representing the required width.
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .