QRCodeLogo Class
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
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Barcode
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class 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(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);
QRCodeLogo(String)
Initializes a new instance of the QRCodeLogo class with the image file specified by the file path.
Declaration
public QRCodeLogo(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | A string representing the file path of 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);
//Create QR Barcode logo.
QRCodeLogo qRCodeLogo = new QRCodeLogo("logo.png");
//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);