翻譯|使用教程|編輯:胡濤|2022-12-30 10:16:08.057|閱讀 265 次
概述:在本文中,我們將學(xué)習(xí)如何生成 GS1-128 條形碼。完成上述步驟后,我們將在 C# 中擁有自己的 GS1-128 條碼生成器。讓我們開始吧。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Aspose API支持流行文件格式處理,并允許將各類文檔導(dǎo)出或轉(zhuǎn)換為固定布局文件格式和最常用的圖像/多媒體格式。
我們都知道,條碼是識別商品的圖形符號。GS1-128 條形碼在零售業(yè)中非常普遍。GS1-128 標(biāo)準(zhǔn)促進(jìn)了全球公司之間的數(shù)據(jù)交換。從本質(zhì)上講,它是一種電子商務(wù)技術(shù)標(biāo)準(zhǔn),用于提供有關(guān)產(chǎn)品的準(zhǔn)確可靠信息。在本文中,我們將學(xué)習(xí)如何生成 GS1-128 條形碼。完成上述步驟后,我們將在 C# 中擁有自己的 GS1-128 條碼生成器。讓我們開始吧。
為了生成 GS1-128 條形碼,我們將使用Aspose.BarCode for .NET API。它允許生成和識別范圍廣泛的 1D 和 2D條碼類型。
API的BarcodeGenerator類允許生成指定 EncodeType 的條形碼。EncodeType類允許指定要編碼的條形碼類型。我們可以使用此類的Save(string)方法保存生成的條形碼圖像。
請下載API 的 DLL 或使用NuGet安裝它。
PM> Install-Package Aspose.BarCode
GS1-128(以前稱為 UCC/EAN-128)條碼是一種機器可讀的產(chǎn)品識別碼,用于存儲數(shù)據(jù)并提供有關(guān)產(chǎn)品的信息。此代碼適用于貨物的包裝和容器,以幫助促進(jìn)食品的有效分配和使用。
全球數(shù)以千計的行業(yè)使用 GS1 條形碼或全球貿(mào)易項目代碼 (GTIN)。全球的客戶和供應(yīng)商都知道食品、藥品和其他商品的 GS1-128 條碼。它作為制造商、零售商和消費者的庫存管理工具。GS1-128 代碼由國際標(biāo)準(zhǔn)化組織 (ISO) 定義并由 GS1 組織發(fā)布。
GS1-128 條形碼遵循以下格式:
(Application_Identifier_1)Application_Data(Application_Identifier_2)Application_Data
GS1-128 條形碼包含以下有用信息:
我們可以按照以下步驟生成 GS1-128 條形碼:
以下代碼示例顯示如何在 C# 中生成 GS1-128 條形碼。
// This code example demonstrates how to generate a GS1-128 barcode. // Create an instane of the BarcodeGenerator class // Specify Encode type as GS1Code128 BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.GS1Code128); // Specify the code text generator.CodeText = "(01)12345678901231(21)ASPOSE(30)9876"; // Specify the X-dimension // the smallest width of the unit of BarCode bars or spaces generator.Parameters.Barcode.XDimension.Pixels = 2; // Save the output generator.Save(@"C:\Files\GS1Code128.jpg");
同樣,我們可以按照前面提到的步驟生成一個條形碼標(biāo)簽,在同一圖像中放置一個額外的 GS1-128 優(yōu)惠券條形碼。但是,我們需要在第一步中將 EncodeType設(shè)置為UpcaGs1Code128Coupon 。
以下代碼示例顯示如何在 C# 中生成 UPC-A GS1 代碼 128 優(yōu)惠券。
// This code example demonstrates how to generate a UPC-A GS1 Code 128 Coupon. // Create an instane of the BarcodeGenerator class // Specify Encode type as UpcaGs1Code128Coupon BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.UpcaGs1Code128Coupon); // Specify the code text generator.CodeText = "123456789012(8110)ASPOSE"; // Specify the X-dimension // the smallest width of the unit of BarCode bars or spaces generator.Parameters.Barcode.XDimension.Pixels = 2; // Save the output generator.Save(@"C:\Files\Gs1CouponUpcaCode128.jpg");
我們還可以按照前面提到的步驟自定義條形碼的外觀。但是,在最后一步保存圖像之前,我們需要指定其他屬性。
以下代碼示例顯示如何在 C# 中自定義 GS1 128 優(yōu)惠券的條形碼外觀。
// This code example demonstrates how to customize the barcode appearance of GS1 128 Coupon. // Create an instane of the BarcodeGenerator class // Specify Encode type as UpcaGs1Code128Coupon BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.UpcaGs1Code128Coupon); // Specify the code text generator.CodeText = "123456789012(8110)ASPOSE"; // Specify the X-dimension // the smallest width of the unit of BarCode bars or spaces generator.Parameters.Barcode.XDimension.Pixels = 2; // Set coupon supplement space 50 pixels generator.Parameters.Barcode.Coupon.SupplementSpace.Pixels = 50; // Set Bar Height generator.Parameters.Barcode.BarHeight.Pixels = 50; // Set Bar Color generator.Parameters.Barcode.BarColor = System.Drawing.Color.Blue; // Set Lable Color generator.Parameters.Barcode.CodeTextParameters.Color = System.Drawing.Color.Red; // Save the output generator.Save(@"C:\Files\Gs1CouponAppearance.jpg");
以上便是如何在C# 中生成GS1-128 條碼,希望能幫到您,除此之外,你有其他方面的需求,也歡迎和我們互動,或這下體驗我們更多的產(chǎn)品~
歡迎下載|體驗更多Aspose產(chǎn)品
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn