iText 9.0.0 API
iText.Barcodes.BarcodeQRCode Class Reference

A QRCode implementation based on the zxing code. More...

Inheritance diagram for iText.Barcodes.BarcodeQRCode:
iText.Barcodes.Barcode2D

Public Member Functions

  BarcodeQRCode (String code, IDictionary< EncodeHintType, Object > hints)
  Creates the QR barcode. More...
 
  BarcodeQRCode (String content)
  Creates the QR barcode with default error correction level (ErrorCorrectionLevel.L) and default character set (ISO-8859-1). More...
 
  BarcodeQRCode ()
  Creates an instance of the BarcodeQRCode class. More...
 
virtual String  GetCode ()
  Gets the current data. More...
 
virtual void  SetCode (String code)
  Sets the data to be encoded by the barcode. More...
 
virtual IDictionary< EncodeHintType, Object >  GetHints ()
 
Returns
modifiers to change the way the barcode is created.

 
virtual void  SetHints (IDictionary< EncodeHintType, Object > hints)
 
virtual void  Regenerate ()
  Regenerates barcode after changes in hints or code. More...
 
override Rectangle  GetBarcodeSize ()
  Gets the size of the barcode grid More...
 
virtual Rectangle  GetBarcodeSize (float moduleSize)
  Gets the barcode size More...
 
override Rectangle  PlaceBarcode (PdfCanvas canvas, Color foreground)
  Places the barcode in a PdfCanvas. More...
 
virtual Rectangle  PlaceBarcode (PdfCanvas canvas, Color foreground, float moduleSide)
  * Places the barcode in a PdfCanvas. More...
 
override PdfFormXObject  CreateFormXObject (Color foreground, PdfDocument document)
  Creates a PdfFormXObject with the barcode. More...
 
virtual PdfFormXObject  CreateFormXObject (Color foreground, float moduleSize, PdfDocument document)
  Creates a PdfFormXObject with the barcode. More...
 
- Public Member Functions inherited from iText.Barcodes.Barcode2D
virtual PdfFormXObject  CreateFormXObject (PdfDocument document)
  Creates a PdfFormXObject with the barcode. More...
 

Additional Inherited Members

- Static Package Attributes inherited from iText.Barcodes.Barcode2D
const float  DEFAULT_MODULE_SIZE = 1
 

Detailed Description

A QRCode implementation based on the zxing code.

Constructor & Destructor Documentation

◆ BarcodeQRCode() [1/3]

iText.Barcodes.BarcodeQRCode.BarcodeQRCode ( String  code,
IDictionary< EncodeHintType, Object >  hints 
)
inline

Creates the QR barcode.

Parameters
code the text to be encoded
hints barcode hints. See #setHints for description.

◆ BarcodeQRCode() [2/3]

iText.Barcodes.BarcodeQRCode.BarcodeQRCode ( String  content )
inline

Creates the QR barcode with default error correction level (ErrorCorrectionLevel.L) and default character set (ISO-8859-1).

Parameters
content the text to be encoded

◆ BarcodeQRCode() [3/3]

iText.Barcodes.BarcodeQRCode.BarcodeQRCode ( )
inline

Creates an instance of the BarcodeQRCode class.

Member Function Documentation

◆ CreateFormXObject() [1/2]

virtual PdfFormXObject iText.Barcodes.BarcodeQRCode.CreateFormXObject ( Color  foreground,
float  moduleSize,
PdfDocument  document 
)
inlinevirtual

Creates a PdfFormXObject with the barcode.

Parameters
foreground The color of the pixels. It can be null
moduleSize The size of the pixels.
document The document
Returns
the XObject.

◆ CreateFormXObject() [2/2]

override PdfFormXObject iText.Barcodes.BarcodeQRCode.CreateFormXObject ( Color  foreground,
PdfDocument  document 
)
inlinevirtual

Creates a PdfFormXObject with the barcode.

Parameters
foreground the color of the pixels. It can be null
Returns
the XObject.

Implements iText.Barcodes.Barcode2D.

◆ GetBarcodeSize() [1/2]

override Rectangle iText.Barcodes.BarcodeQRCode.GetBarcodeSize ( )
inlinevirtual

Gets the size of the barcode grid

Implements iText.Barcodes.Barcode2D.

◆ GetBarcodeSize() [2/2]

virtual Rectangle iText.Barcodes.BarcodeQRCode.GetBarcodeSize ( float  moduleSize )
inlinevirtual

Gets the barcode size

Parameters
moduleSize The module size
Returns
The size of the barcode

◆ GetCode()

virtual String iText.Barcodes.BarcodeQRCode.GetCode ( )
inlinevirtual

Gets the current data.

Returns
the encoded data

◆ PlaceBarcode() [1/2]

override Rectangle iText.Barcodes.BarcodeQRCode.PlaceBarcode ( PdfCanvas  canvas,
Color  foreground 
)
inlinevirtual

Places the barcode in a PdfCanvas.

Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere.

Parameters
canvas the PdfCanvas where the barcode will be placed
foreground the foreground color. It can be null
Returns
the dimensions the barcode occupies

Implements iText.Barcodes.Barcode2D.

◆ PlaceBarcode() [2/2]

virtual Rectangle iText.Barcodes.BarcodeQRCode.PlaceBarcode ( PdfCanvas  canvas,
Color  foreground,
float  moduleSide 
)
inlinevirtual

* Places the barcode in a PdfCanvas.

  • Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere.
Parameters
canvas the PdfCanvas where the barcode will be placed
foreground the foreground color. It can be null
moduleSide the size of the square grid cell
Returns
the dimensions the barcode occupies

◆ Regenerate()

virtual void iText.Barcodes.BarcodeQRCode.Regenerate ( )
inlinevirtual

Regenerates barcode after changes in hints or code.

◆ SetCode()

virtual void iText.Barcodes.BarcodeQRCode.SetCode ( String  code )
inlinevirtual

Sets the data to be encoded by the barcode.

Sets the data to be encoded by the barcode. If not specified in hints otherwise, the character set should be ISO-8859-1.

Parameters
code The data to encode

◆ SetHints()

virtual void iText.Barcodes.BarcodeQRCode.SetHints ( IDictionary< EncodeHintType, Object >  hints )
inlinevirtual
Parameters
hints modifiers to change the way the barcode is created. They can be EncodeHintType.ERROR_CORRECTION and EncodeHintType.CHARACTER_SET. For EncodeHintType.ERROR_CORRECTION the values can be ErrorCorrectionLevel.L, M, Q, H. For EncodeHintType.CHARACTER_SET the values are strings and can be Cp437, Shift_JIS and ISO-8859-1 to ISO-8859-16. You can also use UTF-8, but correct behaviour is not guaranteed as Unicode is not supported in QRCodes. The default value is ISO-8859-1.