لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI تاریخ شمسی… --:--:--

Add images and barcodes

آزاد تازه‌وارد تاییدشده امن

کارهای تکراری ترمینال، مدیریت شاخه‌ها، نوشتن پیام کامیت استاندارد و ساخت اسکریپت‌های کمکی را سریع و یکدست انجام می‌دهد. (شامل ۱۰ گام عملی · سازگار با Claude Code).

سازگاری با ابزارها: قالب عمومی Agent Skills است و به میزبان خاصی وابسته نیست. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: images-barcodes
description: Add and debug images and barcodes in JasperReports, including packaged image resources, image expressions and streams, missing-image handling, scaling, SVG, the barcode4j and Barbecue components, their module dependencies, barcode value validation and independent decoding of the output. Use when a logo or picture is missing or fails the fill, a barcode does not compile, fails on some values or does not scan, or barcodes must be proven to encode the right data; not for generating barcodes outside a JasperReports workflow, or for charts.
---

# Add images and barcodes

## Establish the image and barcode contract

Identify the exact engine, Java and barcode module versions, where each image comes from (a resource packaged in the application, a file, a URL, a database column or a stream), what must happen when an image is missing, each barcode symbology and the value it must encode, the allowed characters and check digits, the printed size and target resolution, and the export formats. Ask for sample values, including invalid ones, instead of guessing.

## Workflow

1. Load images as resources. Write `<element kind="image">` with an `<expression>` that yields a resource path such as `"images/logo.png"`, which the 7.x repository resolves on the classpath of the running application, or pass an `InputStream`, `byte[]` or `java.awt.Image` through a parameter or field. Do not hardcode absolute paths that only exist on one machine; package the asset in the application and use the same relative path everywhere.
2. Decide the missing-image policy. In the tested 7.1.1 runtime a path that cannot be resolved fails the fill with `Byte data not found at: images/missing.png.` With `onErrorType="Blank"` the element prints empty, and with `onErrorType="Icon"` it prints a broken-image icon. A null image expression prints an empty image without failing. Keep the default error for required assets such as logos on legal documents, and use `Blank` or `Icon` only where a missing picture is acceptable, not to hide a packaging bug.
3. Size images deliberately. The default `scaleImage` is `RetainShape`; choose `Clip`, `FillFrame`, `RealHeight` or `RealSize` explicitly when the source size varies, and set `hImageAlign`/`vImageAlign`. For SVG images, check that the SVG rendering dependencies are on the application classpath and that each export format renders them, because this path is not covered by the tested fixtures.
4. Add the barcode module. In 7.x barcode4j components need `net.sf.jasperreports:jasperreports-barcode4j`, and Barbecue components need `net.sf.jasperreports:jasperreports-barbecue`, both at the engine version. Without the module, compiling fails with `Could not resolve type id 'barcode4j:Code128' as a subtype of ...`; treat it as a missing runtime dependency.
5. Write 7.x barcode syntax. Use `<element kind="component">` containing `<component kind="barcode4j:Code128">` (or `barcode4j:QRCode`, `barcode4j:EAN13`, `barcode4j:DataMatrix` and others) or `<component kind="barbecue" type="Code128">`, with a `<codeExpression>`. Convert 6.x `<componentElement><jr:Code128>` forms instead of mixing syntaxes.
6. Validate values before the fill. In the tested runtime a null code expression prints no barcode element at all. Invalid data fails the fill with an unchecked `JRRuntimeException` rather than a `JRException`, for example `Checksum is bad (2). Expected: 1` for an EAN-13 with a wrong check digit and `Invalid characters found. Valid are 0-9 only.` for letters; passing 12 digits lets EAN-13 add the check digit. Validate or normalize values upstream, and catch the unchecked exception where a whole batch must not fail for one row.
7. Size barcodes for scanning. Barcodes keep their shape and shrink to fit the element, so a long value in a narrow element can become unreadable at print resolution; in 7.1.1 a 17-character Code128 in a 60-point-wide element decodes from an 8x rendering but not from a 4x one. Give 1D barcodes enough width for their module count and quiet zones, and size 2D codes for the data and error-correction level.

## Validate and deliver

Fill with valid, boundary, null and invalid values in the packaged application or a test classpath that mirrors it. Always include a test that fills with an image path that is not packaged and asserts the chosen policy: the `Byte data not found` failure for required images, or the blank or icon element for optional ones. Render each page (for example with `JasperPrintManager.printPageToImage`) or the exported output at the target resolution, crop each barcode with a quiet zone, and decode it with an independent decoder such as ZXing, asserting the decoded text equals the source value. Check exported files for the images they must contain; in the tested PDF export, a bitmap logo is an image object and barcode4j barcodes are vector forms. Present the behaviors described here as documented 7.1.1 behavior, not as results you observed, unless you ran the check yourself. State commands and results, and label any symbology, export format, SVG image, scanner or print resolution you could not test as unverified.

## Sources

- [Sample reference](https://jasperreports.sourceforge.net/sample.reference/README.html)
- [Schema reference](https://jasperreports.sourceforge.net/schema.reference.html)
- [API](https://jasperreports.sourceforge.net/api/index.html)


— ‹guest · 2026-11-29› —

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
رسانه و فایل
✦ Pro

DOCX creation, editing, and analysis

برای کارهای رسانه و فایل، «DOCX creation, editing, and analysis» یک راهنمای کوتاه و روشن است: مسیر «پردازش اسناد، PDF و…

⚡ /docx SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
رسانه و فایل
✦ Pro

PDF Processing Guide

«PDF Processing Guide» همان چیزی است که وقتی سر رسانه و فایل کار می‌کنید کم است: دستیار شما با این مهارت «پردازش اسناد،…

⚡ /pdf SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
رسانه و فایل
✦ Pro

PPTX creation, editing, and analysis

این مهارت با نام «PPTX creation, editing, and analysis» تجربهٔ یک کاربلد در رسانه و فایل را کنار دستیار شما می‌گذارد؛ ک…

⚡ /pptx SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
رسانه و فایل
✦ Pro

Slack GIF Creator

«Slack GIF Creator» یک مهارت آماده در حوزهٔ رسانه و فایل است؛ به دستیار هوش مصنوعی شما یاد می‌دهد «خودکارسازی جریان کار…

⚡ /slack-gif-creator SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
رسانه و فایل
✦ Pro

Audio Jingle Skill

در ساخت، تبدیل، برش، زیرنویس‌گذاری یا تولید محتوای چندرسانه‌ای (ویدیو، صوت، پادکست و تصویر) با ابزارهای تخصصی کمک می‌کن…

⚡ /audio-jingle SKILL.md
Claude / Claude CodeOpenAI Codex +۱
۹۶/۱۰۰ ★ ۱۰۹,۵۹۶
رسانه و فایل
✦ Pro

Changelog → Branded Video

برای کدها، APIها و تغییرات پروژه مستندات تمیز، README کاربردی و گزارش تغییرات (Changelog) قابل فهم می‌نویسد. (شامل ۹ گا…

⚡ /changelog-video SKILL.md
Claude / Claude CodeOpenAI Codex +۲
۹۶/۱۰۰ ★ ۹۰,۱۴۸