diQRcodeNet 4.0.0
.NET interface to diQRcode.
QRcode Class Methods
QRcode.CreateGif Method
Create a GIF file of a QR code [deprecated].
Syntax
[C#]
public static int CreateGif(
string outFile,
string inputStr,
int nPixelsPerModule,
Ecc level,
string paramStr,
Options options
)
[VB.NET]
Public Shared Function CreateGif ( _
outFile As String, _
inputStr As String, _
nPixelsPerModule As Integer, _
level As Ecc, _
paramStr As String, _
options As Options _
) As Integer
Parameters
- outFile
- Name of output GIF file to be created.
- inputStr
- Text input to be encoded (ANSI characters only).
- nPixelsPerModule
- Number of pixels per module (default = 2 ppm)
- level
- Type: Ecc
Error correction level (default = M)
- paramStr
- Optional parameter string. Set as "margin=N" to change the margin to N modules (default=4).
- options
- Type: Options
Set as Escaped to indicate #-escaped sequences in the input string.
Return Value
Zero on success, or a nonzero error code.
Remarks
Deprecated. Use QRCode.CreateImage
Example
[C#]
int n = QRcode.CreateGif("hello.gif", "hello world");
if (n != 0) Console.WriteLine("Error: {0}", QRcode.ErrorLookup(n));
QRcode.CreateGifInUtf8 Method
Create a GIF file of a QR code, using UTF-8 encoding [deprecated].
Syntax
[C#]
public static int CreateGifInUtf8(
string outFile,
string inputStr,
int nPixelsPerModule,
Ecc level,
string paramStr,
Options options
)
[VB.NET]
Public Shared Function CreateGifInUtf8 ( _
outFile As String, _
inputStr As String, _
nPixelsPerModule As Integer, _
level As Ecc, _
paramStr As String, _
options As Options _
) As Integer
Parameters
- outFile
- Name of output GIF file to be created.
- inputStr
- Text input to be encoded.
- nPixelsPerModule
- Number of pixels per module (default = 2 ppm)
- level
- Type: Ecc
Error correction code level (default = M)
- paramStr
- Optional parameter string. Set as "margin=N" to change the margin to N modules (default=4).
- options
- Type: Options
Option flags.
Return Value
Zero on success, or a nonzero error code.
Remarks
Any non-ASCII characters in inputStr will be encoded in UTF-8 before processing. Deprecated. Use QRCode.CreateImageInUtf8
QRcode.CreateImage Method
Create an image file of a QR code.
Syntax
[C#]
public static int CreateImage(
string outFile,
string inputStr,
ImageType imageType,
int nPixelsPerModule,
int margin,
Ecc level,
Options options
)
[VB.NET]
Public Shared Function CreateImage ( _
outFile As String, _
inputStr As String, _
imageType As ImageType, _
nPixelsPerModule As Integer, _
margin As Integer, _
level As Ecc, _
options As Options _
) As Integer
Parameters
- outFile
- Name of output image file to be created.
- inputStr
- Text input to be encoded (ANSI characters only).
- imageType
- Type: ImageType
Image type (GIF/SVG) (default = GIF).
- nPixelsPerModule
- Number of pixels per module (default = 2 ppm).
- margin
- Size of margin in modules (default = 4 modules).
- level
- Type: Ecc
Error correction level (default = M).
- options
- Type: Options
Set as Escaped to indicate #-escaped sequences in the input string.
Return Value
Zero on success, or a nonzero error code.
Example
[C#]
int n = QRcode.CreateImage("hello.gif", "hello world");
if (n != 0) Console.WriteLine("Error: {0}", QRcode.ErrorLookup(n));
n = QRcode.CreateImage("hello.svg", "hello world", ImageType.Svg);
if (n != 0) Console.WriteLine("Error: {0}", QRcode.ErrorLookup(n));
QRcode.CreateImageInUtf8 Method
Create an image file of a QR code, using UTF-8 encoding.
Syntax
[C#]
public static int CreateImageInUtf8(
string outFile,
string inputStr,
ImageType imageType,
int nPixelsPerModule,
int margin,
Ecc level,
Options options
)
[VB.NET]
Public Shared Function CreateImageInUtf8 ( _
outFile As String, _
inputStr As String, _
imageType As ImageType, _
nPixelsPerModule As Integer, _
margin As Integer, _
level As Ecc, _
options As Options _
) As Integer
Parameters
- outFile
- Name of output image file to be created.
- inputStr
- Text input to be encoded.
- imageType
- Type: ImageType
Image type (GIF/SVG) (default = GIF).
- nPixelsPerModule
- Number of pixels per module (default = 2 ppm)
- margin
- Size of margin in modules (default = 4 modules).
- level
- Type: Ecc
Error correction code level (default = M)
- options
- Type: Options
Option flags.
Return Value
Zero on success, or a nonzero error code.
Remarks
Any non-ASCII characters in inputStr will be encoded in UTF-8 before processing.
Example
[C#]
n = QRcode.CreateImageInUtf8("zz-utf8.svg", "中国", ImageType.Svg);
QRcode.CreatePdf Method
Create a PDF file of a QR code.
Syntax
[C#]
public static int CreatePdf(
string outFile,
string inputStr,
int nPixelsPerModule,
Ecc level,
int nPageWidth,
int nPageHeight,
int nX,
int nY,
Options options
)
[VB.NET]
Public Shared Function CreatePdf ( _
outFile As String, _
inputStr As String, _
nPixelsPerModule As Integer, _
level As Ecc, _
nPageWidth As Integer, _
nPageHeight As Integer, _
nX As Integer, _
nY As Integer, _
options As Options _
) As Integer
Parameters
- outFile
- Name of output PDF file to be created.
- inputStr
- Text input to be encoded.
- nPixelsPerModule
- Number of pixels per module (default = 2 ppm)
- level
- Type: Ecc
Error correction code level (default = M)
- nPageWidth
- Width of PDF page in pixels (default = 0 => set width to fit QRcode image).
- nPageHeight
- Height of PDF page in pixels (default = 0 => set height to fit QRcode image).
- nX
- X-coordinate in pixels of bottom-left of QRcode image (default = 0 => at left side).
- nY
- Y-coordinate in pixels of bottom-left of QRcode image (default = 0 => at bottom).
- options
- Type: Options
Option flags.
Return Value
Zero on success, or a nonzero error code.
Example
[C#]
n = QRcode.CreatePdf("hello0.pdf", "Hello world!");
n = QRcode.CreatePdf("helloA4.pdf", "Hello world!", nPixelsPerModule: 6, nPageWidth: 595, nPageHeight: 842, nX: 230, nY: 380);
QRcode.CreatePdfInUtf8 Method
Create a PDF file of a QR code, using UTF-8 encoding.
Syntax
[C#]
public static int CreatePdfInUtf8(
string outFile,
string inputStr,
int nPixelsPerModule,
Ecc level,
int nPageWidth,
int nPageHeight,
int nX,
int nY,
Options options
)
[VB.NET]
Public Shared Function CreatePdfInUtf8 ( _
outFile As String, _
inputStr As String, _
nPixelsPerModule As Integer, _
level As Ecc, _
nPageWidth As Integer, _
nPageHeight As Integer, _
nX As Integer, _
nY As Integer, _
options As Options _
) As Integer
Parameters
- outFile
- Name of output PDF file to be created.
- inputStr
- Text input to be encoded.
- nPixelsPerModule
- Number of pixels per module (default = 2 ppm)
- level
- Type: Ecc
Error correction code level (default = M)
- nPageWidth
- Width of PDF page in pixels (default = 0 => set width to fit QRcode image).
- nPageHeight
- Height of PDF page in pixels (default = 0 => set height to fit QRcode image).
- nX
- X-coordinate in pixels of bottom-left of QRcode image (default = 0 => at left side).
- nY
- Y-coordinate in pixels of bottom-left of QRcode image (default = 0 => at bottom).
- options
- Type: Options
Option flags.
Return Value
Zero on success, or a nonzero error code.
Remarks
Any non-ASCII characters in inputStr will be encoded in UTF-8 before processing.
QRcode.DllInfo Method
Get information about the core diQRcode DLL.
Syntax
[C#]
public static string DllInfo()
[VB.NET]
Public Shared Function DllInfo As String
Return Value
String with information including platform core DLL is compiled for: Win32 or X64.
QRcode.ErrorLookup Method
Look up description for error code.
Syntax
[C#]
public static string ErrorLookup(
int errCode
)
[VB.NET]
Public Shared Function ErrorLookup ( _
errCode As Integer _
) As String
Parameters
- errCode
- Value of error code to lookup (may be positive or negative)
Return Value
Error message, or empty string if no corresponding error code.
Example
[C#]
Console.WriteLine(QRcode.ErrorLookup(-39));
QRcode.NetVersion Method
Return the version of this .NET module.
Syntax
[C#]
public static string NetVersion()
[VB.NET]
Public Shared Function NetVersion As String
Return Value
Version string, e.g. "03.05.00"
QRcode.Version Method
Get version number of core diQRcode DLL.
Syntax
[C#]
public static int Version()
[VB.NET]
Public Shared Function Version As Integer
Return Value
Version number in form Major * 10000 + Minor * 100 + Release
Remarks
For example, version 1.2.3 would return 10203
Ecc Enumeration
Error correction code level
Syntax
[C#]
public enum Ecc
[VB.NET]
Public Enumeration Ecc
Members
| Member name | Description |
---|
| M | EC level M (default) |
| L | EC level L |
| Q | EC level Q |
| H | EC level H |
ImageType Enumeration
Image type
Syntax
[C#]
public enum ImageType
[VB.NET]
Public Enumeration ImageType
Members
| Member name | Description |
---|
| Gif | Output image as a GIF file (default) |
| Svg | Output image as an SVG file |
Options Enumeration
Option flags
Syntax
[C#]
[FlagsAttribute]
public enum Options
[VB.NET]
<FlagsAttribute> _
Public Enumeration Options
Members
| Member name | Description |
---|
| Default | Default options. |
| Escaped | Input string contains #-escaped sequences. |
| Base64 | Encode image output formatted as base64 text. |
| NoNameCheck | Do not check filename extension against file type. |