Class PdfQRBarcode
Represents the PDF QR barcode.
Inheritance
System.Object
PdfQRBarcode
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfQRBarcode : PdfBidimensionalBarcode
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Creates a new PDF QR barcode.
PdfQRBarcode qrBarcode = new PdfQRBarcode();
//Set text.
qrBarcode.Text = "012345678";
//Set barcode size.
qrBarcode.Size = new SizeF(200, 200);
//Set the dimention of the barcode.
qrBarcode.XDimension = 5;
//Set the barcode location.
qrBarcode.Location = new PointF(100, 100);
//Draw the barcode to PDF page.
qrBarcode.Draw(page);
//Save document to disk.
document.Save("output.pdf");
//Close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Creates a new PDF QR barcode.
Dim qrBarcode As New PdfQRBarcode()
'Set text.
qrBarcode.Text = "012345678"
'Set barcode size.
qrBarcode.Size = New SizeF(200, 200)
'Set the dimention of the barcode.
qrBarcode.XDimension = 5
'Set the barcode location.
qrBarcode.Location = New PointF(100, 100)
'Draw the barcode to PDF page.
qrBarcode.Draw(page)
'Save document to disk.
document.Save("output.pdf")
'Close the document.
document.Close(True)
Constructors
PdfQRBarcode()
Declaration
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Creates a new PDF QR barcode.
PdfQRBarcode qrBarcode = new PdfQRBarcode();
//Set text.
qrBarcode.Text = "012345678";
//Set barcode size.
qrBarcode.Size = new SizeF(200, 200);
//Set the dimention of the barcode.
qrBarcode.XDimension = 5;
//Set the barcode location.
qrBarcode.Location = new PointF(100, 100);
//Draw the barcode to PDF page.
qrBarcode.Draw(page);
//Save document to disk.
document.Save("output.pdf");
//Close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Creates a new PDF QR barcode.
Dim qrBarcode As New PdfQRBarcode()
'Set text.
qrBarcode.Text = "012345678"
'Set barcode size.
qrBarcode.Size = New SizeF(200, 200)
'Set the dimention of the barcode.
qrBarcode.XDimension = 5
'Set the barcode location.
qrBarcode.Location = New PointF(100, 100)
'Draw the barcode to PDF page.
qrBarcode.Draw(page)
'Save document to disk.
document.Save("output.pdf")
'Close the document.
document.Close(True)
Properties
ErrorCorrectionLevel
Declaration
public PdfErrorCorrectionLevel ErrorCorrectionLevel { get; set; }
Property Value
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Creates a new PDF QR barcode.
PdfQRBarcode qrBarcode = new PdfQRBarcode();
//Set text.
qrBarcode.Text = "012345678";
//Set barcode size.
qrBarcode.Size = new SizeF(200, 200);
//Set the error correction level.
qrBarcode.ErrorCorrectionLevel = PdfErrorCorrectionLevel.High;
//Set the dimention of the barcode.
qrBarcode.XDimension = 5;
//Set the barcode location.
qrBarcode.Location = new PointF(100, 100);
//Draw the barcode to PDF page.
qrBarcode.Draw(page);
//Save document to disk.
document.Save("output.pdf");
//Close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Creates a new PDF QR barcode.
Dim qrBarcode As New PdfQRBarcode()
'Set text.
qrBarcode.Text = "012345678"
'Set barcode size.
qrBarcode.Size = New SizeF(200, 200)
'Set the error correction level.
qrBarcode.ErrorCorrectionLevel = PdfErrorCorrectionLevel.High
'Set the dimention of the barcode.
qrBarcode.XDimension = 5
'Set the barcode location.
qrBarcode.Location = New PointF(100, 100)
'Draw the barcode to PDF page.
qrBarcode.Draw(page)
'Save document to disk.
document.Save("output.pdf")
'Close the document.
document.Close(True)
Declaration
public InputMode InputMode { get; set; }
Property Value
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Creates a new PDF QR barcode.
PdfQRBarcode qrBarcode = new PdfQRBarcode();
//Set text.
qrBarcode.Text = "012345678";
//Set barcode size.
qrBarcode.Size = new SizeF(200, 200);
//Set the input mode.
qrBarcode.InputMode = InputMode.BinaryMode;
//Set the dimention of the barcode.
qrBarcode.XDimension = 5;
//Set the barcode location.
qrBarcode.Location = new PointF(100, 100);
//Draw the barcode to PDF page.
qrBarcode.Draw(page);
//Save document to disk.
document.Save("output.pdf");
//Close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Creates a new PDF QR barcode.
Dim qrBarcode As New PdfQRBarcode()
'Set text.
qrBarcode.Text = "012345678"
'Set barcode size.
qrBarcode.Size = New SizeF(200, 200)
'Set the input mode.
qrBarcode.InputMode = InputMode.BinaryMode
'Set the dimention of the barcode.
qrBarcode.XDimension = 5
'Set the barcode location.
qrBarcode.Location = New PointF(100, 100)
'Draw the barcode to PDF page.
qrBarcode.Draw(page)
'Save document to disk.
document.Save("output.pdf")
'Close the document.
document.Close(True)
Logo
Gets or sets the logo image that will be displayed in the center of the QR barcode.
Declaration
public QRCodeLogo Logo { set; }
Property Value
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Creates a new PDF QR barcode.
PdfQRBarcode qrBarcode = new PdfQRBarcode();
//Set text.
qrBarcode.Text = "012345678";
//Set barcode size.
qrBarcode.Size = new SizeF(200, 200);
//Set the logo image to QR barcode.
FileStream imageStream = new FileStream("logo.png", FileMode.Open, FileAccess.Read);
//Create QR Barcode logo.
QRCodeLogo qRCodeLogo = new QRCodeLogo(imageStream);
//Set the QR barcode logo.
qrBarcode.Logo = qRCodeLogo;
//Set the dimention of the barcode.
qrBarcode.XDimension = 5;
//Set the barcode location.
qrBarcode.Location = new PointF(100, 100);
//Draw the barcode to PDF page.
qrBarcode.Draw(page);
//Save document to disk.
document.Save("output.pdf");
//Close the document.
document.Close(true);
Size
Gets or set the size of the barcode.
Declaration
public override SizeF Size { get; set; }
Property Value
Overrides
Version
Declaration
public QRCodeVersion Version { get; set; }
Property Value
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Creates a new PDF QR barcode.
PdfQRBarcode qrBarcode = new PdfQRBarcode();
//Set text.
qrBarcode.Text = "012345678";
//Set barcode size.
qrBarcode.Size = new SizeF(200, 200);
//Set the QR barcode version.
qrBarcode.Version = QRCodeVersion.Version05;
//Set the dimention of the barcode.
qrBarcode.XDimension = 5;
//Set the barcode location.
qrBarcode.Location = new PointF(100, 100);
//Draw the barcode to PDF page.
qrBarcode.Draw(page);
//Save document to disk.
document.Save("output.pdf");
//Close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Creates a new PDF QR barcode.
Dim qrBarcode As New PdfQRBarcode()
'Set text.
qrBarcode.Text = "012345678"
'Set barcode size.
qrBarcode.Size = New SizeF(200, 200)
'Set the QR barcode version.
qrBarcode.Version = QRCodeVersion.Version05
'Set the dimention of the barcode.
qrBarcode.XDimension = 5
'Set the barcode location.
qrBarcode.Location = New PointF(100, 100)
'Draw the barcode to PDF page.
qrBarcode.Draw(page)
'Save document to disk.
document.Save("output.pdf")
'Close the document.
document.Close(True)
Methods
Draw(PdfGraphics)
Declaration
public override void Draw(PdfGraphics graphics)
Parameters
Type |
Name |
Description |
PdfGraphics |
graphics |
The PDF graphics.
|
Overrides
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create Pdf graphics for the page.
PdfGraphics graphics=page.Graphics;
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfQRBarcode.
PdfQRBarcode qrCode = new PdfQRBarcode();
//Set the barcode text.
qrCode.Text = "012345678";
qrCode.Location = new PointF(100,100);
//Draw a barcode in the new pdfGraphics.
qrCode.Draw(graphics);
//Save the document to disk.
document.Save("QRBarcode.pdf");
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create Pdf graphics for the page.
Dim graphics As PdfGraphics =page.Graphics
'Creates a new PdfQRBarcode.
Dim qrCode As PdfQRBarcode = New PdfQRBarcode()
'Set the barcode text.
qrCode.Text = "012345678"
qrCode.Location = new PointF(100,100);
'Draw a barcode in the new pdfGraphics.
qrCode.Draw(graphics)
'Save the document to disk.
document.Save("QRBarcode.pdf")
Draw(PdfGraphics, PointF)
Draws the barcode on the PdfGraphics at the specified location.
Declaration
public override void Draw(PdfGraphics graphics, PointF location)
Parameters
Type |
Name |
Description |
PdfGraphics |
graphics |
The pdf graphics.
|
PointF |
location |
The barcode location.
|
Overrides
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create Pdf graphics for the page.
PdfGraphics graphics=page.Graphics;
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfQRBarcode.
PdfQRBarcode qrCode = new PdfQRBarcode();
//Set the barcode text.
qrCode.Text = "012345678";
//Draw a barcode in the new PdfGraphics.
qrCode.Draw(page, new PointF(25, 500));
//Save the document to disk.
document.Save("QRBarcode.pdf");
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create Pdf graphics for the page.
Dim graphics As PdfGraphics=page.Graphics
'Creates a new PdfQRBarcode.
Dim qrCode As PdfQRBarcode = New PdfQRBarcode()
'Set the barcode text.
qrCode.Text = "012345678"
'Draw a barcode in the new pdfGraphics.
qrCode.Draw(graphics, New PointF(25, 500))
'Save the document to disk.
document.Save("QRBarcode.pdf")
Draw(PdfGraphics, PointF, SizeF)
Declaration
public void Draw(PdfGraphics graphics, PointF location, SizeF size)
Parameters
Draw(PdfGraphics, RectangleF)
Declaration
public void Draw(PdfGraphics graphics, RectangleF rectangle)
Parameters
Draw(PdfGraphics, Single, Single, Single, Single)
Declaration
public void Draw(PdfGraphics graphics, float a, float b, float width, float height)
Parameters
Type |
Name |
Description |
PdfGraphics |
graphics |
|
System.Single |
a |
|
System.Single |
b |
|
System.Single |
width |
|
System.Single |
height |
|
Draw(PdfPageBase)
Draws the barcode on the PdfPage at the specified location.
Declaration
public override void Draw(PdfPageBase page)
Parameters
Overrides
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfQRBarcode.
PdfQRBarcode qrCode = new PdfQRBarcode();
//Set the barcode text.
qrCode.Text = "012345678";
qrCode.Location = new PointF(100,100);
//Draw a barcode in the new Page.
qrCode.Draw(page);
//Save the document to disk.
document.Save("QRBarcode.pdf");
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Creates a new PdfQRBarcode.
Dim qrCode As PdfQRBarcode = New PdfQRBarcode()
'Set the barcode text.
qrCode.Text = "012345678"
qrCode.Location = new PointF(100,100);
'Draw a barcode in the new Page.
qrCode.Draw(page)
'Save the document to disk.
document.Save("QRBarcode.pdf")
Draw(PdfPageBase, PointF)
Draws the barcode on the PdfPage at the specified location.
Declaration
public override void Draw(PdfPageBase page, PointF location)
Parameters
Type |
Name |
Description |
PdfPageBase |
page |
The pdf page.
|
PointF |
location |
The barcode location.
|
Overrides
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create Pdf graphics for the page
PfgGraphics graphics=page.Graphics;
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfQRBarcode.
PdfQRBarcode qrCode = new PdfQRBarcode();
//Set the barcode text.
qrCode.Text = "012345678";
//Draw a barcode in the new Page.
qrCode.Draw(graphics, new PointF(25, 500));
//Save the document to disk.
document.Save("QRBarcode.pdf");
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
//Create Pdf graphics for the page
Dim graphics As PdfGraphics=page.Graphics
'Creates a new PdfQRBarcode.
Dim qrCode As PdfQRBarcode = New PdfQRBarcode()
'Set the barcode text.
qrCode.Text = "012345678"
'Draw a barcode in the new Page.
qrCode.Draw(graphics, New PointF(25, 500))
'Save the document to disk.
document.Save("QRBarcode.pdf")
Draw(PdfPageBase, PointF, SizeF)
Declaration
public void Draw(PdfPageBase page, PointF location, SizeF size)
Parameters
Draw(PdfPageBase, RectangleF)
Declaration
public void Draw(PdfPageBase page, RectangleF rectangle)
Parameters
Draw(PdfPageBase, Single, Single, Single, Single)
Declaration
public void Draw(PdfPageBase page, float x, float y, float width, float height)
Parameters
Type |
Name |
Description |
PdfPageBase |
page |
|
System.Single |
x |
|
System.Single |
y |
|
System.Single |
width |
|
System.Single |
height |
|
Extension Methods