Class QRCodeLogo
QRCodeLogo class represents a logo image that can be used in a QR code. It can be initialized with a file path, an image object, or an image stream.
Inheritance
System.Object
QRCodeLogo
Namespace: Syncfusion.Pdf.Barcode
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class QRCodeLogo : Object
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);
Constructors
QRCodeLogo()
Initializes a new instance of the QRCodeLogo class.
Declaration
public QRCodeLogo()
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();
//Set the image to qr code logo.
qRCodeLogo.Image = new PdfBitmap(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);
QRCodeLogo(PdfImage)
Initializes a new instance of the QRCodeLogo class with the specified logo image.
Declaration
public QRCodeLogo(PdfImage logoImage)
Parameters
Type | Name | Description |
---|---|---|
PdfImage | logoImage | A PdfImage object representing the logo image. |
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);
PdfImage logoImage = new PdfBitmap(imageStream);
//Create QR Barcode logo.
QRCodeLogo qRCodeLogo = new QRCodeLogo(logoImage);
//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);
QRCodeLogo(Stream)
Initializes a new instance of the QRCodeLogo class with the logo image specified by the image stream.
Declaration
public QRCodeLogo(Stream logoImageStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | logoImageStream | A Stream object representing the image stream. |
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);
Properties
Image
Gets or sets the image used as a logo in the QR barcode
Declaration
public PdfImage Image { set; }
Property Value
Type |
---|
PdfImage |
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();
//Set the image to qr code logo.
qRCodeLogo.Image = new PdfBitmap(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);