翻譯|行業(yè)資訊|編輯:胡濤|2024-08-22 11:08:13.110|閱讀 104 次
概述:我們將實(shí)現(xiàn)如何使用Aspose.BarCode for .NET在 C# 中創(chuàng)建微型二維碼。接下來,我們還將演示如何以編程方式創(chuàng)建/讀取其他類型的二維碼。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Aspose.BarCode提供多種編程語言的 API,例如Java、Python、C++等。它提供了強(qiáng)大的解決方案,可以通過編程創(chuàng)建和處理?xiàng)l形碼和二維碼,我們將實(shí)現(xiàn)如何使用Aspose.BarCode for .NET在 C# 中創(chuàng)建微型二維碼。接下來,我們還將演示如何以編程方式創(chuàng)建/讀取其他類型的二維碼。
Aspose.BarCode for .NET 是一個(gè)功能強(qiáng)大的API,可以從任意角度生成和識別多種圖像類型的一維和二維條形碼。開發(fā)人員可以輕松添加條形碼生成和識別功能,以及在.NET應(yīng)用程序中將生成的條形碼導(dǎo)出為高質(zhì)量的圖像格式。
Aspose API支持流行文件格式處理,并允許將各類文檔導(dǎo)出或轉(zhuǎn)換為固定布局文件格式和最常用的圖像/多媒體格式。
如果遇到任何意外情況, 請轉(zhuǎn)到安裝指南。不過,您可以在NuGet 包管理器中運(yùn)行以下命令或下載 此 C# 庫的DLL文件:
PM> Install-Package Aspose.BarCode
您可以簡單地按照以下步驟操作:
以下代碼示例展示了如何使用C# 開發(fā)微型二維碼生成器:
namespace CSharp.MicroQRVersionM4
{
class MicroQRVersionM4
{
static void Main(string[] args)
{
// Define the path to the documents directory.
string path = "/Desktop/";
System.Console.WriteLine("MicroQRVersion:");
// Create an instance of the BarcodeGenerator class and initialize it with the QRcode symbology type and text to be encoded.
using (BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.MicroQR, "EARTH"))
{
// Set the size of QR code in Pixels.
gen.Parameters.Barcode.XDimension.Pixels = 4;
// Save(auto by default) the QR Code image to a specific file in PNG format.
gen.Save($"{path}MicroQRVersionAuto.png", BarCodeImageFormat.Png);
// Set MicroQR M4 version and invoke the Save method to save the output file.
gen.Parameters.Barcode.QR.MicroQRVersion = MicroQRVersion.M4;
gen.Save($"{path}MicroQRVersionM4.png", BarCodeImageFormat.Png);
}
}
}
}
輸出:
	 
 
同樣,您可以使用以下代碼片段生成矩形微型二維碼:
namespace CSharp.RectMicroQRVersionR11x77
{
class RectMicroQRVersionR11x77
{
static void Main(string[] args)
{
// Define the path to the documents directory.
string path = "/Desktop/";
System.Console.WriteLine("MicroQRVersion:");
using (BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.RectMicroQR, "EARTH"))
{
gen.Parameters.Barcode.XDimension.Pixels = 4;
//auto (by default)
gen.Save($"{path}RectMicroQRVersionAuto.png", BarCodeImageFormat.Png);
//set RectMicroQR R11x77 version
gen.Parameters.Barcode.QR.RectMicroQrVersion = Aspose.BarCode.Generation.RectMicroQRVersion.R11x77;
gen.Save($"{path}RectMicroQRVersionR11x77.png", BarCodeImageFormat.Png);
}
}
}
}
您可以在下圖中看到生成的矩形微型二維碼:
	 
 
有一個(gè)由微型二維碼掃描器和生成器。此外,它是免費(fèi)的,您可以在幾乎所有常用的 Web 瀏覽器中打開它。
	 
歡迎下載|體驗(yàn)更多Aspose產(chǎn)品
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@ke049m.cn