翻译|使用教程|编辑:胡涛|2023-03-30 10:04:58.627|阅读 48 次
概述:在本文中,我们将学习如何生成 GS1-128 条形码。
# 31款JAVA开发必备控件和工具 # 界面/文档管理/报表/IDE等4000款产品火热销售中 >>
相关链接:
Aspose.BarCode for .NET 是一个功能强大的API,可以从任意角度生成和识别多种图像类型的一维和二维条形码。开发人员可以轻松添加条形码生成和识别功能,以及在.NET应用程序中将生成的条形码导出为高质量的图像格式。
Aspose API支持流行文件格式处理,并允许将各类文档导出或转换为固定布局文件格式和最常用的图像/多媒体格式。
条形码是用于识别产品的图形符号。在零售行业,GS1-128 条码无处不在。世界各地的许多公司都使用 GS1-128 标准交换数据。作为电子商务标准,它使公司能够提供有关其产品的准确可靠的信息。在本文中,我们将学习如何生成 GS1-128 条形码。完成上述步骤后,我们将拥有自己的Java GS1-128 条码生成器。让我们开始吧。
我们将使用Aspose.BarCode for Java API 生成 GS1-128 条码。它是用于条形码生成和识别的强大、可靠且易于使用的 Java API。它支持范围广泛的一维和二维条码类型。
请下载 API 的 JAR或在基于 Maven 的 Java 应用程序中添加以下 pom.xml 配置。
<repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>http://repository.aspose.com/repo/</url> </repository> <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-barcode</artifactId> <version>22.10</version> </dependency>
我们可以按照以下步骤轻松生成 GS1-128 条形码:
以下代码示例显示了如何在 Java 中生成 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.GS_1_CODE_128); // Specify the code text generator.setCodeText("(01)12345678901231(21)ASPOSE(30)9876"); // Specify the X-dimension // the smallest width of the unit of BarCode bars or spaces generator.getParameters().getBarcode().getXDimension().setPixels(2); // Save the output generator.save("C:\\Files\\GS1Code128.jpg");
同样,我们也可以按照前面提到的步骤生成一个条码标签,在同一图像中放置一个额外的 GS1-128 优惠券条码。但是,我们需要在第一步中将EncodeType设置为UPCA_GS_1_CODE_128_COUPON 。
以下代码示例显示如何在 Java 中生成 UPC-A GS1 代码 128 优惠券。
// 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.UPCA_GS_1_CODE_128_COUPON); // Specify the code text generator.setCodeText("123456789012(8110)ASPOSE"); // Specify the X-dimension // the smallest width of the unit of BarCode bars or spaces generator.getParameters().getBarcode().getXDimension().setPixels(2); // Save the output generator.save("C:\\Files\\Gs1CouponUpcaCode128.jpg");
我们还可以按照前面提到的步骤自定义条形码的外观。但是,在最后一步保存图像之前,我们需要指定其他属性。
下面的代码示例显示了如何在 Java 中自定义 GS1 128 优惠券的条形码外观。
// 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.UPCA_GS_1_CODE_128_COUPON); // Specify the code text generator.setCodeText("123456789012(8110)ASPOSE"); // Specify the X-dimension // the smallest width of the unit of BarCode bars or spaces generator.getParameters().getBarcode().getXDimension().setPixels(2); // Set coupon supplement space 50 pixels generator.getParameters().getBarcode().getCoupon().getSupplementSpace().setPixels(50); // Set Bar Height generator.getParameters().getBarcode().getBarHeight().setPixels(50); // Set Bar Color generator.getParameters().getBarcode().setBarColor(Color.RED); // Set Lable Color generator.getParameters().getBarcode().getCodeTextParameters().setColor(Color.BLUE); // Save the output generator.save("C:\\Files\\Gs1CouponAppearance.jpg");
以上便是如何在Java 中的 GS1-128 条码生成器,希望能帮到您,除此之外,你有其他方面的需求,也欢迎和我们互动,或这下体验我们更多的产品~
欢迎下载|体验更多Aspose产品
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com
在对装配体进行装配时,如何使用用SOLIDWORKS创建智能零部件,然后在插入到装配体中?一个模型示例告诉你。
本文将为大家介绍基于DevExpress的GridControl实现的一些界面处理功能,欢迎下载最新版组件体验!
本指南将向您展示如何通过 Spire.Doc for .NET 创建条码的方法。
可在任何平台上生成和识别条形码。
Aspose.Cells for .NET专业的电子表格控件,无需MS Excel也可满足一切Excel表格功能。
Aspose.Words for .NET无需Microsoft Word也可在任何平台上满足Word文档的一切操作需求。
Aspose.PDF for .NETPDF文档创建组件,无需Adobe Acrobat,也可以在任何平台上操作PDF文档。
服务电话
重庆/ 023-68661681
华东/ 18183052121
华南/ 18100878085
华北/ 17382392642
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@evget.com
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
慧都科技有限公司 版权所有 Copyright 2003-2023 渝ICP备12000582号-13 渝公网安备
50010702500608号