Штрихкоды для JasperReports и JasperServer
- Рендеринг 80+ barcode symbologies, включая 1D, 2D и postal форматы
- Работает с JasperReports и JasperServer на Java SE (J2SE) 5+
- Форматы вывода: PNG, JPEG, TIFF, BMP, GIF, EXIF, а также SVG и EMF
Добавьте штрихкод в шаблон JasperReports
// Build report from JRXML + export to PDF (minimal example)
ReportBuilder rb = new ReportBuilder(); rb.setPatternFilePath(path + "builder-params1.jrxml"); rb.addReportParameter("barcode-title1", "EAN14");
BarcodeAttributesGroup g = new BarcodeAttributesGroup("barcode-attributes1");
g.addBarcodeAttribute(BarcodeAttributeName.CodeText, "EAN14");
g.addBarcodeAttribute(BarcodeAttributeName.EncodeType, EncodeTypes.EAN_14);
rb.addBarcodeAttributesGroup(g);
JasperPrint jp = rb.compileReport().getJasperPrint();
JRPdfExporter ex = new JRPdfExporter();
ex.setExporterInput(new SimpleExporterInput(jp));
ex.setExporterOutput(new SimpleOutputStreamExporterOutput(new FileOutputStream(out + "builder-params1.pdf")));
ex.exportReport();
Вывод штрихкодов под ваш JasperReports workflow
Aspose.BarCode for JasperReports — чистое Java‑расширение, которое развёртывается как один JAR. Оно позволяет авторам отчётов размещать штрихкоды в отчётах без построения отдельного сервиса рендеринга. Это полезно для инвойсов, shipping labels, билетов и внутренних форм, где важны размер и чёткость штрихкода.
Развёртывание одним JAR
Развёртывайте, просто скопировав один JAR в нужное место для JasperReports или JasperServer. Это упрощает настройку в разных средах.
Штрихкоды генерируются во время рендеринга отчёта
Связывайте значения штрихкода с полями и параметрами dataset отчёта. Штрихкод рендерится как часть обычного export и print workflow.
Форматы вывода, удобные для печати
Рендерьте растровые изображения для типичных экспортов или используйте SVG и EMF, когда нужно чёткое масштабирование для print layouts.
Широкое покрытие symbology
Используйте популярные 1D и 2D форматы в одном reporting stack, включая QR Code, Data Matrix, PDF417 и Code 128.
Стандарты? Поддерживаются.
Aspose.BarCode for JasperReports поддерживает все основные форматы изображений, включая векторные форматы SVG и EMF, а также PDF. Используйте наш API, чтобы распознавать files со сканеров или камер без лишних усилий. Ниже — все поддерживаемые barcode symbologies, включая 1D, 2D, postal и composite типы. Каждый из них можно генерировать и распознавать на всех поддерживаемых платформах.
Matrix / 2D Codes
- QR Code, MicroQR, rMQR
- Data Matrix, Industrial Data Matrix (DPM)
- Aztec
- Han Xin
- MaxiCode
- DotCode
Linear / 1D Codes
- UPCA, UPCE
- EAN13, EAN14, EAN8
- Code 128
- DataBar
- ITF
- Postal
Industry & Composite Codes
- GS1
- ECI
- Composite barcodes
- HIBC
- SwissQR
- Royal Mailmark
Системные требования и варианты развёртывания
Aspose.BarCode for JasperReports работает на Java SE (J2SE) 5.0 и выше и интегрируется с JasperReports и JasperServer. В документации продукта указана совместимость с JasperReports 2.0+ и 3.0+. Вы можете использовать Maven для управления зависимостями или скачать пакет JAR и развёрнуть его в установку JasperReports или JasperServer.
Пример кода: параметризованный стиль штрихкода в JasperReports
Определите содержимое штрихкода и визуальные атрибуты как переиспользуемую группу, передайте значения через параметры отчёта, скомпилируйте шаблон JRXML и экспортируйте аккуратный PDF — всё это в чистом code‑first workflow с Aspose.BarCode for JasperReports.
// Input JRXML template path + output PDF path
String patternFilePath = path + "builder-params1.jrxml";
String reportFilePath = out + "builder-params1.pdf";
// Create ReportBuilder (main entry point for assembling the report)
ReportBuilder reportBuilder = new ReportBuilder();
// Define a reusable barcode attributes group (styling + barcode content settings)
BarcodeAttributesGroup attributesGroup = new BarcodeAttributesGroup("barcode-attributes1");
attributesGroup.addBarcodeAttribute(BarcodeAttributeName.CodeText, "EAN14");
attributesGroup.addBarcodeAttribute(BarcodeAttributeName.EncodeType, EncodeTypes.EAN_14);
attributesGroup.addBarcodeAttribute(BarcodeAttributeName.ForeColor, new Color(85, 107, 47));
attributesGroup.addBarcodeAttribute(BarcodeAttributeName.BackColor, new Color(245, 245, 220));
attributesGroup.addBarcodeAttribute(BarcodeAttributeName.BorderColor, new Color(39, 64, 139));
attributesGroup.addBarcodeAttribute(BarcodeAttributeName.BorderVisible, true);
attributesGroup.addBarcodeAttribute(BarcodeAttributeName.BorderWidth, 2);
attributesGroup.addBarcodeAttribute(BarcodeAttributeName.BorderDashStyle, DashStyle.Solid);
// Attach the barcode attributes group + provide report parameters used by the template
reportBuilder.addBarcodeAttributesGroup(attributesGroup);
reportBuilder.addReportParameter("barcode-title1", "Barcode for EAN14");
reportBuilder.addReportParameter("report-title", "Example of ReportBuilder with customer's parameters");
reportBuilder.addReportParameter("author", "Report prepared By Alex");
reportBuilder.setPatternFilePath(patternFilePath);
// Compile the template and get JasperPrint (ready-to-export report instance)
JasperPrint jasperPrint = reportBuilder.compileReport().getJasperPrint();
// Configure PDF exporter (input JasperPrint + PDF settings)
JRPdfExporter exporter = new JRPdfExporter();
ExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
exporter.setExporterInput(exporterInput);
PdfExporterConfiguration pdfExporterConfiguration = new SimplePdfExporterConfiguration();
exporter.setConfiguration(pdfExporterConfiguration);
// Prepare output stream and run export to PDF file
File saveToFile = new File(reportFilePath);
OutputStream outputStream = new FileOutputStream(saveToFile);
SimpleOutputStreamExporterOutput outputStreamExporterOutput = new SimpleOutputStreamExporterOutput(outputStream);
exporter.setExporterOutput(outputStreamExporterOutput);
exporter.exportReport();
Штрихкоды в отчётах для биллинга, логистики и операций
JasperReports часто используют для выпуска документов, которые проходят через операционные системы. Добавление штрихкодов делает такие документы сканируемыми и снижает ручной ввод.
- Invoices и statements: кодируйте document IDs и customer references
- Shipping labels и packing slips: добавляйте tracking codes и internal routing IDs
- Tickets и passes: генерируйте 2D штрихкоды для компактных payloads
- Asset и inventory reports: добавляйте сканируемые идентификаторы для reconciliation workflows
- Изображения для экспорта: PNG, JPEG, TIFF, BMP, GIF, EXIF, плюс SVG и EMF
Создано для JasperReports‑команд
Чистое Java‑расширение, поставляемое одним JAR
Используйте поля и параметры JasperReports для формирования значений штрихкода
Вывод в распространённые растровые и векторные форматы для печати
Работает в развёртываниях JasperReports и JasperServer
80+ barcode symbologies в семействах 1D, 2D и postal
Примеры и руководства по интеграции и настройке