From cacd645eea1c7caaa3293e0eb00f0ed9527b91e5 Mon Sep 17 00:00:00 2001 From: Muhammad Adil Date: Sun, 9 Aug 2026 18:42:57 +0000 Subject: [PATCH] Add 3 barcode python-java tutorials MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Categories: general Source: AI Search API Tutorials: - Create barcode image in C# – complete programming guide - Create barcode image with C# barcode generator – guide - Create 4‑column databar barcode in C# – step‑by‑step guide Auto-generated by Professionalize.Tutorials Agent --- .../_index.md | 241 ++++++++++++++ .../_index.md | 303 +++++++++++++++++ .../_index.md | 224 +++++++++++++ .../_index.md | 240 ++++++++++++++ .../_index.md | 299 +++++++++++++++++ .../_index.md | 222 +++++++++++++ .../_index.md | 241 ++++++++++++++ .../_index.md | 303 +++++++++++++++++ .../_index.md | 224 +++++++++++++ .../_index.md | 240 ++++++++++++++ .../_index.md | 303 +++++++++++++++++ .../_index.md | 223 +++++++++++++ .../_index.md | 243 ++++++++++++++ .../og-image.png | Bin 0 -> 52405 bytes .../_index.md | 305 +++++++++++++++++ .../og-image.png | Bin 0 -> 51188 bytes .../_index.md | 226 +++++++++++++ .../og-image.png | Bin 0 -> 49823 bytes .../_index.md | 242 ++++++++++++++ .../_index.md | 303 +++++++++++++++++ .../_index.md | 225 +++++++++++++ .../_index.md | 240 ++++++++++++++ .../_index.md | 307 ++++++++++++++++++ .../_index.md | 227 +++++++++++++ .../_index.md | 243 ++++++++++++++ .../_index.md | 306 +++++++++++++++++ .../_index.md | 227 +++++++++++++ .../_index.md | 239 ++++++++++++++ .../_index.md | 305 +++++++++++++++++ .../_index.md | 225 +++++++++++++ .../_index.md | 237 ++++++++++++++ .../_index.md | 299 +++++++++++++++++ .../_index.md | 222 +++++++++++++ .../_index.md | 240 ++++++++++++++ .../_index.md | 303 +++++++++++++++++ .../_index.md | 225 +++++++++++++ .../_index.md | 242 ++++++++++++++ .../_index.md | 306 +++++++++++++++++ .../_index.md | 225 +++++++++++++ .../_index.md | 239 ++++++++++++++ .../_index.md | 303 +++++++++++++++++ .../_index.md | 225 +++++++++++++ .../_index.md | 240 ++++++++++++++ .../_index.md | 299 +++++++++++++++++ .../_index.md | 223 +++++++++++++ .../_index.md | 239 ++++++++++++++ .../_index.md | 301 +++++++++++++++++ .../_index.md | 223 +++++++++++++ .../_index.md | 240 ++++++++++++++ .../_index.md | 306 +++++++++++++++++ .../_index.md | 226 +++++++++++++ .../_index.md | 239 ++++++++++++++ .../_index.md | 305 +++++++++++++++++ .../_index.md | 225 +++++++++++++ .../_index.md | 239 ++++++++++++++ .../_index.md | 303 +++++++++++++++++ .../_index.md | 227 +++++++++++++ .../_index.md | 242 ++++++++++++++ .../_index.md | 306 +++++++++++++++++ .../_index.md | 226 +++++++++++++ .../_index.md | 242 ++++++++++++++ .../_index.md | 303 +++++++++++++++++ .../_index.md | 225 +++++++++++++ .../_index.md | 239 ++++++++++++++ .../_index.md | 301 +++++++++++++++++ .../_index.md | 223 +++++++++++++ .../_index.md | 242 ++++++++++++++ .../_index.md | 303 +++++++++++++++++ .../_index.md | 223 +++++++++++++ .../_index.md | 241 ++++++++++++++ .../_index.md | 306 +++++++++++++++++ .../_index.md | 223 +++++++++++++ 72 files changed, 17672 insertions(+) create mode 100644 barcode/arabic/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/arabic/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/arabic/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/chinese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/chinese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/chinese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/czech/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/czech/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/czech/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/dutch/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/dutch/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/dutch/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/english/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/english/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/og-image.png create mode 100644 barcode/english/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/english/python-java/general/create-barcode-image-in-c-complete-programming-guide/og-image.png create mode 100644 barcode/english/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/english/python-java/general/create-barcode-image-with-c-barcode-generator-guide/og-image.png create mode 100644 barcode/french/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/french/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/french/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/german/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/german/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/german/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/greek/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/greek/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/greek/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/hindi/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/hindi/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/hindi/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/hongkong/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/hongkong/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/hongkong/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/hungarian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/hungarian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/hungarian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/indonesian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/indonesian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/indonesian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/italian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/italian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/italian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/japanese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/japanese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/japanese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/korean/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/korean/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/korean/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/polish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/polish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/polish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/portuguese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/portuguese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/portuguese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/russian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/russian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/russian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/spanish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/spanish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/spanish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/swedish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/swedish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/swedish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/thai/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/thai/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/thai/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/turkish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/turkish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/turkish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md create mode 100644 barcode/vietnamese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md create mode 100644 barcode/vietnamese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md create mode 100644 barcode/vietnamese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md diff --git a/barcode/arabic/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/arabic/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..080cbefc1 --- /dev/null +++ b/barcode/arabic/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,241 @@ +--- +category: general +date: 2026-08-09 +description: أنشئ باركود داتابار بأربعة أعمدة في C# بسرعة باستخدام Aspose.BarCode. + تعلّم كيفية ضبط الأعمدة والصفوف وحفظ صور PNG في هذا الدليل المختصر. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: ar +lastmod: 2026-08-09 +og_description: إنشاء باركود داتابار بأربعة أعمدة في C# باستخدام Aspose.BarCode، ثم + تخصيص الصفوف وتصدير صور PNG لتطبيقك. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: إنشاء باركود داتابار بأربعة أعمدة في C# – دليل سريع +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: إنشاء باركود داتابار بأربع أعمدة في C# – دليل خطوة بخطوة +url: /ar/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# إنشاء باركود DataBar بأربعة أعمدة في C# – دليل خطوة بخطوة + +إذا كنت بحاجة إلى **إنشاء باركود DataBar بأربعة أعمدة** في C#، فإن هذا الدليل يوضح لك بالضبط كيفية ذلك. سنستعرض عملية إنشاء باركود DataBar Expanded Stacked، وضبط أربعة أعمدة، وحفظ النتيجة كصورة PNG. + +في هذا الدليل ستتعلم كيف: + +* تهيئة `BarcodeGenerator` لرمز **DataBar Expanded Stacked**. +* ضبط عدد الأعمدة إلى 4 (المتطلب الأساسي). +* تعديل عدد الصفوف عندما تحتاج إلى تخطيط مكدس مع ثلاثة صفوف. +* تصدير الباركود كملف PNG باستخدام **تنسيق صورة الباركود** المناسب. + +كل ما تحتاجه هو مكتبة Aspose.BarCode for .NET (الإصدار 23.10 أو أحدث) وبيئة تطوير .NET 6+ مثل Visual Studio 2022. لا توجد تبعيات إضافية مطلوبة. + +--- + +## كيفية إنشاء باركود DataBar بأربعة أعمدة + +الخطوة الأولى هي إنشاء كائن `BarcodeGenerator` يستهدف رموز **DataBar Expanded Stacked**. هذه الفئة تغلف جميع خيارات العرض، مما يجعل من السهل التبديل بين التخطيطات القائمة على الأعمدة أو الصفوف. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**لماذا هذا يعمل:** +`EncodeTypes.DatabarExpandedStacked` يخبر Aspose.BarCode بإنتاج النسخة المكدسة من عائلة DataBar. خاصية `DataBar.Columns` تتحكم في عدد الوحدات العمودية التي يشغلها الباركود. ضبطها على 4 يطابق المتطلب لإنشاء **باركود DataBar بأربعة أعمدة**. أخيرًا، `Save` يكتب التمثيل البصري على القرص باستخدام **تنسيق صورة الباركود** `Png`. + +### تكوين أعمدة DataBar Expanded Stacked + +إذا كنت بحاجة إلى عدد أعمدة مختلف، ما عليك سوى تغيير القيمة الصحيحة المخصصة لـ `Columns`. الخاصية تقبل قيمًا من 1 إلى 4 للنسخة المكدسة الموسعة. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*نصيحة احترافية:* اختبر دائمًا الباركود المُولد باستخدام ماسح يدعم عائلة DataBar، لأن المظهر البصري وحده لا يضمن القابلية للقراءة. + +### حفظ صورة الباركود + +تُوفر تعداد `BarCodeImageFormat` عدة خيارات (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG غير مضغوط ويعمل جيدًا لمعظم سيناريوهات الويب وسطح المكتب. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +إذا كنت بحاجة إلى تنسيق مختلف، استبدل `Png` بالقيمة المطلوبة من التعداد. يمكن تضمين الملف المحفوظ مباشرةً في HTML أو PDFs أو طباعته على الملصقات. + +## إنشاء باركود بصفوف مخصصة + +أحيانًا يكون التخطيط المكدس مطلوبًا بعدد محدد من الصفوف بدلاً من الأعمدة. نفس الفئة `BarcodeGenerator` تُظهر خاصية `Rows` لهذا الغرض. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**لماذا الصفوف مهمة:** +عندما يكون الباركود المكدس أطول من عرضه، تحدد خاصية `Rows` عدد الشرائح الأفقية التي يُقسم إليها الرمز. ضبط `Rows = 3` يُنشئ باركودًا مكدسًا بثلاثة صفوف، وهو مفيد لعروض الملصقات الضيقة. + +### ضبط صفوف الباركود ديناميكيًا + +يمكنك حساب عدد الصفوف في وقت التشغيل بناءً على بيانات الإدخال: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +هذه المرونة تتيح لك **ضبط صفوف الباركود** دون الحاجة إلى إعادة تجميع التطبيق. + +## مثال كامل من البداية إلى النهاية + +فيما يلي برنامج واحد يُنشئ كلًا من باركود بأربعة أعمدة وباركود بثلاثة صفوف، موضحًا كيفية ت coexistence التكوينين. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**الناتج المتوقع:** +ظهر ملفان PNG في دليل العمل الخاص بالتطبيق: + +* `DatabarCols4.png` – باركود DataBar Expanded Stacked بأربعة أعمدة عمودية. +* `DatabarRows3.png` – نفس الرمز مُرتب في ثلاثة صفوف أفقية. + +يمكن فتح الصورتين في أي عارض صور أو تضمينهما في عنصر واجهة مستخدم. + +--- + +## أسئلة شائعة وحالات خاصة + +| السؤال | الجواب | +|----------|--------| +| *هل يمكنني استخدام رموز باركود مختلفة؟* | نعم. استبدل `EncodeTypes.DatabarExpandedStacked` بقيمة `EncodeTypes` أخرى (مثل `EncodeTypes.QR`)، لكن خاصيتي `Columns` و `Rows` خاصة بعائلات DataBar. | +| *ماذا لو تجاوز نص البيانات الحد الأقصى للطول؟* | تدعم رموز DataBar Expanded Stacked ما يصل إلى 61 حرفًا رقميًا. تجاوز هذا الحد يُطلق استثناء `ArgumentException`. تحقق من صحة الإدخال قبل تمريره إلى المُولد. | +| *هل يجب إغلاق `BarcodeGenerator`؟* | `BarcodeGenerator` يُطبق الواجهة `IDisposable`. في خدمة طويلة التشغيل، غلفه بكتلة `using` أو استدعِ `Dispose()` يدويًا لتحرير الموارد الأصلية. | +| *هل يمكنني إنشاء SVG بدلاً من PNG؟* | بالتأكيد. استخدم `BarCodeImageFormat.Svg` في طريقة `Save`. | +| *هل المكتبة متوافقة مع .NET Core؟* | Aspose.BarCode for .NET يدعم .NET Core 3.1، .NET 5، .NET 6 وما بعده. لا تحتاج إلى تعديل الكود. | + +--- + +## الخلاصة + +أنت الآن تعرف كيف **تنشئ باركود DataBar بأربعة أعمدة** في C# باستخدام Aspose.BarCode، وكيفية تعديل التخطيط بالصفوف، وكيفية تصدير النتيجة بتنسيق **صورة باركود** ملائم. يُظهر المثال الكامل كلًا من التكوينات القائمة على الأعمدة والصفوف، مما يمنحك أساسًا قويًا لأي سيناريو طباعة ملصقات أو مسح ضوئي عبر الهاتف المحمول. + +**الخطوات التالية** + +* جرّب أحمال بيانات مختلفة وتحقق من توافقها مع الماسحات. +* استكشف خيارات تنسيق إضافية مثل ألوان المقدمة/الخلفية (`generator.Parameters.Barcode.Color`). +* دمج الباركود مع رسومات أخرى باستخدام واجهة `Graphics` لتصميم ملصقات مخصص. + +لا تتردد في تعديل الكود لمشاريع ASP.NET Core أو Windows Forms أو Xamarin—Aspose.BarCode يعمل عبر جميع منصات .NET. برمجة سعيدة! + +## ما الذي ينبغي أن تتعلمه بعد ذلك؟ + +الدروس التالية تغطي مواضيع ذات صلة وثيقة تُبنى على التقنيات الموضحة في هذا الدليل. كل مورد يتضمن أمثلة شاملة مع شروحات خطوة بخطوة لمساعدتك على إتقان ميزات API إضافية واستكشاف أساليب تنفيذ بديلة في مشاريعك. + +- [إنشاء صورة باركود DotCode – الصفوف والأعمدة (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [إنشاء صورة باركود c# – تكوين صفوف وأعمدة Codablock F](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [كيفية إنشاء نص رمزي موسع لـ dotcode باستخدام Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/arabic/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/arabic/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..f4d1515b2 --- /dev/null +++ b/barcode/arabic/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,303 @@ +--- +category: general +date: 2026-08-09 +description: إنشاء صورة باركود في C# باستخدام هذا الدليل خطوة بخطوة. تعلّم كيفية توليد + الباركود، وضبط ارتفاع الباركود بالبكسل، وإنشاء عدة باركودات بكفاءة. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: ar +lastmod: 2026-08-09 +og_description: أنشئ صورة باركود في C# بسرعة. اتبع هذا الدرس لتتعلم كيفية إنشاء الباركود، + وضبط ارتفاعه بالبكسل، وإنتاج عدة باركودات. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: إنشاء صورة باركود في C# – دليل كامل للمطورين +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: إنشاء صورة الباركود في C# – دليل برمجي كامل +url: /ar/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# إنشاء صورة الباركود في C# – دليل برمجة شامل + +إذا كنت بحاجة إلى **إنشاء صورة باركود** في تطبيق .NET، يوضح لك هذا الدليل بالضبط **كيفية توليد الباركود** باستخدام مكتبة Aspose.BarCode. ستتعرف على كيفية التحكم في **ارتفاع الباركود بوحدات البكسل**، حفظ الصورة، وإنتاج **باركودات متعددة** دون تكرار الشيفرة. + +يغطي الدرس كل شيء من تثبيت الحزمة إلى تخصيص الأبعاد، بحيث يمكنك نسخ‑لصق مثال جاهز للتنفيذ في مشروعك اليوم. + +## المتطلبات المسبقة + +قبل أن تبدأ، تأكد من وجود ما يلي: + +* .NET 6.0 SDK أو أحدث مثبت +* Visual Studio 2022 (أو أي بيئة تطوير C#) +* حزمة NuGet `Aspose.BarCode` – تثبيت عبر + +```bash +dotnet add package Aspose.BarCode +``` + +لا توجد تبعيات إضافية مطلوبة. + +## كيفية توليد صورة باركود باستخدام BarcodeGenerator في C# + +الفئة الأساسية لإنشاء صورة باركود هي `BarcodeGenerator`. فهي تغلف نوع الترميز، سلسلة البيانات، وجميع معلمات العرض. + +### الخطوة 1: تحديد مجلد الإخراج + +اختر مجلدًا سيُحفظ فيه ملفات PNG المُولدة. استخدام مسار مطلق يجنب مفاجآت الأذونات. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **لماذا؟** إنشاء المجلد برمجيًا يضمن نجاح استدعاءات `Save` اللاحقة حتى على جهاز جديد. + +### الخطوة 2: إنشاء كائن مولد الباركود + +لإنشاء باركود DataBar Omnidirectional، مرّر `EncodeTypes.DatabarOmniDirectional` وسلسلة البيانات GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **ملاحظة:** كائن `BarcodeGenerator` قابل لإعادة الاستخدام؛ يمكنك تغيير معاييره بين عمليات الحفظ **لإنشاء باركودات متعددة** من نفس البيانات. + +### الخطوة 3: ضبط معلمات الباركود العامة + +أكثر التعديلات البصرية شيوعًا هي بُعد X (عرض الوحدة) وارتفاع الشريط. كلاهما يُعبَّر عنهما بوحدات البكسل. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **لماذا ضبط بُعد X؟** بُعد X أصغر ينتج دقة أعلى، وهو أمر مهم عندما تُطبع الصورة أو تُعرض على شاشات عالية الـ DPI. + +### الخطوة 4: حفظ صورة الباركود الأولى + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +الملف `DatabarBarHeight30Pixels.png` الآن يحتوي على باركود DataBar Omnidirectional بارتفاع 30 بكسل. + +### الخطوة 5: تعديل ارتفاع الباركود بوحدات البكسل + +تغيير الارتفاع لا يتطلب إنشاء كائن `BarcodeGenerator` جديد—فقط عدّل المعامل. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### الخطوة 6: حفظ صورة الباركود الثانية + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +الآن لديك ملفا PNG بارتفاعات **باركود مختلفة بوحدات البكسل**، مما يوضح مدى سهولة **إنشاء صورة باركود** بتنوعات مختلفة. + +## ضبط ارتفاع الباركود بوحدات البكسل بشكل ديناميكي + +في كثير من الأحيان تحتاج إلى سلسلة من الباركودات بأارتفاعات تتطابق مع عناصر الواجهة أو الملصقات المطبوعة. الطريقة المساعدة التالية تج abstract عملية تغيير الارتفاع: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +يمكنك الآن استدعاء `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` لإنشاء **صورة باركود** بارتفاع 45 بكسل في سطر واحد. + +## إنشاء باركودات متعددة داخل حلقة + +عند وجود مجموعة من معرفات المنتجات، تُزيل حلقة `foreach` الحاجة إلى كتابة شيفرة مكررة. يوضح هذا المثال كيفية **إنشاء باركودات متعددة** من مصفوفة GTINs. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +تنتج الحلقة ثلاثة ملفات PNG، كل منها يحمل قيمة **ارتفاع باركود مختلفة بوحدات البكسل**. وبما أن الطريقة المساعدة `SaveBarcodeWithHeight` تتولى تعديل الارتفاع، يبقى الحلقة الرئيسية نظيفة ومركزة على البيانات. + +### النتيجة المتوقعة + +بعد تشغيل العينة الكاملة، يحتوي مجلد `Barcodes` على: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +فتح أي ملف PNG يظهر باركود DataBar Omnidirectional واضح يمكن مسحه بواسطة تطبيقات الهواتف المحمولة القياسية. + +## الأخطاء الشائعة ونصائح الخبراء + +| المشكلة | لماذا يحدث | كيفية تجنبه | +|-------|----------------|-----------------| +| **EncodeTypes غير صحيح** | استخدام نوع 1D لباركود DataBar ينتج صورة غير قابلة للقراءة. | اختر دائمًا `EncodeTypes.DatabarOmniDirectional` (أو أي نوع DataBar آخر) للحمولة GS1‑128. | +| **بُعد X غير كافٍ** | بُعد X منخفض جدًا قد يجعل الخطوط الرفيعة تختفي على الشاشات منخفضة الدقة. | حافظ على `XDimension.Pixels` ≥ 2 للعرض على الشاشة؛ وزّده إلى 3‑4 للطباعة. | +| **أخطاء مسار الملف** | قد تُحل المسارات النسبية إلى دلائل غير متوقعة. | استخدم `Path.Combine` و `Environment.CurrentDirectory` لبناء مسارات مطلقة. | +| **الكتابة فوق الصور** | إعادة استخدام نفس اسم الملف داخل حلقة يكتب فوق النتائج السابقة. | أضف معرفات فريدة (مثل GTIN أو طابع زمني) إلى اسم الملف. | +| **غياب حزمة NuGet** | الشيفرة تُجمع لكن تُطلق استثناء `FileNotFoundException` وقت التشغيل. | تأكد من تثبيت `Aspose.BarCode` وأن المشروع يشار إليه. | + +## مثال كامل يعمل + +فيما يلي البرنامج الكامل الذي يمكنك نسخه إلى تطبيق Console. يتضمن جميع الخطوات، الطرق المساعدة، ومعالجة الأخطاء. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +تشغيل هذا البرنامج + +## ماذا يجب أن تتعلم بعد ذلك؟ + +الدروس التالية تغطي مواضيع ذات صلة وثيقة تبني على التقنيات الموضحة في هذا الدليل. كل مصدر يتضمن أمثلة شيفرة كاملة مع شروحات خطوة‑بخطوة لمساعدتك على إتقان ميزات API إضافية واستكشاف أساليب تنفيذ بديلة في مشاريعك. + +- [إنشاء ارتفاع مخصص للباركود – باركودات أحادية الأبعاد](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [إنشاء صورة باركود C# – مثال GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [إنشاء صورة باركود DotCode – الصفوف والأعمدة (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/arabic/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/arabic/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..f1618e780 --- /dev/null +++ b/barcode/arabic/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-09 +description: إنشاء صورة باركود باستخدام مولد باركود C# وتعلم كيفية إنشاء عدة باركودات + بنسب أبعاد مخصصة في دقائق. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: ar +lastmod: 2026-08-09 +og_description: إنشاء صورة باركود باستخدام مولد باركود بلغة C#. يوضح هذا الدرس كيفية + إنشاء عدة باركودات، وضبط نسب الأبعاد، وحفظ ملفات PNG بكفاءة. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: إنشاء صورة باركود باستخدام مولد باركود C# – دليل سريع +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: إنشاء صورة الباركود باستخدام مولد الباركود C# – دليل +url: /ar/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# إنشاء صورة باركود باستخدام مولد باركود C# – دليل + +إذا كنت بحاجة إلى **إنشاء صورة باركود** بسرعة، يوضح لك هذا الدليل كيفية القيام بذلك باستخدام مولد باركود C#. ستتعلم كيفية توليد باركودات متعددة، تغيير نسبة العرض إلى الارتفاع، وحفظ كل صورة كملف PNG. + +توليد صور الباركود هو مهمة شائعة عند بناء أنظمة المخزون، نقاط البيع، أو ملصقات الشحن. بنهاية هذا البرنامج التعليمي ستحصل على ملفي PNG جاهزين للاستخدام يوضحان نسب عرض إلى ارتفاع مختلفة، وستفهم كيف يمكن توسيع النهج لتوليد أي عدد من الباركودات. + +## المتطلبات المسبقة + +قبل أن تبدأ، تأكد من وجود ما يلي: + +* .NET 6.0 SDK أو أحدث مثبت +* Visual Studio 2022 (أو أي بيئة تطوير تدعم C#) +* مرجع لمكتبة باركود تدعم DataBar Stacked Omnidirectional (على سبيل المثال، **Aspose.BarCode for .NET**). تستخدم مقاطع الشيفرة واجهة برمجة تطبيقات Aspose، لكن المفاهيم تنطبق على أي مكتبة ذات خصائص مشابهة. + +لا تحتاج إلى قاعدة بيانات منفصلة أو خادم ويب—هذا تطبيق كونسول بسيط. + +## الخطوة 1: إعداد مشروع الكونسول + +أنشئ مشروع كونسول جديد وأضف مكتبة الباركود عبر NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +أمر `dotnet add package` يجلب أحدث نسخة مستقرة من **Aspose.BarCode**، التي توفر الفئة `BarcodeGenerator` المستخدمة لاحقًا. + +## الخطوة 2: كتابة البرنامج الكامل + +افتح *Program.cs* واستبدل محتواه بالمثال الكامل أدناه. البرنامج ينشئ **صورة باركود**، يغير نسبة العرض إلى الارتفاع، ويحفظ ملفي PNG. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### لماذا كل جزء مهم + +* **Create barcode image** – يقوم مُنشئ `BarcodeGenerator` بتهيئة الكائن بالرمز المطلوب والبيانات. +* **c# barcode generator** – خاصية `Parameters` تمنحك التحكم الكامل في خيارات العرض؛ ضبط `XDimension.Pixels` يضمن وضوح كل شريط على الشاشة. +* **generate multiple barcodes** – بتغيير `DataBar.AspectRatio` بين عمليات الحفظ، ينتج نفس كائن المولد صورتين مميزتين دون الحاجة لإعادة إنشاء الكائن، مما يزيد الكفاءة. + +## الخطوة 3: تشغيل البرنامج وعرض النتائج + +نفّذ التطبيق: + +```bash +dotnet run +``` + +يجب أن ترى مخرجات كونسول مشابهة لـ: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +افتح مجلد `BarcodeOutputs`. ستجد ملفي PNG: + +* **DatabarAspectRatio15.png** – باركود مضغوط مناسب للملصقات ذات الارتفاع المحدود. +* **DatabarAspectRatio30.png** – باركود أطول يقرأه العديد من الماسحات الضوئية بشكل أكثر موثوقية من مسافة. + +كلا الصورتين جاهزتين للدمج في ملفات PDF، الطباعة على الإيصالات، أو الإرسال إلى تطبيق موبايل. + +## الخطوة 4: توسيع الحل لتوليد أي عدد من الباركودات + +النمط المعروض أعلاه يمكن توسيعه بسهولة: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – الحلقة تتكرر عبر مصفوفة من نسب العرض إلى الارتفاع، مُنشئة **صورة باركود** مميزة لكل قيمة. +* عدّل `EncodeTypes` أو السلسلة المشفرة لتوليد QR codes، Code 128، أو رموز أخرى دون تغيير المنطق الأساسي. + +## نصائح عملية ومخاطر شائعة + +| النصيحة | الشرح | +|-----|-------------| +| **إعادة استخدام نفس المولد** | إعادة تهيئة `BarcodeGenerator` لكل صورة يضيف عبئًا غير ضروري. تغيير المعلمات بين استدعاءات `Save` أسرع ويستهلك ذاكرة أقل. | +| **التحقق من مجلد الإخراج** | احرص دائمًا على استدعاء `Directory.CreateDirectory` قبل الحفظ؛ وإلا سيُطلق `Save` استثناء `DirectoryNotFoundException`. | +| **اختيار X‑dimension مناسب** | القيم البكسلية المنخفضة جدًا (مثلاً 1) قد تجعل الباركود غير قابل للقراءة على الشاشات منخفضة الدقة. قيم 2–3 تعمل جيدًا لمعظم الطابعات. | +| **الانتباه إلى الترميز** | يتوقع GS1 DataBar وجود بادئة `(01)` للـ GTIN. إذا حذفت الأقواس، قد تُنتج المكتبة باركودًا غير صالح. | +| **اختبار مع ماسح حقيقي** | الفحص البصري ليس كافيًا. اختبر ملفات PNG باستخدام جهاز الماسح الفعلي الذي تخطط لاستخدامه. | + +## النتيجة المتوقعة (وصف بصري) + +*كلا ملفي PNG يعرضان باركود DataBar Stacked Omnidirectional بلون داكن على خلفية فاتحة. النسخة ذات نسبة العرض إلى الارتفاع 15 أقصر، بينما النسخة ذات النسبة 30 تقريبًا أطول بمرتين.* + +إذا أدرجت الصور في مستند، ستظهر بوضوح لأننا ضبطنا `XDimension.Pixels = 2`. + +## الخلاصة + +أصبحت الآن تعرف كيف **تنشئ ملفات صورة باركود** باستخدام **مولد باركود C#**، ويمكنك **توليد باركودات متعددة** عبر تعديل نسبة العرض إلى الارتفاع أو أي معلمة أخرى. المثال الكامل القابل للتنفيذ يوضح أفضل الممارسات مثل إعادة استخدام كائن المولد، التعامل مع مجلدات الإخراج، والتحقق من إنشاء الملفات. + +الخطوات التالية قد تشمل: + +* إضافة ألوان مخصصة عبر `generator.Parameters.Barcode.Color` (الكلمة المفتاحية الثانوية: **c# barcode generator**) +* التصدير إلى صيغ أخرى مثل JPEG أو SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* دمج منطق إنشاء الباركود في Web API لتقديم الصور عند الطلب (الكلمة المفتاحية الثانوية) + +## ما الذي يجب أن تتعلمه بعد ذلك؟ + +الدروس التالية تغطي مواضيع ذات صلة وثيقة تبني على التقنيات الموضحة في هذا الدليل. كل مورد يتضمن أمثلة شيفرة كاملة مع شروحات خطوة بخطوة لمساعدتك على إتقان ميزات API إضافية واستكشاف أساليب تنفيذ بديلة في مشاريعك. + +- [إنشاء باركود PNG – نسبة عرض DataMatrix – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [دروس مولد الباركود c# – تخصيص نسب عرض باركود Code 16K مع Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [كيفية توليد باركود Aztec بنسبة عرض مخصصة باستخدام Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/chinese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/chinese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..234f9bb29 --- /dev/null +++ b/barcode/chinese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,240 @@ +--- +category: general +date: 2026-08-09 +description: 使用 Aspose.BarCode 在 C# 中快速创建 4 列 DataBar 条形码。在本简明指南中了解如何配置列、行并保存 PNG + 图像。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: zh +lastmod: 2026-08-09 +og_description: 使用 Aspose.BarCode 在 C# 中创建 4 列 DataBar 条形码,然后自定义行并导出 PNG 图像供您的应用使用。 +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: 在 C# 中创建四列 DataBar 条码 – 快速教程 +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: 在 C# 中创建 4 列 DataBar 条码 – 步骤指南 +url: /zh/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 在 C# 中创建 4 列 DataBar 条形码 – 步骤指南 + +如果您需要在 C# 中 **创建 4 列 DataBar 条形码**,本教程将精准演示。我们将逐步讲解生成 DataBar Expanded Stacked 条形码、配置四列以及将结果保存为 PNG 图像的过程。 + +在本指南中,您将学习如何: + +* 初始化用于 **DataBar Expanded Stacked** 符号的 `BarcodeGenerator`。 +* 将列数设置为 4(主要需求)。 +* 在需要三行堆叠布局时调整行数。 +* 使用相应的 **barcode image format** 将条形码导出为 PNG。 + +您只需使用 Aspose.BarCode for .NET 库(版本 23.10 或更高)以及 .NET 6+ 开发环境(如 Visual Studio 2022),无需其他依赖。 + +--- + +## 如何创建 4 列 DataBar 条形码 + +第一步是创建一个针对 **DataBar Expanded Stacked** 符号的 `BarcodeGenerator` 实例。该类封装了所有渲染选项,使在基于列和基于行的布局之间切换变得简单。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**工作原理说明:** +`EncodeTypes.DatabarExpandedStacked` 告诉 Aspose.BarCode 生成 DataBar 系列的堆叠版本。`DataBar.Columns` 属性控制条形码占用的垂直模块数量。将其设为 4 即满足 **创建 4 列 DataBar 条形码** 的要求。最后,`Save` 使用 **barcode image format** `Png` 将可视化表示写入磁盘。 + +### 配置 DataBar Expanded Stacked 列数 + +如果需要不同的列数,只需更改分配给 `Columns` 的整数。该属性在扩展堆叠变体中接受 1 到 4 的值。 + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*小贴士:* 始终使用支持 DataBar 系列的扫描仪测试生成的条形码,因为仅凭视觉外观并不能保证可读性。 + +### 保存条形码图像 + +`BarCodeImageFormat` 枚举提供了多种选项(`Png`、`Jpeg`、`Bmp`、`Gif`、`Tiff`)。PNG 为无损格式,适用于大多数 Web 和桌面场景。 + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +如果需要其他格式,只需将 `Png` 替换为相应的枚举值。保存的文件可以直接嵌入 HTML、PDF,或打印到标签上。 + +## 使用自定义行数创建条形码 + +有时需要在特定行数而非列数的堆叠布局。相同的 `BarcodeGenerator` 类提供了 `Rows` 属性来实现此目的。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**行数的重要性:** +当堆叠条形码的高度大于宽度时,`Rows` 属性决定符号被划分为多少水平切片。将 `Rows = 3` 设置为三行堆叠条形码,适用于标签宽度较窄的情况。 + +### 动态设置条形码行数 + +您可以根据输入数据在运行时计算行数: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +这种灵活性让您 **设置条形码行数** 而无需重新编译应用程序。 + +## 完整端到端示例 + +下面的单个程序同时生成 4 列条形码和 3 行条形码,演示两种配置如何共存。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**预期输出:** +两个 PNG 文件会出现在应用程序的工作目录中: + +* `DatabarCols4.png` – 具有四个垂直列的 DataBar Expanded Stacked 条形码。 +* `DatabarRows3.png` – 同一符号以三行水平排列的形式。 + +两张图片均可在任何图像查看器中打开,或嵌入 UI 控件。 + +--- + +## 常见问题与边缘情况 + +| 问题 | 答案 | +|----------|--------| +| *我可以使用其他条形码符号吗?* | 可以。将 `EncodeTypes.DatabarExpandedStacked` 替换为其他 `EncodeTypes` 值(例如 `EncodeTypes.QR`),但 `Columns` 和 `Rows` 属性仅适用于 DataBar 系列。 | +| *如果数据字符串超过最大长度怎么办?* | DataBar Expanded Stacked 符号最多支持 61 位数字字符。超出此限制会抛出 `ArgumentException`。请在将数据分配给生成器之前进行验证。 | +| *是否需要释放 `BarcodeGenerator`?* | `BarcodeGenerator` 实现了 `IDisposable`。在长期运行的服务中,建议使用 `using` 块或手动调用 `Dispose()` 来释放本机资源。 | +| *我可以生成 SVG 而不是 PNG 吗?* | 完全可以。在 `Save` 方法中使用 `BarCodeImageFormat.Svg`。 | +| *该库是否兼容 .NET Core?* | Aspose.BarCode for .NET 支持 .NET Core 3.1、.NET 5、.NET 6 及更高版本。无需代码更改。 | + +--- + +## 结论 + +现在,您已经掌握了如何在 C# 中使用 Aspose.BarCode **创建 4 列 DataBar 条形码**、如何通过行数调整布局,以及如何以便捷的 **barcode image format** 导出结果。完整示例展示了列式和行式两种配置,为任何标签打印或移动扫描场景提供了坚实的基础。 + +**后续步骤** + +* 试验不同的数据负载并验证扫描仪兼容性。 +* 探索更多样式选项,如前景/背景颜色(`generator.Parameters.Barcode.Color`)。 +* 使用 `Graphics` API 将条形码与其他图形组合,实现自定义标签设计。 + +欢迎将代码迁移到 ASP.NET Core、Windows Forms 或 Xamarin 项目——Aspose.BarCode 在所有 .NET 平台上均可使用。祝编码愉快! + +## 接下来您应该学习什么? + +以下教程涵盖与本指南技术紧密相关的主题,帮助您进一步掌握 API 功能并在项目中探索替代实现方式,每篇资源均提供完整可运行的代码示例和逐步解释。 + +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Create barcode image c# – Configure Codablock F Rows & Columns](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [How to create dotcode extended codetext with Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/chinese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/chinese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..8da46c70d --- /dev/null +++ b/barcode/chinese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,299 @@ +--- +category: general +date: 2026-08-09 +description: 使用本分步指南在 C# 中创建条形码图像。学习如何生成条形码、调整条形码高度像素,并高效地创建多个条形码。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: zh +lastmod: 2026-08-09 +og_description: 快速在 C# 中创建条形码图像。请按照本教程学习如何生成条形码、设置条形码高度像素以及生成多个条形码。 +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: 在 C# 中创建条形码图像 – 开发者完整指南 +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: 在 C# 中创建条形码图像——完整编程指南 +url: /zh/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 在 C# 中创建条形码图像 – 完整编程指南 + +如果您需要在 .NET 应用程序中**创建条形码图像**,本指南将向您展示如何使用 Aspose.BarCode 库**生成条形码**。您将了解如何控制**条形码高度像素**、保存图像以及在不重复代码的情况下**生成多个条形码**。 + +本教程涵盖了从安装包到自定义尺寸的全部内容,您可以直接复制粘贴一个可直接运行的示例到您的项目中。 + +## 前提条件 + +* .NET 6.0 SDK 或更高版本已安装 +* Visual Studio 2022(或任何 C# IDE) +* NuGet 包 `Aspose.BarCode` – 使用以下方式安装 + +```bash +dotnet add package Aspose.BarCode +``` + +无需其他依赖项。 + +## 使用 BarcodeGenerator C# 生成条形码图像 + +用于创建条形码图像的核心类是 `BarcodeGenerator`。它封装了编码类型、数据字符串以及所有渲染参数。 + +### 步骤 1:定义输出文件夹 + +选择一个用于存放生成的 PNG 文件的文件夹。使用绝对路径可以避免权限问题。 + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **为什么?** 以编程方式创建文件夹可确保即使在全新机器上,后续的 `Save` 调用也能成功。 + +### 步骤 2:实例化条形码生成器 + +对于 DataBar Omnidirectional 条形码,传入 `EncodeTypes.DatabarOmniDirectional` 和 GS1‑128 数据字符串。 + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **注意:** `BarcodeGenerator` 对象是可复用的;您可以在保存之间更改其参数,以**从相同数据创建多个条形码**。 + +### 步骤 3:设置通用条形码参数 + +最常见的视觉调节是 X‑dimension(模块宽度)和条码高度。两者均以像素为单位。 + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **为什么要设置 X‑dimension?** 较小的 X‑dimension 能产生更高的分辨率,这在图像需要打印或在高 DPI 屏幕上显示时尤为重要。 + +### 步骤 4:保存第一张条形码图像 + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +文件 `DatabarBarHeight30Pixels.png` 现在包含一个高度为 30 像素的 DataBar Omnidirectional 条形码。 + +### 步骤 5:调整条形码高度像素 + +更改高度不需要新的 `BarcodeGenerator` 实例,只需修改参数即可。 + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### 步骤 6:保存第二张条形码图像 + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +现在您拥有两个 PNG 文件,具有不同的**条形码高度像素**,演示了创建**条形码图像**变体是多么简单。 + +## 动态设置条形码高度像素 + +通常您需要一系列高度匹配 UI 元素或打印标签的条形码。下面的辅助方法抽象了高度的更改: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +现在您可以调用 `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` 在一行代码中**创建高度为 45 像素的条形码图像**。 + +## 在循环中创建多个条形码 + +当您拥有一组产品标识符时,`foreach` 循环可以消除重复代码。此示例展示了如何从 GTIN 数组**创建多个条形码**。 + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +该循环生成三个 PNG 文件,每个文件都有不同的 **条形码高度像素** 值。由于 `SaveBarcodeWithHeight` 辅助方法封装了高度的更改,主循环保持简洁且专注于数据。 + +### 预期输出 + +运行完整示例后,`Barcodes` 文件夹包含: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +打开任意 PNG 文件,都能看到清晰的 DataBar Omnidirectional 条形码,可被标准移动应用扫描。 + +## 常见陷阱与专业提示 + +| 问题 | 为什么会发生 | 如何避免 | +|------|--------------|----------| +| **错误的 EncodeTypes** | 对 DataBar 使用 1D 类型会生成不可读的图像。 | 始终为 GS1‑128 负载选择 `EncodeTypes.DatabarOmniDirectional`(或其他 DataBar 变体)。 | +| **X‑dimension 不足** | 非常低的 X‑dimension 可能导致细条在低分辨率显示器上消失。 | 在屏幕显示时保持 `XDimension.Pixels` ≥ 2;打印时提高到 3‑4。 | +| **文件路径错误** | 相对路径可能解析到意外的目录。 | 使用 `Path.Combine` 和 `Environment.CurrentDirectory` 构建绝对路径。 | +| **覆盖图像** | 在循环中重复使用相同文件名会覆盖之前的结果。 | 在文件名中加入唯一标识符(例如 GTIN 或时间戳)。 | +| **缺少 NuGet 包** | 代码可以编译,但运行时抛出 `FileNotFoundException`。 | 确认已安装 `Aspose.BarCode` 并在项目中引用它。 | + +## 完整工作示例 + +下面是完整的程序,您可以复制到控制台应用程序中。它包括所有步骤、辅助方法和错误处理。 + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +运行此程序 + +## 接下来应该学习什么? + +以下教程涵盖与本指南技术密切相关的主题。每个资源都包含完整的可运行代码示例和逐步解释,帮助您掌握更多 API 功能并在自己的项目中探索替代实现方案。 + +- [创建条形码自定义高度 – 一维条形码](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [创建条形码图像 C# – GS1 DataMatrix 示例](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [创建 DotCode 条形码图像 – 行与列 (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/chinese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/chinese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..ffab80041 --- /dev/null +++ b/barcode/chinese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,222 @@ +--- +category: general +date: 2026-08-09 +description: 使用 C# 条码生成器创建条码图像,并在几分钟内学习生成具有自定义宽高比的多个条码。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: zh +lastmod: 2026-08-09 +og_description: 使用 C# 条形码生成器创建条形码图像。本教程展示了如何生成多个条形码、调整宽高比以及高效保存 PNG 文件。 +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: 使用 C# 条码生成器创建条码图像 – 快速指南 +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: 使用 C# 条码生成器创建条码图像 – 指南 +url: /zh/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 使用 C# 条码生成器创建条码图像 – 指南 + +如果您需要快速 **创建条码图像**,本指南将向您展示如何使用 C# 条码生成器实现。您将学习生成多个条码、修改宽高比,并将每个图像保存为 PNG 文件。 + +在构建库存系统、销售点终端或运输标签时,生成条码图像是常见任务。完成本教程后,您将拥有两个可直接使用的 PNG 文件,展示不同的宽高比,并且您将了解如何将此方法扩展到任意数量的条码。 + +## 前提条件 + +在开始之前,请确保您已具备: + +* .NET 6.0 SDK 或更高版本已安装 +* Visual Studio 2022(或任何支持 C# 的 IDE) +* 对支持 DataBar Stacked Omnidirectional 的条码库的引用(例如,**Aspose.BarCode for .NET**)。代码片段使用 Aspose API,但概念适用于任何具有类似属性的库。 + +您无需单独的数据库或 Web 服务器——这只是一个普通的控制台应用程序。 + +## 第一步:设置控制台项目 + +创建一个新的控制台项目,并通过 NuGet 添加条码库。 + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +`dotnet add package` 命令会获取最新的稳定版 **Aspose.BarCode**,该库提供后续使用的 `BarcodeGenerator` 类。 + +## 第二步:编写完整程序 + +打开 *Program.cs*,将其内容替换为下面的完整示例。该程序会创建 **条码图像**,更改宽高比,并保存两个 PNG 文件。 + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### 各部分重要性说明 + +* **Create barcode image** – `BarcodeGenerator` 构造函数使用所需的符号类型和数据初始化对象。 +* **c# barcode generator** – `Parameters` 属性让您完全控制渲染选项;设置 `XDimension.Pixels` 可确保每根条在屏幕上清晰。 +* **generate multiple barcodes** – 通过在保存之间更改 `DataBar.AspectRatio`,同一个生成器实例即可生成两幅不同的图像,而无需重新创建对象,这更高效。 + +## 第三步:运行程序并查看结果 + +执行应用程序: + +```bash +dotnet run +``` + +您应该会看到类似以下的控制台输出: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +打开 `BarcodeOutputs` 文件夹。您会看到两个 PNG 文件: + +* **DatabarAspectRatio15.png** – 适用于高度受限标签的紧凑条码。 +* **DatabarAspectRatio30.png** – 更高的条码,许多扫描仪在远距离下读取更可靠。 + +这两个图像均可嵌入 PDF、打印在收据上或发送至移动应用。 + +## 第四步:扩展解决方案以生成任意数量的条码 + +上述模式易于扩展: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – 循环遍历宽高比数组,为每个值创建不同的 **条码图像**。 +* 调整 `EncodeTypes` 或编码字符串,即可生成 QR 码、Code 128 或其他符号,而无需更改外围逻辑。 + +## 实用技巧与常见陷阱 + +| Tip | Explanation | +|-----|-------------| +| **Reuse the same generator** | 为每个图像重新实例化 `BarcodeGenerator` 会增加不必要的开销。 在 `Save` 调用之间更改参数更快且占用更少内存。 | +| **Validate the output folder** | 保存前务必调用 `Directory.CreateDirectory`;否则 `Save` 会抛出 `DirectoryNotFoundException`。 | +| **Choose an appropriate X‑dimension** | 极低的像素值(例如 1)可能导致条码在低分辨率屏幕上无法读取。 2–3 的值在大多数打印机上表现良好。 | +| **Mind the encoding** | GS1 DataBar 需要以 `(01)` 开头的 GTIN。若省略括号,库可能生成无效条码。 | +| **Test with a real scanner** | 仅靠目视检查不足。请使用实际的扫描硬件测试 PNG 文件。 | + +## 预期输出(视觉描述) + +*两个 PNG 文件均显示深色背景上的 DataBar Stacked Omnidirectional 条码。宽高比为 15 的版本较短,而宽高比为 30 的版本大约是其两倍高。* + +如果将图像嵌入文档,它们将呈现锐利,因为我们将 `XDimension.Pixels = 2`。 + +## 结论 + +现在,您已经了解如何使用 **C# 条码生成器** **创建条码图像** 文件,并且可以通过调整宽高比或其他参数 **生成多个条码**。完整的可运行示例展示了最佳实践,如复用生成器实例、处理输出目录以及验证文件创建。 + +接下来,您可能会探索: + +* 使用 `generator.Parameters.Barcode.Color` 添加自定义颜色(次要关键词:**c# barcode generator**) +* 导出为 JPEG 或 SVG 等其他格式(`BarCodeImageFormat.Jpeg`、`BarCodeImageFormat.Svg`) +* 将条码创建逻辑集成到 Web API 中,以按需提供图像(次要关键词 + +## 接下来您应该学习什么? + +以下教程涵盖与本指南技术密切相关的主题。每个资源都包含完整的可运行代码示例和逐步说明,帮助您掌握更多 API 功能,并在自己的项目中探索替代实现方案。 + +- [创建条码 PNG – DataMatrix 宽高比 – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – 使用 Aspose.BarCode for .NET 自定义 Code 16K 条码宽高比](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [如何使用 Aspose.BarCode for .NET 生成具有自定义宽高比的 Aztec 条码](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/czech/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/czech/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..0f6ec3c58 --- /dev/null +++ b/barcode/czech/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,241 @@ +--- +category: general +date: 2026-08-09 +description: Rychle vytvořte 4‑sloupcový databar čárový kód v C# pomocí Aspose.BarCode. + V tomto stručném průvodci se naučíte, jak nastavit sloupce, řádky a uložit PNG obrázky. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: cs +lastmod: 2026-08-09 +og_description: Vytvořte 4‑sloupcový databar čárový kód v C# pomocí Aspose.BarCode, + poté přizpůsobte řádky a exportujte PNG obrázky pro vaši aplikaci. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Vytvořte 4‑sloupcový DataBar čárový kód v C# – rychlý tutoriál +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Vytvořte čtyřsloupcový databar čárový kód v C# – krok za krokem průvodce +url: /cs/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Vytvoření 4‑sloupcového databar čárového kódu v C# – krok‑za‑krokem průvodce + +Pokud potřebujete **vytvořit 4‑sloupcový databar čárový kód** v C#, tento tutoriál vám ukáže přesně jak. Provedeme vás generováním DataBar Expanded Stacked čárového kódu, nastavením čtyř sloupců a uložením výsledku jako PNG obrázku. + +V tomto průvodci se naučíte: + +* Inicializovat `BarcodeGenerator` pro symbol **DataBar Expanded Stacked**. +* Nastavit počet sloupců na 4 (hlavní požadavek). +* Upravit počet řádků, pokud potřebujete uspořádání ve třech řadách. +* Exportovat čárový kód jako PNG pomocí odpovídajícího **barcode image format**. + +Stačí vám knihovna Aspose.BarCode for .NET (verze 23.10 nebo novější) a vývojové prostředí .NET 6+ jako Visual Studio 2022. Žádné další závislosti nejsou potřeba. + +--- + +## Jak vytvořit 4‑sloupcový databar čárový kód + +Prvním krokem je vytvořit instanci `BarcodeGenerator`, která cílí na symbologii **DataBar Expanded Stacked**. Tato třída zapouzdřuje všechny možnosti vykreslování, takže přepínání mezi rozvržením podle sloupců a řádků je jednoduché. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Proč to funguje:** +`EncodeTypes.DatabarExpandedStacked` říká Aspose.BarCode, aby vytvořil vrstvenou verzi rodiny DataBar. Vlastnost `DataBar.Columns` určuje, kolik vertikálních modulů čárový kód zabírá. Nastavením na 4 splníte požadavek **vytvořit 4‑sloupcový databar čárový kód**. Nakonec `Save` zapíše vizuální reprezentaci na disk pomocí **barcode image format** `Png`. + +### Konfigurace sloupců DataBar Expanded Stacked + +Pokud potřebujete jiný počet sloupců, jednoduše změňte celé číslo přiřazené k `Columns`. Vlastnost akceptuje hodnoty od 1 do 4 pro variantu expanded stacked. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro tip:* Vždy otestujte vygenerovaný čárový kód skenerem, který podporuje rodinu DataBar, protože samotný vzhled nezaručuje čitelnost. + +### Uložení obrázku čárového kódu + +Výčtová hodnota `BarCodeImageFormat` poskytuje několik možností (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG je bezztrátový a dobře funguje ve většině webových i desktopových scénářů. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Pokud potřebujete jiný formát, nahraďte `Png` požadovanou hodnotou výčtu. Uložený soubor lze přímo vložit do HTML, PDF nebo vytisknout na štítky. + +## Vytvoření čárového kódu s vlastním počtem řádků + +Někdy je potřeba vrstvené rozvržení s konkrétním počtem řádků místo sloupců. Stejná třída `BarcodeGenerator` nabízí vlastnost `Rows` pro tento účel. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Proč jsou řádky důležité:** +Když je vrstvený čárový kód vyšší než široký, vlastnost `Rows` určuje, na kolik horizontálních částí je symbol rozdělen. Nastavením `Rows = 3` vytvoříte třířádkový vrstvený čárový kód, což je užitečné pro úzké štítky. + +### Dynamické nastavení řádků čárového kódu + +Počet řádků můžete vypočítat za běhu na základě vstupních dat: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Tato flexibilita vám umožní **nastavit řádky čárového kódu** bez nutnosti překladu aplikace. + +## Kompletní end‑to‑end příklad + +Níže je kompletní program, který generuje jak 4‑sloupcový čárový kód, tak 3‑řádkový čárový kód, a ukazuje, jak obě konfigurace koexistují. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Očekávaný výstup:** +Ve výchozím adresáři aplikace se objeví dva PNG soubory: + +* `DatabarCols4.png` – DataBar Expanded Stacked čárový kód se čtyřmi vertikálními sloupci. +* `DatabarRows3.png` – stejná symbologie uspořádaná ve třech horizontálních řádcích. + +Oba obrázky lze otevřít v libovolném prohlížeči obrázků nebo vložit do UI komponenty. + +--- + +## Často kladené otázky a okrajové případy + +| Otázka | Odpověď | +|----------|--------| +| *Mohu použít jinou symbologii čárového kódu?* | Ano. Nahraďte `EncodeTypes.DatabarExpandedStacked` jinou hodnotou `EncodeTypes` (např. `EncodeTypes.QR`), ale vlastnosti `Columns` a `Rows` jsou specifické pro rodiny DataBar. | +| *Co když řetězec dat překročí maximální délku?* | Symbologie DataBar Expanded Stacked podporuje až 61 číselných znaků. Překročení tohoto limitu vyvolá `ArgumentException`. Ověřte vstup před přiřazením do generátoru. | +| *Musím uvolnit prostředky `BarcodeGenerator`?* | `BarcodeGenerator` implementuje `IDisposable`. V dlouho běžící službě jej obalte do bloku `using` nebo zavolejte `Dispose()` ručně, aby se uvolnily nativní zdroje. | +| *Mohu generovat SVG místo PNG?* | Rozhodně. Použijte `BarCodeImageFormat.Svg` v metodě `Save`. | +| *Je knihovna kompatibilní s .NET Core?* | Aspose.BarCode for .NET podporuje .NET Core 3.1, .NET 5, .NET 6 a novější. Žádné změny kódu nejsou potřeba. | + +--- + +## Závěr + +Nyní víte, jak **vytvořit 4‑sloupcový databar čárový kód** v C# pomocí Aspose.BarCode, jak upravit rozvržení pomocí řádků a jak exportovat výsledek v praktickém **barcode image format**. Kompletní příklad ukazuje jak konfiguraci založenou na sloupcích, tak na řádcích, což vám poskytuje pevný základ pro jakýkoli scénář tisku štítků nebo mobilního skenování. + +**Další kroky** + +* Experimentujte s různými datovými náklady a ověřujte kompatibilitu se skenery. +* Prozkoumejte další možnosti stylování, jako jsou barvy popředí/pozadí (`generator.Parameters.Barcode.Color`). +* Kombinujte čárový kód s další grafikou pomocí API `Graphics` pro vlastní návrhy štítků. + +Neváhejte přizpůsobit kód pro projekty ASP.NET Core, Windows Forms nebo Xamarin — Aspose.BarCode funguje na všech .NET platformách. Šťastné programování! + +## Co byste se měli naučit dál? + +Následující tutoriály pokrývají úzce související témata, která staví na technikách předvedených v tomto průvodci. Každý zdroj obsahuje kompletní funkční ukázky kódu s podrobnými vysvětleními, aby vám pomohl zvládnout další funkce API a prozkoumat alternativní přístupy ve vlastních projektech. + +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Create barcode image c# – Configure Codablock F Rows & Columns](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [How to create dotcode extended codetext with Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/czech/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/czech/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..7b0942bfb --- /dev/null +++ b/barcode/czech/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,303 @@ +--- +category: general +date: 2026-08-09 +description: Vytvořte obrázek čárového kódu v C# podle tohoto krok za krokem návodu. + Naučte se, jak generovat čárový kód, nastavit výšku čárového kódu v pixelech a efektivně + vytvářet více čárových kódů. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: cs +lastmod: 2026-08-09 +og_description: Rychle vytvořte obrázek čárového kódu v C#. Sledujte tento tutoriál, + abyste se naučili, jak generovat čárový kód, nastavit výšku čárového kódu v pixelech + a vytvořit více čárových kódů. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Vytvořte obrázek čárového kódu v C# – kompletní průvodce pro vývojáře +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Vytvořte obrázek čárového kódu v C# – kompletní programovací průvodce +url: /cs/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Vytvoření obrázku čárového kódu v C# – kompletní programovací průvodce + +Pokud potřebujete **vytvořit obrázek čárového kódu** v .NET aplikaci, tento průvodce vám přesně ukáže **jak generovat čárový kód** pomocí knihovny Aspose.BarCode. Uvidíte, jak ovládat **výšku čárového kódu v pixelech**, uložit obrázek a vytvořit **více čárových kódů** bez duplicitního kódu. + +Tutoriál pokrývá vše od instalace balíčku po přizpůsobení rozměrů, takže můžete zkopírovat‑vložit připravený příklad, který lze okamžitě spustit, do svého projektu ještě dnes. + +## Požadavky + +* .NET 6.0 SDK nebo novější nainstalovaný +* Visual Studio 2022 (nebo jakékoli C# IDE) +* NuGet balíček `Aspose.BarCode` – nainstalujte pomocí + +```bash +dotnet add package Aspose.BarCode +``` + +Žádné další závislosti nejsou vyžadovány. + +## Jak generovat obrázek čárového kódu pomocí BarcodeGenerator v C# + +Základní třída pro vytvoření obrázku čárového kódu je `BarcodeGenerator`. Zapouzdřuje typ kódování, datový řetězec a všechny parametry vykreslování. + +### Krok 1: Definujte výstupní složku + +Vyberte složku, do které budou ukládány vygenerované PNG soubory. Použití absolutní cesty zabraňuje neočekávaným problémům s oprávněními. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Proč?** Vytvoření složky programově zajišťuje, že následné volání `Save` uspěje i na novém počítači. + +### Krok 2: Vytvořte instanci generátoru čárových kódů + +Pro čárový kód DataBar Omnidirectional předávejte `EncodeTypes.DatabarOmniDirectional` a datový řetězec GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Poznámka:** Objekt `BarcodeGenerator` je znovupoužitelný; můžete mezi ukládáním měnit jeho parametry a **vytvořit více čárových kódů** ze stejných dat. + +### Krok 3: Nastavte společné parametry čárového kódu + +Nejčastější vizuální úpravy jsou X‑dimenze (šířka modulu) a výška čárového kódu. Obě jsou vyjádřeny v pixelech. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Proč nastavit X‑dimenzi?** Menší X‑dimenze poskytuje vyšší rozlišení, což je důležité, když bude obrázek tištěn nebo zobrazen na obrazovkách s vysokým DPI. + +### Krok 4: Uložte první obrázek čárového kódu + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +Soubor `DatabarBarHeight30Pixels.png` nyní obsahuje DataBar Omnidirectional čárový kód vysoký 30 pixelů. + +### Krok 5: Upravit výšku čárového kódu v pixelech + +Změna výšky nevyžaduje novou instanci `BarcodeGenerator` — stačí upravit parametr. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Krok 6: Uložte druhý obrázek čárového kódu + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Nyní máte dva PNG soubory s různou **výškou čárového kódu v pixelech**, což ukazuje, jak snadno lze vytvořit různé **obrázky čárových kódů**. + +## Dynamické nastavení výšky čárového kódu v pixelech + +Často potřebujete sérii čárových kódů s výškami, které odpovídají UI prvkům nebo tištěným štítkům. Následující pomocná metoda abstrahuje změnu výšky: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Nyní můžete zavolat `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` a **vytvořit obrázek čárového kódu** s výškou 45 pixelů v jediném řádku. + +## Vytváření více čárových kódů ve smyčce + +Když máte kolekci identifikátorů produktů, smyčka `foreach` eliminuje opakovaný kód. Tento příklad ukazuje, jak **vytvořit více čárových kódů** z pole GTIN. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +Smyčka vytvoří tři PNG soubory, každý s odlišnou hodnotou **výšky čárového kódu v pixelech**. Protože pomocná metoda `SaveBarcodeWithHeight` zapouzdřuje změnu výšky, hlavní smyčka zůstává čistá a soustředěná na data. + +### Očekávaný výstup + +Po spuštění kompletního příkladu složka `Barcodes` obsahuje: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Otevření libovolného PNG zobrazí ostrý DataBar Omnidirectional čárový kód, který lze naskenovat standardními mobilními aplikacemi. + +## Časté chyby a tipy pro profesionály + +| Problém | Proč k tomu dochází | Jak tomu předejít | +|-------|----------------|-----------------| +| **Špatné EncodeTypes** | Použití 1D typu pro DataBar vytvoří nečitelné obrázky. | Vždy zvolte `EncodeTypes.DatabarOmniDirectional` (nebo jinou variantu DataBar) pro GS1‑128 payloady. | +| **Nedostatečná X‑dimenze** | Velmi nízká X‑dimenze může způsobit, že tenké čáry zmizí na monitorech s nízkým rozlišením. | Udržujte `XDimension.Pixels` ≥ 2 pro zobrazení na obrazovce; pro tisk zvýšte na 3‑4. | +| **Chyby v cestě k souboru** | Relativní cesty se mohou rozpoznat do neočekávaných adresářů. | Používejte `Path.Combine` a `Environment.CurrentDirectory` pro vytvoření absolutních cest. | +| **Přepisování obrázků** | Opakované použití stejného názvu souboru ve smyčce přepíše předchozí výsledky. | Zahrňte do názvu souboru jedinečné identifikátory (např. GTIN nebo časové razítko). | +| **Chybějící NuGet balíček** | Kód se zkompiluje, ale při běhu vyhodí `FileNotFoundException`. | Ověřte, že je nainstalován `Aspose.BarCode` a projekt na něj odkazuje. | + +## Kompletní funkční příklad + +Níže je kompletní program, který můžete zkopírovat do konzolové aplikace. Obsahuje všechny kroky, pomocné metody a ošetření chyb. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Spuštěním tohoto programu + +## Co byste se měli naučit dál? + +Následující tutoriály pokrývají úzce související témata, která staví na technikách předvedených v tomto průvodci. Každý zdroj obsahuje kompletní funkční ukázky kódu s podrobnými vysvětleními, které vám pomohou zvládnout další funkce API a prozkoumat alternativní přístupy k implementaci ve vašich projektech. + +- [Vytvořit čárový kód s vlastní výškou – jednorozměrné čárové kódy](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Vytvořit obrázek čárového kódu C# – příklad GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Vytvořit obrázek DotCode čárového kódu – řádky a sloupce (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/czech/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/czech/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..d98a78998 --- /dev/null +++ b/barcode/czech/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-09 +description: Vytvořte obrázek čárového kódu pomocí generátoru čárových kódů v C# a + během několika minut se naučte generovat více čárových kódů s vlastním poměrem stran. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: cs +lastmod: 2026-08-09 +og_description: Vytvořte obrázek čárového kódu pomocí generátoru čárových kódů v C#. + Tento tutoriál ukazuje, jak generovat více čárových kódů, upravovat poměry stran + a efektivně ukládat soubory PNG. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Vytvořte obrázek čárového kódu pomocí generátoru čárových kódů v C# – rychlý + průvodce +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Vytvořte obrázek čárového kódu pomocí generátoru čárových kódů v C# – průvodce +url: /cs/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Vytvoření obrázku čárového kódu pomocí generátoru čárových kódů v C# – průvodce + +Pokud potřebujete rychle **vytvořit obrázek čárového kódu**, tento průvodce vám ukáže, jak to provést pomocí generátoru čárových kódů v C#. Naučíte se generovat více čárových kódů, měnit poměr stran a uložit každý obrázek jako soubor PNG. + +Generování obrázků čárových kódů je běžný úkol při tvorbě inventárních systémů, pokladních terminálů nebo přepravních štítků. Na konci tohoto tutoriálu budete mít dva připravené soubory PNG, které ukazují různé poměry stran, a pochopíte, jak rozšířit tento přístup na libovolný počet čárových kódů. + +## Požadavky + +* .NET 6.0 SDK nebo novější nainstalováno +* Visual Studio 2022 (nebo jakékoli IDE podporující C#) +* Odkaz na knihovnu čárových kódů, která podporuje DataBar Stacked Omnidirectional (například **Aspose.BarCode for .NET**). Ukázky kódu používají Aspose API, ale koncepty platí pro jakoukoli knihovnu s podobnými vlastnostmi. + +Nemusíte mít samostatnou databázi ani webový server — jedná se o jednoduchou konzolovou aplikaci. + +## Krok 1: Nastavení konzolového projektu + +Vytvořte nový konzolový projekt a přidejte knihovnu čárových kódů pomocí NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +Příkaz `dotnet add package` stáhne nejnovější stabilní verzi **Aspose.BarCode**, která poskytuje třídu `BarcodeGenerator` používanou později. + +## Krok 2: Napsání kompletního programu + +Otevřete *Program.cs* a nahraďte jeho obsah kompletním příkladem níže. Program vytvoří **obrázek čárového kódu**, změní poměr stran a uloží dva soubory PNG. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Proč je každá část důležitá + +* **Create barcode image** – Konstruktor `BarcodeGenerator` inicializuje objekt s požadovanou symbologií a daty. +* **c# barcode generator** – Vlastnost `Parameters` vám dává plnou kontrolu nad možnostmi vykreslování; nastavení `XDimension.Pixels` zajišťuje, že každý pruh je na obrazovce ostrý. +* **generate multiple barcodes** – Změnou `DataBar.AspectRatio` mezi ukládáním stejná instance generátoru vytvoří dva odlišné obrázky, aniž by se objekt znovu vytvářel, což je efektivnější. + +## Krok 3: Spuštění programu a zobrazení výsledků + +Spusťte aplikaci: + +```bash +dotnet run +``` + +Měli byste vidět výstup v konzoli podobný tomuto: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Otevřete složku `BarcodeOutputs`. Najdete v ní dva soubory PNG: + +* **DatabarAspectRatio15.png** – kompaktní čárový kód vhodný pro štítky s omezenou výškou. +* **DatabarAspectRatio30.png** – vyšší čárový kód, který mnoho skenerů čte spolehlivěji z větší vzdálenosti. + +Oba obrázky jsou připraveny k vložení do PDF, tisku na účtenky nebo odeslání do mobilní aplikace. + +## Krok 4: Rozšíření řešení pro generování libovolného počtu čárových kódů + +Vzor uvedený výše se snadno škáluje: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – Smyčka prochází pole poměrů stran a pro každou hodnotu vytváří odlišný **obrázek čárového kódu**. +* Upravit `EncodeTypes` nebo kódovaný řetězec pro vytvoření QR kódů, Code 128 nebo jiných symbologií bez změny okolní logiky. + +## Praktické tipy a běžné úskalí + +| Tip | Vysvětlení | +|-----|-------------| +| **Reuse the same generator** | Znovu‑inicializace `BarcodeGenerator` pro každý obrázek přidává zbytečnou zátěž. Změna parametrů mezi voláními `Save` je rychlejší a používá méně paměti. | +| **Validate the output folder** | Vždy zavolejte `Directory.CreateDirectory` před uložením; jinak `Save` vyhodí `DirectoryNotFoundException`. | +| **Choose an appropriate X‑dimension** | Velmi nízké hodnoty pixelů (např. 1) mohou způsobit, že čárový kód bude nečitelný na obrazovkách s nízkým rozlišením. Hodnoty 2–3 fungují dobře pro většinu tiskáren. | +| **Mind the encoding** | GS1 DataBar očekává úvodní `(01)` pro GTIN. Pokud závorky vynecháte, knihovna může vygenerovat neplatný čárový kód. | +| **Test with a real scanner** | Vizuální kontrola není dostačující. Otestujte soubory PNG s reálným skenerovým hardwarem, který plánujete použít. | + +## Očekávaný výstup (vizuální popis) + +*Oba soubory PNG zobrazují tmavý na světlém DataBar Stacked Omnidirectional čárový kód. Verze s poměrem stran 15 je kratší, zatímco verze s poměrem stran 30 je přibližně dvakrát vyšší.* + +Pokud vložíte obrázky do dokumentu, vykreslí se ostře, protože jsme nastavili `XDimension.Pixels = 2`. + +## Závěr + +Nyní víte, jak pomocí **C# barcode generator** **vytvořit soubory s obrázkem čárového kódu**, a můžete **generovat více čárových kódů** úpravou poměru stran nebo jakéhokoli jiného parametru. Kompletní, spustitelný příklad ukazuje osvědčené postupy, jako je opětovné použití instance generátoru, práce s výstupními složkami a ověřování vytvoření souboru. + +Dále můžete zkoumat: + +* Přidání vlastních barev pomocí `generator.Parameters.Barcode.Color` (sekundární klíčové slovo: **c# barcode generator**) +* Export do dalších formátů, jako je JPEG nebo SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Integrace logiky vytváření čárových kódů do Web API pro poskytování obrázků na vyžádání (sekundární klíčové slovo + +## Co byste se měli naučit dál? + +Následující tutoriály pokrývají úzce související témata, která staví na technikách předvedených v tomto průvodci. Každý zdroj obsahuje kompletní funkční příklady kódu s podrobnými vysvětleními, které vám pomohou zvládnout další funkce API a prozkoumat alternativní přístupy k implementaci ve vašich projektech. + +- [Vytvořit Barcode PNG – DataMatrix Poměr Stran – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Přizpůsobení poměrů stran Code 16K Barcode s Aspose.BarCode pro .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Jak generovat Aztec čárový kód s vlastním poměrem stran pomocí Aspose.BarCode pro .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/dutch/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/dutch/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..150ede18e --- /dev/null +++ b/barcode/dutch/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,240 @@ +--- +category: general +date: 2026-08-09 +description: Maak snel een 4‑koloms databar‑barcode in C# met Aspose.BarCode. Leer + hoe je kolommen, rijen configureert en PNG‑afbeeldingen opslaat in deze beknopte + gids. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: nl +lastmod: 2026-08-09 +og_description: Maak een 4‑koloms databar‑streepcode in C# met Aspose.BarCode, pas + vervolgens rijen aan en exporteer PNG‑afbeeldingen voor uw app. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Maak een 4‑koloms databar barcode in C# – snelle tutorial +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Maak een 4‑koloms databar‑barcode in C# – stapsgewijze handleiding +url: /nl/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Maak 4‑kolom databar barcode in C# – stap‑voor‑stap gids + +Als je een **4‑kolom databar barcode** in C# moet maken, laat deze tutorial je precies zien hoe. We lopen door het genereren van een DataBar Expanded Stacked barcode, het configureren van vier kolommen, en het opslaan van het resultaat als een PNG‑afbeelding. + +In deze gids leer je hoe je: + +* Initialiseer de `BarcodeGenerator` voor een **DataBar Expanded Stacked** symbool. +* Stel het aantal kolommen in op 4 (de primaire vereiste). +* Pas het aantal rijen aan wanneer je een gestapelde lay-out met drie rijen nodig hebt. +* Exporteer de barcode als een PNG met het juiste **barcode image format**. + +Je hebt alleen de Aspose.BarCode for .NET bibliotheek nodig (versie 23.10 of later) en een .NET 6+ ontwikkelomgeving zoals Visual Studio 2022. Er zijn geen extra afhankelijkheden vereist. + +--- + +## Hoe maak je een 4‑kolom databar barcode + +De eerste stap is het maken van een `BarcodeGenerator`‑instantie die zich richt op de **DataBar Expanded Stacked** symbologie. Deze klasse omvat alle renderopties, waardoor het eenvoudig is om te schakelen tussen kolom‑gebaseerde en rij‑gebaseerde lay-outs. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Waarom dit werkt:** +`EncodeTypes.DatabarExpandedStacked` vertelt Aspose.BarCode om de gestapelde versie van de DataBar‑familie te produceren. De eigenschap `DataBar.Columns` bepaalt hoeveel verticale modules de barcode inneemt. Het instellen op 4 voldoet aan de vereiste om een **4‑kolom databar barcode** te **maken**. Ten slotte schrijft `Save` de visuele weergave naar schijf met het **barcode image format** `Png`. + +### Configureer DataBar Expanded Stacked kolommen + +Als je een ander aantal kolommen nodig hebt, wijzig dan eenvoudig het gehele getal dat aan `Columns` is toegewezen. De eigenschap accepteert waarden van 1 tot 4 voor de expanded stacked variant. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro tip:* Test de gegenereerde barcode altijd met een scanner die de DataBar‑familie ondersteunt, omdat alleen de visuele weergave geen leesbaarheid garandeert. + +### Sla de barcode‑afbeelding op + +De `BarCodeImageFormat`‑enumeratie biedt verschillende opties (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG is verliesvrij en werkt goed voor de meeste web‑ en desktopscenario's. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Als je een ander formaat nodig hebt, vervang dan `Png` door de gewenste enum‑waarde. Het opgeslagen bestand kan direct in HTML, PDF's of op etiketten worden ingevoegd. + +## Maak een barcode met aangepaste rijen + +Soms is een gestapelde lay-out vereist met een specifiek aantal rijen in plaats van kolommen. Dezelfde `BarcodeGenerator`‑klasse biedt een `Rows`‑eigenschap voor dit doel. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Waarom rijen belangrijk zijn:** +Wanneer de gestapelde barcode hoger is dan breed, bepaalt de `Rows`‑eigenschap in hoeveel horizontale segmenten het symbool wordt verdeeld. Het instellen van `Rows = 3` creëert een drie‑rij gestapelde barcode, wat nuttig is voor smalle etiketbreedtes. + +### Stel barcode‑rijen dynamisch in + +Je kunt het aantal rijen tijdens runtime berekenen op basis van invoergegevens: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Deze flexibiliteit stelt je in staat om **barcode‑rijen in te stellen** zonder de applicatie opnieuw te compileren. + +## Volledig end‑to‑end voorbeeld + +Hieronder staat een enkel programma dat zowel een 4‑kolom barcode als een 3‑rij barcode genereert, en laat zien hoe de twee configuraties naast elkaar bestaan. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Verwachte output:** +Twee PNG‑bestanden verschijnen in de werkmap van de applicatie: + +* `DatabarCols4.png` – een DataBar Expanded Stacked barcode met vier verticale kolommen. +* `DatabarRows3.png` – dezelfde symbologie gerangschikt in drie horizontale rijen. + +Beide afbeeldingen kunnen worden geopend in elke afbeeldingsviewer of ingebed in een UI‑controle. + +--- + +## Veelgestelde vragen en randgevallen + +| Vraag | Antwoord | +|----------|--------| +| *Kan ik een andere barcode‑symbologie gebruiken?* | Ja. Vervang `EncodeTypes.DatabarExpandedStacked` door een andere `EncodeTypes`‑waarde (bijv. `EncodeTypes.QR`), maar de `Columns`‑ en `Rows`‑eigenschappen zijn specifiek voor DataBar‑families. | +| *Wat gebeurt er als de gegevensreeks de maximale lengte overschrijdt?* | De DataBar Expanded Stacked symbologie ondersteunt tot 61 numerieke tekens. Het overschrijden van deze limiet veroorzaakt een `ArgumentException`. Valideer de invoer voordat je deze aan de generator toewijst. | +| *Moet ik de `BarcodeGenerator` vrijgeven?* | `BarcodeGenerator` implementeert `IDisposable`. In een langdurige service, wikkel het in een `using`‑blok of roep `Dispose()` handmatig aan om native resources vrij te geven. | +| *Kan ik SVG genereren in plaats van PNG?* | Absoluut. Gebruik `BarCodeImageFormat.Svg` in de `Save`‑methode. | +| *Is de bibliotheek compatibel met .NET Core?* | Aspose.BarCode for .NET ondersteunt .NET Core 3.1, .NET 5, .NET 6 en later. Er zijn geen code‑wijzigingen nodig. | + +## Conclusie + +Je weet nu hoe je een **4‑kolom databar barcode** in C# kunt **maken** met Aspose.BarCode, hoe je de lay-out met rijen kunt aanpassen, en hoe je het resultaat kunt exporteren in een handig **barcode image format**. Het volledige voorbeeld toont zowel kolom‑gebaseerde als rij‑gebaseerde configuraties, waardoor je een solide basis hebt voor elke label‑print‑ of mobiele‑scan‑situatie. + +**Volgende stappen** + +* Experimenteer met verschillende gegevenspayloads en controleer de scanner‑compatibiliteit. +* Verken extra stylingopties zoals voor‑/achtergrondkleuren (`generator.Parameters.Barcode.Color`). +* Combineer de barcode met andere grafische elementen via de `Graphics`‑API voor aangepaste label‑ontwerpen. + +Voel je vrij om de code aan te passen voor ASP.NET Core, Windows Forms of Xamarin‑projecten—Aspose.BarCode werkt op alle .NET‑platformen. Veel plezier met coderen! + +## Wat moet je hierna leren? + +De volgende tutorials behandelen nauw verwante onderwerpen die voortbouwen op de technieken die in deze gids worden gedemonstreerd. Elke bron bevat volledige werkende code‑voorbeelden met stapsgewijze uitleg om je te helpen extra API‑functies onder de knie te krijgen en alternatieve implementatie‑benaderingen in je eigen projecten te verkennen. + +- [Maak DotCode barcode‑afbeelding – rijen & kolommen (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Maak barcode‑afbeelding c# – Configureer Codablock F rijen & kolommen](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Hoe maak je dotcode uitgebreide codetext met Aspose.BarCode voor .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/dutch/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/dutch/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..5749ddea0 --- /dev/null +++ b/barcode/dutch/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,303 @@ +--- +category: general +date: 2026-08-09 +description: Maak een barcode‑afbeelding in C# met deze stapsgewijze handleiding. + Leer hoe je een barcode genereert, de hoogte van de barcode in pixels aanpast en + efficiënt meerdere barcodes maakt. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: nl +lastmod: 2026-08-09 +og_description: Maak snel een barcode‑afbeelding in C#. Volg deze tutorial om te leren + hoe je een barcode genereert, de barcodehoogte in pixels instelt en meerdere barcodes + maakt. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Barcode-afbeelding maken in C# – volledige gids voor ontwikkelaars +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Barcode‑afbeelding maken in C# – volledige programmeergids +url: /nl/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Barcodeafbeelding maken in C# – volledige programmeergids + +Als je een **barcode-afbeelding** moet maken in een .NET‑applicatie, laat deze gids je precies zien **hoe je een barcode genereert** met de Aspose.BarCode‑bibliotheek. Je ziet hoe je de **barcode‑hoogte in pixels** kunt regelen, de afbeelding opslaat en **meerdere barcodes** maakt zonder code te dupliceren. + +De tutorial behandelt alles, van het installeren van het pakket tot het aanpassen van afmetingen, zodat je vandaag nog een kant‑klaar voorbeeld kunt kopiëren‑plakken in je project. + +## Vereisten + +* .NET 6.0 SDK of later geïnstalleerd +* Visual Studio 2022 (of een andere C#‑IDE) +* NuGet‑pakket `Aspose.BarCode` – installeren met + +```bash +dotnet add package Aspose.BarCode +``` + +Er zijn geen extra afhankelijkheden nodig. + +## Hoe een barcode‑afbeelding te genereren met BarcodeGenerator C# + +De kernklasse voor het maken van een barcode‑afbeelding is `BarcodeGenerator`. Deze omvat het coderings‑type, de gegevensreeks en alle weergave‑parameters. + +### Stap 1: Definieer de uitvoermap + +Kies een map waarin de gegenereerde PNG‑bestanden worden opgeslagen. Het gebruik van een absoluut pad voorkomt verrassingen met rechten. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Waarom?** Het programmatically aanmaken van de map garandeert dat de daaropvolgende `Save`‑aanroepen slagen, zelfs op een nieuwe machine. + +### Stap 2: Instantieer de barcode‑generator + +Voor een DataBar Omnidirectional‑barcode, geef `EncodeTypes.DatabarOmniDirectional` en de GS1‑128‑gegevensreeks door. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Opmerking:** Het `BarcodeGenerator`‑object is herbruikbaar; je kunt de parameters tussen opslagen wijzigen om **meerdere barcodes** uit dezelfde gegevens te **maken**. + +### Stap 3: Stel algemene barcode‑parameters in + +De meest voorkomende visuele aanpassingen zijn de X‑dimensie (module‑breedte) en de balkhoogte. Beide worden uitgedrukt in pixels. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Waarom X‑dimensie instellen?** Een kleinere X‑dimensie levert een hogere resolutie op, wat belangrijk is wanneer de afbeelding wordt afgedrukt of weergegeven op schermen met hoge DPI. + +### Stap 4: Sla de eerste barcode‑afbeelding op + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +Het bestand `DatabarBarHeight30Pixels.png` bevat nu een DataBar Omnidirectional‑barcode van 30 pixels hoog. + +### Stap 5: Pas de barcode‑hoogte in pixels aan + +Het wijzigen van de hoogte vereist geen nieuwe `BarcodeGenerator`‑instantie—pas gewoon de parameter aan. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Stap 6: Sla de tweede barcode‑afbeelding op + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Nu heb je twee PNG‑bestanden met verschillende **barcode‑hoogte in pixels**, wat laat zien hoe eenvoudig het is om **barcode‑afbeeldingen** te variëren. + +## Barcode‑hoogte in pixels dynamisch instellen + +Vaak heb je een reeks barcodes nodig met hoogtes die passen bij UI‑elementen of afgedrukte labels. De volgende hulpfunctie abstraheert de hoogte‑aanpassing: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Je kunt nu `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` aanroepen om een **barcode‑afbeelding** met een hoogte van 45 pixels in één regel te **maken**. + +## Meerdere barcodes maken in een lus + +Wanneer je een verzameling product‑identifiers hebt, verwijdert een `foreach`‑lus repetitieve code. Dit voorbeeld laat zien hoe je **meerdere barcodes** uit een array van GTIN‑s kunt **maken**. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +De lus produceert drie PNG‑bestanden, elk met een verschillende **barcode‑hoogte in pixels**. Omdat de `SaveBarcodeWithHeight`‑helper de hoogte‑wijziging encapsuleert, blijft de hoofd‑lus overzichtelijk en gericht op de data. + +### Verwachte output + +Na het uitvoeren van het volledige voorbeeld bevat de map `Barcodes`: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Het openen van een PNG toont een scherpe DataBar Omnidirectional‑barcode die kan worden gescand met standaard mobiele apps. + +## Veelvoorkomende valkuilen en pro‑tips + +| Probleem | Waarom het gebeurt | Hoe te vermijden | +|----------|--------------------|------------------| +| **Verkeerde EncodeTypes** | Het gebruik van een 1D‑type voor een DataBar levert een onleesbare afbeelding op. | Kies altijd `EncodeTypes.DatabarOmniDirectional` (of een andere DataBar‑variant) voor GS1‑128‑payloads. | +| **Onvoldoende X‑dimensie** | Een zeer lage X‑dimensie kan dunne balken laten verdwijnen op monitoren met lage resolutie. | Houd `XDimension.Pixels` ≥ 2 voor schermweergave; verhoog naar 3‑4 voor afdrukken. | +| **Bestandspad‑fouten** | Relatieve paden kunnen naar onverwachte mappen verwijzen. | Gebruik `Path.Combine` en `Environment.CurrentDirectory` om absolute paden te bouwen. | +| **Afbeeldingen overschrijven** | Het hergebruiken van dezelfde bestandsnaam in een lus overschrijft eerdere resultaten. | Voeg unieke identifiers (bijv. GTIN of tijdstempel) toe aan de bestandsnaam. | +| **Ontbrekend NuGet‑pakket** | Code compileert maar gooit `FileNotFoundException` tijdens runtime. | Controleer of `Aspose.BarCode` geïnstalleerd is en het project ernaar verwijst. | + +## Volledig werkend voorbeeld + +Hieronder staat het volledige programma dat je kunt kopiëren naar een console‑applicatie. Het bevat alle stappen, hulpmethoden en foutafhandeling. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Dit programma uitvoeren + +## Wat moet je hierna leren? + +De volgende tutorials behandelen nauw verwante onderwerpen die voortbouwen op de technieken die in deze gids worden getoond. Elke bron bevat volledige werkende code‑voorbeelden met stap‑voor‑stap‑uitleg om je te helpen extra API‑functies onder de knie te krijgen en alternatieve implementatie‑benaderingen in je eigen projecten te verkennen. + +- [Barcode met aangepaste hoogte maken – Eén-dimensionale barcodes](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Barcode‑afbeelding maken C# – GS1 DataMatrix‑voorbeeld](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [DotCode‑barcode‑afbeelding maken – rijen & kolommen (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/dutch/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/dutch/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..4c911657a --- /dev/null +++ b/barcode/dutch/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,223 @@ +--- +category: general +date: 2026-08-09 +description: Maak een barcode‑afbeelding met een C#‑barcodegenerator en leer in enkele + minuten meerdere barcodes met aangepaste beeldverhoudingen te genereren. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: nl +lastmod: 2026-08-09 +og_description: Maak een barcode‑afbeelding met een C# barcodegenerator. Deze tutorial + laat zien hoe je meerdere barcodes genereert, de beeldverhoudingen aanpast en PNG‑bestanden + efficiënt opslaat. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Maak een barcode‑afbeelding met C# barcodegenerator – snelle gids +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Barcode-afbeelding maken met C# barcodegenerator – gids +url: /nl/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Maak barcode‑afbeelding met C# barcode generator – gids + +Als je snel een **barcode‑afbeelding** wilt maken, laat deze gids je zien hoe je dat doet met een C# barcode generator. Je leert meerdere barcodes te genereren, de beeldverhouding aan te passen en elke afbeelding op te slaan als een PNG‑bestand. + +Barcode‑afbeeldingen genereren is een veelvoorkomende taak bij het bouwen van voorraadbeheersystemen, point‑of‑sale‑terminals of verzendetiketten. Aan het einde van deze tutorial heb je twee kant‑klaar PNG‑bestanden die verschillende beeldverhoudingen tonen, en begrijp je hoe je de aanpak kunt uitbreiden naar een willekeurig aantal barcodes. + +## Vereisten + +* .NET 6.0 SDK of later geïnstalleerd +* Visual Studio 2022 (of een IDE die C# ondersteunt) +* Een referentie naar een barcode‑bibliotheek die DataBar Stacked Omnidirectional ondersteunt (bijvoorbeeld **Aspose.BarCode for .NET**). De code‑fragmenten gebruiken de Aspose API, maar de concepten zijn toepasbaar op elke bibliotheek met vergelijkbare eigenschappen. + +Je hebt geen aparte database of webserver nodig – dit is een eenvoudige console‑applicatie. + +## Stap 1: Zet het console‑project op + +Maak een nieuw console‑project aan en voeg de barcode‑bibliotheek toe via NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +Het `dotnet add package`‑commando haalt de nieuwste stabiele versie van **Aspose.BarCode** op, die de `BarcodeGenerator`‑klasse levert die later wordt gebruikt. + +## Stap 2: Schrijf het volledige programma + +Open *Program.cs* en vervang de inhoud door het volledige voorbeeld hieronder. Het programma maakt een **barcode‑afbeelding**, wijzigt de beeldverhouding en slaat twee PNG‑bestanden op. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Waarom elk onderdeel belangrijk is + +* **Create barcode image** – De `BarcodeGenerator`‑constructor initialiseert het object met de gewenste symbologie en data. +* **c# barcode generator** – De `Parameters`‑eigenschap geeft volledige controle over render‑opties; het instellen van `XDimension.Pixels` zorgt ervoor dat elke staaf scherp op het scherm verschijnt. +* **generate multiple barcodes** – Door `DataBar.AspectRatio` tussen opslagen te wijzigen, produceert dezelfde generator‑instantie twee verschillende afbeeldingen zonder het object opnieuw te maken, wat efficiënter is. + +## Stap 3: Voer het programma uit en bekijk de resultaten + +Voer de applicatie uit: + +```bash +dotnet run +``` + +Je zou console‑output moeten zien die lijkt op: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Open de map `BarcodeOutputs`. Je vindt daar twee PNG‑bestanden: + +* **DatabarAspectRatio15.png** – een compacte barcode geschikt voor labels met beperkte hoogte. +* **DatabarAspectRatio30.png** – een hogere barcode die door veel scanners betrouwbaarder van een afstand wordt gelezen. + +Beide afbeeldingen zijn klaar om in PDF‑bestanden te worden ingebed, afgedrukt op kassabonnen, of verzonden naar een mobiele app. + +## Stap 4: Breid de oplossing uit om een willekeurig aantal barcodes te genereren + +Het patroon hierboven schaalt eenvoudig: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – De lus iterereert over een array van beeldverhoudingen en maakt voor elke waarde een aparte **barcode‑afbeelding**. +* Pas de `EncodeTypes` of de te coderen string aan om QR‑codes, Code 128, of andere symbologieën te produceren zonder de omliggende logica te wijzigen. + +## Praktische tips en veelvoorkomende valkuilen + +| Tip | Explanation | +|-----|-------------| +| **Reuse the same generator** | Het opnieuw initialiseren van `BarcodeGenerator` voor elke afbeelding voegt onnodige overhead toe. Het wijzigen van parameters tussen `Save`‑aanroepen is sneller en gebruikt minder geheugen. | +| **Validate the output folder** | Roep altijd `Directory.CreateDirectory` aan vóór het opslaan; anders gooit `Save` een `DirectoryNotFoundException`. | +| **Choose an appropriate X‑dimension** | Zeer lage pixelwaarden (bijv. 1) kunnen de barcode onleesbaar maken op schermen met lage resolutie. Waarden van 2–3 werken goed voor de meeste printers. | +| **Mind the encoding** | GS1 DataBar verwacht een leidende `(01)` voor GTIN. Als je de haakjes weglaten, kan de bibliotheek een ongeldige barcode genereren. | +| **Test with a real scanner** | Visuele inspectie is niet voldoende. Test de PNG‑bestanden met de daadwerkelijke scanner‑hardware die je wilt gebruiken. | + +## Verwachte output (visuele beschrijving) + +*Beide PNG‑bestanden tonen een donker‑op‑licht DataBar Stacked Omnidirectional barcode. De versie met beeldverhouding 15 is korter, terwijl de versie met beeldverhouding 30 ongeveer twee keer zo hoog is.* + +Als je de afbeeldingen in een document embedt, renderen ze scherp omdat we `XDimension.Pixels = 2` hebben ingesteld. + +## Conclusie + +Je weet nu hoe je **barcode‑afbeeldingen** kunt maken met een **C# barcode generator**, en je kunt **meerdere barcodes genereren** door de beeldverhouding of een andere parameter aan te passen. Het volledige, uitvoerbare voorbeeld toont best practices zoals het hergebruiken van de generator‑instantie, het afhandelen van output‑mappen, en het verifiëren van bestandscreatie. + +Vervolgens kun je het volgende verkennen: + +* Toevoegen van aangepaste kleuren met `generator.Parameters.Barcode.Color` (secundair trefwoord: **c# barcode generator**) +* Exporteren naar andere formaten zoals JPEG of SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Integreren van de barcode‑creatie‑logica in een Web API om afbeeldingen op aanvraag te leveren (secundair trefwoord + +## Wat moet je hierna leren? + +De volgende tutorials behandelen nauw verwante onderwerpen die voortbouwen op de technieken die in deze gids worden getoond. Elke bron bevat volledige werkende code‑voorbeelden met stap‑voor‑stap‑uitleg om je te helpen extra API‑functies onder de knie te krijgen en alternatieve implementatie‑benaderingen in je eigen projecten te verkennen. + +- [Barcode PNG maken – DataMatrix beeldverhouding – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Code 16K barcode beeldverhoudingen aanpassen met Aspose.BarCode voor .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Hoe een Aztec barcode te genereren met aangepaste beeldverhouding met Aspose.BarCode voor .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/english/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/english/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..5563bb2aa --- /dev/null +++ b/barcode/english/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,243 @@ +--- +category: general +date: 2026-08-09 +description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. Learn + how to configure columns, rows, and save PNG images in this concise guide. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: en +lastmod: 2026-08-09 +og_description: Create 4‑column databar barcode in C# using Aspose.BarCode, then customize + rows and export PNG images for your app. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Create 4‑column databar barcode in C# – quick tutorial +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Create 4‑column databar barcode in C# – step‑by‑step guide +url: /python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Create 4‑column databar barcode in C# – step‑by‑step guide + +If you need to **create 4‑column databar barcode** in C#, this tutorial shows you exactly how. We'll walk through generating a DataBar Expanded Stacked barcode, configuring four columns, and saving the result as a PNG image. + +In this guide you will learn how to: + +* Initialise the `BarcodeGenerator` for a **DataBar Expanded Stacked** symbol. +* Set the column count to 4 (the primary requirement). +* Adjust the row count when you need a stacked layout with three rows. +* Export the barcode as a PNG using the appropriate **barcode image format**. + +You only need the Aspose.BarCode for .NET library (version 23.10 or later) and a .NET 6+ development environment such as Visual Studio 2022. No additional dependencies are required. + +--- + +## How to create 4‑column databar barcode + +The first step is to create a `BarcodeGenerator` instance that targets the **DataBar Expanded Stacked** symbology. This class encapsulates all rendering options, making it straightforward to switch between column‑based and row‑based layouts. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Why this works:** +`EncodeTypes.DatabarExpandedStacked` tells Aspose.BarCode to produce the stacked version of the DataBar family. The `DataBar.Columns` property controls how many vertical modules the barcode occupies. Setting it to 4 matches the requirement to **create 4‑column databar barcode**. Finally, `Save` writes the visual representation to disk using the **barcode image format** `Png`. + +### Configure DataBar Expanded Stacked columns + +If you need a different column count, simply change the integer assigned to `Columns`. The property accepts values from 1 to 4 for the expanded stacked variant. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro tip:* Always test the generated barcode with a scanner that supports the DataBar family, because visual appearance alone does not guarantee readability. + +### Save the barcode image + +The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop scenarios. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +If you need a different format, replace `Png` with the desired enum value. The saved file can be embedded directly into HTML, PDFs, or printed on labels. + +## Create a barcode with custom rows + +Sometimes a stacked layout is required with a specific number of rows instead of columns. The same `BarcodeGenerator` class exposes a `Rows` property for this purpose. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Why rows matter:** +When the stacked barcode is taller than it is wide, the `Rows` property determines how many horizontal slices the symbol is divided into. Setting `Rows = 3` creates a three‑row stacked barcode, which is useful for narrow label widths. + +### Set barcode rows dynamically + +You can compute the row count at runtime based on input data: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +This flexibility lets you **set barcode rows** without recompiling the application. + +## Full end‑to‑end example + +Below is a single program that generates both a 4‑column barcode and a 3‑row barcode, demonstrating how the two configurations coexist. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Expected output:** +Two PNG files appear in the application’s working directory: + +* `DatabarCols4.png` – a DataBar Expanded Stacked barcode with four vertical columns. +* `DatabarRows3.png` – the same symbology arranged in three horizontal rows. + +Both images can be opened in any image viewer or embedded in a UI control. + +--- + +## Common questions and edge cases + +| Question | Answer | +|----------|--------| +| *Can I use a different barcode symbology?* | Yes. Replace `EncodeTypes.DatabarExpandedStacked` with another `EncodeTypes` value (e.g., `EncodeTypes.QR`), but the `Columns` and `Rows` properties are specific to DataBar families. | +| *What if the data string exceeds the maximum length?* | The DataBar Expanded Stacked symbology supports up to 61 numeric characters. Exceeding this limit throws an `ArgumentException`. Validate the input before assigning it to the generator. | +| *Do I need to dispose the `BarcodeGenerator`?* | `BarcodeGenerator` implements `IDisposable`. In a long‑running service, wrap it in a `using` block or call `Dispose()` manually to free native resources. | +| *Can I generate SVG instead of PNG?* | Absolutely. Use `BarCodeImageFormat.Svg` in the `Save` method. | +| *Is the library compatible with .NET Core?* | Aspose.BarCode for .NET supports .NET Core 3.1, .NET 5, .NET 6, and later. No code changes are required. | + +--- + +## Conclusion + +You now know how to **create 4‑column databar barcode** in C# using Aspose.BarCode, how to adjust the layout with rows, and how to export the result in a convenient **barcode image format**. The complete example shows both column‑based and row‑based configurations, giving you a solid foundation for any label‑printing or mobile‑scanning scenario. + +**Next steps** + +* Experiment with different data payloads and verify scanner compatibility. +* Explore additional styling options such as foreground/background colors (`generator.Parameters.Barcode.Color`). +* Combine the barcode with other graphics using the `Graphics` API for custom label designs. + +Feel free to adapt the code for ASP.NET Core, Windows Forms, or Xamarin projects—Aspose.BarCode works across all .NET platforms. Happy coding! + + +## What Should You Learn Next? + + +The following tutorials cover closely related topics that build on the techniques demonstrated in this guide. Each resource includes complete working code examples with step-by-step explanations to help you master additional API features and explore alternative implementation approaches in your own projects. + +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Create barcode image c# – Configure Codablock F Rows & Columns](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [How to create dotcode extended codetext with Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/english/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/og-image.png b/barcode/english/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/og-image.png new file mode 100644 index 0000000000000000000000000000000000000000..efb7b5947091a114ed63f3295f246409eb2cc34f GIT binary patch literal 52405 zcmc$`Ra6{X*EUL=K#<^02=2jy6C}912X}AWl0YC>Ai>?G(clijwQ<+rZjCk#^k1;| z`;GtNoHO3<>M(LqDXLbjHRoJYp7|_7loTY

4{FkdV-%rNmW`ke>cVLVE0m{1~|N z=j}c!64IcLwD<=#kGcItS0Ccq$1fab%LC9kI7}$Cx?>Wpbggn-Nl%GgYO5C;?9I&0 z&GX)IaAZHZfOnK^(Oh(q(87F$Z=2#_hakSxoM?0^ok>IJezdI24{+xJfVXJr||qW@XaKWp3u&$TAfl(|o0 zvI7!NCH{}Hw7u0@nE#_Jxi7{_i8^Xw|Ey$@AnjkH`5!A1e3`9FranZ6r@(wh!rt;% zUp+38^J(T;L`l@Woh|C}_=tXAdUM8EvF>^H{L$;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Hyt|0vgg~(%$!{C zZN~2W&d)dMhJF1-MMQ5m&58_(fVer&Q@=ju_7f{{D<-V#drNXEr%vdd0NsN|_4aL9 z09UBQgM!8d`h4ZZ@#;XNuc@o+p3xDR$JWrmYOPEx4N*VgtTAKk;PNCxioBeQ1+JsH zx%=0z2`k5zLSr@>F5QIa=>96mE$KUAUPU@MZ)lYe(k(v$D})6JbgU5c=(ts+XVZb} z%y~=*%Jq{rJzWK14$`o{%%vU;;H-p%gg7EN#MtI%GJ8kR>yTSFNWHmF24LU@%U~rfXaKC zbCDqNHLJwVlB9ETwCJHpQ3XZpJe;i+k+8k`XKw34qBSQ|z+BIDIVlI?u`8vDi3%x5VHb_c;nZh6}qdrq#_ zmUfo58Lz%m(af5fgCBs5&A7y#r*AD^zMPBZR=7mQ>azM|oDQH5ij;7|!v%{;0tp zGh4oJaM+nNV4oHURep*9N&!r_9qR!Aot2vmwGa@JYp`9o;Hd@LbKv)(nS|A;)f&-C z&i{Ca;Da>&>KXngik_#T0`?=}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Create barcode image in C# – complete programming guide + +If you need to **create barcode image** in a .NET application, this guide shows you exactly **how to generate barcode** using the Aspose.BarCode library. You’ll see how to control the **barcode height pixels**, save the image, and produce **multiple barcodes** without duplicating code. + +The tutorial covers everything from installing the package to customizing dimensions, so you can copy‑paste a ready‑to‑run example into your project today. + +## Prerequisites + +Before you start, make sure you have: + +* .NET 6.0 SDK or later installed +* Visual Studio 2022 (or any C# IDE) +* NuGet package `Aspose.BarCode` – install with + +```bash +dotnet add package Aspose.BarCode +``` + +No additional dependencies are required. + +## How to generate barcode image with BarcodeGenerator C# + +The core class for creating a barcode image is `BarcodeGenerator`. It encapsulates the encoding type, the data string, and all rendering parameters. + +### Step 1: Define the output folder + +Choose a folder where the generated PNG files will be stored. Using an absolute path avoids permission surprises. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Why?** Creating the folder programmatically guarantees that the subsequent `Save` calls succeed even on a fresh machine. + +### Step 2: Instantiate the barcode generator + +For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` and the GS1‑128 data string. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Note:** The `BarcodeGenerator` object is reusable; you can change its parameters between saves to **create multiple barcodes** from the same data. + +### Step 3: Set common barcode parameters + +The most common visual tweaks are the X‑dimension (module width) and the bar height. Both are expressed in pixels. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Why set X‑dimension?** A smaller X‑dimension yields higher resolution, which is important when the image will be printed or displayed on high‑DPI screens. + +### Step 4: Save the first barcode image + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +The file `DatabarBarHeight30Pixels.png` now contains a 30‑pixel‑high DataBar Omnidirectional barcode. + +### Step 5: Adjust the barcode height pixels + +Changing the height does not require a new `BarcodeGenerator` instance—just modify the parameter. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Step 6: Save the second barcode image + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Now you have two PNG files with different **barcode height pixels**, demonstrating how easy it is to **create barcode image** variations. + +## Setting barcode height pixels dynamically + +Often you need a series of barcodes with heights that match UI elements or printed labels. The following helper method abstracts the height change: + +```csharp +///

+/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +You can now call `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` to **create barcode image** with a 45‑pixel height in a single line. + +## Creating multiple barcodes in a loop + +When you have a collection of product identifiers, a `foreach` loop eliminates repetitive code. This example shows how to **create multiple barcodes** from an array of GTINs. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +The loop produces three PNG files, each with a distinct **barcode height pixels** value. Because the `SaveBarcodeWithHeight` helper encapsulates the height change, the main loop stays clean and focused on data. + +### Expected output + +After running the full sample, the `Barcodes` folder contains: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Opening any PNG shows a crisp DataBar Omnidirectional barcode that can be scanned by standard mobile apps. + +## Common pitfalls and pro tips + +| Issue | Why it happens | How to avoid it | +|-------|----------------|-----------------| +| **Wrong EncodeTypes** | Using a 1D type for a DataBar will produce an unreadable image. | Always pick `EncodeTypes.DatabarOmniDirectional` (or another DataBar variant) for GS1‑128 payloads. | +| **Insufficient X‑dimension** | Very low X‑dimension can make thin bars disappear on low‑resolution monitors. | Keep `XDimension.Pixels` ≥ 2 for screen display; increase to 3‑4 for printing. | +| **File path errors** | Relative paths may resolve to unexpected directories. | Use `Path.Combine` and `Environment.CurrentDirectory` to build absolute paths. | +| **Overwriting images** | Re‑using the same file name in a loop overwrites previous results. | Include unique identifiers (e.g., GTIN or timestamp) in the file name. | +| **Missing NuGet package** | Code compiles but throws `FileNotFoundException` at runtime. | Verify `Aspose.BarCode` is installed and the project references it. | + +## Full working example + +Below is the complete program you can copy into a console application. It includes all steps, helper methods, and error handling. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Running this program + + +## What Should You Learn Next? + + +The following tutorials cover closely related topics that build on the techniques demonstrated in this guide. Each resource includes complete working code examples with step-by-step explanations to help you master additional API features and explore alternative implementation approaches in your own projects. + +- [Create Barcode Custom Height – One-Dimensional Barcodes](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Create barcode image C# – GS1 DataMatrix Example](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/english/python-java/general/create-barcode-image-in-c-complete-programming-guide/og-image.png b/barcode/english/python-java/general/create-barcode-image-in-c-complete-programming-guide/og-image.png new file mode 100644 index 0000000000000000000000000000000000000000..7ba63e9a526ce80faf0fa1647bf7e4376b153e3d GIT binary patch literal 51188 zcmbrl1yEdD7bZ#!NYDVm-JRg>9y|mK7ToFJPD5xQxVyW%dw}5X4#C|W8hD4?`~Nj> zrl#giy{=UHq;t+bYp=cbl5c%GKv7;2=^gGn7#J8NX(_SKFfgynVPIZ5!oLK5`9*qw z00Yz0BrPWV#d-c<$-#L+f(Y)U$^f2ga8Ndf&8&ZLusLSBMstSw{3^7rmd;Y!%*fc- zSSrddA)(I^?f#*&B#yFHKQzT%P$7*!fg&Y)Vrkd&2YQKZEN8^;UD*#WfVaTFc!dUq z(*M1J5fXy`=K>!7pZ|k-LGsTJ#Kf=vxp)ov=iAE*^`8q=)MsIV&r6YizDKPQ4gWs< z^9Dz-O*34PL8xB}hsG&8I;WlB?>){1RP$?~?BM8#%F?{xe+Du<3@EG>42+Io`E0!s z{r-O*^k2#JOC-w`r{Xbz@yI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bEmoP8HrWp4;HWU{3aAQ{gqeeu}~ zt)lif%u*9UE>3irMrpY4mlZWVX^tN**3X=(3!|8^Fdf{QWwRBrmP)Sm`_~y@I+*@w$^zax|4>gA(d2>#p*4yDDEB2Ed6kwtoMDFJ)9S1`pVQ0Ve69SZQ0k= z@lnj>{#RuhatCR0AWG5R)z#H|XUbs1<)BSkno$s$XL`$%x9hX0zLzqo232d^+(mP= zuV}J(<=dK%CVa@ge|UK#&7XiD*R-^oY$&&kY?FC=324D2j*7t8`BeMb>m8YFCWCr_ zvI!RbrVS(w#GJNwvqSoTT>Q#PSBYUb;V_njg^N7iTjo@eJM5UjsW}p2mNEM zwVCxNI{HT)nwD`qCVmG`W955AuC7eFEcSng%e-4#vvYHGD;Fpi5D)+d zeCWCOw8D~8=w1c~<>jlQ_Nfn?Y_pLH^rM?#oS}>3Trx@kL zbvQVh#hc1gku15leK?WaO$~<>K^cJ0)|r_JLYu{W!J5&8aD%?&qTP4m*u%?JRfy7| z=q{?m8qs1CBq)tKo9-KyoSjA{8A|$r9016I?f%@(YGkkXlJ)zoZE_|OaR0Uj5#ijP8G9DoNS(FUH5BmeMa?wJKYsiOX#p{0 zQTD+XgAUQsz3VbCLeabwBKl)t7Q6)nCZmE6*6@mkm_&kZ?DFEy;@a1xbI+~ z3>D%}G$4MZrQ+uXq5AF26qu9}%N!)bJzj&cK0H#xNynAiE6X3*=w*dKz5X`FJk|%&&)FL`(A0!I!(q2A)^B;4QUbALLw5hb` wGn{|Ts?mz+7kTJE{{BBW)c>oG(reEyDL=hZ!>~xHaXv}~S(PWnkQZ}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Create barcode image with C# barcode generator – guide + +If you need to **create barcode image** quickly, this guide shows you how to do it with a C# barcode generator. You will learn to generate multiple barcodes, change the aspect ratio, and save each image as a PNG file. + +Generating barcode images is a common task when building inventory systems, point‑of‑sale terminals, or shipping labels. By the end of this tutorial you will have two ready‑to‑use PNG files that demonstrate different aspect ratios, and you will understand how to extend the approach to any number of barcodes. + +## Prerequisites + +Before you start, make sure you have: + +* .NET 6.0 SDK or later installed +* Visual Studio 2022 (or any IDE that supports C#) +* A reference to a barcode library that supports DataBar Stacked Omnidirectional (for example, **Aspose.BarCode for .NET**). The code snippets use the Aspose API, but the concepts apply to any library with similar properties. + +You do not need a separate database or web server—this is a plain console application. + +## Step 1: Set up the console project + +Create a new console project and add the barcode library via NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +The `dotnet add package` command pulls the latest stable version of **Aspose.BarCode**, which provides the `BarcodeGenerator` class used later. + +## Step 2: Write the full program + +Open *Program.cs* and replace its content with the complete example below. The program creates a **barcode image**, changes the aspect ratio, and saves two PNG files. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Why each part matters + +* **Create barcode image** – The `BarcodeGenerator` constructor initializes the object with the desired symbology and data. +* **c# barcode generator** – The `Parameters` property gives you full control over rendering options; setting `XDimension.Pixels` ensures each bar is crisp on screen. +* **generate multiple barcodes** – By changing `DataBar.AspectRatio` between saves, the same generator instance produces two distinct images without recreating the object, which is more efficient. + +## Step 3: Run the program and view the results + +Execute the application: + +```bash +dotnet run +``` + +You should see console output similar to: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Open the `BarcodeOutputs` folder. You will find two PNG files: + +* **DatabarAspectRatio15.png** – a compact barcode suitable for limited‑height labels. +* **DatabarAspectRatio30.png** – a taller barcode that many scanners read more reliably from a distance. + +Both images are ready to be embedded in PDFs, printed on receipts, or sent to a mobile app. + +## Step 4: Extend the solution to generate any number of barcodes + +The pattern shown above easily scales: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – The loop iterates over an array of aspect ratios, creating a distinct **barcode image** for each value. +* Adjust the `EncodeTypes` or the encoded string to produce QR codes, Code 128, or other symbologies without changing the surrounding logic. + +## Practical tips and common pitfalls + +| Tip | Explanation | +|-----|-------------| +| **Reuse the same generator** | Re‑initializing `BarcodeGenerator` for every image adds unnecessary overhead. Changing parameters between `Save` calls is faster and uses less memory. | +| **Validate the output folder** | Always call `Directory.CreateDirectory` before saving; otherwise `Save` throws a `DirectoryNotFoundException`. | +| **Choose an appropriate X‑dimension** | Very low pixel values (e.g., 1) can make the barcode unreadable on low‑resolution screens. Values of 2–3 work well for most printers. | +| **Mind the encoding** | GS1 DataBar expects a leading `(01)` for GTIN. If you omit the parentheses, the library may generate an invalid barcode. | +| **Test with a real scanner** | Visual inspection is not enough. Test the PNG files with the actual scanner hardware you plan to use. | + +## Expected output (visual description) + +*Both PNG files display a dark‑on‑light DataBar Stacked Omnidirectional barcode. The version with aspect ratio 15 is shorter, while the version with aspect ratio 30 is roughly twice as tall.* + +If you embed the images in a document, they will render sharply because we set `XDimension.Pixels = 2`. + +## Conclusion + +You now know how to **create barcode image** files using a **C# barcode generator**, and you can **generate multiple barcodes** by adjusting the aspect ratio or any other parameter. The complete, runnable example demonstrates best practices such as reusing the generator instance, handling output directories, and verifying file creation. + +Next, you might explore: + +* Adding custom colors with `generator.Parameters.Barcode.Color` (secondary keyword: **c# barcode generator**) +* Exporting to other formats like JPEG or SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Integrating the barcode creation logic into a Web API to serve images on demand (secondary keyword + + +## What Should You Learn Next? + + +The following tutorials cover closely related topics that build on the techniques demonstrated in this guide. Each resource includes complete working code examples with step-by-step explanations to help you master additional API features and explore alternative implementation approaches in your own projects. + +- [Create Barcode PNG – DataMatrix Aspect Ratio – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Customize Code 16K Barcode Aspect Ratios with Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/english/python-java/general/create-barcode-image-with-c-barcode-generator-guide/og-image.png b/barcode/english/python-java/general/create-barcode-image-with-c-barcode-generator-guide/og-image.png new file mode 100644 index 0000000000000000000000000000000000000000..f5849dde742837ea6623162562e499a679f9d1a7 GIT binary patch literal 49823 zcmc$`WmFtp6D~>&Nbm&L5D4z>5Zv80xLa^f(BSUwZoy?Bf#B{A!QB~TV20D=eZRAg ztRwf{A9ofjz0=S=yQ^wfJ@r)e4po$wKzW1z1`ZAmMM_ds84m7c4IJEaSH$PQnV%ny zkl^6D%%ns=sk$#7t+==^iIX6l)fppl4G%{IeNIhP->Iyx%D40C8*XpV;iX~)KE<{v zQ%p`al(lPu%bu1-v@E?+9ofZWS;KMillv#mg18AhA ztaO%4v&32!3AkVEm;0iBuf;r!E^DF;ONeDrwp&Y}W}-27AIkXS-2P_d!{3PrQ3mt= z`#}Gz8v}CxA0L^AC+R^7c?TQsasG==SDC>WjZOA5UHXM=<|4;&uK&XYyC# zlDBw*Ae|UZdf_LbxfLaB|04RU9QP{9#SQzvB9c%@eV+d%xM}$HC}r6M-IETTe_1F> z)8A0VumB1;PG@0XCjCe0dwKtv?mxo*T2%&)w>I7w{$mZ!A1mZrG!%j_9V~JW70;iY4o>oIk@lNd?SGX8 zX0x}-iJ~O%e{}Q@_%HXuwn>P5gp`11 z|2q2a=}e9R(s&QT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y9pFc_<0#sz`Ehd26xFTj;?G)f3L9FM{K#8n0|lQpYfvB3|2L=WT{ zrASqLpqjMss9T?6LyK5T#Scjhbv9z&IeA;uNW<#(9E!2F4gyjW4bf(jo|6&&FDxwQ z+F}l-Dz$M{#P;w?GRaQ@J$Ru-^c~;ql$7AOQmJ@QL6R^En=&_*sH*h$RfK4VUj@M^ zyKi9CYq77UB9yDA%D1!16lj>QE{u(#$NOJ>Hp>y;yw;2Kj7O$b;!E-VAZ4on02CX=iq-DkRe)~vGhh1bwCToJ8J`sGzR{KEf+dU$ ziH{D6qcL|wZf*W~Zb^j5qXC#W8L7={x#5PuR)B0mcN1lKpBW5gBzYa}^w9#{_NC#e zb-*_*ZX9PZ&<EGt?o}rOHDlww|-#=)pOyzyA80h)~I|bkF=gt3%a7av@tPHWt)7r zRz#iVe+_(pQzATIG%`ZFKnr4Na6v{1r?eIU8oJPA0PHql%UmaaWC01e?A_}$GV#)0 z$q3v-I7YNwIr<}OBkRJ#f)|6>#(p%ego47(M26ioB7{yn8K9~1m&j~K(~E)3c~sOu z`<`!aMklv%ffxY09RS!JFZC+VJ>T=>Lh`%z7PA&0Odc&+jXm0C*e8^|!-$mxkCJ6( z^lGP9OM?Im82Qzn@>HPSUS1B8Y^BcT`-tPZ73{$Pd`t__VSnNGGFfZg>az6C=h!5`nRU%UQty`00)3Fe4f^l2k*gvjM%5`t3cNY<@bRQP2po{su zz#a((vC$%zYP3(>Qw9v0L z#LVea-tw2YeNT1W09y^94?j!o6Qo|*H)I#fe`I1~J>{LA{q?5TQP^sbY`D(B7yiM& zJN07uD^4zV>eN4Nb8wb$k$L!=O8LvhRKMSSA^*^|@t^Lr_=hHdfA-z~*G(%L{lwEF XJL{}MrLMP5?nm*l+M_&~CvX1;$Q`#_ literal 0 HcmV?d00001 diff --git a/barcode/french/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/french/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..f746527f4 --- /dev/null +++ b/barcode/french/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,242 @@ +--- +category: general +date: 2026-08-09 +description: Créez rapidement un code‑barres databar à 4 colonnes en C# avec Aspose.BarCode. + Apprenez à configurer les colonnes, les lignes et à enregistrer des images PNG dans + ce guide concis. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: fr +lastmod: 2026-08-09 +og_description: Créez un code‑barres databar à 4 colonnes en C# avec Aspose.BarCode, + puis personnalisez les lignes et exportez des images PNG pour votre application. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Créer un code‑barres databar à 4 colonnes en C# – tutoriel rapide +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Créer un code‑barres Databar à 4 colonnes en C# – guide étape par étape +url: /fr/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Créer un code‑barres databar à 4 colonnes en C# – guide étape par étape + +Si vous devez **créer un code‑barres databar à 4 colonnes** en C#, ce tutoriel vous montre exactement comment procéder. Nous parcourrons la génération d’un code‑barres DataBar Expanded Stacked, la configuration de quatre colonnes et l’enregistrement du résultat sous forme d’image PNG. + +Dans ce guide, vous apprendrez à : + +* Initialiser le `BarcodeGenerator` pour un symbole **DataBar Expanded Stacked**. +* Définir le nombre de colonnes à 4 (l’exigence principale). +* Ajuster le nombre de lignes lorsque vous avez besoin d’une disposition empilée avec trois lignes. +* Exporter le code‑barres au format PNG en utilisant le **format d’image de code‑barres** approprié. + +Vous avez seulement besoin de la bibliothèque Aspose.BarCode for .NET (version 23.10 ou ultérieure) et d’un environnement de développement .NET 6+ tel que Visual Studio 2022. Aucune dépendance supplémentaire n’est requise. + +--- + +## Comment créer un code‑barres databar à 4 colonnes + +La première étape consiste à créer une instance de `BarcodeGenerator` qui cible la symbologie **DataBar Expanded Stacked**. Cette classe encapsule toutes les options de rendu, ce qui facilite le passage entre les dispositions basées sur les colonnes et celles basées sur les lignes. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Pourquoi cela fonctionne :** +`EncodeTypes.DatabarExpandedStacked` indique à Aspose.BarCode de produire la version empilée de la famille DataBar. La propriété `DataBar.Columns` contrôle le nombre de modules verticaux occupés par le code‑barres. La définir à 4 correspond à l’exigence de **créer un code‑barres databar à 4 colonnes**. Enfin, `Save` écrit la représentation visuelle sur le disque en utilisant le **format d’image de code‑barres** `Png`. + +### Configurer les colonnes du DataBar Expanded Stacked + +Si vous avez besoin d’un nombre de colonnes différent, modifiez simplement l’entier attribué à `Columns`. La propriété accepte des valeurs de 1 à 4 pour la variante expanded stacked. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Astuce :* Testez toujours le code‑barres généré avec un lecteur qui prend en charge la famille DataBar, car l’apparence visuelle seule ne garantit pas la lisibilité. + +### Enregistrer l’image du code‑barres + +L’énumération `BarCodeImageFormat` propose plusieurs options (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG est sans perte et fonctionne bien pour la plupart des scénarios web et desktop. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Si vous avez besoin d’un format différent, remplacez `Png` par la valeur d’énumération souhaitée. Le fichier enregistré peut être intégré directement dans du HTML, des PDF, ou imprimé sur des étiquettes. + +## Créer un code‑barres avec des lignes personnalisées + +Parfois, une disposition empilée nécessite un nombre spécifique de lignes au lieu de colonnes. La même classe `BarcodeGenerator` expose une propriété `Rows` à cet effet. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Pourquoi les lignes comptent :** +Lorsque le code‑barres empilé est plus haut que large, la propriété `Rows` détermine en combien de tranches horizontales le symbole est divisé. Définir `Rows = 3` crée un code‑barres empilé à trois lignes, ce qui est utile pour des largeurs d’étiquette étroites. + +### Définir les lignes du code‑barres dynamiquement + +Vous pouvez calculer le nombre de lignes à l’exécution en fonction des données d’entrée : + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Cette flexibilité vous permet de **définir les lignes du code‑barres** sans recompilation de l’application. + +## Exemple complet de bout en bout + +Voici un programme unique qui génère à la fois un code‑barres à 4 colonnes et un code‑barres à 3 lignes, démontrant comment les deux configurations coexistent. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Résultat attendu :** +Deux fichiers PNG apparaissent dans le répertoire de travail de l’application : + +* `DatabarCols4.png` – un code‑barres DataBar Expanded Stacked avec quatre colonnes verticales. +* `DatabarRows3.png` – la même symbologie disposée en trois lignes horizontales. + +Les deux images peuvent être ouvertes avec n’importe quel visualiseur d’images ou intégrées dans un contrôle UI. + +--- + +## Questions fréquentes et cas particuliers + +| Question | Réponse | +|----------|--------| +| *Puis‑je utiliser une symbologie de code‑barres différente ?* | Oui. Remplacez `EncodeTypes.DatabarExpandedStacked` par une autre valeur `EncodeTypes` (par ex., `EncodeTypes.QR`), mais les propriétés `Columns` et `Rows` sont spécifiques aux familles DataBar. | +| *Que se passe-t-il si la chaîne de données dépasse la longueur maximale ?* | La symbologie DataBar Expanded Stacked prend en charge jusqu’à 61 caractères numériques. Dépasser cette limite génère une `ArgumentException`. Validez l’entrée avant de l’attribuer au générateur. | +| *Dois‑je disposer du `BarcodeGenerator` ?* | `BarcodeGenerator` implémente `IDisposable`. Dans un service de longue durée, encapsulez‑le dans un bloc `using` ou appelez `Dispose()` manuellement pour libérer les ressources natives. | +| *Puis‑je générer du SVG au lieu de PNG ?* | Absolument. Utilisez `BarCodeImageFormat.Svg` dans la méthode `Save`. | +| *La bibliothèque est‑elle compatible avec .NET Core ?* | Aspose.BarCode for .NET prend en charge .NET Core 3.1, .NET 5, .NET 6 et les versions ultérieures. Aucun changement de code n’est nécessaire. | + +--- + +## Conclusion + +Vous savez maintenant comment **créer un code‑barres databar à 4 colonnes** en C# avec Aspose.BarCode, comment ajuster la disposition avec des lignes, et comment exporter le résultat dans un **format d’image de code‑barres** pratique. L’exemple complet montre les configurations basées sur les colonnes et sur les lignes, vous offrant une base solide pour tout scénario d’impression d’étiquettes ou de numérisation mobile. + +**Prochaines étapes** + +* Expérimentez avec différents contenus de données et vérifiez la compatibilité du lecteur. +* Explorez des options de style supplémentaires telles que les couleurs de premier plan/arrière‑plan (`generator.Parameters.Barcode.Color`). +* Combinez le code‑barres avec d’autres graphiques en utilisant l’API `Graphics` pour des conceptions d’étiquettes personnalisées. + +N’hésitez pas à adapter le code pour des projets ASP.NET Core, Windows Forms ou Xamarin—Aspose.BarCode fonctionne sur toutes les plateformes .NET. Bon codage ! + +## Que devriez‑vous apprendre ensuite ? + +Les tutoriels suivants couvrent des sujets étroitement liés qui s’appuient sur les techniques démontrées dans ce guide. Chaque ressource comprend des exemples de code complets et fonctionnels avec des explications étape par étape pour vous aider à maîtriser des fonctionnalités supplémentaires de l’API et explorer des approches d’implémentation alternatives dans vos propres projets. + +- [Créer une image de code‑barres DotCode – lignes & colonnes (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Créer une image de code‑barres c# – Configurer les lignes & colonnes de Codablock F](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Comment créer un texte de code étendu dotcode avec Aspose.BarCode pour .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/french/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/french/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..6243ead8a --- /dev/null +++ b/barcode/french/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,303 @@ +--- +category: general +date: 2026-08-09 +description: Créez une image de code‑barres en C# avec ce guide étape par étape. Apprenez + à générer un code‑barres, à ajuster la hauteur du code‑barres en pixels et à créer + plusieurs codes‑barres efficacement. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: fr +lastmod: 2026-08-09 +og_description: Créez rapidement une image de code‑barres en C#. Suivez ce tutoriel + pour apprendre à générer un code‑barres, définir la hauteur du code‑barres en pixels + et produire plusieurs codes‑barres. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Créer une image de code-barres en C# – guide complet pour les développeurs +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Créer une image de code-barres en C# – guide complet de programmation +url: /fr/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Créer une image de code-barres en C# – guide complet de programmation + +Si vous devez **créer une image de code-barres** dans une application .NET, ce guide vous montre exactement **comment générer un code-barres** en utilisant la bibliothèque Aspose.BarCode. Vous verrez comment contrôler les **pixels de hauteur du code-barres**, enregistrer l'image et produire **plusieurs codes-barres** sans dupliquer le code. + +Le tutoriel couvre tout, de l'installation du package à la personnalisation des dimensions, afin que vous puissiez copier‑coller un exemple prêt à l'emploi dans votre projet dès aujourd'hui. + +## Prérequis + +* SDK .NET 6.0 ou version ultérieure installé +* Visual Studio 2022 (ou tout IDE C#) +* Package NuGet `Aspose.BarCode` – installer avec + +```bash +dotnet add package Aspose.BarCode +``` + +Aucune dépendance supplémentaire n'est requise. + +## Comment générer une image de code-barres avec BarcodeGenerator C# + +La classe principale pour créer une image de code-barres est `BarcodeGenerator`. Elle encapsule le type d'encodage, la chaîne de données et tous les paramètres de rendu. + +### Étape 1 : Définir le dossier de sortie + +Choisissez un dossier où les fichiers PNG générés seront stockés. Utiliser un chemin absolu évite les surprises liées aux permissions. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Pourquoi ?** Créer le dossier de manière programmatique garantit que les appels `Save` suivants réussissent même sur une machine neuve. + +### Étape 2 : Instancier le générateur de code-barres + +Pour un code-barres DataBar Omnidirectional, passez `EncodeTypes.DatabarOmniDirectional` et la chaîne de données GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Remarque :** L'objet `BarcodeGenerator` est réutilisable ; vous pouvez modifier ses paramètres entre les enregistrements pour **créer plusieurs codes-barres** à partir des mêmes données. + +### Étape 3 : Définir les paramètres communs du code-barres + +Les ajustements visuels les plus courants sont la X‑dimension (largeur du module) et la hauteur des barres. Les deux sont exprimés en pixels. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Pourquoi définir la X‑dimension ?** Une X‑dimension plus petite donne une résolution plus élevée, ce qui est important lorsque l'image sera imprimée ou affichée sur des écrans à haute densité de pixels (DPI). + +### Étape 4 : Enregistrer la première image de code-barres + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +Le fichier `DatabarBarHeight30Pixels.png` contient maintenant un code-barres DataBar Omnidirectional de 30 pixels de hauteur. + +### Étape 5 : Ajuster la hauteur du code-barres en pixels + +Modifier la hauteur ne nécessite pas une nouvelle instance de `BarcodeGenerator` — il suffit de modifier le paramètre. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Étape 6 : Enregistrer la deuxième image de code-barres + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Vous avez maintenant deux fichiers PNG avec des **pixels de hauteur de code-barres** différents, démontrant la facilité de créer des variantes d'**image de code-barres**. + +## Définir dynamiquement les pixels de hauteur du code-barres + +Souvent, vous avez besoin d'une série de codes-barres avec des hauteurs correspondant aux éléments d'interface ou aux étiquettes imprimées. La méthode d'assistance suivante abstrait le changement de hauteur : + +```csharp +///

+/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Vous pouvez maintenant appeler `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` pour **créer une image de code-barres** avec une hauteur de 45 pixels en une seule ligne. + +## Créer plusieurs codes-barres dans une boucle + +Lorsque vous avez une collection d'identifiants de produits, une boucle `foreach` élimine le code répétitif. Cet exemple montre comment **créer plusieurs codes-barres** à partir d'un tableau de GTIN. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +La boucle génère trois fichiers PNG, chacun avec une valeur distincte de **pixels de hauteur du code-barres**. Comme la fonction d'assistance `SaveBarcodeWithHeight` encapsule le changement de hauteur, la boucle principale reste propre et centrée sur les données. + +### Résultat attendu + +Après avoir exécuté l'exemple complet, le dossier `Barcodes` contient : + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Ouvrir n'importe quel PNG montre un code-barres DataBar Omnidirectional net qui peut être scanné par des applications mobiles standard. + +## Pièges courants et astuces pro + +| Problème | Pourquoi cela se produit | Comment l'éviter | +|----------|--------------------------|------------------| +| **EncodeTypes incorrects** | Utiliser un type 1D pour un DataBar produira une image illisible. | Toujours choisir `EncodeTypes.DatabarOmniDirectional` (ou une autre variante DataBar) pour les charges utiles GS1‑128. | +| **X‑dimension insuffisante** | Une X‑dimension très faible peut faire disparaître les barres fines sur des moniteurs à faible résolution. | Conservez `XDimension.Pixels` ≥ 2 pour l'affichage à l'écran ; augmentez à 3‑4 pour l'impression. | +| **Erreurs de chemin de fichier** | Les chemins relatifs peuvent se résoudre vers des répertoires inattendus. | Utilisez `Path.Combine` et `Environment.CurrentDirectory` pour construire des chemins absolus. | +| **Écrasement d'images** | Réutiliser le même nom de fichier dans une boucle écrase les résultats précédents. | Incluez des identifiants uniques (par ex., GTIN ou horodatage) dans le nom de fichier. | +| **Package NuGet manquant** | Le code compile mais lève une `FileNotFoundException` à l'exécution. | Vérifiez que `Aspose.BarCode` est installé et que le projet le référence. | + +## Exemple complet fonctionnel + +Voici le programme complet que vous pouvez copier dans une application console. Il inclut toutes les étapes, les méthodes d'assistance et la gestion des erreurs. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Exécution de ce programme + +## Que devriez‑vous apprendre ensuite ? + +Les tutoriels suivants couvrent des sujets étroitement liés qui s'appuient sur les techniques démontrées dans ce guide. Chaque ressource inclut des exemples de code complets avec des explications étape par étape pour vous aider à maîtriser des fonctionnalités supplémentaires de l'API et à explorer des approches d'implémentation alternatives dans vos propres projets. + +- [Créer un code-barres hauteur personnalisée – Codes-barres unidimensionnels](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Créer une image de code-barres C# – Exemple GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Créer une image de code-barres DotCode – lignes & colonnes (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/french/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/french/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..6901ee385 --- /dev/null +++ b/barcode/french/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-09 +description: Créez une image de code‑barres avec un générateur de codes‑barres C# + et apprenez à générer plusieurs codes‑barres avec des rapports d’aspect personnalisés + en quelques minutes. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: fr +lastmod: 2026-08-09 +og_description: Créez une image de code-barres à l'aide d'un générateur de codes-barres + en C#. Ce tutoriel montre comment générer plusieurs codes-barres, ajuster les rapports + d'aspect et enregistrer des fichiers PNG efficacement. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Créer une image de code-barres avec le générateur de code-barres C# – guide + rapide +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Créer une image de code-barres avec le générateur de code-barres C# – guide +url: /fr/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Créer une image de code-barres avec le générateur de code-barres C# – guide + +Si vous devez **créer une image de code-barres** rapidement, ce guide vous montre comment le faire avec un générateur de code-barres C#. Vous apprendrez à générer plusieurs codes-barres, à modifier le rapport d'aspect et à enregistrer chaque image au format PNG. + +Générer des images de code-barres est une tâche courante lors de la création de systèmes d'inventaire, de terminaux point de vente ou d'étiquettes d'expédition. À la fin de ce tutoriel, vous disposerez de deux fichiers PNG prêts à l'emploi qui illustrent différents rapports d'aspect, et vous comprendrez comment étendre l'approche à n'importe quel nombre de codes-barres. + +## Prérequis + +* SDK .NET 6.0 ou version ultérieure installé +* Visual Studio 2022 (ou tout IDE prenant en charge C#) +* Une référence à une bibliothèque de codes-barres qui prend en charge DataBar Stacked Omnidirectional (par exemple, **Aspose.BarCode for .NET**). Les extraits de code utilisent l'API Aspose, mais les concepts s'appliquent à toute bibliothèque avec des propriétés similaires. + +Vous n'avez pas besoin d'une base de données ou d'un serveur web séparé — il s'agit d'une simple application console. + +## Étape 1 : Configurer le projet console + +Créez un nouveau projet console et ajoutez la bibliothèque de codes-barres via NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +La commande `dotnet add package` récupère la dernière version stable de **Aspose.BarCode**, qui fournit la classe `BarcodeGenerator` utilisée plus tard. + +## Étape 2 : Écrire le programme complet + +Ouvrez *Program.cs* et remplacez son contenu par l'exemple complet ci‑dessous. Le programme crée une **image de code-barres**, modifie le rapport d'aspect et enregistre deux fichiers PNG. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Pourquoi chaque partie est importante + +* **Créer une image de code-barres** – Le constructeur `BarcodeGenerator` initialise l'objet avec la symbologie et les données souhaitées. +* **c# barcode generator** – La propriété `Parameters` vous donne un contrôle total sur les options de rendu ; définir `XDimension.Pixels` garantit que chaque barre est nette à l'écran. +* **generate multiple barcodes** – En modifiant `DataBar.AspectRatio` entre les sauvegardes, la même instance du générateur produit deux images distinctes sans recréer l'objet, ce qui est plus efficace. + +## Étape 3 : Exécuter le programme et voir les résultats + +Exécutez l'application : + +```bash +dotnet run +``` + +Vous devriez voir une sortie console similaire à : + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Ouvrez le dossier `BarcodeOutputs`. Vous y trouverez deux fichiers PNG : + +* **DatabarAspectRatio15.png** – un code-barres compact adapté aux étiquettes de hauteur limitée. +* **DatabarAspectRatio30.png** – un code-barres plus haut que de nombreux lecteurs lisent plus fiable à distance. + +Les deux images sont prêtes à être intégrées dans des PDF, imprimées sur des reçus ou envoyées à une application mobile. + +## Étape 4 : Étendre la solution pour générer n'importe quel nombre de codes-barres + +Le modèle présenté ci‑dessus s'adapte facilement : + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – La boucle parcourt un tableau de rapports d'aspect, créant une **image de code-barres** distincte pour chaque valeur. +* Ajustez les `EncodeTypes` ou la chaîne encodée pour produire des QR codes, Code 128 ou d'autres symbologies sans modifier la logique environnante. + +## Conseils pratiques et pièges courants + +| Conseil | Explication | +|-----|-------------| +| **Réutiliser le même générateur** | Ré‑initialiser `BarcodeGenerator` pour chaque image ajoute une surcharge inutile. Modifier les paramètres entre les appels `Save` est plus rapide et utilise moins de mémoire. | +| **Valider le dossier de sortie** | Appelez toujours `Directory.CreateDirectory` avant d'enregistrer ; sinon `Save` lève une `DirectoryNotFoundException`. | +| **Choisir une X‑dimension appropriée** | Des valeurs de pixels très faibles (par ex., 1) peuvent rendre le code-barres illisible sur des écrans basse résolution. Des valeurs de 2–3 fonctionnent bien pour la plupart des imprimantes. | +| **Faire attention à l'encodage** | GS1 DataBar attend un préfixe `(01)` pour le GTIN. Si vous omettez les parenthèses, la bibliothèque peut générer un code-barres invalide. | +| **Tester avec un vrai scanner** | L'inspection visuelle ne suffit pas. Testez les fichiers PNG avec le matériel de scanner réel que vous prévoyez d'utiliser. | + +## Résultat attendu (description visuelle) + +*Les deux fichiers PNG affichent un code-barres DataBar Stacked Omnidirectional sombre sur fond clair. La version avec un rapport d'aspect 15 est plus courte, tandis que celle avec un rapport d'aspect 30 est approximativement deux fois plus haute.* + +Si vous intégrez les images dans un document, elles s'afficheront nettes car nous avons défini `XDimension.Pixels = 2`. + +## Conclusion + +Vous savez maintenant comment **créer des fichiers d'image de code-barres** en utilisant un **générateur de code-barres C#**, et vous pouvez **générer plusieurs codes-barres** en ajustant le rapport d'aspect ou tout autre paramètre. L'exemple complet et exécutable montre les meilleures pratiques telles que la réutilisation de l'instance du générateur, la gestion des dossiers de sortie et la vérification de la création des fichiers. + +Ensuite, vous pourriez explorer : + +* Ajouter des couleurs personnalisées avec `generator.Parameters.Barcode.Color` (mot‑clé secondaire : **c# barcode generator**) +* Exporter vers d'autres formats comme JPEG ou SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Intégrer la logique de création de code-barres dans une Web API pour fournir des images à la demande (mot‑clé secondaire + +## Que devriez‑vous apprendre ensuite ? + +Les tutoriels suivants couvrent des sujets étroitement liés qui s'appuient sur les techniques démontrées dans ce guide. Chaque ressource comprend des exemples de code complets et fonctionnels avec des explications étape par étape pour vous aider à maîtriser des fonctionnalités d'API supplémentaires et explorer des approches d'implémentation alternatives dans vos propres projets. + +- [Créer un PNG de code-barres – Ratio d'aspect DataMatrix – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [Tutoriel générateur de code-barres C# – Personnaliser les rapports d'aspect du code 16K avec Aspose.BarCode pour .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Comment générer un code-barres Aztec avec un rapport d'aspect personnalisé en utilisant Aspose.BarCode pour .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/german/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/german/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..600e26583 --- /dev/null +++ b/barcode/german/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,240 @@ +--- +category: general +date: 2026-08-09 +description: Erstellen Sie schnell einen 4‑Spalten‑Databar-Barcode in C# mit Aspose.BarCode. + Erfahren Sie, wie Sie Spalten, Zeilen konfigurieren und PNG‑Bilder speichern, in + diesem knappen Leitfaden. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: de +lastmod: 2026-08-09 +og_description: Erstellen Sie einen 4‑Spalten‑Databar‑Barcode in C# mit Aspose.BarCode, + passen Sie anschließend die Zeilen an und exportieren Sie PNG‑Bilder für Ihre App. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Erstelle einen 4‑Spalten‑Databar‑Barcode in C# – Schnell‑Tutorial +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Erstellen Sie einen 4‑spaltigen DataBar-Barcode in C# – Schritt‑für‑Schritt‑Anleitung +url: /de/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Erstellen Sie einen 4‑Spalten‑Databar‑Barcode in C# – Schritt‑für‑Schritt‑Anleitung + +Wenn Sie einen **4‑Spalten‑Databar‑Barcode** in C# erstellen müssen, zeigt Ihnen dieses Tutorial genau, wie es geht. Wir führen Sie durch die Erzeugung eines DataBar Expanded Stacked‑Barcodes, die Konfiguration von vier Spalten und das Speichern des Ergebnisses als PNG‑Bild. + +In diesem Leitfaden lernen Sie, wie Sie: + +* Initialisieren Sie den `BarcodeGenerator` für ein **DataBar Expanded Stacked**‑Symbol. +* Setzen Sie die Spaltenanzahl auf 4 (die Hauptanforderung). +* Passen Sie die Zeilenanzahl an, wenn Sie ein gestapeltes Layout mit drei Zeilen benötigen. +* Exportieren Sie den Barcode als PNG unter Verwendung des entsprechenden **barcode image format**. + +Sie benötigen lediglich die Aspose.BarCode for .NET‑Bibliothek (Version 23.10 oder höher) und eine .NET 6+ Entwicklungsumgebung wie Visual Studio 2022. Keine zusätzlichen Abhängigkeiten sind erforderlich. + +--- + +## So erstellen Sie einen 4‑Spalten‑Databar‑Barcode + +Der erste Schritt besteht darin, eine `BarcodeGenerator`‑Instanz zu erstellen, die die **DataBar Expanded Stacked**‑Symbolik anvisiert. Diese Klasse kapselt alle Rendering‑Optionen und ermöglicht ein einfaches Umschalten zwischen spalten‑basierten und zeilen‑basierten Layouts. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Warum das funktioniert:** +`EncodeTypes.DatabarExpandedStacked` weist Aspose.BarCode an, die gestapelte Version der DataBar‑Familie zu erzeugen. Die Eigenschaft `DataBar.Columns` steuert, wie viele vertikale Module der Barcode einnimmt. Das Setzen auf 4 entspricht der Anforderung, **einen 4‑Spalten‑Databar‑Barcode zu erstellen**. Schließlich schreibt `Save` die visuelle Darstellung mit dem **barcode image format** `Png` auf die Festplatte. + +### DataBar Expanded Stacked‑Spalten konfigurieren + +Wenn Sie eine andere Spaltenanzahl benötigen, ändern Sie einfach die dem `Columns`‑Parameter zugewiesene Ganzzahl. Die Eigenschaft akzeptiert Werte von 1 bis 4 für die erweiterte gestapelte Variante. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro Tipp:* Testen Sie den erzeugten Barcode stets mit einem Scanner, der die DataBar‑Familie unterstützt, da das reine Aussehen keine Lesbarkeit garantiert. + +### Barcode‑Bild speichern + +Die Aufzählung `BarCodeImageFormat` bietet mehrere Optionen (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG ist verlustfrei und eignet sich gut für die meisten Web‑ und Desktop‑Szenarien. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Wenn Sie ein anderes Format benötigen, ersetzen Sie `Png` durch den gewünschten Enum‑Wert. Die gespeicherte Datei kann direkt in HTML, PDFs eingebettet oder auf Etiketten gedruckt werden. + +## Barcode mit benutzerdefinierten Zeilen erstellen + +Manchmal ist ein gestapeltes Layout mit einer bestimmten Anzahl von Zeilen anstelle von Spalten erforderlich. Die gleiche `BarcodeGenerator`‑Klasse stellt dafür die Eigenschaft `Rows` bereit. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Warum Zeilen wichtig sind:** +Wenn der gestapelte Barcode höher als breit ist, bestimmt die Eigenschaft `Rows`, in wie viele horizontale Abschnitte das Symbol unterteilt wird. Das Setzen von `Rows = 3` erzeugt einen dreizeiligen gestapelten Barcode, was bei schmalen Etikettenbreiten nützlich ist. + +### Barcode‑Zeilen dynamisch festlegen + +Sie können die Zeilenanzahl zur Laufzeit basierend auf Eingabedaten berechnen: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Diese Flexibilität ermöglicht es Ihnen, **Barcode‑Zeilen festzulegen**, ohne die Anwendung neu zu kompilieren. + +## Vollständiges End‑to‑End‑Beispiel + +Unten finden Sie ein einzelnes Programm, das sowohl einen 4‑Spalten‑Barcode als auch einen 3‑Zeilen‑Barcode erzeugt und zeigt, wie die beiden Konfigurationen koexistieren. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Erwartete Ausgabe:** +Zwei PNG‑Dateien erscheinen im Arbeitsverzeichnis der Anwendung: + +* `DatabarCols4.png` – ein DataBar Expanded Stacked‑Barcode mit vier vertikalen Spalten. +* `DatabarRows3.png` – dieselbe Symbolik, angeordnet in drei horizontalen Zeilen. + +Beide Bilder können in jedem Bildbetrachter geöffnet oder in ein UI‑Steuerelement eingebettet werden. + +--- + +## Häufige Fragen und Sonderfälle + +| Frage | Antwort | +|----------|--------| +| *Kann ich eine andere Barcode‑Symbologie verwenden?* | Ja. Ersetzen Sie `EncodeTypes.DatabarExpandedStacked` durch einen anderen `EncodeTypes`‑Wert (z. B. `EncodeTypes.QR`), aber die Eigenschaften `Columns` und `Rows` sind spezifisch für DataBar‑Familien. | +| *Was passiert, wenn die Datenzeichenkette die maximale Länge überschreitet?* | Die DataBar Expanded Stacked‑Symbolik unterstützt bis zu 61 numerische Zeichen. Überschreitet man dieses Limit, wird eine `ArgumentException` ausgelöst. Validieren Sie die Eingabe, bevor Sie sie dem Generator zuweisen. | +| *Muss ich den `BarcodeGenerator` entsorgen?* | `BarcodeGenerator` implementiert `IDisposable`. In einem langlaufenden Service sollten Sie ihn in einem `using`‑Block einbetten oder `Dispose()` manuell aufrufen, um native Ressourcen freizugeben. | +| *Kann ich SVG anstelle von PNG erzeugen?* | Absolut. Verwenden Sie `BarCodeImageFormat.Svg` in der `Save`‑Methode. | +| *Ist die Bibliothek mit .NET Core kompatibel?* | Aspose.BarCode for .NET unterstützt .NET Core 3.1, .NET 5, .NET 6 und neuere Versionen. Es sind keine Code‑Änderungen erforderlich. | + +## Fazit + +Sie wissen jetzt, wie Sie **einen 4‑Spalten‑Databar‑Barcode** in C# mit Aspose.BarCode erstellen, das Layout mit Zeilen anpassen und das Ergebnis in einem praktischen **barcode image format** exportieren. Das vollständige Beispiel zeigt sowohl spalten‑basierte als auch zeilen‑basierte Konfigurationen und bietet Ihnen eine solide Grundlage für jedes Etikett‑Druck‑ oder Mobile‑Scanning‑Szenario. + +**Nächste Schritte** + +* Experimentieren Sie mit verschiedenen Datenpayloads und überprüfen Sie die Scanner‑Kompatibilität. +* Erkunden Sie zusätzliche Styling‑Optionen wie Vorder‑/Hintergrundfarben (`generator.Parameters.Barcode.Color`). +* Kombinieren Sie den Barcode mit anderen Grafiken über die `Graphics`‑API für benutzerdefinierte Etikettendesigns. + +Passen Sie den Code gern für ASP.NET Core, Windows Forms oder Xamarin‑Projekte an – Aspose.BarCode funktioniert auf allen .NET‑Plattformen. Viel Spaß beim Coden! + +## Was sollten Sie als Nächstes lernen? + +Die folgenden Tutorials behandeln eng verwandte Themen, die auf den in diesem Leitfaden gezeigten Techniken aufbauen. Jede Ressource enthält vollständige, funktionierende Code‑Beispiele mit Schritt‑für‑Schritt‑Erklärungen, um Ihnen zu helfen, weitere API‑Funktionen zu meistern und alternative Implementierungsansätze in Ihren eigenen Projekten zu erkunden. + +- [DotCode‑Barcode‑Bild erstellen – Zeilen & Spalten (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Barcode‑Bild in C# erstellen – Codablock F‑Zeilen & Spalten konfigurieren](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Wie man erweiterten DotCode‑Codetext mit Aspose.BarCode für .NET erstellt](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/german/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/german/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..4e19de12c --- /dev/null +++ b/barcode/german/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,307 @@ +--- +category: general +date: 2026-08-09 +description: Erstelle ein Barcode‑Bild in C# mit dieser Schritt‑für‑Schritt‑Anleitung. + Erfahre, wie du Barcodes generierst, die Barcode‑Höhe in Pixeln anpasst und mehrere + Barcodes effizient erstellst. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: de +lastmod: 2026-08-09 +og_description: Erstellen Sie schnell ein Barcode‑Bild in C#. Folgen Sie diesem Tutorial, + um zu lernen, wie man Barcodes generiert, die Barcode‑Höhe in Pixeln festlegt und + mehrere Barcodes erzeugt. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Barcode-Bild in C# erstellen – vollständige Anleitung für Entwickler +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Barcode-Bild in C# erstellen – vollständiger Programmierleitfaden +url: /de/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Barcode‑Bild in C# erstellen – vollständiger Programmierleitfaden + +Wenn Sie in einer .NET‑Anwendung **Barcode‑Bild** erstellen müssen, zeigt Ihnen dieser Leitfaden genau **wie man Barcode** mit der Aspose.BarCode‑Bibliothek generiert. Sie sehen, wie Sie die **Barcode‑Höhe in Pixeln** steuern, das Bild speichern und **mehrere Barcodes** erzeugen, ohne Code zu duplizieren. + +Das Tutorial deckt alles ab, von der Installation des Pakets bis zur Anpassung der Abmessungen, sodass Sie noch heute ein einsatzbereites Beispiel in Ihr Projekt kopieren‑und‑einfügen können. + +## Voraussetzungen + +Bevor Sie beginnen, stellen Sie sicher, dass Sie Folgendes haben: + +* .NET 6.0 SDK oder neuer installiert +* Visual Studio 2022 (oder jede C#‑IDE) +* NuGet‑Paket `Aspose.BarCode` – Installation mit + +```bash +dotnet add package Aspose.BarCode +``` + +Weitere Abhängigkeiten sind nicht erforderlich. + +## Wie man ein Barcode‑Bild mit BarcodeGenerator C# erzeugt + +Die Kernklasse zum Erstellen eines Barcode‑Bildes ist `BarcodeGenerator`. Sie kapselt den Codierungstyp, den Daten‑String und alle Rendering‑Parameter. + +### Schritt 1: Ausgabeverzeichnis festlegen + +Wählen Sie einen Ordner, in dem die erzeugten PNG‑Dateien gespeichert werden. Ein absoluter Pfad verhindert Überraschungen bei Berechtigungen. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Warum?** Das programmgesteuerte Anlegen des Ordners garantiert, dass die nachfolgenden `Save`‑Aufrufe selbst auf einem frischen Rechner erfolgreich sind. + +### Schritt 2: Barcode‑Generator instanziieren + +Für einen DataBar Omnidirectional‑Barcode übergeben Sie `EncodeTypes.DatabarOmniDirectional` und den GS1‑128‑Daten‑String. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Hinweis:** Das `BarcodeGenerator`‑Objekt ist wiederverwendbar; Sie können seine Parameter zwischen den Saves ändern, um **mehrere Barcodes** aus denselben Daten zu **erstellen**. + +### Schritt 3: Gemeinsame Barcode‑Parameter setzen + +Die häufigsten visuellen Anpassungen sind die X‑Dimension (Modulbreite) und die Balkenhöhe. Beide werden in Pixeln angegeben. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Warum X‑Dimension setzen?** Eine kleinere X‑Dimension liefert höhere Auflösung, was wichtig ist, wenn das Bild gedruckt oder auf hochauflösenden Bildschirmen angezeigt wird. + +### Schritt 4: Erstes Barcode‑Bild speichern + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +Die Datei `DatabarBarHeight30Pixels.png` enthält nun einen 30‑Pixel‑hohen DataBar Omnidirectional‑Barcode. + +### Schritt 5: Barcode‑Höhe in Pixeln anpassen + +Die Höhe zu ändern erfordert keine neue `BarcodeGenerator`‑Instanz – passen Sie einfach den Parameter an. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Schritt 6: Zweites Barcode‑Bild speichern + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Jetzt haben Sie zwei PNG‑Dateien mit unterschiedlichen **Barcode‑Höhen in Pixeln**, was zeigt, wie einfach es ist, **Barcode‑Bilder** zu variieren. + +## Barcode‑Höhe in Pixeln dynamisch setzen + +Oft benötigen Sie eine Reihe von Barcodes mit Höhen, die zu UI‑Elementen oder gedruckten Etiketten passen. Die folgende Hilfsmethode kapselt die Höhenänderung: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Sie können nun `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` aufrufen, um **Barcode‑Bild** mit einer Höhe von 45 Pixeln in einer einzigen Zeile zu **erstellen**. + +## Mehrere Barcodes in einer Schleife erzeugen + +Wenn Sie eine Sammlung von Produkt‑Identifiers haben, eliminiert eine `foreach`‑Schleife wiederholenden Code. Dieses Beispiel zeigt, wie man **mehrere Barcodes** aus einem Array von GTINs **erstellt**. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +Die Schleife erzeugt drei PNG‑Dateien, jede mit einem anderen **Barcode‑Höhen‑Pixel**‑Wert. Da die Hilfsmethode `SaveBarcodeWithHeight` die Höhenänderung kapselt, bleibt die Hauptschleife sauber und fokussiert auf die Daten. + +### Erwartete Ausgabe + +Nach Ausführen des vollständigen Beispiels enthält der Ordner `Barcodes`: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Das Öffnen einer beliebigen PNG zeigt einen scharfen DataBar Omnidirectional‑Barcode, der von gängigen mobilen Apps gescannt werden kann. + +## Häufige Fallstricke und Profi‑Tipps + +| Problem | Warum es passiert | Wie man es vermeidet | +|---------|-------------------|----------------------| +| **Falsche EncodeTypes** | Verwendung eines 1D‑Typs für einen DataBar erzeugt ein nicht lesbares Bild. | Immer `EncodeTypes.DatabarOmniDirectional` (oder eine andere DataBar‑Variante) für GS1‑128‑Payloads wählen. | +| **Unzureichende X‑Dimension** | Sehr niedrige X‑Dimension kann dünne Balken auf Bildschirmen mit niedriger Auflösung verschwinden lassen. | `XDimension.Pixels` ≥ 2 für Bildschirmanzeige behalten; für Druck auf 3‑4 erhöhen. | +| **Dateipfad‑Fehler** | Relative Pfade können zu unerwarteten Verzeichnissen auflösen. | `Path.Combine` und `Environment.CurrentDirectory` verwenden, um absolute Pfade zu bauen. | +| **Überschreiben von Bildern** | Wiederverwendung desselben Dateinamens in einer Schleife überschreibt vorherige Ergebnisse. | Eindeutige Kennungen (z. B. GTIN oder Zeitstempel) in den Dateinamen einbinden. | +| **Fehlendes NuGet‑Paket** | Code kompiliert, wirft aber zur Laufzeit `FileNotFoundException`. | Sicherstellen, dass `Aspose.BarCode` installiert und im Projekt referenziert ist. | + +## Komplettes funktionierendes Beispiel + +Unten finden Sie das vollständige Programm, das Sie in eine Konsolenanwendung kopieren können. Es enthält alle Schritte, Hilfsmethoden und Fehlerbehandlung. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Das Ausführen dieses Programms + + +## Was sollten Sie als Nächstes lernen? + + +Die folgenden Tutorials behandeln eng verwandte Themen, die auf den in diesem Leitfaden gezeigten Techniken aufbauen. Jede Ressource enthält vollständige, funktionierende Code‑Beispiele mit Schritt‑für‑Schritt‑Erklärungen, um Ihnen zu helfen, weitere API‑Funktionen zu meistern und alternative Implementierungsansätze in Ihren eigenen Projekten zu erkunden. + +- [Barcode mit benutzerdefinierter Höhe erstellen – Eindimensionale Barcodes](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Barcode‑Bild C# erstellen – GS1 DataMatrix‑Beispiel](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [DotCode‑Barcode‑Bild erstellen – Reihen & Spalten (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/german/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/german/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..3ba6acc40 --- /dev/null +++ b/barcode/german/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-09 +description: Erstellen Sie ein Barcode‑Bild mit einem C#‑Barcode‑Generator und lernen + Sie, innerhalb von Minuten mehrere Barcodes mit benutzerdefinierten Seitenverhältnissen + zu erzeugen. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: de +lastmod: 2026-08-09 +og_description: Erstellen Sie Barcode‑Bilder mit einem C#‑Barcode‑Generator. Dieses + Tutorial zeigt, wie man mehrere Barcodes generiert, Seitenverhältnisse anpasst und + PNG‑Dateien effizient speichert. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Barcode-Bild mit C#‑Barcode‑Generator erstellen – Kurzanleitung +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Barcode-Bild mit C#-Barcode-Generator erstellen – Anleitung +url: /de/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Barcode‑Bild mit C# Barcode‑Generator erstellen – Anleitung + +Wenn Sie **ein Barcode‑Bild** schnell erstellen müssen, zeigt Ihnen diese Anleitung, wie Sie das mit einem C# Barcode‑Generator tun. Sie lernen, mehrere Barcodes zu erzeugen, das Seitenverhältnis zu ändern und jedes Bild als PNG‑Datei zu speichern. + +Das Erzeugen von Barcode‑Bildern ist eine gängige Aufgabe beim Aufbau von Inventarsystemen, Kassen‑Terminals oder Versandetiketten. Am Ende dieses Tutorials verfügen Sie über zwei einsatzbereite PNG‑Dateien, die unterschiedliche Seitenverhältnisse demonstrieren, und Sie verstehen, wie Sie den Ansatz auf beliebig viele Barcodes ausweiten können. + +## Voraussetzungen + +Bevor Sie beginnen, stellen Sie sicher, dass Sie Folgendes haben: + +* .NET 6.0 SDK oder neuer installiert +* Visual Studio 2022 (oder jede IDE, die C# unterstützt) +* Einen Verweis auf eine Barcode‑Bibliothek, die **DataBar Stacked Omnidirectional** unterstützt (z. B. **Aspose.BarCode for .NET**). Die Code‑Snippets verwenden die Aspose‑API, aber die Konzepte gelten für jede Bibliothek mit ähnlichen Eigenschaften. + +Sie benötigen keine separate Datenbank oder Web‑Server – dies ist eine reine Konsolenanwendung. + +## Schritt 1: Das Konsolenprojekt einrichten + +Erstellen Sie ein neues Konsolenprojekt und fügen Sie die Barcode‑Bibliothek über NuGet hinzu. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +Der Befehl `dotnet add package` holt die neueste stabile Version von **Aspose.BarCode**, die die später verwendete Klasse `BarcodeGenerator` bereitstellt. + +## Schritt 2: Das vollständige Programm schreiben + +Öffnen Sie *Program.cs* und ersetzen Sie den Inhalt durch das komplette Beispiel unten. Das Programm erstellt ein **barcode image**, ändert das Seitenverhältnis und speichert zwei PNG‑Dateien. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Warum jeder Teil wichtig ist + +* **Create barcode image** – Der Konstruktor `BarcodeGenerator` initialisiert das Objekt mit der gewünschten Symbolik und den Daten. +* **c# barcode generator** – Die Eigenschaft `Parameters` gibt Ihnen die volle Kontrolle über Render‑Optionen; das Setzen von `XDimension.Pixels` sorgt dafür, dass jede Leiste auf dem Bildschirm scharf erscheint. +* **generate multiple barcodes** – Durch das Ändern von `DataBar.AspectRatio` zwischen den Saves erzeugt dieselbe Generator‑Instanz zwei unterschiedliche Bilder, ohne das Objekt neu zu erstellen, was effizienter ist. + +## Schritt 3: Das Programm ausführen und die Ergebnisse ansehen + +Führen Sie die Anwendung aus: + +```bash +dotnet run +``` + +Sie sollten eine Konsolenausgabe ähnlich der folgenden sehen: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Öffnen Sie den Ordner `BarcodeOutputs`. Dort finden Sie zwei PNG‑Dateien: + +* **DatabarAspectRatio15.png** – ein kompaktes Barcode, geeignet für etiketten mit begrenzter Höhe. +* **DatabarAspectRatio30.png** – ein höheres Barcode, das von vielen Scannern aus größerer Entfernung zuverlässiger gelesen wird. + +Beide Bilder können in PDFs eingebettet, auf Quittungen gedruckt oder an eine mobile App gesendet werden. + +## Schritt 4: Die Lösung erweitern, um beliebig viele Barcodes zu erzeugen + +Das oben gezeigte Muster lässt sich leicht skalieren: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – Die Schleife iteriert über ein Array von Seitenverhältnissen und erstellt für jeden Wert ein eigenes **barcode image**. +* Passen Sie `EncodeTypes` oder den zu codierenden String an, um QR‑Codes, Code 128 oder andere Symboliken zu erzeugen, ohne die umgebende Logik zu ändern. + +## Praktische Tipps und häufige Stolperfallen + +| Tipp | Erklärung | +|-----|-------------| +| **Reuse the same generator** | Das erneute Initialisieren von `BarcodeGenerator` für jedes Bild verursacht unnötigen Overhead. Das Ändern von Parametern zwischen `Save`‑Aufrufen ist schneller und verbraucht weniger Speicher. | +| **Validate the output folder** | Rufen Sie immer `Directory.CreateDirectory` auf, bevor Sie speichern; sonst wirft `Save` eine `DirectoryNotFoundException`. | +| **Choose an appropriate X‑dimension** | Sehr niedrige Pixelwerte (z. B. 1) können das Barcode auf Bildschirmen mit niedriger Auflösung unlesbar machen. Werte von 2–3 funktionieren für die meisten Drucker gut. | +| **Mind the encoding** | GS1 DataBar erwartet ein führendes `(01)` für die GTIN. Wenn Sie die Klammern weglassen, kann die Bibliothek ein ungültiges Barcode erzeugen. | +| **Test with a real scanner** | Visuelle Inspektion reicht nicht aus. Testen Sie die PNG‑Dateien mit der tatsächlichen Scanner‑Hardware, die Sie einsetzen wollen. | + +## Erwartete Ausgabe (visuelle Beschreibung) + +*Beide PNG‑Dateien zeigen ein dunkel‑auf‑hellen DataBar Stacked Omnidirectional Barcode. Die Version mit Seitenverhältnis 15 ist kürzer, während die Version mit Seitenverhältnis 30 etwa doppelt so hoch ist.* + +Wenn Sie die Bilder in ein Dokument einbetten, werden sie scharf dargestellt, weil wir `XDimension.Pixels = 2` gesetzt haben. + +## Fazit + +Sie wissen jetzt, wie Sie **barcode image**‑Dateien mit einem **C# barcode generator** erstellen und **multiple barcodes** erzeugen, indem Sie das Seitenverhältnis oder andere Parameter anpassen. Das vollständige, ausführbare Beispiel demonstriert Best Practices wie das Wiederverwenden der Generator‑Instanz, das Handhaben von Ausgabeverzeichnissen und die Überprüfung der Dateierstellung. + +Als Nächstes könnten Sie: + +* Benutzerdefinierte Farben mit `generator.Parameters.Barcode.Color` hinzufügen (secondary keyword: **c# barcode generator**) +* In andere Formate wie JPEG oder SVG exportieren (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Die Barcode‑Erstellungslogik in eine Web‑API integrieren, um Bilder bei Bedarf bereitzustellen (secondary keyword + +## Was sollten Sie als Nächstes lernen? + + +Die folgenden Tutorials behandeln eng verwandte Themen, die auf den in diesem Leitfaden gezeigten Techniken aufbauen. Jede Ressource enthält vollständige, funktionierende Code‑Beispiele mit Schritt‑für‑Schritt‑Erklärungen, um Ihnen zu helfen, weitere API‑Funktionen zu meistern und alternative Implementierungsansätze in Ihren eigenen Projekten zu erkunden. + +- [Create Barcode PNG – DataMatrix Aspect Ratio – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Customize Code 16K Barcode Aspect Ratios with Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/greek/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/greek/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..5139f8fd6 --- /dev/null +++ b/barcode/greek/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,243 @@ +--- +category: general +date: 2026-08-09 +description: Δημιουργήστε γρήγορα γραμμωτό κώδικα databar 4‑στηλών σε C# με το Aspose.BarCode. + Μάθετε πώς να ρυθμίσετε στήλες, γραμμές και να αποθηκεύσετε εικόνες PNG σε αυτόν + τον σύντομο οδηγό. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: el +lastmod: 2026-08-09 +og_description: Δημιουργήστε γραμμωτό κώδικα databar 4 στηλών σε C# χρησιμοποιώντας + το Aspose.BarCode, στη συνέχεια προσαρμόστε τις σειρές και εξάγετε εικόνες PNG για + την εφαρμογή σας. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Δημιουργία barcode databar 4‑στηλών σε C# – γρήγορος οδηγός +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Δημιουργία 4‑στήλης barcode τύπου databar σε C# – οδηγός βήμα‑βήμα +url: /el/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Δημιουργία barcode databar 4‑στηλών σε C# – βήμα‑βήμα οδηγός + +Αν χρειάζεστε **να δημιουργήσετε barcode databar 4‑στηλών** σε C#, αυτό το tutorial σας δείχνει ακριβώς πώς. Θα περάσουμε από τη δημιουργία ενός barcode DataBar Expanded Stacked, τη ρύθμιση των τεσσάρων στηλών και την αποθήκευση του αποτελέσματος ως εικόνα PNG. + +Σε αυτόν τον οδηγό θα μάθετε πώς να: + +* Αρχικοποιήσετε το `BarcodeGenerator` για ένα σύμβολο **DataBar Expanded Stacked**. +* Ορίσετε τον αριθμό στηλών σε 4 (η κύρια απαίτηση). +* Ρυθμίσετε τον αριθμό σειρών όταν χρειάζεστε στοίβαξη με τρεις σειρές. +* Εξάγετε το barcode ως PNG χρησιμοποιώντας το κατάλληλο **barcode image format**. + +Χρειάζεστε μόνο τη βιβλιοθήκη Aspose.BarCode for .NET (έκδοση 23.10 ή νεότερη) και ένα περιβάλλον ανάπτυξης .NET 6+ όπως το Visual Studio 2022. Δεν απαιτούνται πρόσθετες εξαρτήσεις. + +--- + +## Πώς να δημιουργήσετε barcode databar 4‑στηλών + +Το πρώτο βήμα είναι να δημιουργήσετε μια παρουσία του `BarcodeGenerator` που στοχεύει στη **DataBar Expanded Stacked** συμβολική. Αυτή η κλάση περιλαμβάνει όλες τις επιλογές απόδοσης, καθιστώντας εύκολο το μεταπήδημα μεταξύ διατάξεων με βάση στήλες ή σειρές. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Γιατί λειτουργεί αυτό:** +`EncodeTypes.DatabarExpandedStacked` λέει στο Aspose.BarCode να παραγάγει την στοίβαξη της οικογένειας DataBar. Η ιδιότητα `DataBar.Columns` ελέγχει πόσες κάθετες μονάδες καταλαμβάνει το barcode. Ορίζοντάς το σε 4 ταιριάζει με την απαίτηση **να δημιουργήσετε barcode databar 4‑στηλών**. Τέλος, η μέθοδος `Save` γράφει την οπτική αναπαράσταση στο δίσκο χρησιμοποιώντας το **barcode image format** `Png`. + +### Διαμόρφωση στηλών DataBar Expanded Stacked + +Αν χρειάζεστε διαφορετικό αριθμό στηλών, απλώς αλλάξτε τον ακέραιο που έχει ανατεθεί στο `Columns`. Η ιδιότητα δέχεται τιμές από 1 ως 4 για την παραλλαγή expanded stacked. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Συμβουλή:* Πάντα δοκιμάζετε το παραγόμενο barcode με έναν σαρωτή που υποστηρίζει την οικογένεια DataBar, επειδή η οπτική εμφάνιση από μόνη της δεν εγγυάται την αναγνώσιμότητα. + +### Αποθήκευση της εικόνας barcode + +Η απαρίθμηση `BarCodeImageFormat` παρέχει αρκετές επιλογές (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). Το PNG είναι χωρίς απώλειες και λειτουργεί καλά για τις περισσότερες διαδικτυακές και επιτραπέζιες περιπτώσεις. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Αν χρειάζεστε διαφορετική μορφή, αντικαταστήστε το `Png` με την επιθυμητή τιμή της απαρίθμησης. Το αποθηκευμένο αρχείο μπορεί να ενσωματωθεί απευθείας σε HTML, PDF ή να εκτυπωθεί σε ετικέτες. + +## Δημιουργία barcode με προσαρμοσμένες σειρές + +Μερικές φορές απαιτείται στοίβαξη με συγκεκριμένο αριθμό σειρών αντί για στήλες. Η ίδια κλάση `BarcodeGenerator` εκθέτει μια ιδιότητα `Rows` για αυτό το σκοπό. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Γιατί οι σειρές έχουν σημασία:** +Όταν το στοίβαγμα barcode είναι ψηλότερο από το πλάτος του, η ιδιότητα `Rows` καθορίζει σε πόσες οριζόντιες φέτες διαιρείται το σύμβολο. Ορίζοντας `Rows = 3` δημιουργείται ένα barcode στοίβαξης τριών σειρών, χρήσιμο για στενά πλάτη ετικετών. + +### Ορισμός σειρών barcode δυναμικά + +Μπορείτε να υπολογίσετε τον αριθμό σειρών κατά την εκτέλεση βάσει των εισερχόμενων δεδομένων: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Αυτή η ευελιξία σας επιτρέπει να **ορίσετε σειρές barcode** χωρίς να χρειάζεται επαναμεταγλώττιση της εφαρμογής. + +## Πλήρες παράδειγμα από άκρο σε άκρο + +Παρακάτω υπάρχει ένα ενιαίο πρόγραμμα που δημιουργεί τόσο ένα barcode 4‑στηλών όσο και ένα barcode 3‑σειρών, δείχνοντας πώς συνυπάρχουν οι δύο διαμορφώσεις. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Αναμενόμενο αποτέλεσμα:** +Δύο αρχεία PNG εμφανίζονται στον τρέχοντα φάκελο της εφαρμογής: + +* `DatabarCols4.png` – ένα DataBar Expanded Stacked barcode με τέσσερις κάθετες στήλες. +* `DatabarRows3.png` – το ίδιο σύμβολο διατεταγμένο σε τρεις οριζόντιες σειρές. + +Και οι δύο εικόνες μπορούν να ανοιχτούν σε οποιονδήποτε προβολέα εικόνων ή να ενσωματωθούν σε ένα UI control. + +--- + +## Συχνές ερωτήσεις και ειδικές περιπτώσεις + +| Ερώτηση | Απάντηση | +|----------|--------| +| *Μπορώ να χρησιμοποιήσω διαφορετική συμβολική barcode;* | Ναι. Αντικαταστήστε το `EncodeTypes.DatabarExpandedStacked` με άλλη τιμή του `EncodeTypes` (π.χ., `EncodeTypes.QR`), αλλά οι ιδιότητες `Columns` και `Rows` είναι συγκεκριμένες για τις οικογένειες DataBar. | +| *Τι γίνεται αν η συμβολοσειρά δεδομένων υπερβαίνει το μέγιστο μήκος;* | Η συμβολική DataBar Expanded Stacked υποστηρίζει έως 61 αριθμητικούς χαρακτήρες. Η υπέρβαση αυτού του ορίου προκαλεί `ArgumentException`. Επαληθεύστε την είσοδο πριν την αναθέσετε στον γεννήτρια. | +| *Πρέπει να απελευθερώσω το `BarcodeGenerator`;* | Το `BarcodeGenerator` υλοποιεί το `IDisposable`. Σε μια υπηρεσία μακράς διάρκειας, τυλίξτε το σε μπλοκ `using` ή καλέστε το `Dispose()` χειροκίνητα για να ελευθερώσετε τους εγγενείς πόρους. | +| *Μπορώ να δημιουργήσω SVG αντί για PNG;* | Απόλυτα. Χρησιμοποιήστε `BarCodeImageFormat.Svg` στη μέθοδο `Save`. | +| *Είναι η βιβλιοθήκη συμβατή με .NET Core;* | Το Aspose.BarCode for .NET υποστηρίζει .NET Core 3.1, .NET 5, .NET 6 και μεταγενέστερες εκδόσεις. Δεν απαιτούνται αλλαγές κώδικα. | + +--- + +## Συμπέρασμα + +Τώρα γνωρίζετε πώς να **δημιουργήσετε barcode databar 4‑στηλών** σε C# χρησιμοποιώντας το Aspose.BarCode, πώς να προσαρμόσετε τη διάταξη με σειρές και πώς να εξάγετε το αποτέλεσμα σε ένα βολικό **barcode image format**. Το πλήρες παράδειγμα δείχνει τόσο τις διαμορφώσεις με στήλες όσο και με σειρές, παρέχοντάς σας μια σταθερή βάση για οποιοδήποτε σενάριο εκτύπωσης ετικετών ή κινητής σάρωσης. + +**Επόμενα βήματα** + +* Πειραματιστείτε με διαφορετικά δεδομένα και επαληθεύστε τη συμβατότητα του σαρωτή. +* Εξερευνήστε πρόσθετες επιλογές στυλ όπως χρώματα προσκηνίου/υπόβαθρου (`generator.Parameters.Barcode.Color`). +* Συνδυάστε το barcode με άλλα γραφικά χρησιμοποιώντας το API `Graphics` για προσαρμοσμένα σχέδια ετικετών. + +Αισθανθείτε ελεύθεροι να προσαρμόσετε τον κώδικα για έργα ASP.NET Core, Windows Forms ή Xamarin—το Aspose.BarCode λειτουργεί σε όλες τις πλατφόρμες .NET. Καλό κώδικα! + +## Τι πρέπει να μάθετε στη συνέχεια; + +Τα παρακάτω tutorials καλύπτουν στενά σχετικές θεματικές που επεκτείνουν τις τεχνικές που παρουσιάστηκαν σε αυτόν τον οδηγό. Κάθε πόρος περιλαμβάνει πλήρη λειτουργικά παραδείγματα κώδικα με βήμα‑βήμα εξηγήσεις για να σας βοηθήσουν να κατακτήσετε πρόσθετες δυνατότητες του API και να εξερευνήσετε εναλλακτικές προσεγγίσεις υλοποίησης στα δικά σας έργα. + +- [Δημιουργία εικόνας barcode DotCode – σειρές & στήλες (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Δημιουργία εικόνας barcode c# – Διαμόρφωση σειρών & στηλών Codablock F](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Πώς να δημιουργήσετε εκτεταμένο κείμενο κώδικα dotcode με Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/greek/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/greek/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..3b181015c --- /dev/null +++ b/barcode/greek/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,306 @@ +--- +category: general +date: 2026-08-09 +description: Δημιουργήστε εικόνα γραμμωτού κώδικα σε C# με αυτόν τον οδηγό βήμα‑βήμα. + Μάθετε πώς να δημιουργείτε γραμμωτό κώδικα, να ρυθμίζετε το ύψος του σε εικονοστοιχεία + και να δημιουργείτε πολλαπλούς γραμμωτούς κώδικες αποδοτικά. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: el +lastmod: 2026-08-09 +og_description: Δημιουργήστε εικόνα γραμμωτού κώδικα σε C# γρήγορα. Ακολουθήστε αυτό + το σεμινάριο για να μάθετε πώς να δημιουργήσετε γραμμωτό κώδικα, να ορίσετε το ύψος + του γραμμωτού κώδικα σε εικονοστοιχεία και να παράγετε πολλαπλούς γραμμωτούς κώδικες. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Δημιουργήστε εικόνα barcode σε C# – πλήρης οδηγός για προγραμματιστές +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Δημιουργία εικόνας barcode σε C# – πλήρης οδηγός προγραμματισμού +url: /el/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Δημιουργία εικόνας barcode σε C# – πλήρης οδηγός προγραμματισμού + +Αν χρειάζεστε **δημιουργία εικόνας barcode** σε μια εφαρμογή .NET, αυτός ο οδηγός σας δείχνει ακριβώς **πώς να δημιουργήσετε barcode** χρησιμοποιώντας τη βιβλιοθήκη Aspose.BarCode. Θα δείτε πώς να ελέγξετε το **ύψος του barcode σε pixel**, να αποθηκεύσετε την εικόνα και να παράγετε **πολλαπλά barcodes** χωρίς να διπλασιάζετε κώδικα. + +Το tutorial καλύπτει όλα, από την εγκατάσταση του πακέτου μέχρι την προσαρμογή διαστάσεων, ώστε να μπορείτε να αντιγράψετε‑επικολλήσετε ένα έτοιμο παράδειγμα που τρέχει αμέσως στο πρόγραμμά σας. + +## Προαπαιτούμενα + +Πριν ξεκινήσετε, βεβαιωθείτε ότι έχετε: + +* .NET 6.0 SDK ή νεότερο εγκατεστημένο +* Visual Studio 2022 (ή οποιοδήποτε IDE για C#) +* Πακέτο NuGet `Aspose.BarCode` – εγκαταστήστε το με + +```bash +dotnet add package Aspose.BarCode +``` + +Δεν απαιτούνται πρόσθετες εξαρτήσεις. + +## Πώς να δημιουργήσετε εικόνα barcode με BarcodeGenerator C# + +Η βασική κλάση για τη δημιουργία εικόνας barcode είναι η `BarcodeGenerator`. Συγκεντρώνει τον τύπο κωδικοποίησης, τη συμβολοσειρά δεδομένων και όλες τις παραμέτρους απόδοσης. + +### Βήμα 1: Ορίστε το φάκελο εξόδου + +Επιλέξτε έναν φάκελο όπου θα αποθηκευτούν τα παραγόμενα αρχεία PNG. Η χρήση απόλυτης διαδρομής αποφεύγει εκπλήξεις με δικαιώματα. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Γιατί;** Η δημιουργία του φακέλου προγραμματιστικά εγγυάται ότι οι επόμενες κλήσεις `Save` θα πετύχουν ακόμη και σε νέο μηχάνημα. + +### Βήμα 2: Δημιουργήστε το αντικείμενο barcode generator + +Για ένα barcode DataBar Omnidirectional, περάστε το `EncodeTypes.DatabarOmniDirectional` και τη συμβολοσειρά δεδομένων GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Σημείωση:** Το αντικείμενο `BarcodeGenerator` είναι επαναχρησιμοποιήσιμο· μπορείτε να αλλάζετε τις παραμέτρους του μεταξύ των αποθηκεύσεων για **δημιουργία πολλαπλών barcodes** από τα ίδια δεδομένα. + +### Βήμα 3: Ορίστε κοινές παραμέτρους barcode + +Οι πιο συνηθισμένες οπτικές ρυθμίσεις είναι η διάσταση X (πλάτος μονάδας) και το ύψος της γραμμής. Και τα δύο εκφράζονται σε pixel. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Γιατί να ορίσετε τη διάσταση X;** Μικρότερη διάσταση X προσφέρει υψηλότερη ανάλυση, κάτι που είναι σημαντικό όταν η εικόνα θα εκτυπωθεί ή εμφανιστεί σε οθόνες υψηλής ανάλυσης (DPI). + +### Βήμα 4: Αποθηκεύστε την πρώτη εικόνα barcode + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +Το αρχείο `DatabarBarHeight30Pixels.png` περιέχει τώρα ένα DataBar Omnidirectional barcode ύψους 30 pixel. + +### Βήμα 5: Προσαρμόστε το ύψος του barcode σε pixel + +Η αλλαγή του ύψους δεν απαιτεί νέο αντικείμενο `BarcodeGenerator·` απλώς τροποποιήστε την παράμετρο. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Βήμα 6: Αποθηκεύστε τη δεύτερη εικόνα barcode + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Τώρα έχετε δύο αρχεία PNG με διαφορετικό **ύψος barcode σε pixel**, δείχνοντας πόσο εύκολο είναι να δημιουργήσετε **παραλλαγές εικόνας barcode**. + +## Ορισμός ύψους barcode σε pixel δυναμικά + +Συχνά χρειάζεστε μια σειρά barcodes με ύψη που ταιριάζουν σε στοιχεία UI ή ετικέτες εκτύπωσης. Η παρακάτω βοηθητική μέθοδος αφαιρεί την αλλαγή ύψους: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Τώρα μπορείτε να καλέσετε `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` για **δημιουργία εικόνας barcode** με ύψος 45 pixel σε μία μόνο γραμμή. + +## Δημιουργία πολλαπλών barcodes σε βρόχο + +Όταν έχετε μια συλλογή αναγνωριστικών προϊόντων, ένας βρόχος `foreach` εξαλείφει τον επαναλαμβανόμενο κώδικα. Αυτό το παράδειγμα δείχνει πώς να **δημιουργήσετε πολλαπλά barcodes** από έναν πίνακα GTIN. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +Ο βρόχος παράγει τρία αρχεία PNG, το καθένα με διαφορετική τιμή **ύψους barcode σε pixel**. Επειδή η βοηθητική μέθοδος `SaveBarcodeWithHeight` κρύβει την αλλαγή ύψους, ο κύριος βρόχος παραμένει καθαρός και επικεντρωμένος στα δεδομένα. + +### Αναμενόμενο αποτέλεσμα + +Μετά την εκτέλεση του πλήρους δείγματος, ο φάκελος `Barcodes` περιέχει: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Ανοίγοντας οποιοδήποτε PNG θα δείτε ένα καθαρό DataBar Omnidirectional barcode που μπορεί να σαρωθεί από τυπικές εφαρμογές κινητών. + +## Συνηθισμένα προβλήματα και επαγγελματικές συμβουλές + +| Πρόβλημα | Γιατί συμβαίνει | Πώς να το αποφύγετε | +|----------|----------------|----------------------| +| **Λάθος EncodeTypes** | Η χρήση 1D τύπου για DataBar παράγει εικόνα που δεν διαβάζεται. | Πάντα επιλέξτε `EncodeTypes.DatabarOmniDirectional` (ή άλλη παραλλαγή DataBar) για φορτία GS1‑128. | +| **Ανεπαρκής διάσταση X** | Πολύ μικρή διάσταση X μπορεί να κάνει τις λεπτές γραμμές να εξαφανιστούν σε οθόνες χαμηλής ανάλυσης. | Κρατήστε `XDimension.Pixels` ≥ 2 για προβολή σε οθόνη· αυξήστε σε 3‑4 για εκτύπωση. | +| **Σφάλματα διαδρομής αρχείου** | Οι σχετικές διαδρομές μπορεί να λυθούν σε απρόσμενους φακέλους. | Χρησιμοποιήστε `Path.Combine` και `Environment.CurrentDirectory` για δημιουργία απόλυτών διαδρομών. | +| **Αντικατάσταση εικόνων** | Η επαναχρησιμοποίηση του ίδιου ονόματος αρχείου σε βρόχο αντικαθιστά τα προηγούμενα αποτελέσματα. | Συμπεριλάβετε μοναδικά αναγνωριστικά (π.χ., GTIN ή χρονική σήμανση) στο όνομα του αρχείου. | +| **Λείπει το πακέτο NuGet** | Ο κώδικας μεταγλωττίζεται αλλά πετάει `FileNotFoundException` κατά την εκτέλεση. | Επαληθεύστε ότι το `Aspose.BarCode` είναι εγκατεστημένο και το έργο το αναφέρει. | + +## Πλήρες λειτουργικό παράδειγμα + +Παρακάτω βρίσκεται το ολοκληρωμένο πρόγραμμα που μπορείτε να αντιγράψετε σε μια εφαρμογή κονσόλας. Περιλαμβάνει όλα τα βήματα, τις βοηθητικές μεθόδους και τη διαχείριση σφαλμάτων. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Η εκτέλεση αυτού του προγράμματος + + +## Τι πρέπει να μάθετε στη συνέχεια; + +Τα παρακάτω tutorials καλύπτουν στενά συναφή θέματα που επεκτείνουν τις τεχνικές που παρουσιάζονται σε αυτόν τον οδηγό. Κάθε πόρος περιλαμβάνει πλήρη λειτουργικό κώδικα με βήμα‑βήμα εξηγήσεις για να σας βοηθήσει να κυριαρχήσετε πρόσθετες δυνατότητες του API και να εξερευνήσετε εναλλακτικές προσεγγίσεις υλοποίησης στα δικά σας έργα. + +- [Δημιουργία προσαρμοσμένου ύψους Barcode – Μονοδιάστατα Barcodes](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Δημιουργία εικόνας barcode C# – Παράδειγμα GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Δημιουργία εικόνας DotCode barcode – σειρές & στήλες (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/greek/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/greek/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..5db59bca8 --- /dev/null +++ b/barcode/greek/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-09 +description: Δημιουργήστε εικόνα barcode με έναν δημιουργό barcode σε C# και μάθετε + να δημιουργείτε πολλαπλά barcode με προσαρμοσμένες αναλογίες διαστάσεων σε λίγα + λεπτά. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: el +lastmod: 2026-08-09 +og_description: Δημιουργήστε εικόνα γραμμωτού κώδικα χρησιμοποιώντας έναν γεννήτρια + γραμμωτού κώδικα σε C#. Αυτό το σεμινάριο δείχνει πώς να δημιουργήσετε πολλαπλούς + γραμμωτούς κώδικες, να προσαρμόσετε τις αναλογίες διαστάσεων και να αποθηκεύσετε + αρχεία PNG αποδοτικά. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Δημιουργία εικόνας barcode με τη γεννήτρια barcode C# – γρήγορος οδηγός +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Δημιουργία εικόνας barcode με τον δημιουργό barcode C# – οδηγός +url: /el/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Δημιουργία εικόνας barcode με γεννήτρια barcode C# – οδηγός + +Αν χρειάζεστε να **δημιουργία εικόνας barcode** γρήγορα, αυτός ο οδηγός σας δείχνει πώς να το κάνετε με μια γεννήτρια barcode C#. Θα μάθετε να δημιουργείτε πολλαπλά barcodes, να αλλάζετε το aspect ratio και να αποθηκεύετε κάθε εικόνα ως αρχείο PNG. + +Η δημιουργία εικόνων barcode είναι μια συχνή εργασία όταν χτίζετε συστήματα αποθεμάτων, τερματικά σημείου πώλησης ή ετικέτες αποστολής. Στο τέλος αυτού του tutorial θα έχετε δύο έτοιμα προς χρήση αρχεία PNG που δείχνουν διαφορετικά aspect ratios, και θα καταλάβετε πώς να επεκτείνετε την προσέγγιση για οποιονδήποτε αριθμό barcodes. + +## Προαπαιτούμενα + +Πριν ξεκινήσετε, βεβαιωθείτε ότι έχετε: + +* .NET 6.0 SDK ή νεότερη έκδοση εγκατεστημένη +* Visual Studio 2022 (ή οποιοδήποτε IDE που υποστηρίζει C#) +* Μια αναφορά σε βιβλιοθήκη barcode που υποστηρίζει DataBar Stacked Omnidirectional (για παράδειγμα, **Aspose.BarCode for .NET**). Τα αποσπάσματα κώδικα χρησιμοποιούν το Aspose API, αλλά οι έννοιες ισχύουν για οποιαδήποτε βιβλιοθήκη με παρόμοιες ιδιότητες. + +Δεν χρειάζεστε ξεχωριστή βάση δεδομένων ή web server—αυτή είναι μια απλή εφαρμογή console. + +## Βήμα 1: Ρύθμιση του έργου console + +Δημιουργήστε ένα νέο έργο console και προσθέστε τη βιβλιοθήκη barcode μέσω NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +Η εντολή `dotnet add package` κατεβάζει την πιο πρόσφατη σταθερή έκδοση του **Aspose.BarCode**, η οποία παρέχει την κλάση `BarcodeGenerator` που χρησιμοποιείται αργότερα. + +## Βήμα 2: Γράψτε το πλήρες πρόγραμμα + +Ανοίξτε το *Program.cs* και αντικαταστήστε το περιεχόμενό του με το πλήρες παράδειγμα παρακάτω. Το πρόγραμμα δημιουργεί μια **barcode image**, αλλάζει το aspect ratio και αποθηκεύει δύο αρχεία PNG. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Γιατί κάθε μέρος είναι σημαντικό + +* **Create barcode image** – Ο κατασκευαστής `BarcodeGenerator` αρχικοποιεί το αντικείμενο με τη ζητούμενη συμβολική και τα δεδομένα. +* **c# barcode generator** – Η ιδιότητα `Parameters` σας δίνει πλήρη έλεγχο πάνω στις επιλογές απόδοσης· ορίζοντας `XDimension.Pixels` εξασφαλίζει ότι κάθε μπάρα είναι καθαρή στην οθόνη. +* **generate multiple barcodes** – Αλλάζοντας το `DataBar.AspectRatio` μεταξύ των αποθηκεύσεων, η ίδια παρουσία του γεννήτριας παράγει δύο διαφορετικές εικόνες χωρίς να δημιουργείται ξανά το αντικείμενο, κάτι που είναι πιο αποδοτικό. + +## Βήμα 3: Εκτελέστε το πρόγραμμα και δείτε τα αποτελέσματα + +Εκτελέστε την εφαρμογή: + +```bash +dotnet run +``` + +Θα πρέπει να δείτε έξοδο κονσόλας παρόμοια με: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Ανοίξτε το φάκελο `BarcodeOutputs`. Θα βρείτε δύο αρχεία PNG: + +* **DatabarAspectRatio15.png** – ένα συμπαγές barcode κατάλληλο για ετικέτες περιορισμένου ύψους. +* **DatabarAspectRatio30.png** – ένα πιο ψηλό barcode που πολλοί σαρωτές διαβάζουν πιο αξιόπιστα από απόσταση. + +Και οι δύο εικόνες είναι έτοιμες να ενσωματωθούν σε PDFs, να εκτυπωθούν σε αποδείξεις ή να σταλούν σε εφαρμογή κινητού. + +## Βήμα 4: Επεκτείνετε τη λύση για να δημιουργήσετε οποιονδήποτε αριθμό barcode + +Το μοτίβο που φαίνεται παραπάνω κλιμακώνεται εύκολα: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – Ο βρόχος διατρέχει έναν πίνακα aspect ratios, δημιουργώντας μια ξεχωριστή **barcode image** για κάθε τιμή. +* Προσαρμόστε τα `EncodeTypes` ή το κωδικοποιημένο συμβολοσειρά για να παραγάγετε QR codes, Code 128 ή άλλες συμβολές χωρίς να αλλάξετε τη λογική γύρω από αυτό. + +## Πρακτικές συμβουλές και κοινά προβλήματα + +| Συμβουλή | Επεξήγηση | +|-----|-------------| +| **Reuse the same generator** | Η επανεκκίνηση του `BarcodeGenerator` για κάθε εικόνα προσθέτει περιττό φόρτο. Η αλλαγή παραμέτρων μεταξύ κλήσεων `Save` είναι πιο γρήγορη και χρησιμοποιεί λιγότερη μνήμη. | +| **Validate the output folder** | Πάντα καλέστε `Directory.CreateDirectory` πριν αποθηκεύσετε· διαφορετικά το `Save` ρίχνει `DirectoryNotFoundException`. | +| **Choose an appropriate X‑dimension** | Πολύ χαμηλές τιμές pixel (π.χ., 1) μπορούν να κάνουν το barcode μη αναγνώσιμο σε οθόνες χαμηλής ανάλυσης. Τιμές 2–3 λειτουργούν καλά για τις περισσότερες εκτυπωτές. | +| **Mind the encoding** | Το GS1 DataBar απαιτεί ένα προθετικό `(01)` για GTIN. Αν παραλείψετε τις παρενθέσεις, η βιβλιοθήκη μπορεί να δημιουργήσει ένα μη έγκυρο barcode. | +| **Test with a real scanner** | Η οπτική επιθεώρηση δεν αρκεί. Δοκιμάστε τα αρχεία PNG με το πραγματικό υλικό σαρωτή που σκοπεύετε να χρησιμοποιήσετε. | + +## Αναμενόμενη έξοδος (προβολή) + +*Και τα δύο αρχεία PNG εμφανίζουν ένα σκούρο‑σε‑ανοιχτό DataBar Stacked Omnidirectional barcode. Η έκδοση με aspect ratio 15 είναι πιο σύντομη, ενώ η έκδοση με aspect ratio 30 είναι περίπου δύο φορές πιο ψηλή.* + +Αν ενσωματώσετε τις εικόνες σε ένα έγγραφο, θα αποδοθούν οξυγόνα επειδή ορίσαμε `XDimension.Pixels = 2`. + +## Συμπέρασμα + +Τώρα ξέρετε πώς να **create barcode image** αρχεία χρησιμοποιώντας μια **C# barcode generator**, και μπορείτε να **generate multiple barcodes** ρυθμίζοντας το aspect ratio ή οποιαδήποτε άλλη παράμετρο. Το πλήρες, εκτελέσιμο παράδειγμα δείχνει βέλτιστες πρακτικές όπως η επαναχρησιμοποίηση της παρουσίας του γεννήτρια, η διαχείριση των φακέλων εξόδου και η επαλήθευση της δημιουργίας αρχείων. + +Στη συνέχεια, μπορείτε να εξερευνήσετε: + +* Προσθήκη προσαρμοσμένων χρωμάτων με `generator.Parameters.Barcode.Color` (δευτερεύον κλειδί: **c# barcode generator**) +* Εξαγωγή σε άλλες μορφές όπως JPEG ή SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Ενσωμάτωση της λογικής δημιουργίας barcode σε ένα Web API για εξυπηρέτηση εικόνων κατ' απαίτηση (δευτερεύον κλειδί + +## Τι πρέπει να μάθετε στη συνέχεια; + +Τα παρακάτω tutorials καλύπτουν στενά σχετιζόμενα θέματα που βασίζονται στις τεχνικές που παρουσιάστηκαν σε αυτόν τον οδηγό. Κάθε πόρος περιλαμβάνει πλήρη λειτουργικά παραδείγματα κώδικα με βήμα‑βήμα εξηγήσεις για να σας βοηθήσουν να κυριαρχήσετε επιπλέον δυνατότητες API και να εξερευνήσετε εναλλακτικές προσεγγίσεις υλοποίησης στα δικά σας έργα. + +- [Δημιουργία Barcode PNG – DataMatrix Aspect Ratio – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Προσαρμογή Aspect Ratios Barcode Code 16K με Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Πώς να δημιουργήσετε Aztec barcode με προσαρμοσμένο aspect ratio χρησιμοποιώντας Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hindi/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/hindi/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..f9153f9ff --- /dev/null +++ b/barcode/hindi/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,239 @@ +--- +category: general +date: 2026-08-09 +description: Aspose.BarCode के साथ C# में जल्दी से 4‑कॉलम डेटाबार बारकोड बनाएं। इस + संक्षिप्त गाइड में कॉलम, रो को कैसे कॉन्फ़िगर करें और PNG इमेजेस को कैसे सहेजें, + सीखें। +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: hi +lastmod: 2026-08-09 +og_description: Aspose.BarCode का उपयोग करके C# में 4‑कॉलम डेटाबार बारकोड बनाएं, फिर + पंक्तियों को अनुकूलित करें और अपने ऐप के लिए PNG छवियों को निर्यात करें। +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: C# में 4‑कॉलम डेटाबार बारकोड बनाएं – त्वरित ट्यूटोरियल +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: C# में 4‑कॉलम डेटाबार बारकोड बनाएं – चरण‑दर‑चरण गाइड +url: /hi/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# में 4‑कॉलम डेटाबार बारकोड बनाएं – चरण‑दर‑चरण गाइड + +यदि आपको C# में **4‑कॉलम डेटाबार बारकोड** बनाना है, तो यह ट्यूटोरियल आपको ठीक‑ठीक दिखाएगा। हम DataBar Expanded Stacked बारकोड जेनरेट करने, चार कॉलम कॉन्फ़िगर करने, और परिणाम को PNG इमेज के रूप में सहेजने की प्रक्रिया को चरण‑दर‑चरण बताएँगे। + +इस गाइड में आप सीखेंगे: + +* `BarcodeGenerator` को **DataBar Expanded Stacked** सिम्बल के लिए इनिशियलाइज़ करें। +* कॉलम काउंट को 4 सेट करें (मुख्य आवश्यकता)। +* जब आपको तीन पंक्तियों वाला स्टैक्ड लेआउट चाहिए, तो रो काउंट को समायोजित करें। +* उपयुक्त **barcode image format** का उपयोग करके बारकोड को PNG के रूप में एक्सपोर्ट करें। + +आपको केवल Aspose.BarCode for .NET लाइब्रेरी (वर्ज़न 23.10 या बाद का) और .NET 6+ डेवलपमेंट एनवायरनमेंट जैसे Visual Studio 2022 की आवश्यकता है। कोई अतिरिक्त डिपेंडेंसीज़ आवश्यक नहीं हैं। + +--- + +## 4‑कॉलम डेटाबार बारकोड कैसे बनाएं + +पहला कदम यह है कि आप एक `BarcodeGenerator` इंस्टेंस बनाएँ जो **DataBar Expanded Stacked** सिम्बोलॉजी को टार्गेट करे। यह क्लास सभी रेंडरिंग विकल्पों को एन्कैप्सुलेट करती है, जिससे कॉलम‑बेस्ड और रो‑बेस्ड लेआउट के बीच स्विच करना आसान हो जाता है। + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Why this works:** +`EncodeTypes.DatabarExpandedStacked` Aspose.BarCode को DataBar परिवार का स्टैक्ड वर्ज़न बनाने के लिए बताता है। `DataBar.Columns` प्रॉपर्टी नियंत्रित करती है कि बारकोड कितने वर्टिकल मॉड्यूल्स लेता है। इसे 4 सेट करने से **4‑कॉलम डेटाबार बारकोड** बनाने की आवश्यकता पूरी होती है। अंत में, `Save` **barcode image format** `Png` का उपयोग करके विज़ुअल रिप्रेजेंटेशन को डिस्क पर लिखता है। + +### DataBar Expanded Stacked कॉलम कॉन्फ़िगर करें + +यदि आपको अलग कॉलम काउंट चाहिए, तो बस `Columns` को असाइन किए गए इंटीजर को बदल दें। यह प्रॉपर्टी एक्सपैंडेड स्टैक्ड वेरिएंट के लिए 1 से 4 तक के मान स्वीकार करती है। + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro tip:* हमेशा जनरेटेड बारकोड को ऐसे स्कैनर से टेस्ट करें जो DataBar परिवार को सपोर्ट करता हो, क्योंकि केवल विज़ुअल अपीयरेंस से रीडेबिलिटी की गारंटी नहीं मिलती। + +### बारकोड इमेज सहेजें + +`BarCodeImageFormat` एनेमरेशन कई विकल्प प्रदान करता है (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`)। PNG लॉस‑लेस है और अधिकांश वेब एवं डेस्कटॉप परिदृश्यों के लिए उपयुक्त है। + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +यदि आपको अलग फॉर्मेट चाहिए, तो `Png` को इच्छित एनेम वैल्यू से बदल दें। सहेजी गई फ़ाइल को सीधे HTML, PDFs में एम्बेड किया जा सकता है या लेबल पर प्रिंट किया जा सकता है। + +## कस्टम रो के साथ बारकोड बनाएं + +कभी‑कभी कॉलम की बजाय एक विशिष्ट रो संख्या के साथ स्टैक्ड लेआउट की आवश्यकता होती है। इसी `BarcodeGenerator` क्लास में इस उद्देश्य के लिए `Rows` प्रॉपर्टी उपलब्ध है। + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Why rows matter:** +जब स्टैक्ड बारकोड चौड़ाई से अधिक ऊँचा होता है, तो `Rows` प्रॉपर्टी तय करती है कि सिम्बल को कितनी हॉरिज़ॉन्टल स्लाइस में विभाजित किया जाए। `Rows = 3` सेट करने से तीन‑रो वाला स्टैक्ड बारकोड बनता है, जो संकरी लेबल चौड़ाई के लिए उपयोगी है। + +### बारकोड रो को डायनामिकली सेट करें + +आप इनपुट डेटा के आधार पर रनटाइम पर रो काउंट की गणना कर सकते हैं: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +यह लचीलापन आपको एप्लिकेशन को री‑कम्पाइल किए बिना **बारकोड रो सेट** करने की सुविधा देता है। + +## पूरा एंड‑टू‑एंड उदाहरण + +नीचे एक सिंगल प्रोग्राम दिया गया है जो 4‑कॉलम बारकोड और 3‑रो बारकोड दोनों जेनरेट करता है, यह दर्शाते हुए कि दोनों कॉन्फ़िगरेशन कैसे साथ‑साथ काम कर सकते हैं। + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Expected output:** +एप्लिकेशन की वर्किंग डायरेक्टरी में दो PNG फ़ाइलें बनेंगी: + +* `DatabarCols4.png` – चार वर्टिकल कॉलम वाला DataBar Expanded Stacked बारकोड। +* `DatabarRows3.png` – वही सिम्बोलॉजी तीन हॉरिज़ॉन्टल रो में व्यवस्थित। + +दोनों इमेज को किसी भी इमेज व्यूअर में खोला जा सकता है या UI कंट्रोल में एम्बेड किया जा सकता है। + +--- + +## सामान्य प्रश्न और किनारे के मामलों + +| Question | Answer | +|----------|--------| +| *Can I use a different barcode symbology?* | हाँ। `EncodeTypes.DatabarExpandedStacked` को किसी अन्य `EncodeTypes` वैल्यू (जैसे `EncodeTypes.QR`) से बदलें, लेकिन `Columns` और `Rows` प्रॉपर्टी विशेष रूप से DataBar परिवार के लिए हैं। | +| *What if the data string exceeds the maximum length?* | DataBar Expanded Stacked सिम्बोलॉजी अधिकतम 61 न्यूमेरिक कैरेक्टर्स को सपोर्ट करती है। इस सीमा से अधिक होने पर `ArgumentException` फेंका जाता है। जनरेटर को असाइन करने से पहले इनपुट को वैलिडेट करें। | +| *Do I need to dispose the `BarcodeGenerator`?* | `BarcodeGenerator` `IDisposable` को इम्प्लीमेंट करता है। एक लांग‑रनिंग सर्विस में, इसे `using` ब्लॉक में रैप करें या मैन्युअली `Dispose()` कॉल करके नेटीव रिसोर्सेज़ को फ्री करें। | +| *Can I generate SVG instead of PNG?* | बिल्कुल। `Save` मेथड में `BarCodeImageFormat.Svg` का उपयोग करें। | +| *Is the library compatible with .NET Core?* | Aspose.BarCode for .NET .NET Core 3.1, .NET 5, .NET 6 और बाद के वर्ज़न को सपोर्ट करता है। कोई कोड परिवर्तन आवश्यक नहीं है। | + +## निष्कर्ष + +अब आप जानते हैं कि Aspose.BarCode का उपयोग करके C# में **4‑कॉलम डेटाबार बारकोड** कैसे बनाते हैं, रो के साथ लेआउट कैसे एडजस्ट करते हैं, और परिणाम को सुविधाजनक **barcode image format** में कैसे एक्सपोर्ट करते हैं। पूरा उदाहरण दोनों कॉलम‑बेस्ड और रो‑बेस्ड कॉन्फ़िगरेशन दिखाता है, जिससे आप किसी भी लेबल‑प्रिंटिंग या मोबाइल‑स्कैनिंग परिदृश्य के लिए ठोस आधार प्राप्त कर सकते हैं। + +**Next steps** +* विभिन्न डेटा पेलोड के साथ प्रयोग करें और स्कैनर कम्पैटिबिलिटी को वेरिफ़ाई करें। +* अतिरिक्त स्टाइलिंग विकल्पों का अन्वेषण करें जैसे फ़ोरग्राउंड/बैकग्राउंड कलर्स (`generator.Parameters.Barcode.Color`)। +* `Graphics` API का उपयोग करके बारकोड को अन्य ग्राफिक्स के साथ मिलाकर कस्टम लेबल डिज़ाइन बनाएं। + +कोड को ASP.NET Core, Windows Forms, या Xamarin प्रोजेक्ट्स के लिए एडेप्ट करने में संकोच न करें—Aspose.BarCode सभी .NET प्लेटफ़ॉर्म पर काम करता है। Happy coding! + +## आपको अगला क्या सीखना चाहिए? + +निम्नलिखित ट्यूटोरियल्स उन विषयों को कवर करते हैं जो इस गाइड में दिखाए गए तकनीकों पर आधारित हैं। प्रत्येक रिसोर्स में पूर्ण कार्यशील कोड उदाहरण और चरण‑दर‑चरण व्याख्याएँ शामिल हैं, जो आपको अतिरिक्त API फीचर्स में महारत हासिल करने और अपने प्रोजेक्ट्स में वैकल्पिक इम्प्लीमेंटेशन अप्रोचेज़ को एक्सप्लोर करने में मदद करेंगे। + +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Create barcode image c# – Configure Codablock F Rows & Columns](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [How to create dotcode extended codetext with Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hindi/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/hindi/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..b63ddfd39 --- /dev/null +++ b/barcode/hindi/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,305 @@ +--- +category: general +date: 2026-08-09 +description: C# में बारकोड इमेज बनाएं इस चरण-दर-चरण गाइड के साथ। सीखें कैसे बारकोड + जेनरेट करें, बारकोड की ऊँचाई पिक्सेल में समायोजित करें, और कई बारकोड को कुशलतापूर्वक + बनाएं। +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: hi +lastmod: 2026-08-09 +og_description: C# में जल्दी से बारकोड इमेज बनाएं। इस ट्यूटोरियल का पालन करके सीखें + कि बारकोड कैसे जेनरेट करें, बारकोड की ऊँचाई पिक्सेल में सेट करें, और कई बारकोड बनाएं। +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: C# में बारकोड इमेज बनाएं – डेवलपर्स के लिए पूर्ण गाइड +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: C# में बारकोड इमेज बनाएं – पूर्ण प्रोग्रामिंग गाइड +url: /hi/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# में बारकोड इमेज बनाएं – पूर्ण प्रोग्रामिंग गाइड + +यदि आपको .NET एप्लिकेशन में **बारकोड इमेज बनानी** है, तो यह गाइड आपको Aspose.BarCode लाइब्रेरी का उपयोग करके **बारकोड जेनरेट करने** का सटीक तरीका दिखाता है। आप देखेंगे कि **बारकोड की ऊँचाई पिक्सेल** कैसे नियंत्रित करें, इमेज को कैसे सेव करें, और **कोड दोहराए बिना कई बारकोड** कैसे बनाएं। + +यह ट्यूटोरियल पैकेज को इंस्टॉल करने से लेकर आयामों को कस्टमाइज़ करने तक सब कुछ कवर करता है, ताकि आप आज ही अपने प्रोजेक्ट में एक तैयार‑चलाने‑योग्य उदाहरण कॉपी‑पेस्ट कर सकें। + +## आवश्यकताएँ + +शुरू करने से पहले सुनिश्चित करें कि आपके पास है: + +* .NET 6.0 SDK या बाद का संस्करण स्थापित +* Visual Studio 2022 (या कोई भी C# IDE) +* NuGet पैकेज `Aspose.BarCode` – इंस्टॉल करें + +```bash +dotnet add package Aspose.BarCode +``` + +कोई अतिरिक्त निर्भरताएँ आवश्यक नहीं हैं। + +## C# में BarcodeGenerator के साथ बारकोड इमेज कैसे जेनरेट करें + +बारकोड इमेज बनाने के लिए मुख्य क्लास `BarcodeGenerator` है। यह एन्कोडिंग प्रकार, डेटा स्ट्रिंग, और सभी रेंडरिंग पैरामीटर को समेटे रहता है। + +### चरण 1: आउटपुट फ़ोल्डर निर्धारित करें + +एक फ़ोल्डर चुनें जहाँ जेनरेट की गई PNG फ़ाइलें संग्रहीत होंगी। पूर्ण पथ (absolute path) उपयोग करने से अनुमति संबंधी आश्चर्य से बचा जा सकता है। + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **क्यों?** फ़ोल्डर को प्रोग्रामेटिकली बनाना यह सुनिश्चित करता है कि बाद में `Save` कॉल्स नई मशीन पर भी सफल हों। + +### चरण 2: बारकोड जेनरेटर का इंस्टैंस बनाएं + +DataBar Omnidirectional बारकोड के लिए, `EncodeTypes.DatabarOmniDirectional` और GS1‑128 डेटा स्ट्रिंग पास करें। + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **ध्यान दें:** `BarcodeGenerator` ऑब्जेक्ट पुन: उपयोग योग्य है; आप सेव करने के बीच उसके पैरामीटर बदलकर **एक ही डेटा से कई बारकोड** बना सकते हैं। + +### चरण 3: सामान्य बारकोड पैरामीटर सेट करें + +सबसे सामान्य दृश्य समायोजन X‑डायमेंशन (मॉड्यूल चौड़ाई) और बार की ऊँचाई होते हैं। दोनों पिक्सेल में व्यक्त होते हैं। + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **X‑डायमेंशन क्यों सेट करें?** छोटी X‑डायमेंशन उच्च रिज़ॉल्यूशन देती है, जो तब महत्वपूर्ण होती है जब इमेज को प्रिंट या हाई‑DPI स्क्रीन पर दिखाया जाना हो। + +### चरण 4: पहला बारकोड इमेज सेव करें + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +फ़ाइल `DatabarBarHeight30Pixels.png` अब 30‑पिक्सेल‑ऊँचाई वाला DataBar Omnidirectional बारकोड रखती है। + +### चरण 5: बारकोड ऊँचाई पिक्सेल बदलें + +ऊँचाई बदलने के लिए नया `BarcodeGenerator` इंस्टैंस बनाने की आवश्यकता नहीं है—सिर्फ पैरामीटर को संशोधित करें। + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### चरण 6: दूसरा बारकोड इमेज सेव करें + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +अब आपके पास दो PNG फ़ाइलें हैं जिनकी **बारकोड ऊँचाई पिक्सेल** अलग‑अलग है, जो दिखाता है कि **बारकोड इमेज बनाना** कितना आसान है। + +## बारकोड ऊँचाई पिक्सेल को डायनामिक रूप से सेट करना + +अक्सर आपको UI तत्वों या प्रिंटेड लेबलों के साथ मेल खाने वाली ऊँचाइयों वाले कई बारकोड चाहिए होते हैं। नीचे दिया गया हेल्पर मेथड ऊँचाई परिवर्तन को एब्स्ट्रैक्ट करता है: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +अब आप एक ही लाइन में `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` कॉल करके **45‑पिक्सेल ऊँचाई** वाला **बारकोड इमेज** बना सकते हैं। + +## लूप में कई बारकोड बनाना + +जब आपके पास प्रोडक्ट आइडेंटिफ़ायर्स का संग्रह हो, तो `foreach` लूप दोहराव वाले कोड को समाप्त कर देता है। यह उदाहरण दिखाता है कि एरे में मौजूद GTINs से **कई बारकोड** कैसे बनाएँ। + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +लूप तीन PNG फ़ाइलें बनाता है, प्रत्येक की **बारकोड ऊँचाई पिक्सेल** अलग‑अलग है। क्योंकि `SaveBarcodeWithHeight` हेल्पर ऊँचाई परिवर्तन को संभालता है, मुख्य लूप डेटा पर केंद्रित और साफ़ रहता है। + +### अपेक्षित आउटपुट + +पूरा सैंपल चलाने के बाद, `Barcodes` फ़ोल्डर में यह होगा: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +किसी भी PNG को खोलने पर एक स्पष्ट DataBar Omnidirectional बारकोड दिखेगा जिसे मानक मोबाइल ऐप्स द्वारा स्कैन किया जा सकता है। + +## सामान्य समस्याएँ और प्रो टिप्स + +| समस्या | क्यों होता है | इसे कैसे बचें | +|-------|----------------|-----------------| +| **गलत EncodeTypes** | DataBar के लिए 1D प्रकार उपयोग करने पर इमेज अपठनीय बन जाती है। | हमेशा `EncodeTypes.DatabarOmniDirectional` (या अन्य DataBar वैरिएंट) को GS1‑128 पेलोड के लिए चुनें। | +| **अपर्याप्त X‑डायमेंशन** | बहुत छोटी X‑डायमेंशन से पतले बार कम‑रिज़ॉल्यूशन मॉनीटर पर गायब हो सकते हैं। | स्क्रीन पर दिखाने के लिए `XDimension.Pixels` ≥ 2 रखें; प्रिंटिंग के लिए 3‑4 तक बढ़ाएँ। | +| **फ़ाइल पाथ त्रुटियाँ** | रिलेटिव पाथ अनपेक्षित डायरेक्टरी में रिज़ॉल्व हो सकते हैं। | `Path.Combine` और `Environment.CurrentDirectory` का उपयोग करके एब्सॉल्यूट पाथ बनाएं। | +| **इमेज ओवरराइट होना** | लूप में एक ही फ़ाइल नाम उपयोग करने से पहले की फ़ाइलें ओवरराइट हो जाती हैं। | फ़ाइल नाम में यूनिक आइडेंटिफ़ायर (जैसे GTIN या टाइमस्टैंप) शामिल करें। | +| **NuGet पैकेज गायब** | कोड कंपाइल तो हो जाता है लेकिन रनटाइम पर `FileNotFoundException` आती है। | सुनिश्चित करें कि `Aspose.BarCode` इंस्टॉल है और प्रोजेक्ट में रेफ़रेंस किया गया है। | + +## पूर्ण कार्यशील उदाहरण + +नीचे पूरा प्रोग्राम दिया गया है जिसे आप कंसोल एप्लिकेशन में कॉपी‑पेस्ट कर सकते हैं। इसमें सभी चरण, हेल्पर मेथड, और एरर हैंडलिंग शामिल हैं। + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +इस प्रोग्राम को चलाने पर + + +## आगे आप क्या सीखें? + +निम्नलिखित ट्यूटोरियल्स उन विषयों को कवर करते हैं जो इस गाइड में दिखाए गए तकनीकों पर आधारित हैं। प्रत्येक संसाधन में पूर्ण कार्यशील कोड उदाहरण और चरण‑दर‑चरण व्याख्याएँ शामिल हैं, जिससे आप अतिरिक्त API फीचर्स में महारत हासिल कर सकें और अपने प्रोजेक्ट में वैकल्पिक इम्प्लीमेंटेशन एप्रोच को एक्सप्लोर कर सकें। + +- [बारकोड कस्टम ऊँचाई बनाएं – एक‑आयामी बारकोड](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [C# में बारकोड इमेज बनाएं – GS1 DataMatrix उदाहरण](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [DotCode बारकोड इमेज बनाएं – पंक्तियाँ एवं स्तंभ (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hindi/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/hindi/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..ab476a1f6 --- /dev/null +++ b/barcode/hindi/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-09 +description: C# बारकोड जेनरेटर के साथ बारकोड इमेज बनाएं और कुछ ही मिनटों में कस्टम + आस्पेक्ट रेशियो के साथ कई बारकोड जेनरेट करना सीखें। +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: hi +lastmod: 2026-08-09 +og_description: C# बारकोड जेनरेटर का उपयोग करके बारकोड इमेज बनाएं। यह ट्यूटोरियल दिखाता + है कि कई बारकोड कैसे जनरेट करें, अनुपात को कैसे समायोजित करें, और PNG फ़ाइलों को + कुशलतापूर्वक कैसे सहेजें। +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: C# बारकोड जेनरेटर के साथ बारकोड इमेज बनाएं – त्वरित गाइड +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: C# बारकोड जेनरेटर के साथ बारकोड इमेज बनाएं – गाइड +url: /hi/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# barcode generator के साथ बारकोड इमेज बनाएं – गाइड + +यदि आपको **बारकोड इमेज** जल्दी बनानी है, तो यह गाइड आपको C# barcode generator का उपयोग करके इसे करने का तरीका दिखाता है। आप कई बारकोड जेनरेट करना, आस्पेक्ट रेशियो बदलना, और प्रत्येक इमेज को PNG फ़ाइल के रूप में सेव करना सीखेंगे। + +बारकोड इमेज बनाना इन्वेंटरी सिस्टम, पॉइंट‑ऑफ़‑सेल टर्मिनल या शिपिंग लेबल बनाते समय एक सामान्य कार्य है। इस ट्यूटोरियल के अंत तक आपके पास दो तैयार‑उपयोग PNG फ़ाइलें होंगी जो विभिन्न आस्पेक्ट रेशियो दर्शाती हैं, और आप समझेंगे कि इस विधि को किसी भी संख्या में बारकोड के लिए कैसे विस्तारित किया जाए। + +## Prerequisites + +शुरू करने से पहले सुनिश्चित करें कि आपके पास निम्नलिखित हैं: + +* .NET 6.0 SDK या बाद का संस्करण स्थापित हो +* Visual Studio 2022 (या कोई भी IDE जो C# को सपोर्ट करता हो) +* एक बारकोड लाइब्रेरी का रेफ़रेंस जो DataBar Stacked Omnidirectional को सपोर्ट करती हो (उदाहरण के लिए, **Aspose.BarCode for .NET**)। कोड स्निपेट्स Aspose API का उपयोग करते हैं, लेकिन अवधारणाएँ किसी भी समान प्रॉपर्टीज़ वाली लाइब्रेरी पर लागू होती हैं। + +आपको अलग से डेटाबेस या वेब सर्वर की आवश्यकता नहीं है—यह एक साधारण कंसोल एप्लिकेशन है। + +## Step 1: Set up the console project + +एक नया कंसोल प्रोजेक्ट बनाएं और NuGet के माध्यम से बारकोड लाइब्रेरी जोड़ें। + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +`dotnet add package` कमांड **Aspose.BarCode** का नवीनतम स्थिर संस्करण डाउनलोड करता है, जो बाद में उपयोग की जाने वाली `BarcodeGenerator` क्लास प्रदान करता है। + +## Step 2: Write the full program + +*Program.cs* खोलें और उसकी सामग्री को नीचे दिए गए पूर्ण उदाहरण से बदल दें। यह प्रोग्राम **बारकोड इमेज** बनाता है, आस्पेक्ट रेशियो बदलता है, और दो PNG फ़ाइलें सेव करता है। + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Why each part matters + +* **Create barcode image** – `BarcodeGenerator` कन्स्ट्रक्टर वांछित सिम्बोलॉजी और डेटा के साथ ऑब्जेक्ट को इनिशियलाइज़ करता है। +* **c# barcode generator** – `Parameters` प्रॉपर्टी आपको रेंडरिंग विकल्पों पर पूर्ण नियंत्रण देती है; `XDimension.Pixels` सेट करने से प्रत्येक बार स्क्रीन पर स्पष्ट रहता है। +* **generate multiple barcodes** – `DataBar.AspectRatio` को सेव के बीच बदलने से वही जेनरेटर इंस्टेंस दो अलग-अलग इमेज बनाता है बिना ऑब्जेक्ट को फिर से बनाये, जो अधिक प्रभावी है। + +## Step 3: Run the program and view the results + +एप्लिकेशन चलाएँ: + +```bash +dotnet run +``` + +आपको कंसोल आउटपुट कुछ इस तरह दिखना चाहिए: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +`BarcodeOutputs` फ़ोल्डर खोलें। आपको दो PNG फ़ाइलें मिलेंगी: + +* **DatabarAspectRatio15.png** – सीमित‑ऊँचाई लेबल के लिए उपयुक्त एक कॉम्पैक्ट बारकोड। +* **DatabarAspectRatio30.png** – एक लंबा बारकोड जिसे कई स्कैनर दूरी से अधिक विश्वसनीयता से पढ़ते हैं। + +दोनों इमेज को PDFs में एम्बेड किया जा सकता है, रसीदों पर प्रिंट किया जा सकता है, या मोबाइल ऐप को भेजा जा सकता है। + +## Step 4: Extend the solution to generate any number of barcodes + +ऊपर दिखाया गया पैटर्न आसानी से स्केल हो जाता है: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – लूप एक एरे में मौजूद आस्पेक्ट रेशियो पर इटररेट करता है, प्रत्येक मान के लिए एक अलग **बारकोड इमेज** बनाता है। +* `EncodeTypes` या एन्कोडेड स्ट्रिंग को बदलकर QR कोड, Code 128 या अन्य सिम्बोलॉजीज़ उत्पन्न की जा सकती हैं बिना आसपास की लॉजिक बदले। + +## Practical tips and common pitfalls + +| Tip | Explanation | +|-----|-------------| +| **Reuse the same generator** | हर इमेज के लिए `BarcodeGenerator` को फिर से इनिशियलाइज़ करने से अनावश्यक ओवरहेड बढ़ता है। `Save` कॉल्स के बीच पैरामीटर बदलना तेज़ और मेमोरी‑सेविंग होता है। | +| **Validate the output folder** | हमेशा `Directory.CreateDirectory` को कॉल करें इससे पहले कि आप सेव करें; अन्यथा `Save` `DirectoryNotFoundException` फेंकेगा। | +| **Choose an appropriate X‑dimension** | बहुत कम पिक्सेल वैल्यू (जैसे 1) बारकोड को लो‑रेज़ोल्यूशन स्क्रीन पर अपठनीय बना सकती है। 2–3 की वैल्यू अधिकांश प्रिंटरों के लिए अच्छी रहती है। | +| **Mind the encoding** | GS1 DataBar को GTIN के लिए अग्रणी `(01)` की आवश्यकता होती है। यदि आप कोष्ठक छोड़ देते हैं, तो लाइब्रेरी एक अमान्य बारकोड जेनरेट कर सकती है। | +| **Test with a real scanner** | केवल विज़ुअल निरीक्षण पर्याप्त नहीं है। PNG फ़ाइलों को वास्तविक स्कैनर हार्डवेयर पर टेस्ट करें जिसे आप उपयोग करने वाले हैं। | + +## Expected output (visual description) + +*दोनों PNG फ़ाइलें एक डार्क‑ऑन‑लाइट DataBar Stacked Omnidirectional बारकोड दिखाती हैं। आस्पेक्ट रेशियो 15 वाली संस्करण छोटी है, जबकि आस्पेक्ट रेशियो 30 वाली संस्करण लगभग दो गुना ऊँची है।* + +यदि आप इमेज को दस्तावेज़ में एम्बेड करते हैं, तो वे तेज़ दिखेंगी क्योंकि हमने `XDimension.Pixels = 2` सेट किया है। + +## Conclusion + +अब आप **बारकोड इमेज** फ़ाइलें **C# barcode generator** का उपयोग करके बना सकते हैं, और **generate multiple barcodes** को आस्पेक्ट रेशियो या किसी भी अन्य पैरामीटर को बदलकर कर सकते हैं। पूर्ण, रन करने योग्य उदाहरण सर्वोत्तम प्रैक्टिसेज़ जैसे जेनरेटर इंस्टेंस को री‑यूज़ करना, आउटपुट डायरेक्टरी को हैंडल करना, और फ़ाइल निर्माण की पुष्टि करना दर्शाता है। + +आगे आप यह कर सकते हैं: + +* `generator.Parameters.Barcode.Color` के साथ कस्टम रंग जोड़ना (secondary keyword: **c# barcode generator**) +* JPEG या SVG जैसे अन्य फॉर्मैट में एक्सपोर्ट करना (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* बारकोड निर्माण लॉजिक को Web API में इंटीग्रेट करना ताकि इमेज ऑन‑डिमांड सर्व की जा सके (secondary keyword + +## What Should You Learn Next? + +निम्नलिखित ट्यूटोरियल्स उन विषयों को कवर करते हैं जो इस गाइड में दिखाए गए तकनीकों पर आधारित हैं। प्रत्येक संसाधन में पूर्ण कार्यशील कोड उदाहरण और चरण‑दर‑चरण व्याख्याएँ शामिल हैं, जिससे आप अतिरिक्त API फीचर्स में महारत हासिल कर सकें और अपने प्रोजेक्ट्स में वैकल्पिक इम्प्लीमेंटेशन अप्रोच को एक्सप्लोर कर सकें। + +- [Create Barcode PNG – DataMatrix Aspect Ratio – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Customize Code 16K Barcode Aspect Ratios with Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hongkong/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/hongkong/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..67d43a0ea --- /dev/null +++ b/barcode/hongkong/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,237 @@ +--- +category: general +date: 2026-08-09 +description: 使用 Aspose.BarCode 在 C# 中快速建立 4 列 DataBar 條碼。於本簡明指南學習如何設定列、行,並將圖像儲存為 PNG。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: zh-hant +lastmod: 2026-08-09 +og_description: 使用 Aspose.BarCode 在 C# 中建立 4 欄 DataBar 條碼,然後自訂列並匯出 PNG 圖像供您的應用程式使用。 +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: 在 C# 中建立 4 欄 DataBar 條碼 – 快速教學 +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: 在 C# 中建立 4 欄 DataBar 條碼 – 步驟指南 +url: /zh-hant/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 在 C# 中建立 4 列 DataBar 條碼 – 步驟指南 + +如果您需要在 C# 中 **建立 4 列 DataBar 條碼**,本教學將會完整說明。 我們將逐步示範產生 DataBar Expanded Stacked 條碼、設定四個欄位,並將結果儲存為 PNG 圖片。 + +在本指南中您將學會: + +* 為 **DataBar Expanded Stacked** 符號初始化 `BarcodeGenerator`。 +* 將欄位數設定為 4(主要需求)。 +* 在需要三行堆疊佈局時調整列數。 +* 使用適當的 **barcode image format** 將條碼匯出為 PNG。 + +您只需要 Aspose.BarCode for .NET 函式庫(版本 23.10 或更新)以及 .NET 6+ 開發環境(例如 Visual Studio 2022)。不需要其他相依性。 + +--- + +## 如何建立 4 列 DataBar 條碼 + +第一步是建立一個針對 **DataBar Expanded Stacked** 符號的 `BarcodeGenerator` 實例。此類別封裝所有渲染選項,讓在欄位‑基礎與列‑基礎佈局之間切換變得簡單。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**為什麼這樣可行:** +`EncodeTypes.DatabarExpandedStacked` 告訴 Aspose.BarCode 產生 DataBar 系列的堆疊版本。`DataBar.Columns` 屬性控制條碼佔用多少個垂直模組。將其設定為 4 即符合 **建立 4 列 DataBar 條碼** 的需求。最後,`Save` 會使用 **barcode image format** `Png` 將視覺圖像寫入磁碟。 + +### 設定 DataBar Expanded Stacked 欄位 + +如果需要不同的欄位數,只要變更指派給 `Columns` 的整數即可。此屬性接受 1 到 4 的值,適用於 expanded stacked 變體。 + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*小技巧:* 請務必使用支援 DataBar 系列的掃描器測試產生的條碼,因為僅憑外觀無法保證可讀性。 + +### 儲存條碼圖像 + +`BarCodeImageFormat` 列舉提供多種選項(`Png`、`Jpeg`、`Bmp`、`Gif`、`Tiff`)。PNG 為無損格式,適用於大多數網頁與桌面情境。 + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +如果需要其他格式,只要將 `Png` 替換為相應的列舉值即可。儲存的檔案可直接嵌入 HTML、PDF,或列印於標籤上。 + +## 建立具自訂列數的條碼 + +有時需要以特定列數而非欄位數的堆疊佈局。相同的 `BarcodeGenerator` 類別提供 `Rows` 屬性以滿足此需求。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**為什麼列數重要:** +當堆疊條碼的高度大於寬度時,`Rows` 屬性決定符號被分割成多少個水平切片。設定 `Rows = 3` 會產生三列堆疊條碼,適合較窄的標籤寬度。 + +### 動態設定條碼列數 + +您可以根據輸入資料在執行時計算列數: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +此彈性讓您 **設定條碼列數** 而無需重新編譯應用程式。 + +## 完整端對端範例 + +以下是一個單一程式,同時產生 4 欄條碼與 3 列條碼,示範兩種設定如何共存。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**預期輸出:** +兩個 PNG 檔案會出現在應用程式的工作目錄中: + +* `DatabarCols4.png` – 具四個垂直欄位的 DataBar Expanded Stacked 條碼。 +* `DatabarRows3.png` – 同一符號以三個水平列排列。 + +兩張影像皆可在任何圖像檢視器中開啟,或嵌入 UI 控制項。 + +--- + +## 常見問題與邊緣情況 + +| 問題 | 答案 | +|----------|--------| +| *我可以使用其他條碼符號嗎?* | 可以。將 `EncodeTypes.DatabarExpandedStacked` 替換為其他 `EncodeTypes` 值(例如 `EncodeTypes.QR`),但 `Columns` 與 `Rows` 屬性僅適用於 DataBar 系列。 | +| *如果資料字串超過最大長度會怎樣?* | DataBar Expanded Stacked 符號最多支援 61 個數字字元。超過此限制會拋出 `ArgumentException`。請在指派給產生器前先驗證輸入。 | +| *需要手動釋放 `BarcodeGenerator` 嗎?* | `BarcodeGenerator` 實作 `IDisposable`。在長時間執行的服務中,建議使用 `using` 區塊或手動呼叫 `Dispose()` 以釋放本機資源。 | +| *可以產生 SVG 而非 PNG 嗎?* | 當然可以。在 `Save` 方法中使用 `BarCodeImageFormat.Svg`。 | +| *此函式庫相容 .NET Core 嗎?* | Aspose.BarCode for .NET 支援 .NET Core 3.1、.NET 5、.NET 6 以及更高版本。無需修改程式碼。 | + +## 結論 + +現在您已了解如何在 C# 中使用 Aspose.BarCode **建立 4 列 DataBar 條碼**、如何透過列數調整佈局,以及如何以方便的 **barcode image format** 匯出結果。完整範例同時展示欄位‑基礎與列‑基礎設定,為任何標籤列印或行動掃描情境奠定堅實基礎。 + +**後續步驟** + +* 嘗試不同的資料內容並驗證掃描器相容性。 +* 探索其他樣式選項,例如前景/背景顏色 (`generator.Parameters.Barcode.Color`)。 +* 使用 `Graphics` API 將條碼與其他圖形結合,打造自訂標籤設計。 + +隨意將程式碼套用於 ASP.NET Core、Windows Forms 或 Xamarin 專案——Aspose.BarCode 可在所有 .NET 平台上運作。祝開發順利! + +## 接下來該學什麼? + +以下教學涵蓋與本指南技術緊密相關的主題,並提供完整可執行的程式碼範例與步驟說明,協助您精通更多 API 功能,並在自己的專案中探索替代實作方式。 + +- [建立 DotCode 條碼影像 – 行與欄 (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [建立條碼影像 C# – 設定 Codablock F 行與欄](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [如何使用 Aspose.BarCode for .NET 建立 DotCode 延伸代碼文字](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hongkong/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/hongkong/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..30028f274 --- /dev/null +++ b/barcode/hongkong/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,299 @@ +--- +category: general +date: 2026-08-09 +description: 使用本分步指南在 C# 中建立條碼圖像。學習如何產生條碼、調整條碼高度(像素)以及高效地建立多個條碼。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: zh-hant +lastmod: 2026-08-09 +og_description: 快速在 C# 中建立條碼圖像。跟隨本教學了解如何產生條碼、設定條碼高度像素,以及產生多個條碼。 +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: 在 C# 中建立條碼圖像 – 開發者完整指南 +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: 在 C# 中建立條碼圖像 – 完整程式設計指南 +url: /zh-hant/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 在 C# 中建立條碼圖像 – 完整程式指南 + +如果您需要在 .NET 應用程式中**建立條碼圖像**,本指南將向您展示如何使用 Aspose.BarCode 函式庫**產生條碼**。您將看到如何控制**條碼高度(像素)**、儲存圖像,以及在不重複程式碼的情況下**產生多個條碼**。 + +本教學涵蓋從安裝套件到自訂尺寸的所有步驟,讓您可以直接複製貼上即能在專案中執行的範例。 + +## 前置條件 + +* 已安裝 .NET 6.0 SDK 或更新版本 +* Visual Studio 2022(或任何 C# IDE) +* NuGet 套件 `Aspose.BarCode` – 透過以下方式安裝 + +```bash +dotnet add package Aspose.BarCode +``` + +不需要其他相依性。 + +## 使用 BarcodeGenerator C# 產生條碼圖像 + +用於建立條碼圖像的核心類別是 `BarcodeGenerator`。它封裝了編碼類型、資料字串以及所有渲染參數。 + +### 步驟 1:定義輸出資料夾 + +選擇一個用來儲存產生的 PNG 檔案的資料夾。使用絕對路徑可避免權限問題。 + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **為什麼?** 以程式方式建立資料夾可確保即使在全新機器上,隨後的 `Save` 呼叫也能成功。 + +### 步驟 2:實例化條碼產生器 + +對於 DataBar Omnidirectional 條碼,傳入 `EncodeTypes.DatabarOmniDirectional` 以及 GS1‑128 資料字串。 + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **注意:** `BarcodeGenerator` 物件可重複使用;您可以在不同的儲存之間變更其參數,以**從相同資料產生多個條碼**。 + +### 步驟 3:設定共用條碼參數 + +最常調整的視覺參數是 X‑dimension(模組寬度)與條碼高度,兩者皆以像素為單位。 + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **為什麼要設定 X‑dimension?** 較小的 X‑dimension 會產生更高的解析度,這在圖像需要列印或在高 DPI 螢幕上顯示時尤為重要。 + +### 步驟 4:儲存第一個條碼圖像 + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +檔案 `DatabarBarHeight30Pixels.png` 現在包含一個高度為 30 像素的 DataBar Omnidirectional 條碼。 + +### 步驟 5:調整條碼高度(像素) + +變更高度不需要重新建立 `BarcodeGenerator` 實例,只需修改參數即可。 + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### 步驟 6:儲存第二個條碼圖像 + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +現在您擁有兩個 PNG 檔案,具有不同的**條碼高度(像素)**,示範了**建立條碼圖像**變體是多麼簡單。 + +## 動態設定條碼高度(像素) + +通常您需要一系列高度符合 UI 元件或列印標籤的條碼。以下輔助方法將高度變更抽象化: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +現在您可以呼叫 `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");`,在單行程式碼中**建立高度為 45 像素的條碼圖像**。 + +## 在迴圈中建立多個條碼 + +當您擁有一系列產品識別碼時,`foreach` 迴圈可避免重複程式碼。此範例示範如何從 GTIN 陣列**建立多個條碼**。 + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +此迴圈會產生三個 PNG 檔案,每個檔案的**條碼高度(像素)**值不同。由於 `SaveBarcodeWithHeight` 輔助方法已封裝高度變更,主迴圈保持簡潔且專注於資料。 + +### 預期輸出 + +執行完整範例後,`Barcodes` 資料夾會包含: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +開啟任一 PNG 檔案,即可看到清晰的 DataBar Omnidirectional 條碼,可被一般手機應用程式掃描。 + +## 常見陷阱與專業技巧 + +| 問題 | 為何會發生 | 如何避免 | +|------|------------|----------| +| **錯誤的 EncodeTypes** | 為 DataBar 使用 1D 類型會產生無法辨識的圖像。 | 對於 GS1‑128 負載,務必選擇 `EncodeTypes.DatabarOmniDirectional`(或其他 DataBar 變體)。 | +| **X‑dimension 不足** | 極低的 X‑dimension 會導致細條在低解析度螢幕上消失。 | 螢幕顯示時保持 `XDimension.Pixels` ≥ 2;列印時提升至 3‑4。 | +| **檔案路徑錯誤** | 相對路徑可能解析到非預期的目錄。 | 使用 `Path.Combine` 與 `Environment.CurrentDirectory` 來建立絕對路徑。 | +| **覆寫圖像** | 在迴圈中重複使用相同檔名會覆寫先前結果。 | 在檔名中加入唯一識別碼(例如 GTIN 或時間戳記)。 | +| **缺少 NuGet 套件** | 程式碼編譯通過,但執行時拋出 `FileNotFoundException`。 | 確認已安裝 `Aspose.BarCode` 並在專案中正確引用。 | + +## 完整可執行範例 + +以下是完整程式碼,您可以複製到 Console 應用程式中。它包含所有步驟、輔助方法與錯誤處理。 + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +執行此程式 + +## 接下來您可以學習什麼? + +以下教學涵蓋與本指南密切相關的主題,並在此基礎上進一步說明。每個資源皆提供完整可執行的程式碼範例與逐步說明,協助您精通其他 API 功能,並在專案中探索替代實作方式。 + +- [Create Barcode Custom Height – One-Dimensional Barcodes](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Create barcode image C# – GS1 DataMatrix Example](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hongkong/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/hongkong/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..18393014a --- /dev/null +++ b/barcode/hongkong/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,222 @@ +--- +category: general +date: 2026-08-09 +description: 使用 C# 條碼產生器建立條碼圖像,並在數分鐘內學會以自訂長寬比產生多個條碼。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: zh-hant +lastmod: 2026-08-09 +og_description: 使用 C# 條碼產生器建立條碼圖像。本教學示範如何產生多個條碼、調整長寬比,並有效率地儲存 PNG 檔案。 +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: 使用 C# 條碼產生器建立條碼圖像 – 快速指南 +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: 使用 C# 條碼產生器建立條碼圖像 – 指南 +url: /zh-hant/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 使用 C# 條碼產生器建立條碼圖像 – 教學指南 + +如果您需要 **快速建立條碼圖像**,本指南將示範如何使用 C# 條碼產生器完成。您將學會產生多個條碼、調整長寬比,並將每張圖像儲存為 PNG 檔案。 + +產生條碼圖像是建置庫存系統、銷售點終端機或運送標籤時的常見需求。完成本教學後,您將擁有兩個可直接使用的 PNG 檔案,展示不同的長寬比,並了解如何將此方式擴充至任意數量的條碼。 + +## 前置條件 + +開始之前,請確保您已具備: + +* .NET 6.0 SDK 或更新版本 +* Visual Studio 2022(或任何支援 C# 的 IDE) +* 支援 DataBar Stacked Omnidirectional 的條碼函式庫(例如 **Aspose.BarCode for .NET**)。程式碼片段使用 Aspose API,但概念同樣適用於其他具備類似屬性的函式庫。 + +此範例不需要額外的資料庫或 Web 伺服器——僅為純粹的主控台應用程式。 + +## 步驟 1:建立主控台專案 + +建立一個新的主控台專案,並透過 NuGet 加入條碼函式庫。 + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +`dotnet add package` 指令會下載最新穩定版的 **Aspose.BarCode**,其中提供稍後會使用的 `BarcodeGenerator` 類別。 + +## 步驟 2:撰寫完整程式 + +開啟 *Program.cs*,將內容取代為以下完整範例。程式會 **建立條碼圖像**、調整長寬比,並儲存兩個 PNG 檔案。 + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### 為何每個部分都很重要 + +* **Create barcode image** – `BarcodeGenerator` 建構子會以指定的條碼類型與資料初始化物件。 +* **c# barcode generator** – `Parameters` 屬性讓您完整掌控繪製選項;設定 `XDimension.Pixels` 可確保每根條紋在螢幕上都清晰。 +* **generate multiple barcodes** – 透過在儲存前變更 `DataBar.AspectRatio`,同一個產生器實例即可產生兩張不同的圖像,避免重複建立物件,提高效能。 + +## 步驟 3:執行程式並檢視結果 + +執行應用程式: + +```bash +dotnet run +``` + +您應該會看到類似以下的主控台輸出: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +開啟 `BarcodeOutputs` 資料夾,您會看到兩個 PNG 檔案: + +* **DatabarAspectRatio15.png** – 適用於高度受限標籤的緊湊條碼。 +* **DatabarAspectRatio30.png** – 較高的條碼,許多掃描器在遠距離時能更可靠地讀取。 + +兩張圖像皆可直接嵌入 PDF、列印於收據,或傳送至行動應用程式。 + +## 步驟 4:將解決方案擴充至任意數量的條碼 + +上述模式非常容易擴展: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – 迴圈會遍歷長寬比陣列,為每個值建立獨立的 **barcode image**。 +* 只要調整 `EncodeTypes` 或編碼字串,即可產生 QR Code、Code 128 或其他條碼類型,且不必更動其餘程式邏輯。 + +## 實用技巧與常見陷阱 + +| 提示 | 說明 | +|-----|------| +| **Reuse the same generator** | 為每張圖像重新初始化 `BarcodeGenerator` 會產生不必要的開銷。於 `Save` 之間變更參數更快且佔用較少記憶體。 | +| **Validate the output folder** | 儲存前務必呼叫 `Directory.CreateDirectory`;否則 `Save` 會拋出 `DirectoryNotFoundException`。 | +| **Choose an appropriate X‑dimension** | 像素值過低(例如 1)會使條碼在低解析度螢幕上難以辨識。2–3 的值對大多數印表機而言表現良好。 | +| **Mind the encoding** | GS1 DataBar 需要以 `(01)` 作為 GTIN 的前置符號。若省略括號,函式庫可能產生無效條碼。 | +| **Test with a real scanner** | 僅靠目視檢查不足以驗證。請使用實際的掃描硬體測試 PNG 檔案。 | + +## 預期輸出(視覺說明) + +*兩個 PNG 檔案皆顯示深色在淺色背景的 DataBar Stacked Omnidirectional 條碼。長寬比 15 的版本較短,長寬比 30 的版本高度約為前者的兩倍。* + +若將圖像嵌入文件中,因為我們將 `XDimension.Pixels = 2`,所以會呈現銳利的顯示效果。 + +## 結論 + +您現在已掌握如何使用 **C# 條碼產生器** **建立條碼圖像**,並可透過調整長寬比或其他參數 **產生多個條碼**。完整且可執行的範例示範了最佳實踐,包括重複使用產生器實例、處理輸出目錄以及驗證檔案建立。 + +接下來,您可以探索: + +* 使用 `generator.Parameters.Barcode.Color` 加入自訂顏色(次要關鍵字:**c# barcode generator**) +* 匯出為 JPEG 或 SVG 等其他格式(`BarCodeImageFormat.Jpeg`、`BarCodeImageFormat.Svg`) +* 將條碼產生邏輯整合至 Web API,提供即時圖像服務(次要關鍵字 + +## 接下來該學什麼? + +以下教學與本指南緊密相關,能在您已掌握的技巧基礎上,進一步深入 API 功能或探索其他實作方式。每篇資源皆提供完整可執行的程式碼範例與逐步說明,協助您在專案中靈活運用。 + +- [建立條碼 PNG – DataMatrix 長寬比 – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – 使用 Aspose.BarCode for .NET 自訂 Code 16K 條碼長寬比](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [使用 Aspose.BarCode for .NET 以自訂長寬比產生 Aztec 條碼](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hungarian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/hungarian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..250678967 --- /dev/null +++ b/barcode/hungarian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,240 @@ +--- +category: general +date: 2026-08-09 +description: Hozzon létre 4 oszlopos databar vonalkódot C#‑ban gyorsan az Aspose.BarCode + segítségével. Tanulja meg, hogyan állíthatja be az oszlopokat, sorokat, és menthet + PNG képeket ebben a tömör útmutatóban. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: hu +lastmod: 2026-08-09 +og_description: Készíts 4 oszlopos databar vonalkódot C#‑ban az Aspose.BarCode használatával, + majd testreszabja a sorokat és exportálja PNG képekként az alkalmazásához. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: 4 oszlopos databar vonalkód létrehozása C#‑ban – gyors útmutató +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: 4‑oszlopos Databar vonalkód létrehozása C#‑ban – lépésről‑lépésre útmutató +url: /hu/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 4‑oszlopos databar vonalkód létrehozása C#‑ban – lépésről‑lépésre útmutató + +Ha C#‑ban **4‑oszlopos databar vonalkódot** kell létrehoznod, ez a tutorial pontosan megmutatja, hogyan. Végigvezetünk egy DataBar Expanded Stacked vonalkód generálásán, négy oszlop beállításán, és az eredmény PNG képként való mentésén. + +Ebben az útmutatóban megtanulod, hogyan: + +* Inicializáld a `BarcodeGenerator`‑t egy **DataBar Expanded Stacked** szimbólumhoz. +* Állítsd be az oszlopszámot 4‑re (az elsődleges követelmény). +* Állítsd be a sorok számát, ha három soros stacked elrendezésre van szükség. +* Exportáld a vonalkódot PNG‑ként a megfelelő **barcode image format** használatával. + +Csak az Aspose.BarCode for .NET könyvtárra (23.10 vagy újabb verzió) és egy .NET 6+ fejlesztői környezetre, például a Visual Studio 2022‑re van szükséged. További függőségek nem szükségesek. + +--- + +## Hogyan hozzunk létre 4‑oszlopos databar vonalkódot + +Az első lépés egy `BarcodeGenerator` példány létrehozása, amely a **DataBar Expanded Stacked** szimbólumra céloz. Ez az osztály magába foglalja az összes megjelenítési beállítást, így egyszerűen válthatunk az oszlop‑alapú és sor‑alapú elrendezések között. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Why this works:** +`EncodeTypes.DatabarExpandedStacked` azt mondja az Aspose.BarCode‑nak, hogy a DataBar család stacked változatát állítsa elő. A `DataBar.Columns` tulajdonság szabályozza, hány függőleges modulra van szükség a vonalkódban. 4‑re állítva megfelel a **4‑oszlopos databar vonalkód** létrehozásának követelményének. Végül a `Save` a **barcode image format** `Png` használatával írja a vizuális ábrázolást a lemezre. + +### DataBar Expanded Stacked oszlopok konfigurálása + +Ha más oszlopszámra van szükséged, egyszerűen módosítsd a `Columns`‑nak rendelt egész számot. A tulajdonság 1‑től 4‑ig terjedő értékeket fogad el a expanded stacked változatnál. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro tipp:* Mindig teszteld a generált vonalkódot egy, a DataBar családot támogató szkennerrel, mivel a vizuális megjelenés önmagában nem garantálja az olvashatóságot. + +### A vonalkód kép mentése + +A `BarCodeImageFormat` felsorolás több lehetőséget kínál (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). A PNG veszteségmentes, és a legtöbb webes és asztali szituációban jól működik. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Ha más formátumra van szükséged, cseréld le a `Png`‑t a kívánt enum értékre. A mentett fájl közvetlenül beágyazható HTML‑be, PDF‑be, vagy nyomtatható címkékre. + +## Vonalkód létrehozása egyedi sorokkal + +Néha stacked elrendezésre van szükség egy meghatározott sorok számával az oszlopok helyett. Ugyanez a `BarcodeGenerator` osztály egy `Rows` tulajdonságot biztosít erre a célra. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Why rows matter:** +Amikor a stacked vonalkód magasabb, mint széles, a `Rows` tulajdonság meghatározza, hány vízszintes szeletre osztja a szimbólumot. A `Rows = 3` beállítás három soros stacked vonalkódot hoz létre, ami szűk címkeszélességekhez hasznos. + +### A vonalkód sorainak dinamikus beállítása + +A sorok számát futásidőben, a bemeneti adatok alapján számíthatod ki: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Ez a rugalmasság lehetővé teszi, hogy **beállítsd a vonalkód sorait** a program újrafordítása nélkül. + +## Teljes vég‑től‑végig példa + +Az alábbi egyetlen program mind a 4‑oszlopos, mind a 3‑soros vonalkódot generálja, bemutatva, hogyan léteznek együtt a két konfiguráció. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Expected output:** +Két PNG fájl jelenik meg az alkalmazás munkakönyvtárában: + +* `DatabarCols4.png` – egy DataBar Expanded Stacked vonalkód négy függőleges oszloppal. +* `DatabarRows3.png` – ugyanaz a szimbólum három vízszintes sorban elrendezve. + +Mindkét kép megnyitható bármely képnézőben, vagy beágyazható egy UI vezérlőbe. + +--- + +## Gyakori kérdések és szélhelyzetek + +| Question | Answer | +|----------|--------| +| *Can I use a different barcode symbology?* | *Használhatok másik vonalkód szimbólumot?* Igen. Cseréld le a `EncodeTypes.DatabarExpandedStacked`‑t egy másik `EncodeTypes` értékre (például `EncodeTypes.QR`), de a `Columns` és `Rows` tulajdonságok a DataBar családokra specifikusak. | +| *What if the data string exceeds the maximum length?* | *Mi van, ha az adatkarakterlánc meghaladja a maximális hosszúságot?* A DataBar Expanded Stacked szimbólum legfeljebb 61 numerikus karaktert támogat. Ennek a határnak a túllépése `ArgumentException`‑t dob. Ellenőrizd a bemenetet, mielőtt a generátornak átadnád. | +| *Do I need to dispose the `BarcodeGenerator`?* | *Szükséges-e a `BarcodeGenerator` felszabadítása?* `BarcodeGenerator` implementálja az `IDisposable`‑t. Hosszú ideig futó szolgáltatásban csomagold `using` blokkba, vagy hívd meg manuálisan a `Dispose()`‑t a natív erőforrások felszabadításához. | +| *Can I generate SVG instead of PNG?* | *Generálhatok SVG‑t PNG helyett?* Természetesen. Használd a `BarCodeImageFormat.Svg`‑t a `Save` metódusban. | +| *Is the library compatible with .NET Core?* | *Kompatibilis a könyvtár a .NET Core‑ral?* Az Aspose.BarCode for .NET támogatja a .NET Core 3.1, .NET 5, .NET 6 és újabb verziókat. Kódmódosítás nem szükséges. | + +## Összegzés + +Most már tudod, hogyan **hozz létre 4‑oszlopos databar vonalkódot** C#‑ban az Aspose.BarCode használatával, hogyan állíthatod be a sorokkal az elrendezést, és hogyan exportálhatod az eredményt egy kényelmes **barcode image format**‑ban. A teljes példa mind az oszlop‑alapú, mind a sor‑alapú konfigurációkat bemutatja, erős alapot biztosítva minden címkenyomtatási vagy mobil‑szkennelési szituációhoz. + +**Next steps** + +* Kísérletezz különböző adatpayloadokkal, és ellenőrizd a szkenner kompatibilitását. +* Fedezd fel a további stíluslehetőségeket, például az előtér/háttér színeket (`generator.Parameters.Barcode.Color`). +* Kombináld a vonalkódot más grafikákkal a `Graphics` API használatával egyedi címketervekhez. + +Nyugodtan adaptáld a kódot ASP.NET Core, Windows Forms vagy Xamarin projektekhez – az Aspose.BarCode minden .NET platformon működik. Jó kódolást! + +## Mi legyen a következő tanulnivalód? + +Az alábbi tutorialok szorosan kapcsolódó témákat fednek le, amelyek a jelen útmutatóban bemutatott technikákra épülnek. Minden forrás teljes, működő kódrészleteket tartalmaz lépésről‑lépésre magyarázatokkal, hogy segítsenek elsajátítani további API funkciókat és alternatív megvalósítási megközelítéseket a saját projektjeidben. + +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Create barcode image c# – Configure Codablock F Rows & Columns](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [How to create dotcode extended codetext with Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hungarian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/hungarian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..fa237922e --- /dev/null +++ b/barcode/hungarian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,303 @@ +--- +category: general +date: 2026-08-09 +description: Készítsen vonalkód képet C#-ban ezzel a lépésről‑lépésre útmutatóval. + Tanulja meg, hogyan generáljon vonalkódot, állítsa be a vonalkód magasságát pixelekben, + és hatékonyan hozzon létre több vonalkódot. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: hu +lastmod: 2026-08-09 +og_description: Készítsen gyorsan vonalkód képet C#-ban. Kövesse ezt az útmutatót, + hogy megtanulja, hogyan generáljon vonalkódot, állítsa be a vonalkód magasságát + pixelekben, és készítsen több vonalkódot. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Barcode kép létrehozása C#‑ban – teljes útmutató fejlesztőknek +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Vonalkód kép létrehozása C#‑ban – teljes programozási útmutató +url: /hu/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Kódoljon vonalkód képet C#‑ban – teljes programozási útmutató + +Ha .NET alkalmazásban **vonalkód képet kell létrehozni**, ez az útmutató pontosan megmutatja, **hogyan generáljon vonalkódot** az Aspose.BarCode könyvtár segítségével. Megtudja, hogyan szabályozza a **vonalkód magasság pixelben**, hogyan mentse a képet, és hogyan állítson elő **több vonalkódot** anélkül, hogy kódot duplikálná. + +Az útmutató mindent lefed a csomag telepítésétől a méretek testreszabásáig, így még ma be tud másolni egy kész, futtatható példát a projektjébe. + +## Előfeltételek + +* .NET 6.0 SDK vagy újabb telepítve +* Visual Studio 2022 (vagy bármely C# IDE) +* NuGet csomag `Aspose.BarCode` – telepítés: + +```bash +dotnet add package Aspose.BarCode +``` + +Nem szükséges további függőség. + +## Hogyan generáljon vonalkód képet a BarcodeGenerator C#-al + +A vonalkód kép létrehozásához használt központi osztály a `BarcodeGenerator`. Ez magába foglalja a kódolás típusát, az adatkarakterláncot és az összes megjelenítési paramétert. + +### 1. lépés: A kimeneti mappa meghatározása + +Válasszon egy mappát, ahol a generált PNG fájlok tárolódnak. Az abszolút útvonal használata elkerüli a jogosultsági meglepetéseket. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Miért?** A mappa programozott létrehozása garantálja, hogy a későbbi `Save` hívások is sikeresek legyenek még egy tiszta gépen is. + +### 2. lépés: A barcode generator példányosítása + +DataBar Omnidirectional vonalkódhoz adja át a `EncodeTypes.DatabarOmniDirectional` értéket és a GS1‑128 adatkarakterláncot. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Megjegyzés:** A `BarcodeGenerator` objektum újrahasználható; a mentések között módosíthatja a paramétereit, hogy **több vonalkódot** hozzon létre ugyanabból az adatból. + +### 3. lépés: Általános vonalkód paraméterek beállítása + +A leggyakoribb vizuális finomhangolások az X‑dimenzió (modul szélesség) és a vonal magassága. Mindkettő pixelekben van megadva. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Miért állítsuk be az X‑dimenziót?** A kisebb X‑dimenzió nagyobb felbontást eredményez, ami fontos, ha a képet nyomtatni vagy nagy DPI‑jú képernyőn megjeleníteni kell. + +### 4. lépés: Az első vonalkód kép mentése + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +A `DatabarBarHeight30Pixels.png` fájl most egy 30 pixel magas DataBar Omnidirectional vonalkódot tartalmaz. + +### 5. lépés: A vonalkód magasság pixelének módosítása + +A magasság módosításához nem szükséges új `BarcodeGenerator` példány – csak a paramétert kell módosítani. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### 6. lépés: A második vonalkód kép mentése + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Most már két PNG fájlja van különböző **vonalkód magasság pixel** értékekkel, ami bemutatja, milyen egyszerű **vonalkód képek** változatainak **létrehozása**. + +## A vonalkód magasság pixelének dinamikus beállítása + +Gyakran szükség van egy sor vonalkódra, amelyek magassága megegyezik a UI elemekkel vagy a nyomtatott címkékkel. A következő segédmetódus elvonja a magasságváltoztatás részleteit: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Most már meghívhatja a `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` metódust, hogy **vonalkód képet** hozzon létre 45 pixel magassággal egyetlen sorban. + +## Több vonalkód létrehozása ciklusban + +Ha van egy termékazonosítók gyűjteménye, egy `foreach` ciklus megszünteti az ismétlődő kódot. Ez a példa megmutatja, hogyan **hozhat létre több vonalkódot** egy GTIN tömbből. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +A ciklus három PNG fájlt hoz létre, mindegyik egyedi **vonalkód magasság pixel** értékkel. Mivel a `SaveBarcodeWithHeight` segéd a magasságváltoztatást kapszulázza, a fő ciklus tiszta marad és az adatokra koncentrál. + +### Várható kimenet + +A teljes minta futtatása után a `Barcodes` mappa a következőket tartalmazza: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Bármely PNG megnyitása egy tiszta DataBar Omnidirectional vonalkódot mutat, amelyet a szabványos mobilalkalmazások be tudnak olvasni. + +## Gyakori buktatók és profi tippek + +| Probléma | Miért fordul elő | Hogyan kerülhető el | +|----------|------------------|---------------------| +| **Helytelen EncodeTypes** | 1D típus használata DataBar-hoz olvashatatlan képet eredményez. | Mindig válassza a `EncodeTypes.DatabarOmniDirectional` (vagy más DataBar változat) értéket a GS1‑128 terheléshez. | +| **Elégtelen X‑dimenzió** | Nagyon alacsony X‑dimenzió miatt a vékony vonalak eltűnhetnek alacsony felbontású monitorokon. | Tartsa a `XDimension.Pixels` értéket ≥ 2 képernyőn való megjelenítéshez; nyomtatáshoz növelje 3‑4-re. | +| **Fájlútvonal hibák** | A relatív útvonalak váratlan könyvtárakra mutathatnak. | Használja a `Path.Combine` és `Environment.CurrentDirectory` metódusokat abszolút útvonalak építéséhez. | +| **Képek felülírása** | Ugyanazon fájlnév újrahasználata egy ciklusban felülírja a korábbi eredményeket. | Tegyen egyedi azonosítókat (pl. GTIN vagy időbélyeg) a fájlnévbe. | +| **Hiányzó NuGet csomag** | A kód lefordul, de futás közben `FileNotFoundException`-t dob. | Ellenőrizze, hogy a `Aspose.BarCode` telepítve van és a projekt hivatkozik rá. | + +## Teljes működő példa + +Az alábbiakban a teljes program látható, amelyet beilleszthet egy konzolalkalmazásba. Tartalmazza az összes lépést, segédmetódusokat és a hibakezelést. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +A program futtatása + +## Mit érdemes következőként megtanulni? + +Az alábbi oktatóanyagok szorosan kapcsolódó témákat fednek le, amelyek a jelen útmutatóban bemutatott technikákra épülnek. Minden forrás teljesen működő kódrészleteket tartalmaz lépésről‑lépésre magyarázatokkal, hogy segítsen elsajátítani további API funkciókat és alternatív megvalósítási megközelítéseket a saját projektjeiben. + +- [Egyedi magasságú vonalkód létrehozása – Egydimenziós vonalkódok](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Vonalkód kép létrehozása C# – GS1 DataMatrix példa](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [DotCode vonalkód kép létrehozása – sorok és oszlopok (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hungarian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/hungarian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..0b1d184f2 --- /dev/null +++ b/barcode/hungarian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-09 +description: Készíts vonalkód képet C#-os vonalkód generátorral, és tanulj meg percek + alatt egyedi méretarányú több vonalkódot generálni. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: hu +lastmod: 2026-08-09 +og_description: Készítsen vonalkód képet C#-os vonalkódgenerátorral. Ez az útmutató + bemutatja, hogyan generáljon több vonalkódot, állítsa be a képarányokat, és mentse + hatékonyan a PNG-fájlokat. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Készíts vonalkód képet C# vonalkód generátorral – gyors útmutató +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Vonalkód kép létrehozása C# vonalkódgenerátorral – útmutató +url: /hu/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# vonalkód generátorral vonalkód kép létrehozása – útmutató + +Ha gyorsan **vonalkód képet** kell létrehoznod, ez az útmutató megmutatja, hogyan teheted ezt C# vonalkód generátorral. Megtanulod, hogyan generálj több vonalkódot, módosítsd a képarányt, és mentsd el minden képet PNG fájlként. + +A vonalkód képek generálása gyakori feladat készletkezelő rendszerek, értékesítési pont terminálok vagy szállítási címkék fejlesztésekor. A tutorial végére két kész PNG fájlod lesz, amelyek különböző képarányokat mutatnak be, és megérted, hogyan bővítheted a megközelítést tetszőleges számú vonalkódra. + +## Prerequisites + +Mielőtt elkezdenéd, győződj meg róla, hogy a következők telepítve vannak: + +* .NET 6.0 SDK vagy újabb telepítve +* Visual Studio 2022 (vagy bármely C#-t támogató IDE) +* Egy vonalkód könyvtárra való hivatkozás, amely támogatja a DataBar Stacked Omnidirectional szimbólumot (például **Aspose.BarCode for .NET**). A kódrészletek az Aspose API-t használják, de a koncepciók bármely hasonló tulajdonságokkal rendelkező könyvtárra alkalmazhatók. + +Nem szükséges külön adatbázis vagy webszerver – ez egy egyszerű konzolos alkalmazás. + +## Step 1: Set up the console project + +Hozz létre egy új konzolos projektet, és add hozzá a vonalkód könyvtárat a NuGet-en keresztül. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +A `dotnet add package` parancs letölti a **Aspose.BarCode** legújabb stabil verzióját, amely biztosítja a később használt `BarcodeGenerator` osztályt. + +## Step 2: Write the full program + +Nyisd meg a *Program.cs*-t, és cseréld le a tartalmát az alábbi teljes példával. A program **vonalkód képet** hoz létre, módosítja a képarányt, és két PNG fájlt ment el. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Why each part matters + +* **Create barcode image** – A `BarcodeGenerator` konstruktor inicializálja az objektumot a kívánt szimbólummal és adatokkal. +* **c# barcode generator** – A `Parameters` tulajdonság teljes irányítást ad a megjelenítési beállítások felett; az `XDimension.Pixels` beállítása biztosítja, hogy minden vonal éles legyen a képernyőn. +* **generate multiple barcodes** – Az `DataBar.AspectRatio` mentések közti módosításával ugyanaz a generátor példány két különböző képet hoz létre az objektum újra létrehozása nélkül, ami hatékonyabb. + +## Step 3: Run the program and view the results + +Futtasd az alkalmazást: + +```bash +dotnet run +``` + +A konzolon a következőhöz hasonló kimenetet kell látnod: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Nyisd meg a `BarcodeOutputs` mappát. Két PNG fájlt találsz benne: + +* **DatabarAspectRatio15.png** – egy kompakt vonalkód, amely korlátozott magasságú címkékhez alkalmas. +* **DatabarAspectRatio30.png** – egy magasabb vonalkód, amelyet sok szkenner távolabbról is megbízhatóbban olvas. + +Mindkét kép készen áll PDF-ekbe ágyazásra, nyugtákra nyomtatásra vagy mobilalkalmazásba küldésre. + +## Step 4: Extend the solution to generate any number of barcodes + +A fenti minta könnyen skálázható: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – A ciklus egy képarányok tömbjén iterál, minden értékhez egy külön **barcode image**-t hoz létre. +* Állítsd be az `EncodeTypes`-t vagy a kódolt karakterláncot QR kódok, Code 128 vagy más szimbólumok előállításához anélkül, hogy a környező logikát módosítanád. + +## Practical tips and common pitfalls + +| Tip | Explanation | +|-----|-------------| +| **Használd újra ugyanazt a generátort** | A `BarcodeGenerator` minden egyes képhez való újrainicializálása felesleges terhelést jelent. A paraméterek `Save` hívások közti módosítása gyorsabb és kevesebb memóriát használ. | +| **Ellenőrizd a kimeneti mappát** | Mindig hívd meg a `Directory.CreateDirectory`-t mentés előtt; különben a `Save` `DirectoryNotFoundException`-t dob. | +| **Válassz megfelelő X‑dimenziót** | Nagyon alacsony pixelértékek (pl. 1) olvashatatlanná tehetik a vonalkódot alacsony felbontású képernyőkön. A 2–3 érték a legtöbb nyomtatóhoz jól működik. | +| **Figyelj a kódolásra** | A GS1 DataBar a GTIN-hez vezető `(01)` előtagot várja. Ha kihagyod a zárójeleket, a könyvtár érvénytelen vonalkódot generálhat. | +| **Teszteld valódi szkennerrel** | A vizuális ellenőrzés nem elegendő. Teszteld a PNG fájlokat a tényleges szkennerrel, amelyet használni tervezel. | + +## Expected output (visual description) + +*Mindkét PNG fájl sötét‑fehér DataBar Stacked Omnidirectional vonalkódot jelenít meg. A 15‑ös képarányú változat rövidebb, míg a 30‑as képarányú változat nagyjából kétszer olyan magas.* + +Ha a képeket egy dokumentumba ágyazod, élesen fognak megjelenni, mivel az `XDimension.Pixels = 2` értéket állítottuk be. + +## Conclusion + +Most már tudod, hogyan **vonalkód képeket** hozz létre **C# vonalkód generátor** segítségével, és hogyan **több vonalkódot** generálj a képarány vagy bármely más paraméter módosításával. A teljes, futtatható példa a legjobb gyakorlatokat mutatja be, például a generátor példány újrahasználatát, a kimeneti könyvtárak kezelését és a fájlok létrehozásának ellenőrzését. + +Next, you might explore: + +* Egyedi színek hozzáadása a `generator.Parameters.Barcode.Color` segítségével (másodlagos kulcsszó: **c# barcode generator**) +* Exportálás más formátumokba, például JPEG vagy SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* A vonalkód létrehozási logika integrálása egy Web API-ba, hogy igény szerint szolgáltass képeket (másodlagos kulcsszó + +## What Should You Learn Next? + +Az alábbi oktatóanyagok szorosan kapcsolódó témákat fednek le, amelyek a jelen útmutatóban bemutatott technikákra épülnek. Minden forrás teljes, működő kódrészleteket tartalmaz lépésről‑lépésre magyarázatokkal, hogy segítsenek elsajátítani további API funkciókat és alternatív megvalósítási megközelítéseket a saját projektjeidben. + +- [Create Barcode PNG – DataMatrix Aspect Ratio – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Customize Code 16K Barcode Aspect Ratios with Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/indonesian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/indonesian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..4bb75dad1 --- /dev/null +++ b/barcode/indonesian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,242 @@ +--- +category: general +date: 2026-08-09 +description: Buat barcode databar 4‑kolom di C# dengan cepat menggunakan Aspose.BarCode. + Pelajari cara mengatur kolom, baris, dan menyimpan gambar PNG dalam panduan singkat + ini. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: id +lastmod: 2026-08-09 +og_description: Buat kode batang databar 4‑kolom di C# menggunakan Aspose.BarCode, + lalu sesuaikan baris dan ekspor gambar PNG untuk aplikasi Anda. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Buat barcode databar 4‑kolom di C# – tutorial singkat +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Buat barcode databar 4‑kolom di C# – panduan langkah demi langkah +url: /id/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Buat barcode databar 4‑kolom di C# – panduan langkah‑demi‑langkah + +Jika Anda perlu **membuat barcode databar 4‑kolom** di C#, tutorial ini akan menunjukkan secara tepat caranya. Kami akan memandu Anda menghasilkan barcode DataBar Expanded Stacked, mengonfigurasi empat kolom, dan menyimpan hasilnya sebagai gambar PNG. + +Dalam panduan ini Anda akan belajar cara: + +* Menginisialisasi `BarcodeGenerator` untuk simbol **DataBar Expanded Stacked**. +* Mengatur jumlah kolom menjadi 4 (persyaratan utama). +* Menyesuaikan jumlah baris ketika Anda memerlukan tata letak stacked dengan tiga baris. +* Mengekspor barcode sebagai PNG menggunakan **format gambar barcode** yang sesuai. + +Anda hanya memerlukan pustaka Aspose.BarCode untuk .NET (versi 23.10 atau lebih baru) dan lingkungan pengembangan .NET 6+ seperti Visual Studio 2022. Tidak ada ketergantungan tambahan yang diperlukan. + +--- + +## Cara membuat barcode databar 4‑kolom + +Langkah pertama adalah membuat instance `BarcodeGenerator` yang menargetkan simbol **DataBar Expanded Stacked**. Kelas ini mengenkapsulasi semua opsi rendering, sehingga mudah beralih antara tata letak berbasis kolom dan berbasis baris. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Mengapa ini berhasil:** +`EncodeTypes.DatabarExpandedStacked` memberi tahu Aspose.BarCode untuk menghasilkan versi stacked dari keluarga DataBar. Properti `DataBar.Columns` mengontrol berapa banyak modul vertikal yang ditempati barcode. Menetapkannya ke 4 memenuhi persyaratan untuk **membuat barcode databar 4‑kolom**. Akhirnya, `Save` menulis representasi visual ke disk menggunakan **format gambar barcode** `Png`. + +### Konfigurasi kolom DataBar Expanded Stacked + +Jika Anda memerlukan jumlah kolom yang berbeda, cukup ubah nilai integer yang diberikan ke `Columns`. Properti ini menerima nilai dari 1 hingga 4 untuk varian expanded stacked. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro tip:* Selalu uji barcode yang dihasilkan dengan pemindai yang mendukung keluarga DataBar, karena penampilan visual saja tidak menjamin keterbacaan. + +### Simpan gambar barcode + +Enumerasi `BarCodeImageFormat` menyediakan beberapa opsi (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG bersifat loss‑less dan bekerja baik untuk kebanyakan skenario web dan desktop. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Jika Anda memerlukan format lain, ganti `Png` dengan nilai enum yang diinginkan. File yang disimpan dapat disisipkan langsung ke HTML, PDF, atau dicetak pada label. + +## Buat barcode dengan baris khusus + +Kadang-kadang tata letak stacked diperlukan dengan jumlah baris tertentu alih‑alih kolom. Kelas `BarcodeGenerator` yang sama menyediakan properti `Rows` untuk tujuan ini. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Mengapa baris penting:** +Ketika barcode stacked lebih tinggi daripada lebarnya, properti `Rows` menentukan berapa banyak irisan horizontal simbol dibagi. Menetapkan `Rows = 3` menghasilkan barcode stacked tiga baris, yang berguna untuk lebar label yang sempit. + +### Atur baris barcode secara dinamis + +Anda dapat menghitung jumlah baris pada runtime berdasarkan data masukan: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Fleksibilitas ini memungkinkan Anda **mengatur baris barcode** tanpa harus mengompilasi ulang aplikasi. + +## Contoh lengkap end‑to‑end + +Berikut adalah program tunggal yang menghasilkan baik barcode 4‑kolom maupun barcode 3‑baris, memperlihatkan cara kedua konfigurasi dapat berdampingan. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Output yang diharapkan:** +Dua file PNG muncul di direktori kerja aplikasi: + +* `DatabarCols4.png` – barcode DataBar Expanded Stacked dengan empat kolom vertikal. +* `DatabarRows3.png` – simbol yang sama diatur dalam tiga baris horizontal. + +Kedua gambar dapat dibuka di penampil gambar apa pun atau disisipkan dalam kontrol UI. + +--- + +## Pertanyaan umum dan kasus tepi + +| Question | Answer | +|----------|--------| +| *Can I use a different barcode symbology?* | Ya. Ganti `EncodeTypes.DatabarExpandedStacked` dengan nilai `EncodeTypes` lain (misalnya `EncodeTypes.QR`), tetapi properti `Columns` dan `Rows` khusus untuk keluarga DataBar. | +| *What if the data string exceeds the maximum length?* | Simbologi DataBar Expanded Stacked mendukung hingga 61 karakter numerik. Melebihi batas ini akan menimbulkan `ArgumentException`. Validasi input sebelum menetapkannya ke generator. | +| *Do I need to dispose the `BarcodeGenerator`?* | `BarcodeGenerator` mengimplementasikan `IDisposable`. Pada layanan yang berjalan lama, bungkuslah dalam blok `using` atau panggil `Dispose()` secara manual untuk membebaskan sumber daya native. | +| *Can I generate SVG instead of PNG?* | Tentu saja. Gunakan `BarCodeImageFormat.Svg` pada metode `Save`. | +| *Is the library compatible with .NET Core?* | Aspose.BarCode untuk .NET mendukung .NET Core 3.1, .NET 5, .NET 6, dan versi selanjutnya. Tidak diperlukan perubahan kode. | + +--- + +## Kesimpulan + +Anda kini tahu cara **membuat barcode databar 4‑kolom** di C# menggunakan Aspose.BarCode, cara menyesuaikan tata letak dengan baris, dan cara mengekspor hasil dalam **format gambar barcode** yang praktis. Contoh lengkap menampilkan konfigurasi berbasis kolom maupun baris, memberi Anda fondasi yang kuat untuk skenario pencetakan label atau pemindaian seluler apa pun. + +**Langkah selanjutnya** + +* Bereksperimenlah dengan payload data yang berbeda dan verifikasi kompatibilitas pemindai. +* Jelajahi opsi styling tambahan seperti warna latar depan/latar belakang (`generator.Parameters.Barcode.Color`). +* Gabungkan barcode dengan grafik lain menggunakan API `Graphics` untuk desain label khusus. + +Silakan sesuaikan kode untuk proyek ASP.NET Core, Windows Forms, atau Xamarin—Aspose.BarCode berfungsi di semua platform .NET. Selamat coding! + +## Apa yang Harus Anda Pelajari Selanjutnya? + +Tutorial berikut mencakup topik terkait yang membangun teknik yang ditunjukkan dalam panduan ini. Setiap sumber daya menyertakan contoh kode lengkap yang berfungsi dengan penjelasan langkah demi langkah untuk membantu Anda menguasai fitur API tambahan dan mengeksplorasi pendekatan implementasi alternatif dalam proyek Anda sendiri. + +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Create barcode image c# – Configure Codablock F Rows & Columns](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [How to create dotcode extended codetext with Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/indonesian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/indonesian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..8c8f6052c --- /dev/null +++ b/barcode/indonesian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,306 @@ +--- +category: general +date: 2026-08-09 +description: Buat gambar barcode di C# dengan panduan langkah demi langkah ini. Pelajari + cara menghasilkan barcode, mengatur tinggi barcode dalam piksel, dan membuat banyak + barcode secara efisien. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: id +lastmod: 2026-08-09 +og_description: Buat gambar barcode di C# dengan cepat. Ikuti tutorial ini untuk belajar + cara menghasilkan barcode, mengatur tinggi pixel barcode, dan menghasilkan banyak + barcode. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Buat gambar barcode di C# – panduan lengkap untuk pengembang +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Buat gambar barcode di C# – panduan pemrograman lengkap +url: /id/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Buat gambar barcode di C# – panduan pemrograman lengkap + +Jika Anda perlu **membuat gambar barcode** dalam aplikasi .NET, panduan ini menunjukkan secara tepat **cara menghasilkan barcode** menggunakan pustaka Aspose.BarCode. Anda akan melihat cara mengontrol **pixel tinggi barcode**, menyimpan gambar, dan menghasilkan **beberapa barcode** tanpa menduplikasi kode. + +Tutorial ini mencakup semua hal mulai dari menginstal paket hingga menyesuaikan dimensi, sehingga Anda dapat menyalin‑tempel contoh siap‑jalankan ke dalam proyek Anda hari ini. + +## Prasyarat + +Sebelum Anda memulai, pastikan Anda memiliki: + +* .NET 6.0 SDK atau yang lebih baru terinstal +* Visual Studio 2022 (atau IDE C# apa pun) +* Paket NuGet `Aspose.BarCode` – instal dengan + +```bash +dotnet add package Aspose.BarCode +``` + +Tidak ada dependensi tambahan yang diperlukan. + +## Cara menghasilkan gambar barcode dengan BarcodeGenerator C# + +Kelas inti untuk membuat gambar barcode adalah `BarcodeGenerator`. Kelas ini mengenkapsulasi tipe enkoding, string data, dan semua parameter rendering. + +### Langkah 1: Tentukan folder output + +Pilih folder tempat file PNG yang dihasilkan akan disimpan. Menggunakan jalur absolut menghindari kejutan izin. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Mengapa?** Membuat folder secara programatik menjamin bahwa pemanggilan `Save` berikutnya berhasil bahkan pada mesin baru. + +### Langkah 2: Buat instance barcode generator + +Untuk barcode DataBar Omnidirectional, berikan `EncodeTypes.DatabarOmniDirectional` dan string data GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Catatan:** Objek `BarcodeGenerator` dapat digunakan kembali; Anda dapat mengubah parameternya di antara penyimpanan untuk **membuat beberapa barcode** dari data yang sama. + +### Langkah 3: Atur parameter barcode umum + +Penyesuaian visual yang paling umum adalah X‑dimension (lebar modul) dan tinggi bar. Keduanya dinyatakan dalam pixel. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Mengapa mengatur X‑dimension?** X‑dimension yang lebih kecil menghasilkan resolusi lebih tinggi, yang penting ketika gambar akan dicetak atau ditampilkan pada layar ber‑DPI tinggi. + +### Langkah 4: Simpan gambar barcode pertama + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +File `DatabarBarHeight30Pixels.png` kini berisi barcode DataBar Omnidirectional dengan tinggi 30 pixel. + +### Langkah 5: Sesuaikan pixel tinggi barcode + +Mengubah tinggi tidak memerlukan instance `BarcodeGenerator` baru—cukup ubah parameternya. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Langkah 6: Simpan gambar barcode kedua + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Sekarang Anda memiliki dua file PNG dengan **pixel tinggi barcode** yang berbeda, menunjukkan betapa mudahnya **membuat variasi gambar barcode**. + +## Mengatur pixel tinggi barcode secara dinamis + +Seringkali Anda membutuhkan serangkaian barcode dengan tinggi yang sesuai dengan elemen UI atau label cetak. Metode bantu berikut mengabstraksi perubahan tinggi: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Anda kini dapat memanggil `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` untuk **membuat gambar barcode** dengan tinggi 45 pixel dalam satu baris. + +## Membuat beberapa barcode dalam loop + +Ketika Anda memiliki kumpulan identifier produk, loop `foreach` menghilangkan kode berulang. Contoh ini menunjukkan cara **membuat beberapa barcode** dari array GTIN. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +Loop tersebut menghasilkan tiga file PNG, masing‑masing dengan nilai **pixel tinggi barcode** yang berbeda. Karena helper `SaveBarcodeWithHeight` mengenkapsulasi perubahan tinggi, loop utama tetap bersih dan terfokus pada data. + +### Output yang diharapkan + +Setelah menjalankan contoh lengkap, folder `Barcodes` berisi: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Membuka PNG mana pun menampilkan barcode DataBar Omnidirectional yang tajam dan dapat dipindai oleh aplikasi seluler standar. + +## Kesalahan umum dan tip pro + +| Issue | Why it happens | How to avoid it | +|-------|----------------|-----------------| +| **Wrong EncodeTypes** | Menggunakan tipe 1D untuk DataBar akan menghasilkan gambar yang tidak dapat dibaca. | Selalu pilih `EncodeTypes.DatabarOmniDirectional` (atau varian DataBar lainnya) untuk payload GS1‑128. | +| **Insufficient X‑dimension** | X‑dimension yang sangat rendah dapat membuat bar tipis menghilang pada monitor beresolusi rendah. | Pertahankan `XDimension.Pixels` ≥ 2 untuk tampilan layar; tingkatkan menjadi 3‑4 untuk pencetakan. | +| **File path errors** | Jalur relatif mungkin mengarah ke direktori yang tidak terduga. | Gunakan `Path.Combine` dan `Environment.CurrentDirectory` untuk membangun jalur absolut. | +| **Overwriting images** | Menggunakan nama file yang sama dalam loop akan menimpa hasil sebelumnya. | Sertakan identifier unik (mis., GTIN atau timestamp) dalam nama file. | +| **Missing NuGet package** | Kode berhasil dikompilasi tetapi melempar `FileNotFoundException` saat runtime. | Pastikan `Aspose.BarCode` terinstal dan proyek merujuknya. | + +## Contoh lengkap yang berfungsi + +Berikut adalah program lengkap yang dapat Anda salin ke aplikasi console. Program ini mencakup semua langkah, metode bantu, dan penanganan error. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Menjalankan program ini + + +## Apa yang Harus Anda Pelajari Selanjutnya? + +Tutorial berikut mencakup topik yang terkait erat yang membangun teknik yang ditunjukkan dalam panduan ini. Setiap sumber daya menyertakan contoh kode lengkap yang berfungsi dengan penjelasan langkah demi langkah untuk membantu Anda menguasai fitur API tambahan dan mengeksplorasi pendekatan implementasi alternatif dalam proyek Anda sendiri. + +- [Buat Tinggi Kustom Barcode – Barcode Satu Dimensi](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Buat gambar barcode C# – Contoh GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Buat gambar barcode DotCode – baris & kolom (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/indonesian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/indonesian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..e4eadd9eb --- /dev/null +++ b/barcode/indonesian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-09 +description: Buat gambar barcode dengan generator barcode C# dan pelajari cara menghasilkan + banyak barcode dengan rasio aspek khusus dalam hitungan menit. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: id +lastmod: 2026-08-09 +og_description: Buat gambar kode batang menggunakan generator kode batang C#. Tutorial + ini menunjukkan cara menghasilkan beberapa kode batang, menyesuaikan rasio aspek, + dan menyimpan file PNG secara efisien. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Buat gambar barcode dengan generator barcode C# – panduan singkat +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Buat gambar barcode dengan generator barcode C# – panduan +url: /id/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Buat gambar barcode dengan generator barcode C# – panduan + +Jika Anda perlu **create barcode image** dengan cepat, panduan ini menunjukkan cara melakukannya dengan generator barcode C#. Anda akan belajar menghasilkan multiple barcodes, mengubah aspect ratio, dan menyimpan setiap gambar sebagai file PNG. + +Generating barcode images adalah tugas umum saat membangun sistem inventaris, terminal point‑of‑sale, atau label pengiriman. Pada akhir tutorial ini Anda akan memiliki dua file PNG siap pakai yang menunjukkan aspect ratio berbeda, dan Anda akan memahami cara memperluas pendekatan ini ke sejumlah barcode apa pun. + +## Prasyarat + +Sebelum Anda memulai, pastikan Anda memiliki: + +* .NET 6.0 SDK atau yang lebih baru terpasang +* Visual Studio 2022 (atau IDE apa pun yang mendukung C#) +* Referensi ke perpustakaan barcode yang mendukung DataBar Stacked Omnidirectional (misalnya, **Aspose.BarCode for .NET**). Potongan kode menggunakan Aspose API, tetapi konsepnya berlaku untuk perpustakaan apa pun dengan properti serupa. + +Anda tidak memerlukan database atau server web terpisah—ini adalah aplikasi console sederhana. + +## Langkah 1: Siapkan proyek console + +Buat proyek console baru dan tambahkan perpustakaan barcode melalui NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +Perintah `dotnet add package` mengambil versi stabil terbaru dari **Aspose.BarCode**, yang menyediakan kelas `BarcodeGenerator` yang digunakan nanti. + +## Langkah 2: Tulis program lengkap + +Buka *Program.cs* dan ganti isinya dengan contoh lengkap di bawah ini. Program ini membuat **barcode image**, mengubah aspect ratio, dan menyimpan dua file PNG. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Mengapa setiap bagian penting + +* **Create barcode image** – Konstruktor `BarcodeGenerator` menginisialisasi objek dengan simbolologi dan data yang diinginkan. +* **c# barcode generator** – Properti `Parameters` memberi Anda kontrol penuh atas opsi rendering; mengatur `XDimension.Pixels` memastikan setiap bar tajam di layar. +* **generate multiple barcodes** – Dengan mengubah `DataBar.AspectRatio` antara penyimpanan, instance generator yang sama menghasilkan dua gambar berbeda tanpa membuat ulang objek, yang lebih efisien. + +## Langkah 3: Jalankan program dan lihat hasilnya + +Jalankan aplikasi: + +```bash +dotnet run +``` + +Anda akan melihat output console yang mirip dengan: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Buka folder `BarcodeOutputs`. Anda akan menemukan dua file PNG: + +* **DatabarAspectRatio15.png** – barcode kompak yang cocok untuk label dengan tinggi terbatas. +* **DatabarAspectRatio30.png** – barcode lebih tinggi yang dapat dibaca lebih andal oleh banyak pemindai dari jarak jauh. + +Kedua gambar siap disisipkan ke dalam PDF, dicetak pada struk, atau dikirim ke aplikasi seluler. + +## Langkah 4: Perluas solusi untuk menghasilkan sejumlah barcode + +Pola yang ditunjukkan di atas dapat dengan mudah diskalakan: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – Loop iterasi melalui array aspect ratios, membuat **barcode image** yang berbeda untuk setiap nilai. +* Sesuaikan `EncodeTypes` atau string yang dienkode untuk menghasilkan QR code, Code 128, atau simbol lainnya tanpa mengubah logika di sekitarnya. + +## Tips praktis dan jebakan umum + +| Tip | Explanation | +|-----|-------------| +| **Gunakan kembali generator yang sama** | Menginisialisasi ulang `BarcodeGenerator` untuk setiap gambar menambah beban yang tidak perlu. Mengubah parameter antara panggilan `Save` lebih cepat dan menggunakan memori lebih sedikit. | +| **Validasi folder output** | Selalu panggil `Directory.CreateDirectory` sebelum menyimpan; jika tidak, `Save` akan melempar `DirectoryNotFoundException`. | +| **Pilih X‑dimension yang tepat** | Nilai pixel yang sangat rendah (mis., 1) dapat membuat barcode tidak terbaca pada layar beresolusi rendah. Nilai 2–3 bekerja baik untuk kebanyakan printer. | +| **Perhatikan encoding** | GS1 DataBar mengharapkan awalan `(01)` untuk GTIN. Jika Anda menghilangkan tanda kurung, perpustakaan dapat menghasilkan barcode yang tidak valid. | +| **Uji dengan pemindai nyata** | Inspeksi visual tidak cukup. Uji file PNG dengan perangkat pemindai sebenarnya yang akan Anda gunakan. | + +## Output yang diharapkan (deskripsi visual) + +*Kedua file PNG menampilkan barcode DataBar Stacked Omnidirectional dengan warna gelap di atas latar terang. Versi dengan aspect ratio 15 lebih pendek, sedangkan versi dengan aspect ratio 30 kira-kira dua kali lebih tinggi.* + +Jika Anda menyisipkan gambar ke dalam dokumen, gambar akan tampil tajam karena kami mengatur `XDimension.Pixels = 2`. + +## Kesimpulan + +Anda kini tahu cara **create barcode image** menggunakan **C# barcode generator**, dan Anda dapat **generate multiple barcodes** dengan menyesuaikan aspect ratio atau parameter lainnya. Contoh lengkap yang dapat dijalankan menunjukkan praktik terbaik seperti menggunakan kembali instance generator, menangani folder output, dan memverifikasi pembuatan file. + +Selanjutnya, Anda mungkin ingin menjelajahi: + +* Menambahkan warna khusus dengan `generator.Parameters.Barcode.Color` (kata kunci sekunder: **c# barcode generator**) +* Mengekspor ke format lain seperti JPEG atau SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Mengintegrasikan logika pembuatan barcode ke dalam Web API untuk menyajikan gambar sesuai permintaan (kata kunci sekunder + +## Apa yang Harus Anda Pelajari Selanjutnya? + +Tutorial berikut mencakup topik yang terkait erat yang membangun teknik yang ditunjukkan dalam panduan ini. Setiap sumber menyertakan contoh kode lengkap yang berfungsi dengan penjelasan langkah demi langkah untuk membantu Anda menguasai fitur API tambahan dan menjelajahi pendekatan implementasi alternatif dalam proyek Anda. + +- [Buat Barcode PNG – Rasio Aspek DataMatrix – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [tutorial generator barcode c# – Sesuaikan Rasio Aspek Barcode Code 16K dengan Aspose.BarCode untuk .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Cara menghasilkan barcode Aztec dengan rasio aspek khusus menggunakan Aspose.BarCode untuk .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/italian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/italian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..791f1d155 --- /dev/null +++ b/barcode/italian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,239 @@ +--- +category: general +date: 2026-08-09 +description: Crea rapidamente un codice a barre databar a 4 colonne in C# con Aspose.BarCode. + Scopri come configurare colonne, righe e salvare immagini PNG in questa guida concisa. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: it +lastmod: 2026-08-09 +og_description: Crea un codice a barre databar a 4 colonne in C# usando Aspose.BarCode, + poi personalizza le righe ed esporta le immagini PNG per la tua app. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Crea un codice a barre Databar a 4 colonne in C# – tutorial rapido +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Crea un codice a barre Databar a 4 colonne in C# – guida passo passo +url: /it/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Crea codice a barre databar a 4 colonne in C# – guida passo‑passo + +Se hai bisogno di **creare un codice a barre databar a 4 colonne** in C#, questo tutorial ti mostra esattamente come fare. Ti guideremo nella generazione di un codice a barre DataBar Expanded Stacked, nella configurazione di quattro colonne e nel salvataggio del risultato come immagine PNG. + +Nel presente tutorial imparerai a: + +* Inizializzare il `BarcodeGenerator` per un simbolo **DataBar Expanded Stacked**. +* Impostare il conteggio delle colonne a 4 (requisito principale). +* Regolare il conteggio delle righe quando è necessario un layout impilato con tre righe. +* Esportare il codice a barre come PNG utilizzando il **barcode image format** appropriato. + +Hai bisogno solo della libreria Aspose.BarCode per .NET (versione 23.10 o successiva) e di un ambiente di sviluppo .NET 6+ come Visual Studio 2022. Non sono richieste dipendenze aggiuntive. + +--- + +## Come creare un codice a barre databar a 4 colonne + +Il primo passo è creare un'istanza di `BarcodeGenerator` che punti alla simbologia **DataBar Expanded Stacked**. Questa classe incapsula tutte le opzioni di rendering, rendendo semplice passare da layout basati su colonne a layout basati su righe. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Perché funziona:** +`EncodeTypes.DatabarExpandedStacked` indica ad Aspose.BarCode di produrre la versione impilata della famiglia DataBar. La proprietà `DataBar.Columns` controlla quante unità verticali occupa il codice a barre. Impostandola a 4 soddisfa il requisito di **creare un codice a barre databar a 4 colonne**. Infine, `Save` scrive la rappresentazione visiva su disco usando il **barcode image format** `Png`. + +### Configura le colonne di DataBar Expanded Stacked + +Se hai bisogno di un conteggio di colonne diverso, modifica semplicemente l'intero assegnato a `Columns`. La proprietà accetta valori da 1 a 4 per la variante expanded stacked. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Consiglio professionale:* Testa sempre il codice a barre generato con uno scanner che supporta la famiglia DataBar, poiché l'aspetto visivo da solo non garantisce la leggibilità. + +### Salva l'immagine del codice a barre + +L'enumerazione `BarCodeImageFormat` fornisce diverse opzioni (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG è loss‑less e funziona bene nella maggior parte degli scenari web e desktop. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Se ti serve un formato diverso, sostituisci `Png` con il valore enum desiderato. Il file salvato può essere incorporato direttamente in HTML, PDF o stampato su etichette. + +## Crea un codice a barre con righe personalizzate + +A volte è necessario un layout impilato con un numero specifico di righe anziché colonne. La stessa classe `BarcodeGenerator` espone una proprietà `Rows` a questo scopo. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Perché le righe sono importanti:** +Quando il codice a barre impilato è più alto che largo, la proprietà `Rows` determina in quante sezioni orizzontali è suddiviso il simbolo. Impostare `Rows = 3` crea un codice a barre impilato a tre righe, utile per larghezze di etichetta strette. + +### Imposta dinamicamente le righe del codice a barre + +Puoi calcolare il numero di righe a runtime in base ai dati di input: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Questa flessibilità ti consente di **impostare le righe del codice a barre** senza ricompilare l'applicazione. + +## Esempio completo end‑to‑end + +Di seguito trovi un unico programma che genera sia un codice a barre a 4 colonne sia un codice a barre a 3 righe, dimostrando come le due configurazioni coesistano. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Output previsto:** +Due file PNG appaiono nella directory di lavoro dell'applicazione: + +* `DatabarCols4.png` – un codice a barre DataBar Expanded Stacked con quattro colonne verticali. +* `DatabarRows3.png` – la stessa simbologia disposta in tre righe orizzontali. + +Entrambe le immagini possono essere aperte con qualsiasi visualizzatore di immagini o incorporate in un controllo UI. + +--- + +## Domande comuni e casi particolari + +| Domanda | Risposta | +|----------|--------| +| *Posso utilizzare una simbologia di codice a barre diversa?* | Sì. Sostituisci `EncodeTypes.DatabarExpandedStacked` con un altro valore `EncodeTypes` (ad esempio `EncodeTypes.QR`), ma le proprietà `Columns` e `Rows` sono specifiche delle famiglie DataBar. | +| *Cosa succede se la stringa di dati supera la lunghezza massima?* | La simbologia DataBar Expanded Stacked supporta fino a 61 caratteri numerici. Superare questo limite genera un `ArgumentException`. Convalida l'input prima di assegnarlo al generatore. | +| *Devo rilasciare (`dispose`) il `BarcodeGenerator`?* | `BarcodeGenerator` implementa `IDisposable`. In un servizio a lungo termine, avvolgilo in un blocco `using` o chiama manualmente `Dispose()` per liberare le risorse native. | +| *Posso generare SVG invece di PNG?* | Assolutamente. Usa `BarCodeImageFormat.Svg` nel metodo `Save`. | +| *La libreria è compatibile con .NET Core?* | Aspose.BarCode per .NET supporta .NET Core 3.1, .NET 5, .NET 6 e versioni successive. Non sono necessarie modifiche al codice. | + +## Conclusione + +Ora sai come **creare un codice a barre databar a 4 colonne** in C# usando Aspose.BarCode, come regolare il layout con le righe e come esportare il risultato in un comodo **barcode image format**. L'esempio completo mostra sia le configurazioni basate su colonne sia quelle basate su righe, fornendoti una solida base per qualsiasi scenario di stampa di etichette o di scansione mobile. + +**Prossimi passi** + +* Sperimenta con diversi payload di dati e verifica la compatibilità dello scanner. +* Esplora ulteriori opzioni di stile come i colori di primo piano/sfondo (`generator.Parameters.Barcode.Color`). +* Combina il codice a barre con altre grafiche usando l'API `Graphics` per progetti di etichette personalizzate. + +Sentiti libero di adattare il codice per progetti ASP.NET Core, Windows Forms o Xamarin—Aspose.BarCode funziona su tutte le piattaforme .NET. Buon coding! + +## Cosa dovresti imparare dopo? + +I tutorial seguenti trattano argomenti strettamente correlati che si basano sulle tecniche dimostrate in questa guida. Ogni risorsa include esempi di codice completi e funzionanti con spiegazioni passo‑passo per aiutarti a padroneggiare funzionalità aggiuntive dell'API ed esplorare approcci di implementazione alternativi nei tuoi progetti. + +- [Crea immagine di codice a barre DotCode – righe e colonne (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Crea immagine di codice a barre c# – Configura righe e colonne di Codablock F](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Come creare dotcode con testo codificato esteso con Aspose.BarCode per .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/italian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/italian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..ea8ac1d33 --- /dev/null +++ b/barcode/italian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,303 @@ +--- +category: general +date: 2026-08-09 +description: Crea un'immagine di codice a barre in C# con questa guida passo passo. + Scopri come generare il codice a barre, regolare l'altezza del codice a barre in + pixel e creare più codici a barre in modo efficiente. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: it +lastmod: 2026-08-09 +og_description: Crea rapidamente un'immagine di codice a barre in C#. Segui questo + tutorial per imparare a generare il codice a barre, impostare l’altezza del codice + a barre in pixel e produrre più codici a barre. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Crea immagine di codice a barre in C# – guida completa per gli sviluppatori +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Crea immagine di codice a barre in C# – guida completa alla programmazione +url: /it/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Crea immagine barcode in C# – guida completa di programmazione + +Se hai bisogno di **creare un'immagine barcode** in un'applicazione .NET, questa guida ti mostra esattamente **come generare un barcode** utilizzando la libreria Aspose.BarCode. Vedrai come controllare i **pixel di altezza del barcode**, salvare l'immagine e produrre **più barcode** senza duplicare il codice. + +Il tutorial copre tutto, dall'installazione del pacchetto alla personalizzazione delle dimensioni, così potrai copiare‑incollare un esempio pronto all'uso nel tuo progetto oggi. + +## Prerequisiti + +* .NET 6.0 SDK o versioni successive installato +* Visual Studio 2022 (o qualsiasi IDE C#) +* Pacchetto NuGet `Aspose.BarCode` – installa con + +```bash +dotnet add package Aspose.BarCode +``` + +Non sono richieste dipendenze aggiuntive. + +## Come generare un'immagine barcode con BarcodeGenerator C# + +La classe principale per creare un'immagine barcode è `BarcodeGenerator`. Essa incapsula il tipo di codifica, la stringa di dati e tutti i parametri di rendering. + +### Passo 1: Definisci la cartella di output + +Scegli una cartella dove verranno salvati i file PNG generati. Utilizzare un percorso assoluto evita sorprese legate ai permessi. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Perché?** Creare la cartella programmaticamente garantisce che le successive chiamate `Save` riescano anche su una macchina nuova. + +### Passo 2: Istanzia il generatore di barcode + +Per un barcode DataBar Omnidirectional, passa `EncodeTypes.DatabarOmniDirectional` e la stringa di dati GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Nota:** L'oggetto `BarcodeGenerator` è riutilizzabile; puoi modificare i suoi parametri tra i salvataggi per **creare più barcode** dagli stessi dati. + +### Passo 3: Imposta i parametri comuni del barcode + +Le modifiche visive più comuni sono la X‑dimension (larghezza del modulo) e l'altezza delle barre. Entrambe sono espresse in pixel. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Perché impostare la X‑dimension?** Una X‑dimension più piccola produce una risoluzione più alta, importante quando l'immagine verrà stampata o visualizzata su schermi ad alta DPI. + +### Passo 4: Salva la prima immagine barcode + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +Il file `DatabarBarHeight30Pixels.png` ora contiene un barcode DataBar Omnidirectional alto 30 pixel. + +### Passo 5: Regola i pixel di altezza del barcode + +Modificare l'altezza non richiede una nuova istanza di `BarcodeGenerator`—basta modificare il parametro. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Passo 6: Salva la seconda immagine barcode + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Ora hai due file PNG con diversi **pixel di altezza del barcode**, dimostrando quanto sia semplice creare variazioni di **immagine barcode**. + +## Impostare dinamicamente i pixel di altezza del barcode + +Spesso è necessario una serie di barcode con altezze che corrispondono a elementi UI o etichette stampate. Il metodo di supporto seguente astrae il cambiamento di altezza: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Ora puoi chiamare `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` per **creare un'immagine barcode** con un'altezza di 45 pixel in una singola riga. + +## Creare più barcode in un ciclo + +Quando hai una collezione di identificatori di prodotto, un ciclo `foreach` elimina il codice ripetitivo. Questo esempio mostra come **creare più barcode** da un array di GTIN. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +Il ciclo produce tre file PNG, ognuno con un valore distinto di **pixel di altezza del barcode**. Poiché il metodo di supporto `SaveBarcodeWithHeight` incapsula il cambiamento di altezza, il ciclo principale rimane pulito e focalizzato sui dati. + +### Output previsto + +Dopo aver eseguito l'esempio completo, la cartella `Barcodes` contiene: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Aprire qualsiasi PNG mostra un barcode DataBar Omnidirectional nitido che può essere scansionato dalle app mobili standard. + +## Problemi comuni e consigli professionali + +| Problema | Perché succede | Come evitarlo | +|----------|----------------|---------------| +| **EncodeTypes errati** | Usare un tipo 1D per un DataBar produrrà un'immagine illeggibile. | Scegli sempre `EncodeTypes.DatabarOmniDirectional` (o un'altra variante DataBar) per payload GS1‑128. | +| **X‑dimension insufficiente** | Una X‑dimension molto bassa può far scomparire le barre sottili su monitor a bassa risoluzione. | Mantieni `XDimension.Pixels` ≥ 2 per la visualizzazione su schermo; aumentala a 3‑4 per la stampa. | +| **Errori di percorso file** | I percorsi relativi possono risolversi in directory inaspettate. | Usa `Path.Combine` e `Environment.CurrentDirectory` per costruire percorsi assoluti. | +| **Sovrascrittura delle immagini** | Riutilizzare lo stesso nome file in un ciclo sovrascrive i risultati precedenti. | Includi identificatori unici (ad es., GTIN o timestamp) nel nome del file. | +| **Pacchetto NuGet mancante** | Il codice compila ma genera `FileNotFoundException` a runtime. | Verifica che `Aspose.BarCode` sia installato e che il progetto lo riferisca. | + +## Esempio completo funzionante + +Di seguito trovi il programma completo che puoi copiare in un'applicazione console. Include tutti i passaggi, i metodi di supporto e la gestione degli errori. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Eseguendo questo programma + +## Cosa dovresti imparare dopo? + +I seguenti tutorial coprono argomenti strettamente correlati che si basano sulle tecniche dimostrate in questa guida. Ogni risorsa include esempi di codice completi e funzionanti con spiegazioni passo‑passo per aiutarti a padroneggiare funzionalità API aggiuntive ed esplorare approcci di implementazione alternativi nei tuoi progetti. + +- [Crea Barcode Altezza Personalizzata – Barcode Unidimensionali](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Crea immagine barcode C# – Esempio GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Crea immagine barcode DotCode – righe e colonne (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/italian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/italian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..5d5da5a30 --- /dev/null +++ b/barcode/italian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-09 +description: Crea un'immagine di codice a barre con un generatore di codici a barre + in C# e impara a generare più codici a barre con proporzioni personalizzate in pochi + minuti. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: it +lastmod: 2026-08-09 +og_description: Crea un'immagine di codice a barre usando un generatore di codici + a barre in C#. Questo tutorial mostra come generare più codici a barre, regolare + i rapporti di aspetto e salvare file PNG in modo efficiente. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Crea immagine di codice a barre con il generatore di codici a barre C# – + guida rapida +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Crea immagine di codice a barre con il generatore di codici a barre C# – guida +url: /it/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Crea immagine barcode con generatore barcode C# – guida + +Se hai bisogno di **creare immagine barcode** rapidamente, questa guida ti mostra come farlo con un generatore barcode C#. Imparerai a generare più barcode, modificare il rapporto d'aspetto e salvare ogni immagine come file PNG. + +Generare immagini barcode è un compito comune quando si costruiscono sistemi di inventario, terminali point‑of‑sale o etichette di spedizione. Alla fine di questo tutorial avrai due file PNG pronti all'uso che mostrano diversi rapporti d'aspetto, e comprenderai come estendere l'approccio a qualsiasi numero di barcode. + +## Prerequisiti + +* .NET 6.0 SDK o versioni successive installati +* Visual Studio 2022 (o qualsiasi IDE che supporti C#) +* Un riferimento a una libreria barcode che supporta DataBar Stacked Omnidirectional (ad esempio, **Aspose.BarCode for .NET**). Gli snippet di codice usano l'Aspose API, ma i concetti si applicano a qualsiasi libreria con proprietà simili. + +Non è necessario un database o un server web separati—questa è una semplice applicazione console. + +## Passo 1: Configura il progetto console + +Crea un nuovo progetto console e aggiungi la libreria barcode tramite NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +Il comando `dotnet add package` scarica l'ultima versione stabile di **Aspose.BarCode**, che fornisce la classe `BarcodeGenerator` utilizzata più avanti. + +## Passo 2: Scrivi il programma completo + +Apri *Program.cs* e sostituisci il suo contenuto con l'esempio completo qui sotto. Il programma crea una **immagine barcode**, modifica il rapporto d'aspetto e salva due file PNG. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Perché ogni parte è importante + +* **Crea immagine barcode** – Il costruttore `BarcodeGenerator` inizializza l'oggetto con la simbologia e i dati desiderati. +* **c# barcode generator** – La proprietà `Parameters` ti dà il pieno controllo sulle opzioni di rendering; impostare `XDimension.Pixels` garantisce che ogni barra sia nitida sullo schermo. +* **genera più barcode** – Cambiando `DataBar.AspectRatio` tra i salvataggi, la stessa istanza del generatore produce due immagini distinte senza ricreare l'oggetto, il che è più efficiente. + +## Passo 3: Esegui il programma e visualizza i risultati + +Esegui l'applicazione: + +```bash +dotnet run +``` + +Dovresti vedere un output della console simile a: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Apri la cartella `BarcodeOutputs`. Troverai due file PNG: + +* **DatabarAspectRatio15.png** – un barcode compatto adatto a etichette di altezza limitata. +* **DatabarAspectRatio30.png** – un barcode più alto che molti scanner leggono più affidabilmente da una distanza. + +Entrambe le immagini sono pronte per essere incorporate in PDF, stampate su ricevute o inviate a un'app mobile. + +## Passo 4: Estendi la soluzione per generare un numero qualsiasi di barcode + +Il pattern mostrato sopra scala facilmente: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **genera più barcode** – Il ciclo itera su un array di rapporti d'aspetto, creando una **immagine barcode** distinta per ogni valore. +* Regola `EncodeTypes` o la stringa codificata per produrre QR code, Code 128 o altre simbologie senza modificare la logica circostante. + +## Suggerimenti pratici e ostacoli comuni + +| Suggerimento | Spiegazione | +|-----|-------------| +| **Riutilizza lo stesso generatore** | Re‑inizializzare `BarcodeGenerator` per ogni immagine aggiunge un overhead inutile. Cambiare i parametri tra le chiamate `Save` è più veloce e utilizza meno memoria. | +| **Convalida la cartella di output** | Chiama sempre `Directory.CreateDirectory` prima di salvare; altrimenti `Save` genera una `DirectoryNotFoundException`. | +| **Scegli una X‑dimension appropriata** | Valori di pixel molto bassi (es., 1) possono rendere il barcode illeggibile su schermi a bassa risoluzione. Valori tra 2 e 3 funzionano bene per la maggior parte delle stampanti. | +| **Fai attenzione alla codifica** | GS1 DataBar si aspetta un prefisso `(01)` per il GTIN. Se ometti le parentesi, la libreria potrebbe generare un barcode non valido. | +| **Testa con uno scanner reale** | L'ispezione visiva non è sufficiente. Testa i file PNG con l'hardware scanner reale che intendi utilizzare. | + +## Output previsto (descrizione visiva) + +*Entrambi i file PNG mostrano un barcode DataBar Stacked Omnidirectional scuro su sfondo chiaro. La versione con rapporto d'aspetto 15 è più corta, mentre la versione con rapporto d'aspetto 30 è circa il doppio più alta.* + +Se incorpori le immagini in un documento, verranno renderizzate nitide perché abbiamo impostato `XDimension.Pixels = 2`. + +## Conclusione + +Ora sai come **creare file immagine barcode** usando un **generatore barcode C#**, e puoi **generare più barcode** regolando il rapporto d'aspetto o qualsiasi altro parametro. L'esempio completo e eseguibile dimostra le migliori pratiche come riutilizzare l'istanza del generatore, gestire le cartelle di output e verificare la creazione dei file. + +Next, you might explore: + +* Aggiungere colori personalizzati con `generator.Parameters.Barcode.Color` (parola chiave secondaria: **c# barcode generator**) +* Esportare in altri formati come JPEG o SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Integrare la logica di creazione del barcode in una Web API per servire le immagini su richiesta (parola chiave secondaria + +## Cosa dovresti imparare dopo? + +I seguenti tutorial coprono argomenti strettamente correlati che si basano sulle tecniche dimostrate in questa guida. Ogni risorsa include esempi di codice completi e funzionanti con spiegazioni passo‑passo per aiutarti a padroneggiare funzionalità API aggiuntive ed esplorare approcci di implementazione alternativi nei tuoi progetti. + +- [Crea Barcode PNG – Rapporto d'aspetto DataMatrix – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [tutorial generatore barcode c# – Personalizza i rapporti d'aspetto del Barcode Code 16K con Aspose.BarCode per .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Come generare barcode Aztec con rapporto d'aspetto personalizzato usando Aspose.BarCode per .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/japanese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/japanese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..42fd97d48 --- /dev/null +++ b/barcode/japanese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,240 @@ +--- +category: general +date: 2026-08-09 +description: Aspose.BarCode を使用して C# で 4 列のデータバーコードを素早く作成します。この簡潔なガイドで、列や行の設定方法、PNG + 画像の保存方法を学びましょう。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: ja +lastmod: 2026-08-09 +og_description: Aspose.BarCode を使用して C# で 4 列のデータバーコードを作成し、行をカスタマイズしてアプリ用に PNG 画像としてエクスポートします。 +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: C#で4列データバーコードを作成 – クイックチュートリアル +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: C#で4列データバーコードを作成する – ステップバイステップガイド +url: /ja/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# で 4 列のデータバー バーコードを作成する – ステップバイステップ ガイド + +C# で **4 列のデータバー バーコード** を作成する必要がある場合、このチュートリアルで具体的な手順を示します。DataBar Expanded Stacked バーコードの生成、4 列の設定、そして結果を PNG 画像として保存する方法を順を追って説明します。 + +このガイドでは、次のことを学びます: + +* `BarcodeGenerator` を **DataBar Expanded Stacked** シンボル用に初期化する。 +* 列数を 4 に設定する(主な要件)。 +* 3 行のスタックレイアウトが必要な場合に行数を調整する。 +* 適切な **barcode image format** を使用して、バーコードを PNG としてエクスポートする。 + +必要なのは Aspose.BarCode for .NET ライブラリ(バージョン 23.10 以降)と、Visual Studio 2022 などの .NET 6+ 開発環境だけです。追加の依存関係は不要です。 + +--- + +## 4 列のデータバー バーコードの作成方法 + +最初のステップは、**DataBar Expanded Stacked** シンボルを対象とした `BarcodeGenerator` インスタンスを作成することです。このクラスはすべてのレンダリングオプションをカプセル化しており、列ベースと行ベースのレイアウトを簡単に切り替えることができます。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**このコードが機能する理由:** +`EncodeTypes.DatabarExpandedStacked` は Aspose.BarCode に DataBar ファミリーのスタック版を生成させます。`DataBar.Columns` プロパティはバーコードが占める垂直モジュール数を制御します。4 に設定することで **4 列のデータバー バーコード** の要件に合致します。最後に、`Save` は **barcode image format** `Png` を使用して視覚表現をディスクに書き込みます。 + +### DataBar Expanded Stacked 列の設定 + +別の列数が必要な場合は、`Columns` に割り当てられた整数を変更するだけです。このプロパティは拡張スタック版で 1 から 4 までの値を受け付けます。 + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro tip:* 生成されたバーコードは、DataBar ファミリーをサポートするスキャナで必ずテストしてください。視覚的な外観だけでは読み取り可能性が保証されません。 + +### バーコード画像の保存 + +`BarCodeImageFormat` 列挙体は複数のオプション(`Png`、`Jpeg`、`Bmp`、`Gif`、`Tiff`)を提供します。PNG はロスレスで、ほとんどのウェブやデスクトップシナリオでうまく機能します。 + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +別の形式が必要な場合は、`Png` を目的の列挙値に置き換えてください。保存されたファイルは HTML、PDF、またはラベルへの印刷に直接埋め込むことができます。 + +## カスタム行でバーコードを作成する + +場合によっては、列ではなく特定の行数でスタックレイアウトが必要になることがあります。同じ `BarcodeGenerator` クラスはこの目的のために `Rows` プロパティを公開しています。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**行が重要な理由:** +スタックされたバーコードが幅よりも高さがある場合、`Rows` プロパティはシンボルが何個の水平スライスに分割されるかを決定します。`Rows = 3` と設定すると、3 行のスタックバーコードが作成され、狭いラベル幅に有用です。 + +### バーコード行を動的に設定する + +入力データに基づいて、実行時に行数を計算できます: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +この柔軟性により、アプリケーションを再コンパイルせずに **バーコードの行数を設定** できます。 + +## 完全なエンドツーエンド例 + +以下は、4 列のバーコードと 3 行のバーコードの両方を生成し、2 つの構成が共存できることを示す単一プログラムです。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**期待される出力:** +アプリケーションの作業ディレクトリに 2 つの PNG ファイルが生成されます: + +* `DatabarCols4.png` – 4 つの垂直列を持つ DataBar Expanded Stacked バーコード。 +* `DatabarRows3.png` – 同じシンボルが 3 行の水平に配置されたもの。 + +どちらの画像も任意の画像ビューアで開くことができ、UI コントロールに埋め込むこともできます。 + +--- + +## よくある質問とエッジケース + +| Question | Answer | +|----------|--------| +| *別のバーコードシンボルを使用できますか?* | はい。`EncodeTypes.DatabarExpandedStacked` を別の `EncodeTypes` 値(例: `EncodeTypes.QR`)に置き換えてください。ただし、`Columns` と `Rows` プロパティは DataBar ファミリーに固有です。 | +| *データ文字列が最大長を超えた場合はどうなりますか?* | DataBar Expanded Stacked シンボルは最大 61 桁の数字文字列をサポートします。この上限を超えると `ArgumentException` がスローされます。ジェネレータに割り当てる前に入力を検証してください。 | +| *`BarcodeGenerator` を破棄する必要がありますか?* | `BarcodeGenerator` は `IDisposable` を実装しています。長時間実行されるサービスでは、`using` ブロックでラップするか、`Dispose()` を手動で呼び出してネイティブリソースを解放してください。 | +| *PNG の代わりに SVG を生成できますか?* | もちろんです。`Save` メソッドで `BarCodeImageFormat.Svg` を使用してください。 | +| *このライブラリは .NET Core と互換性がありますか?* | Aspose.BarCode for .NET は .NET Core 3.1、.NET 5、.NET 6 以降をサポートしています。コードの変更は不要です。 | + +--- + +## 結論 + +これで、Aspose.BarCode を使用して C# で **4 列のデータバー バーコード** を作成する方法、行でレイアウトを調整する方法、そして便利な **barcode image format** で結果をエクスポートする方法が分かりました。完全な例は列ベースと行ベースの両方の構成を示しており、ラベル印刷やモバイルスキャンのシナリオに対する確固たる基盤を提供します。 + +**次のステップ** + +* さまざまなデータペイロードで実験し、スキャナの互換性を確認する。 +* 前景/背景色(`generator.Parameters.Barcode.Color`)など、追加のスタイリングオプションを調査する。 +* `Graphics` API を使用して他のグラフィックとバーコードを組み合わせ、カスタムラベルデザインを作成する。 + +コードは ASP.NET Core、Windows Forms、Xamarin プロジェクトなどに自由に適用してください—Aspose.BarCode はすべての .NET プラットフォームで動作します。コーディングを楽しんでください! + +## 次に学ぶべきことは? + +以下のチュートリアルは、このガイドで示した手法を基にした密接に関連するトピックを扱っています。各リソースには、ステップバイステップの解説と完全な動作コード例が含まれており、追加の API 機能を習得し、プロジェクトで代替実装アプローチを検討するのに役立ちます。 + +- [DotCode バーコード画像の作成 – 行と列 (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [C# でバーコード画像を作成 – Codablock F の行と列を設定](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [.NET 用 Aspose.BarCode で dotcode 拡張コードテキストを作成する方法](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/japanese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/japanese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..b7fc37bd8 --- /dev/null +++ b/barcode/japanese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,299 @@ +--- +category: general +date: 2026-08-09 +description: C#でバーコード画像を作成するステップバイステップガイドです。バーコードの生成方法、バーコードの高さ(ピクセル)の調整、そして複数のバーコードを効率的に作成する方法を学びましょう。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: ja +lastmod: 2026-08-09 +og_description: C#でバーコード画像を素早く作成しましょう。このチュートリアルに従って、バーコードの生成方法、バーコードの高さ(ピクセル)の設定、そして複数のバーコードの作成方法を学びます。 +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: C#でバーコード画像を作成する – 開発者向け完全ガイド +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: C#でバーコード画像を作成する – 完全プログラミングガイド +url: /ja/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# でバーコード画像を作成 – 完全プログラミングガイド + +.NET アプリケーションで **バーコード画像を作成** する必要がある場合、このガイドでは Aspose.BarCode ライブラリを使用して **バーコードを生成する方法** を正確に示します。**バーコードの高さ(ピクセル)** の制御方法、画像の保存方法、コードを重複させずに **複数のバーコード** を作成する方法が分かります。 + +このチュートリアルでは、パッケージのインストールからサイズのカスタマイズまで、すべてを網羅しているので、すぐにプロジェクトに貼り付けて実行できるサンプルをコピー&ペーストできます。 + +## 前提条件 + +* .NET 6.0 SDK 以降がインストールされていること +* Visual Studio 2022(または任意の C# IDE) +* NuGet パッケージ `Aspose.BarCode` – 以下でインストール + +```bash +dotnet add package Aspose.BarCode +``` + +追加の依存関係は必要ありません。 + +## BarcodeGenerator C# を使用してバーコード画像を生成する方法 + +バーコード画像を作成するためのコアクラスは `BarcodeGenerator` です。エンコードタイプ、データ文字列、すべてのレンダリングパラメータをカプセル化します。 + +### 手順 1: 出力フォルダーを定義する + +生成された PNG ファイルを保存するフォルダーを選択します。絶対パスを使用することで、権限に関する予期せぬ問題を回避できます。 + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **なぜ?** フォルダーをプログラムで作成することで、後続の `Save` 呼び出しが新しいマシンでも確実に成功することが保証されます。 + +### 手順 2: バーコードジェネレーターをインスタンス化する + +DataBar Omnidirectional バーコードの場合、`EncodeTypes.DatabarOmniDirectional` と GS1‑128 データ文字列を渡します。 + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **注:** `BarcodeGenerator` オブジェクトは再利用可能です。保存間でパラメータを変更することで、同じデータから **複数のバーコード** を **作成** できます。 + +### 手順 3: 共通のバーコードパラメータを設定する + +最も一般的なビジュアル調整は X‑dimension(モジュール幅)とバーの高さです。どちらもピクセル単位で指定します。 + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **なぜ X‑dimension を設定するのか?** X‑dimension を小さくすると解像度が上がり、画像を印刷したり高 DPI スクリーンに表示したりする際に重要です。 + +### 手順 4: 最初のバーコード画像を保存する + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +ファイル `DatabarBarHeight30Pixels.png` には、30 ピクセルの高さの DataBar Omnidirectional バーコードが含まれています。 + +### 手順 5: バーコードの高さ(ピクセル)を調整する + +高さを変更する際に新しい `BarcodeGenerator` インスタンスは不要です。パラメータを変更するだけです。 + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### 手順 6: 2 番目のバーコード画像を保存する + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +これで、異なる **バーコード高さ(ピクセル)** を持つ 2 つの PNG ファイルができました。**バーコード画像** のバリエーションを作成するのがいかに簡単かが示されています。 + +## バーコード高さ(ピクセル)を動的に設定する + +UI 要素や印刷ラベルに合わせた高さのバーコードが多数必要になることがよくあります。以下のヘルパーメソッドは高さの変更を抽象化します。 + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +これで、`SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` を呼び出すだけで、45 ピクセルの高さの **バーコード画像** をワンラインで **作成** できます。 + +## ループで複数のバーコードを作成する + +製品識別子のコレクションがある場合、`foreach` ループで繰り返しコードを削減できます。この例は、GTIN の配列から **複数のバーコード** を **作成** する方法を示しています。 + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +このループは 3 つの PNG ファイルを生成し、それぞれ異なる **バーコード高さ(ピクセル)** の値を持ちます。`SaveBarcodeWithHeight` ヘルパーが高さ変更をカプセル化しているため、メインループはデータに集中したシンプルな構造のままです。 + +### 期待される出力 + +サンプル全体を実行すると、`Barcodes` フォルダーには以下が含まれます: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +任意の PNG を開くと、標準的なモバイルアプリでスキャン可能な鮮明な DataBar Omnidirectional バーコードが表示されます。 + +## よくある落とし穴とプロのコツ + +| Issue | Why it happens | How to avoid it | +|-------|----------------|-----------------| +| **EncodeTypes の誤り** | DataBar に 1D タイプを使用すると、読めない画像が生成されます。 | `EncodeTypes.DatabarOmniDirectional`(または他の DataBar バリアント)を GS1‑128 ペイロードに必ず使用してください。 | +| **X‑dimension が不足** | 非常に低い X‑dimension は、低解像度モニターで細いバーが消えてしまう可能性があります。 | `XDimension.Pixels` を画面表示では ≥ 2、印刷では 3‑4 に保ちます。 | +| **ファイルパスエラー** | 相対パスは予期しないディレクトリに解決されることがあります。 | `Path.Combine` と `Environment.CurrentDirectory` を使用して絶対パスを構築します。 | +| **画像の上書き** | ループ内で同じファイル名を再利用すると、以前の結果が上書きされます。 | ファイル名にユニークな識別子(例: GTIN やタイムスタンプ)を含めます。 | +| **NuGet パッケージが欠如** | コードはコンパイルされますが、実行時に `FileNotFoundException` がスローされます。 | `Aspose.BarCode` がインストールされ、プロジェクトが参照していることを確認してください。 | + +## 完全な動作例 + +以下はコンソールアプリケーションにコピーできる完全なプログラムです。すべての手順、ヘルパーメソッド、エラーハンドリングが含まれています。 + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +このプログラムを実行すると + +## 次に学ぶべきことは? + +以下のチュートリアルは、本ガイドで示した手法を基にした密接に関連するトピックを扱っています。各リソースには、ステップバイステップの解説と完全な動作コード例が含まれており、追加の API 機能を習得し、独自プロジェクトで代替実装アプローチを検討するのに役立ちます。 + +- [バーコードのカスタム高さ作成 – 1 次元バーコード](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [C# でバーコード画像作成 – GS1 DataMatrix の例](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [DotCode バーコード画像作成 – 行と列(Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/japanese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/japanese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..12106ca9d --- /dev/null +++ b/barcode/japanese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,223 @@ +--- +category: general +date: 2026-08-09 +description: C# のバーコードジェネレーターでバーコード画像を作成し、数分でカスタムアスペクト比の複数のバーコードを生成する方法を学びましょう。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: ja +lastmod: 2026-08-09 +og_description: C# バーコードジェネレーターを使用してバーコード画像を作成します。このチュートリアルでは、複数のバーコードを生成し、アスペクト比を調整し、PNG + ファイルを効率的に保存する方法を示します。 +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: C# バーコードジェネレーターでバーコード画像を作成 – クイックガイド +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: C# バーコードジェネレーターでバーコード画像を作成する – ガイド +url: /ja/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# バーコードジェネレータでバーコード画像を作成する – ガイド + +バーコード画像を**すぐに作成**したい場合は、このガイドで C# バーコードジェネレータを使用した手順をご紹介します。複数のバーコードを生成し、アスペクト比を変更し、各画像を PNG ファイルとして保存する方法を学びます。 + +バーコード画像の生成は、在庫管理システム、POS 端末、出荷ラベルの作成などで一般的な作業です。このチュートリアルの最後までに、異なるアスペクト比を示す PNG ファイルが 2 つ用意でき、任意の数のバーコードに拡張する方法が理解できるようになります。 + +## 前提条件 + +開始する前に、以下がインストールされていることを確認してください。 + +* .NET 6.0 SDK 以降 +* Visual Studio 2022(または C# をサポートする任意の IDE) +* DataBar Stacked Omnidirectional をサポートするバーコードライブラリへの参照(例: **Aspose.BarCode for .NET**)。コードスニペットは Aspose API を使用していますが、同様のプロパティを持つ任意のライブラリでも概念は同じです。 + +別途データベースや Web サーバは必要ありません—純粋なコンソール アプリケーションです。 + +## 手順 1: コンソール プロジェクトのセットアップ + +新しいコンソール プロジェクトを作成し、NuGet でバーコードライブラリを追加します。 + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +`dotnet add package` コマンドは **Aspose.BarCode** の最新安定版を取得し、後で使用する `BarcodeGenerator` クラスを提供します。 + +## 手順 2: 完全なプログラムを書く + +*Program.cs* を開き、内容を以下の完全なサンプルに置き換えます。プログラムは **バーコード画像** を作成し、アスペクト比を変更して 2 つの PNG ファイルを保存します。 + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### 各部分が重要な理由 + +* **Create barcode image** – `BarcodeGenerator` コンストラクタは、目的のシンボロジーとデータでオブジェクトを初期化します。 +* **c# barcode generator** – `Parameters` プロパティで描画オプションをフルコントロールでき、`XDimension.Pixels` を設定すると画面上の各バーが鮮明になります。 +* **generate multiple barcodes** – `Save` の間で `DataBar.AspectRatio` を変更するだけで、同じジェネレータ インスタンスが 2 つの異なる画像を生成でき、オブジェクトを再作成する必要がなく効率的です。 + +## 手順 3: プログラムを実行し結果を確認 + +アプリケーションを実行します。 + +```bash +dotnet run +``` + +コンソールには次のような出力が表示されます。 + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +`BarcodeOutputs` フォルダーを開くと、2 つの PNG ファイルが見つかります。 + +* **DatabarAspectRatio15.png** – 高さが制限されたラベル向けのコンパクトなバーコード。 +* **DatabarAspectRatio30.png** – より高く、遠距離でも多くのスキャナが読み取りやすいバーコード。 + +どちらの画像も PDF に埋め込んだり、レシートに印刷したり、モバイル アプリに送信したりする準備ができています。 + +## 手順 4: 任意の数のバーコードを生成できるように拡張 + +上記のパターンは簡単にスケールできます。 + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – ループはアスペクト比の配列を走査し、各値に対して個別の **バーコード画像** を作成します。 +* `EncodeTypes` やエンコード文字列を変更すれば、QR コード、Code 128 など他のシンボロジーもロジックを変えずに生成できます。 + +## 実用的なヒントとよくある落とし穴 + +| Tip | Explanation | +|-----|-------------| +| **Reuse the same generator** | 各画像ごとに `BarcodeGenerator` を再初期化すると不要なオーバーヘッドが発生します。`Save` 呼び出し間でパラメータを変更する方が高速でメモリ使用量も少なくてすみます。 | +| **Validate the output folder** | 保存前に必ず `Directory.CreateDirectory` を呼び出してください。呼び出さないと `Save` が `DirectoryNotFoundException` をスローします。 | +| **Choose an appropriate X‑dimension** | ピクセル値が極端に低い(例: 1)と、低解像度画面でバーコードが読めなくなります。2〜3 の値が多くのプリンタでうまく機能します。 | +| **Mind the encoding** | GS1 DataBar は GTIN の先頭に `(01)` が必要です。括弧を省くとライブラリが無効なバーコードを生成する可能性があります。 | +| **Test with a real scanner** | 視覚的な確認だけでは不十分です。実際に使用するスキャナ ハードウェアで PNG ファイルをテストしてください。 | + +## 期待される出力(ビジュアル説明) + +*2 つの PNG ファイルは、暗色の DataBar Stacked Omnidirectional バーコードが淡色背景に描かれています。アスペクト比 15 のバージョンは短く、アスペクト比 30 のバージョンはほぼ 2 倍の高さです。* + +ドキュメントに画像を埋め込むと、`XDimension.Pixels = 2` を設定しているため、鮮明に表示されます。 + +## 結論 + +これで **C# バーコードジェネレータ** を使用して **バーコード画像** ファイルを作成する方法が分かり、アスペクト比やその他のパラメータを調整することで **複数のバーコードを生成** できるようになりました。完全な実行可能サンプルは、ジェネレータ インスタンスの再利用、出力ディレクトリの処理、ファイル作成の検証といったベストプラクティスを示しています。 + +次に試すべきこと: + +* `generator.Parameters.Barcode.Color` でカスタムカラーを追加する(二次キーワード: **c# barcode generator**) +* JPEG や SVG など他の形式へエクスポートする(`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* バーコード生成ロジックを Web API に組み込み、オンデマンドで画像を配信する(二次キーワード + +## 次に学ぶべきことは? + +以下のチュートリアルは、本ガイドで示した手法を基にした関連トピックを扱っています。各リソースには、ステップバイステップの解説と完全な動作コード例が含まれており、API の追加機能を習得したり、プロジェクトで代替実装アプローチを探求したりするのに役立ちます。 + +- [Create Barcode PNG – DataMatrix Aspect Ratio – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Customize Code 16K Barcode Aspect Ratios with Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/korean/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/korean/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..45fb881f6 --- /dev/null +++ b/barcode/korean/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,239 @@ +--- +category: general +date: 2026-08-09 +description: Aspose.BarCode를 사용하여 C#에서 4열 데이터바 바코드를 빠르게 생성하세요. 이 간결한 가이드에서 열과 행을 구성하고 + PNG 이미지를 저장하는 방법을 배워보세요. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: ko +lastmod: 2026-08-09 +og_description: Aspose.BarCode를 사용해 C#에서 4열 데이터바 바코드를 생성하고, 행을 맞춤 설정한 뒤 앱용 PNG 이미지로 + 내보내세요. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: C#로 4열 데이터바 바코드 생성 – 빠른 튜토리얼 +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: C#에서 4열 데이터바 바코드 만들기 – 단계별 가이드 +url: /ko/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C#에서 4열 데이터바 바코드 만들기 – 단계별 가이드 + +C#에서 **4열 데이터바 바코드**를 만들어야 한다면, 이 튜토리얼이 정확히 어떻게 하는지 보여줍니다. DataBar Expanded Stacked 바코드를 생성하고, 네 개의 열을 구성하며, 결과를 PNG 이미지로 저장하는 과정을 단계별로 안내합니다. + +이 가이드에서는 다음을 배웁니다: + +* `BarcodeGenerator`를 **DataBar Expanded Stacked** 심볼에 맞게 초기화하기. +* 열 개수를 4로 설정하기(핵심 요구 사항). +* 3행 스택 레이아웃이 필요할 때 행 개수 조정하기. +* 적절한 **barcode image format**을 사용해 바코드를 PNG로 내보내기. + +Aspose.BarCode for .NET 라이브러리(버전 23.10 이상)와 Visual Studio 2022와 같은 .NET 6+ 개발 환경만 있으면 됩니다. 추가 종속성은 필요하지 않습니다. + +--- + +## 4열 데이터바 바코드 만드는 방법 + +첫 번째 단계는 **DataBar Expanded Stacked** 심볼을 대상으로 하는 `BarcodeGenerator` 인스턴스를 만드는 것입니다. 이 클래스는 모든 렌더링 옵션을 캡슐화하여 열 기반 레이아웃과 행 기반 레이아웃을 쉽게 전환할 수 있게 해줍니다. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**왜 이렇게 동작하나요:** +`EncodeTypes.DatabarExpandedStacked`는 Aspose.BarCode에 DataBar 계열의 스택 버전을 생성하도록 지시합니다. `DataBar.Columns` 속성은 바코드가 차지하는 수직 모듈 수를 제어합니다. 이를 4로 설정하면 **4열 데이터바 바코드**를 만들라는 요구 사항에 맞습니다. 마지막으로 `Save`는 **barcode image format** `Png`를 사용해 시각적 표현을 디스크에 저장합니다. + +### DataBar Expanded Stacked 열 구성 + +다른 열 개수가 필요하면 `Columns`에 할당된 정수를 변경하면 됩니다. 이 속성은 확장 스택 변형에 대해 1부터 4까지의 값을 허용합니다. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro tip:* 시각적 모양만으로는 가독성을 보장할 수 없으므로 DataBar 계열을 지원하는 스캐너로 생성된 바코드를 항상 테스트하세요. + +### 바코드 이미지 저장 + +`BarCodeImageFormat` 열거형은 여러 옵션(`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`)을 제공합니다. PNG는 무손실이며 대부분의 웹 및 데스크톱 시나리오에 적합합니다. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +다른 형식이 필요하면 `Png`를 원하는 열거형 값으로 교체하면 됩니다. 저장된 파일은 HTML, PDF에 직접 삽입하거나 라벨에 인쇄할 수 있습니다. + +## 사용자 정의 행으로 바코드 만들기 + +때때로 열 대신 특정 행 수가 필요한 스택 레이아웃이 요구됩니다. 동일한 `BarcodeGenerator` 클래스가 이를 위한 `Rows` 속성을 제공합니다. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**행이 중요한 이유:** +스택 바코드가 가로보다 세로가 더 길 때, `Rows` 속성은 심볼이 몇 개의 수평 슬라이스로 나뉘는지를 결정합니다. `Rows = 3`으로 설정하면 3행 스택 바코드가 생성되며, 좁은 라벨 폭에 유용합니다. + +### 바코드 행을 동적으로 설정 + +입력 데이터에 따라 런타임에 행 개수를 계산할 수 있습니다: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +이 유연성을 통해 애플리케이션을 다시 컴파일하지 않고도 **바코드 행을 설정**할 수 있습니다. + +## 전체 엔드‑투‑엔드 예제 + +아래는 4열 바코드와 3행 바코드를 모두 생성하는 단일 프로그램으로, 두 구성이 어떻게 공존하는지 보여줍니다. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**예상 출력:** +애플리케이션 작업 디렉터리에 두 개의 PNG 파일이 생성됩니다: + +* `DatabarCols4.png` – 네 개의 수직 열을 가진 DataBar Expanded Stacked 바코드. +* `DatabarRows3.png` – 동일한 심볼이 세 개의 수평 행으로 배열된 형태. + +두 이미지 모두 이미지 뷰어에서 열어볼 수 있으며 UI 컨트롤에 삽입할 수 있습니다. + +--- + +## 일반적인 질문 및 엣지 케이스 + +| Question | Answer | +|----------|--------| +| *다른 바코드 심볼을 사용할 수 있나요?* | 예. `EncodeTypes.DatabarExpandedStacked`를 다른 `EncodeTypes` 값(예: `EncodeTypes.QR`)으로 교체하면 되지만, `Columns`와 `Rows` 속성은 DataBar 계열에만 적용됩니다. | +| *데이터 문자열이 최대 길이를 초과하면 어떻게 되나요?* | DataBar Expanded Stacked 심볼은 최대 61개의 숫자 문자를 지원합니다. 이 한도를 초과하면 `ArgumentException`이 발생합니다. 입력을 제너레이터에 할당하기 전에 검증하세요. | +| *`BarcodeGenerator`를 해제해야 하나요?* | `BarcodeGenerator`는 `IDisposable`을 구현합니다. 장시간 실행되는 서비스에서는 `using` 블록으로 감싸거나 `Dispose()`를 수동으로 호출해 네이티브 리소스를 해제하세요. | +| *PNG 대신 SVG를 생성할 수 있나요?* | 물론 가능합니다. `Save` 메서드에서 `BarCodeImageFormat.Svg`를 사용하면 됩니다. | +| *이 라이브러리가 .NET Core와 호환되나요?* | Aspose.BarCode for .NET은 .NET Core 3.1, .NET 5, .NET 6 및 이후 버전을 지원합니다. 코드 변경이 필요하지 않습니다. | + +## 결론 + +이제 Aspose.BarCode를 사용해 C#에서 **4열 데이터바 바코드**를 만드는 방법, 행을 사용해 레이아웃을 조정하는 방법, 그리고 편리한 **barcode image format**으로 결과를 내보내는 방법을 알게 되었습니다. 전체 예제는 열 기반과 행 기반 구성을 모두 보여주어 라벨 인쇄나 모바일 스캔 시나리오에 탄탄한 기반을 제공합니다. + +**다음 단계** + +* 다양한 데이터 페이로드를 실험하고 스캐너 호환성을 확인하세요. +* 전경/배경 색(`generator.Parameters.Barcode.Color`)과 같은 추가 스타일 옵션을 탐색하세요. +* `Graphics` API를 사용해 바코드를 다른 그래픽과 결합해 맞춤형 라벨 디자인을 만들어 보세요. + +ASP.NET Core, Windows Forms, Xamarin 프로젝트에 코드를 자유롭게 적용해 보세요—Aspose.BarCode는 모든 .NET 플랫폼에서 작동합니다. 즐거운 코딩 되세요! + +## 다음에 배워야 할 내용은? + +다음 튜토리얼은 이 가이드에서 시연한 기술을 기반으로 하는 밀접한 주제를 다룹니다. 각 리소스에는 완전한 코드 예제와 단계별 설명이 포함되어 있어 추가 API 기능을 마스터하고 프로젝트에 적용할 수 있는 다양한 구현 방법을 탐색할 수 있습니다. + +- [DotCode 바코드 이미지 만들기 – 행 및 열 (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [C# 바코드 이미지 만들기 – Codablock F 행 및 열 구성](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Aspose.BarCode for .NET으로 DotCode 확장 코드 텍스트 만들기](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/korean/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/korean/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..b35f4ffc1 --- /dev/null +++ b/barcode/korean/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,301 @@ +--- +category: general +date: 2026-08-09 +description: 이 단계별 가이드를 통해 C#에서 바코드 이미지를 생성하세요. 바코드 생성 방법, 바코드 높이 픽셀 조정, 그리고 여러 바코드를 + 효율적으로 만드는 방법을 배워보세요. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: ko +lastmod: 2026-08-09 +og_description: C#에서 바코드 이미지를 빠르게 생성하세요. 이 튜토리얼을 따라 바코드 생성 방법, 바코드 높이 픽셀 설정, 그리고 여러 + 바코드 생성 방법을 배워보세요. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: C#에서 바코드 이미지 만들기 – 개발자를 위한 완전 가이드 +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: C#에서 바코드 이미지 만들기 – 완전한 프로그래밍 가이드 +url: /ko/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C#에서 바코드 이미지 만들기 – 완전 프로그래밍 가이드 + +.NET 애플리케이션에서 **바코드 이미지 생성**이 필요하다면, 이 가이드는 Aspose.BarCode 라이브러리를 사용하여 **바코드 생성 방법**을 정확히 보여줍니다. **바코드 높이 픽셀**을 제어하고, 이미지를 저장하며, 코드를 중복하지 않고 **여러 바코드**를 생성하는 방법을 확인할 수 있습니다. + +이 튜토리얼은 패키지 설치부터 치수 맞춤까지 모든 내용을 다루며, 바로 실행 가능한 예제를 복사‑붙여넣기하여 오늘 바로 프로젝트에 적용할 수 있습니다. + +## 사전 요구 사항 + +* .NET 6.0 SDK 또는 이후 버전이 설치되어 있어야 합니다 +* Visual Studio 2022 (또는 기타 C# IDE) +* NuGet 패키지 `Aspose.BarCode` – 다음으로 설치합니다 + +```bash +dotnet add package Aspose.BarCode +``` + +추가적인 종속성은 필요하지 않습니다. + +## BarcodeGenerator C#로 바코드 이미지 생성 방법 + +바코드 이미지를 생성하기 위한 핵심 클래스는 `BarcodeGenerator`입니다. 이 클래스는 인코딩 유형, 데이터 문자열 및 모든 렌더링 매개변수를 캡슐화합니다. + +### 단계 1: 출력 폴더 정의 + +생성된 PNG 파일이 저장될 폴더를 선택합니다. 절대 경로를 사용하면 권한 문제를 방지할 수 있습니다. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **왜?** 폴더를 프로그래밍 방식으로 생성하면 새 컴퓨터에서도 이후 `Save` 호출이 성공하도록 보장합니다. + +### 단계 2: 바코드 생성기 인스턴스화 + +DataBar Omnidirectional 바코드의 경우 `EncodeTypes.DatabarOmniDirectional`와 GS1‑128 데이터 문자열을 전달합니다. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **참고:** `BarcodeGenerator` 객체는 재사용 가능하며, 저장 사이에 매개변수를 변경하여 동일한 데이터로 **여러 바코드 생성**이 가능합니다. + +### 단계 3: 일반 바코드 매개변수 설정 + +가장 일반적인 시각적 조정은 X‑dimension(모듈 너비)과 바 높이이며, 두 값 모두 픽셀 단위로 지정됩니다. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **왜 X‑dimension을 설정하나요?** X‑dimension이 작을수록 해상도가 높아지며, 이는 이미지를 인쇄하거나 고 DPI 화면에 표시할 때 중요합니다. + +### 단계 4: 첫 번째 바코드 이미지 저장 + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +`DatabarBarHeight30Pixels.png` 파일에는 30픽셀 높이의 DataBar Omnidirectional 바코드가 포함됩니다. + +### 단계 5: 바코드 높이 픽셀 조정 + +높이를 변경하려면 새로운 `BarcodeGenerator` 인스턴스를 만들 필요가 없으며, 매개변수만 수정하면 됩니다. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### 단계 6: 두 번째 바코드 이미지 저장 + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +이제 서로 다른 **바코드 높이 픽셀**을 가진 두 개의 PNG 파일이 생성되었으며, **바코드 이미지** 변형을 얼마나 쉽게 만들 수 있는지 보여줍니다. + +## 바코드 높이 픽셀을 동적으로 설정하기 + +UI 요소나 인쇄 라벨에 맞는 높이의 바코드 시리즈가 필요할 때가 많습니다. 다음 헬퍼 메서드는 높이 변경을 추상화합니다: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +이제 `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` 를 호출하면 한 줄로 45픽셀 높이의 **바코드 이미지**를 **생성**할 수 있습니다. + +## 루프에서 여러 바코드 생성하기 + +제품 식별자 컬렉션이 있을 때, `foreach` 루프를 사용하면 반복 코드를 없앨 수 있습니다. 이 예제는 GTIN 배열에서 **여러 바코드 생성** 방법을 보여줍니다. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +루프는 각각 다른 **바코드 높이 픽셀** 값을 가진 세 개의 PNG 파일을 생성합니다. `SaveBarcodeWithHeight` 헬퍼가 높이 변경을 캡슐화하므로 메인 루프는 데이터에만 집중하여 깔끔하게 유지됩니다. + +### 예상 출력 + +전체 샘플을 실행하면 `Barcodes` 폴더에 다음이 포함됩니다: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +어떤 PNG를 열어도 선명한 DataBar Omnidirectional 바코드가 표시되며, 표준 모바일 앱으로 스캔할 수 있습니다. + +## 흔히 발생하는 문제와 전문가 팁 + +| Issue | Why it happens | How to avoid it | +|-------|----------------|-----------------| +| **잘못된 EncodeTypes** | DataBar에 1D 유형을 사용하면 읽을 수 없는 이미지가 생성됩니다. | GS1‑128 페이로드에는 항상 `EncodeTypes.DatabarOmniDirectional`(또는 다른 DataBar 변형)를 선택합니다. | +| **불충분한 X‑dimension** | X‑dimension이 매우 낮으면 저해상도 모니터에서 얇은 바가 사라질 수 있습니다. | 화면 표시에는 `XDimension.Pixels` ≥ 2를 유지하고, 인쇄 시에는 3‑4로 늘립니다. | +| **파일 경로 오류** | 상대 경로가 예상치 못한 디렉터리로 해석될 수 있습니다. | `Path.Combine`와 `Environment.CurrentDirectory`를 사용해 절대 경로를 구성합니다. | +| **이미지 덮어쓰기** | 루프에서 동일한 파일명을 재사용하면 이전 결과가 덮어써집니다. | 파일명에 고유 식별자(예: GTIN 또는 타임스탬프)를 포함합니다. | +| **NuGet 패키지 누락** | 코드는 컴파일되지만 런타임에 `FileNotFoundException`이 발생합니다. | `Aspose.BarCode`가 설치되어 있고 프로젝트에 참조되는지 확인합니다. | + +## 전체 작동 예제 + +아래는 콘솔 애플리케이션에 복사하여 사용할 수 있는 전체 프로그램입니다. 모든 단계, 헬퍼 메서드 및 오류 처리가 포함되어 있습니다. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +이 프로그램을 실행하면 + +## 다음에 배워야 할 내용은? + +다음 튜토리얼은 이 가이드에서 시연한 기술을 기반으로 하는 밀접한 관련 주제를 다룹니다. 각 리소스는 단계별 설명과 함께 완전한 코드 예제를 제공하여 추가 API 기능을 마스터하고 프로젝트에서 대체 구현 방식을 탐색하도록 돕습니다. + +- [바코드 맞춤 높이 만들기 – 일차원 바코드](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [C# 바코드 이미지 만들기 – GS1 DataMatrix 예제](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [DotCode 바코드 이미지 만들기 – 행 및 열 (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/korean/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/korean/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..8913b69b7 --- /dev/null +++ b/barcode/korean/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,223 @@ +--- +category: general +date: 2026-08-09 +description: C# 바코드 생성기를 사용하여 바코드 이미지를 만들고, 맞춤 비율로 여러 바코드를 몇 분 안에 생성하는 방법을 배워보세요. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: ko +lastmod: 2026-08-09 +og_description: C# 바코드 생성기를 사용하여 바코드 이미지를 생성합니다. 이 튜토리얼에서는 여러 바코드를 생성하고, 종횡비를 조정하며, + PNG 파일을 효율적으로 저장하는 방법을 보여줍니다. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: C# 바코드 생성기로 바코드 이미지 만들기 – 빠른 가이드 +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: C# 바코드 생성기로 바코드 이미지 만들기 – 가이드 +url: /ko/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# 바코드 생성기로 바코드 이미지 만들기 – 가이드 + +빠르게 **바코드 이미지**를 생성해야 한다면, 이 가이드는 C# 바코드 생성기를 사용하여 수행하는 방법을 보여줍니다. 여러 바코드를 생성하고, 종횡비를 변경하며, 각 이미지를 PNG 파일로 저장하는 방법을 배울 수 있습니다. + +바코드 이미지 생성은 재고 관리 시스템, POS 단말기 또는 배송 라벨을 만들 때 흔히 수행되는 작업입니다. 이 튜토리얼을 마치면 서로 다른 종횡비를 보여주는 두 개의 PNG 파일을 바로 사용할 수 있게 되며, 원하는 만큼 많은 바코드에 이 방식을 확장하는 방법을 이해하게 됩니다. + +## Prerequisites + +시작하기 전에 다음이 설치되어 있는지 확인하세요: + +* .NET 6.0 SDK 이상 +* Visual Studio 2022 (또는 C#을 지원하는 IDE) +* DataBar Stacked Omnidirectional를 지원하는 바코드 라이브러리 참조(예: **Aspose.BarCode for .NET**). 코드 스니펫은 Aspose API를 사용하지만, 유사한 속성을 가진 다른 라이브러리에도 적용됩니다. + +별도의 데이터베이스나 웹 서버가 필요하지 않습니다—순수 콘솔 애플리케이션입니다. + +## Step 1: Set up the console project + +새 콘솔 프로젝트를 만들고 NuGet을 통해 바코드 라이브러리를 추가합니다. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +`dotnet add package` 명령은 나중에 사용할 `BarcodeGenerator` 클래스를 제공하는 **Aspose.BarCode**의 최신 안정 버전을 가져옵니다. + +## Step 2: Write the full program + +*Program.cs* 파일을 열고 내용을 아래 예제로 교체합니다. 프로그램은 **바코드 이미지**를 만들고, 종횡비를 변경한 뒤 두 개의 PNG 파일을 저장합니다. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Why each part matters + +* **Create barcode image** – `BarcodeGenerator` 생성자는 원하는 심볼과 데이터를 사용해 객체를 초기화합니다. +* **c# barcode generator** – `Parameters` 속성을 통해 렌더링 옵션을 완전히 제어할 수 있으며, `XDimension.Pixels`를 설정하면 화면에서 각 바가 선명하게 표시됩니다. +* **generate multiple barcodes** – 저장 사이에 `DataBar.AspectRatio`를 변경하면 동일한 생성기 인스턴스로 두 개의 서로 다른 이미지를 만들 수 있어 객체를 다시 생성할 필요가 없으며 효율적입니다. + +## Step 3: Run the program and view the results + +애플리케이션을 실행합니다: + +```bash +dotnet run +``` + +콘솔에 다음과 유사한 출력이 표시됩니다: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +`BarcodeOutputs` 폴더를 열면 두 개의 PNG 파일을 확인할 수 있습니다: + +* **DatabarAspectRatio15.png** – 높이가 제한된 라벨에 적합한 컴팩트 바코드. +* **DatabarAspectRatio30.png** – 더 높은 바코드로, 많은 스캐너가 거리에서 더 안정적으로 읽을 수 있습니다. + +두 이미지 모두 PDF에 삽입하거나 영수증에 인쇄하거나 모바일 앱에 전달하기에 바로 사용할 수 있습니다. + +## Step 4: Extend the solution to generate any number of barcodes + +위 패턴은 쉽게 확장됩니다: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – 루프가 종횡비 배열을 순회하면서 각 값에 대해 별도의 **바코드 이미지**를 생성합니다. +* `EncodeTypes` 또는 인코딩 문자열을 조정하면 QR 코드, Code 128 등 다른 심볼을 주변 로직을 바꾸지 않고도 만들 수 있습니다. + +## Practical tips and common pitfalls + +| Tip | Explanation | +|-----|-------------| +| **Reuse the same generator** | 매 이미지마다 `BarcodeGenerator`를 다시 초기화하면 불필요한 오버헤드가 발생합니다. `Save` 호출 사이에 매개변수를 변경하는 것이 더 빠르고 메모리 사용량도 적습니다. | +| **Validate the output folder** | 저장하기 전에 항상 `Directory.CreateDirectory`를 호출하세요. 그렇지 않으면 `Save`가 `DirectoryNotFoundException`을 발생시킵니다. | +| **Choose an appropriate X‑dimension** | 픽셀 값이 너무 낮으면(예: 1) 저해상도 화면에서 바코드를 읽을 수 없습니다. 2–3 정도가 대부분 프린터에 적합합니다. | +| **Mind the encoding** | GS1 DataBar는 GTIN 앞에 `(01)`이 필요합니다. 괄호를 생략하면 라이브러리가 잘못된 바코드를 생성할 수 있습니다. | +| **Test with a real scanner** | 시각적 검토만으로는 충분하지 않습니다. 실제 사용하려는 스캐너 하드웨어로 PNG 파일을 테스트하세요. | + +## Expected output (visual description) + +*두 PNG 파일 모두 어두운 색 바코드가 밝은 배경에 표시된 DataBar Stacked Omnidirectional 형태입니다. 종횡비 15 버전은 짧고, 종횡비 30 버전은 대략 두 배 높습니다.* + +문서에 이미지를 삽입하면 `XDimension.Pixels = 2`로 설정했기 때문에 선명하게 렌더링됩니다. + +## Conclusion + +이제 **C# 바코드 생성기**를 사용해 **바코드 이미지** 파일을 만드는 방법을 알게 되었으며, 종횡비나 기타 매개변수를 조정해 **여러 바코드**를 생성할 수 있습니다. 완전한 실행 예제는 생성기 인스턴스를 재사용하고, 출력 디렉터리를 처리하며, 파일 생성 여부를 확인하는 모범 사례를 보여줍니다. + +다음 단계로 시도해 볼 수 있는 내용: + +* `generator.Parameters.Barcode.Color`로 사용자 지정 색상 적용하기 (보조 키워드: **c# barcode generator**) +* JPEG 또는 SVG와 같은 다른 포맷으로 내보내기 (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* 바코드 생성 로직을 Web API에 통합해 필요 시 이미지 제공하기 (보조 키워드 + +## What Should You Learn Next? + +다음 튜토리얼은 이 가이드에서 다룬 기술을 기반으로 하며, 단계별 설명과 완전한 코드 예제를 포함하고 있어 추가 API 기능을 마스터하고 다양한 구현 방식을 탐색하는 데 도움이 됩니다. + +- [Create Barcode PNG – DataMatrix Aspect Ratio – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Customize Code 16K Barcode Aspect Ratios with Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/polish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/polish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..6fb8e1080 --- /dev/null +++ b/barcode/polish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,240 @@ +--- +category: general +date: 2026-08-09 +description: Szybko utwórz kod kreskowy 4‑kolumnowy databar w C# przy użyciu Aspose.BarCode. + Dowiedz się, jak skonfigurować kolumny, wiersze i zapisać obrazy PNG w tym zwięzłym + przewodniku. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: pl +lastmod: 2026-08-09 +og_description: Utwórz kod kreskowy 4‑kolumnowy databar w C# przy użyciu Aspose.BarCode, + a następnie dostosuj wiersze i wyeksportuj obrazy PNG dla swojej aplikacji. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Utwórz kod kreskowy databar 4‑kolumnowy w C# – szybki samouczek +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Tworzenie 4‑kolumnowego kodu kreskowego Databar w C# – przewodnik krok po kroku +url: /pl/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Utwórz kod kreskowy DataBar 4‑kolumnowy w C# – przewodnik krok po kroku + +Jeśli potrzebujesz **utworzyć 4‑kolumnowy kod kreskowy DataBar** w C#, ten samouczek pokaże Ci dokładnie, jak to zrobić. Przejdziemy przez generowanie kodu kreskowego DataBar Expanded Stacked, skonfigurowanie czterech kolumn i zapisanie wyniku jako obrazu PNG. + +W tym przewodniku nauczysz się, jak: + +* Zainicjalizować `BarcodeGenerator` dla symbolu **DataBar Expanded Stacked**. +* Ustawić liczbę kolumn na 4 (główny wymóg). +* Skorygować liczbę wierszy, gdy potrzebny jest układ stosowany z trzema wierszami. +* Wyeksportować kod kreskowy jako PNG przy użyciu odpowiedniego **formatu obrazu kodu kreskowego**. + +Wystarczy biblioteka Aspose.BarCode for .NET (wersja 23.10 lub nowsza) oraz środowisko programistyczne .NET 6+ takie jak Visual Studio 2022. Nie są wymagane dodatkowe zależności. + +--- + +## Jak utworzyć 4‑kolumnowy kod kreskowy DataBar + +Pierwszym krokiem jest utworzenie instancji `BarcodeGenerator`, która obsługuje symbologię **DataBar Expanded Stacked**. Ta klasa kapsułkuje wszystkie opcje renderowania, co ułatwia przełączanie się między układami opartymi na kolumnach a układami opartymi na wierszach. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Dlaczego to działa:** +`EncodeTypes.DatabarExpandedStacked` informuje Aspose.BarCode, aby wygenerował wersję układaną (stacked) rodziny DataBar. Właściwość `DataBar.Columns` kontroluje, ile pionowych modułów zajmuje kod kreskowy. Ustawienie jej na 4 spełnia wymóg **utworzenia 4‑kolumnowego kodu kreskowego DataBar**. Na koniec, `Save` zapisuje wizualną reprezentację na dysk przy użyciu **formatu obrazu kodu kreskowego** `Png`. + +### Konfiguracja kolumn DataBar Expanded Stacked + +Jeśli potrzebujesz innej liczby kolumn, po prostu zmień liczbę całkowitą przypisaną do `Columns`. Właściwość akceptuje wartości od 1 do 4 dla wariantu Expanded Stacked. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Wskazówka:* Zawsze testuj wygenerowany kod kreskowy przy użyciu skanera obsługującego rodzinę DataBar, ponieważ sam wygląd wizualny nie gwarantuje czytelności. + +### Zapisz obraz kodu kreskowego + +Wyliczenie `BarCodeImageFormat` oferuje kilka opcji (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG jest bezstratny i dobrze sprawdza się w większości scenariuszy webowych i desktopowych. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Jeśli potrzebujesz innego formatu, zamień `Png` na żądaną wartość wyliczenia. Zapisany plik może być osadzony bezpośrednio w HTML, PDF‑ach lub wydrukowany na etykietach. + +## Utwórz kod kreskowy z niestandardowymi wierszami + +Czasami potrzebny jest układ stosowany (stacked) z określoną liczbą wierszy zamiast kolumn. Ta sama klasa `BarcodeGenerator` udostępnia właściwość `Rows` w tym celu. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Dlaczego wiersze mają znaczenie:** +Gdy kod kreskowy w układzie stacked jest wyższy niż szerszy, właściwość `Rows` określa, na ile poziomych części podzielony jest symbol. Ustawienie `Rows = 3` tworzy trzy‑wierszowy kod kreskowy stacked, co jest przydatne przy wąskich szerokościach etykiet. + +### Ustaw wiersze kodu kreskowego dynamicznie + +Możesz obliczyć liczbę wierszy w czasie wykonywania na podstawie danych wejściowych: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Ta elastyczność pozwala **ustawić wiersze kodu kreskowego** bez konieczności rekompilacji aplikacji. + +## Pełny przykład end‑to‑end + +Poniżej znajduje się pojedynczy program, który generuje zarówno kod kreskowy 4‑kolumnowy, jak i 3‑wierszowy, demonstrując, jak obie konfiguracje mogą współistnieć. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Oczekiwany wynik:** +Dwa pliki PNG pojawiają się w katalogu roboczym aplikacji: + +* `DatabarCols4.png` – kod kreskowy DataBar Expanded Stacked z czterema pionowymi kolumnami. +* `DatabarRows3.png` – ta sama symbologia ułożona w trzy poziome wiersze. + +Oba obrazy można otworzyć w dowolnym przeglądarce obrazów lub osadzić w kontrolce UI. + +--- + +## Częste pytania i przypadki brzegowe + +| Question | Answer | +|----------|--------| +| *Czy mogę użyć innej symbologii kodu kreskowego?* | Tak. Zastąp `EncodeTypes.DatabarExpandedStacked` inną wartością `EncodeTypes` (np. `EncodeTypes.QR`), ale właściwości `Columns` i `Rows` są specyficzne dla rodzin DataBar. | +| *Co jeśli ciąg danych przekracza maksymalną długość?* | Symbologia DataBar Expanded Stacked obsługuje maksymalnie 61 znaków numerycznych. Przekroczenie tego limitu powoduje wyrzucenie `ArgumentException`. Zweryfikuj dane wejściowe przed przypisaniem ich do generatora. | +| *Czy muszę zwolnić zasoby `BarcodeGenerator`?* | `BarcodeGenerator` implementuje `IDisposable`. W długotrwałej usłudze, otocz go blokiem `using` lub wywołaj `Dispose()` ręcznie, aby zwolnić zasoby natywne. | +| *Czy mogę generować SVG zamiast PNG?* | Oczywiście. Użyj `BarCodeImageFormat.Svg` w metodzie `Save`. | +| *Czy biblioteka jest kompatybilna z .NET Core?* | Aspose.BarCode for .NET obsługuje .NET Core 3.1, .NET 5, .NET 6 i nowsze. Nie są wymagane zmiany w kodzie. | + +## Podsumowanie + +Teraz wiesz, jak **utworzyć 4‑kolumnowy kod kreskowy DataBar** w C# przy użyciu Aspose.BarCode, jak dostosować układ przy użyciu wierszy oraz jak wyeksportować wynik w wygodnym **formacie obrazu kodu kreskowego**. Pełny przykład pokazuje zarówno konfiguracje oparte na kolumnach, jak i na wierszach, dając solidną podstawę dla każdego scenariusza drukowania etykiet lub skanowania mobilnego. + +**Kolejne kroki** + +* Eksperymentuj z różnymi ładunkami danych i weryfikuj kompatybilność ze skanerami. +* Zbadaj dodatkowe opcje stylizacji, takie jak kolory pierwszego planu/tła (`generator.Parameters.Barcode.Color`). +* Połącz kod kreskowy z innymi grafikami przy użyciu API `Graphics` w celu stworzenia niestandardowych projektów etykiet. + +Śmiało dostosuj kod do projektów ASP.NET Core, Windows Forms lub Xamarin — Aspose.BarCode działa na wszystkich platformach .NET. Szczęśliwego kodowania! + +## Co powinieneś nauczyć się dalej? + +Następujące samouczki obejmują ściśle powiązane tematy, które rozwijają techniki przedstawione w tym przewodniku. Każdy zasób zawiera kompletne działające przykłady kodu z wyjaśnieniami krok po kroku, aby pomóc Ci opanować dodatkowe funkcje API i odkrywać alternatywne podejścia implementacyjne w własnych projektach. + +- [Utwórz obraz kodu kreskowego DotCode – wiersze i kolumny (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Utwórz obraz kodu kreskowego c# – Konfiguracja wierszy i kolumn Codablock F](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Jak utworzyć rozszerzony kod tekstowy dotcode przy użyciu Aspose.BarCode dla .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/polish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/polish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..f88dba36b --- /dev/null +++ b/barcode/polish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,306 @@ +--- +category: general +date: 2026-08-09 +description: Utwórz obraz kodu kreskowego w C# za pomocą tego przewodnika krok po + kroku. Dowiedz się, jak generować kod kreskowy, dostosować wysokość kodu w pikselach + oraz efektywnie tworzyć wiele kodów kreskowych. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: pl +lastmod: 2026-08-09 +og_description: Szybko utwórz obraz kodu kreskowego w C#. Skorzystaj z tego samouczka, + aby dowiedzieć się, jak generować kod kreskowy, ustawiać wysokość kodu w pikselach + i tworzyć wiele kodów kreskowych. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Tworzenie obrazu kodu kreskowego w C# – pełny przewodnik dla programistów +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Tworzenie obrazu kodu kreskowego w C# – kompletny przewodnik programistyczny +url: /pl/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Tworzenie obrazu kodu kreskowego w C# – kompletny przewodnik programistyczny + +Jeśli potrzebujesz **utworzyć obraz kodu kreskowego** w aplikacji .NET, ten przewodnik pokaże Ci dokładnie **jak generować kod kreskowy** przy użyciu biblioteki Aspose.BarCode. Zobaczysz, jak kontrolować **wysokość kodu kreskowego w pikselach**, zapisywać obraz oraz tworzyć **wiele kodów kreskowych** bez duplikowania kodu. + +Samouczek obejmuje wszystko, od instalacji pakietu po dostosowywanie wymiarów, dzięki czemu możesz skopiować‑wkleić gotowy przykład do uruchomienia w swoim projekcie już dziś. + +## Wymagania wstępne + +Przed rozpoczęciem upewnij się, że masz: + +* .NET 6.0 SDK lub nowszy zainstalowany +* Visual Studio 2022 (lub dowolne IDE C#) +* Pakiet NuGet `Aspose.BarCode` – zainstaluj przy użyciu + +```bash +dotnet add package Aspose.BarCode +``` + +Nie są wymagane dodatkowe zależności. + +## Jak wygenerować obraz kodu kreskowego przy użyciu BarcodeGenerator w C# + +Podstawową klasą do tworzenia obrazu kodu kreskowego jest `BarcodeGenerator`. Zawiera ona typ kodowania, ciąg danych oraz wszystkie parametry renderowania. + +### Krok 1: Zdefiniuj folder wyjściowy + +Wybierz folder, w którym będą przechowywane wygenerowane pliki PNG. Użycie ścieżki bezwzględnej zapobiega niespodziewanym problemom z uprawnieniami. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Dlaczego?** Tworzenie folderu programowo zapewnia, że kolejne wywołania `Save` zakończą się sukcesem nawet na nowej maszynie. + +### Krok 2: Utwórz generator kodu kreskowego + +Dla kodu DataBar Omnidirectional przekaż `EncodeTypes.DatabarOmniDirectional` oraz ciąg danych GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Uwaga:** Obiekt `BarcodeGenerator` jest wielokrotnego użytku; możesz zmieniać jego parametry pomiędzy zapisami, aby **tworzyć wiele kodów kreskowych** z tych samych danych. + +### Krok 3: Ustaw wspólne parametry kodu kreskowego + +Najczęstsze korekty wizualne to wymiar X (szerokość modułu) oraz wysokość kreski. Oba podawane są w pikselach. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Dlaczego ustawiać wymiar X?** Mniejszy wymiar X daje wyższą rozdzielczość, co jest istotne, gdy obraz będzie drukowany lub wyświetlany na ekranach o wysokiej gęstości DPI. + +### Krok 4: Zapisz pierwszy obraz kodu kreskowego + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +Plik `DatabarBarHeight30Pixels.png` zawiera teraz DataBar Omnidirectional o wysokości 30 pikseli. + +### Krok 5: Dostosuj wysokość kodu kreskowego w pikselach + +Zmiana wysokości nie wymaga nowej instancji `BarcodeGenerator` — wystarczy zmodyfikować parametr. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Krok 6: Zapisz drugi obraz kodu kreskowego + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Teraz masz dwa pliki PNG z różnymi **wysokościami kodu kreskowego w pikselach**, co pokazuje, jak łatwo jest **tworzyć różne obrazy kodu kreskowego**. + +## Ustawianie wysokości kodu kreskowego w pikselach dynamicznie + +Często potrzebna jest seria kodów kreskowych o wysokościach dopasowanych do elementów UI lub etykiet drukowanych. Poniższa metoda pomocnicza abstrahuje zmianę wysokości: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Możesz teraz wywołać `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");`, aby **utworzyć obraz kodu kreskowego** o wysokości 45 pikseli w jednej linii. + +## Tworzenie wielu kodów kreskowych w pętli + +Gdy masz kolekcję identyfikatorów produktów, pętla `foreach` eliminuje powtarzalny kod. Ten przykład pokazuje, jak **tworzyć wiele kodów kreskowych** z tablicy GTIN‑ów. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +Pętla generuje trzy pliki PNG, każdy z inną wartością **wysokości kodu kreskowego w pikselach**. Ponieważ metoda pomocnicza `SaveBarcodeWithHeight` kapsułkuje zmianę wysokości, główna pętla pozostaje czysta i skoncentrowana na danych. + +### Oczekiwany wynik + +Po uruchomieniu pełnego przykładu folder `Barcodes` zawiera: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Otworzenie dowolnego pliku PNG pokazuje wyraźny kod DataBar Omnidirectional, który może być zeskanowany przez standardowe aplikacje mobilne. + +## Częste pułapki i wskazówki profesjonalne + +| Problem | Dlaczego się pojawia | Jak tego uniknąć | +|-------|----------------|-----------------| +| **Nieprawidłowe EncodeTypes** | Użycie typu 1D dla DataBar spowoduje nieczytelny obraz. | Zawsze wybieraj `EncodeTypes.DatabarOmniDirectional` (lub inną odmianę DataBar) dla ładunków GS1‑128. | +| **Niewystarczający wymiar X** | Bardzo mały wymiar X może spowodować znikanie cienkich pasków na monitorach o niskiej rozdzielczości. | Utrzymuj `XDimension.Pixels` ≥ 2 dla wyświetlania na ekranie; zwiększ do 3‑4 przy drukowaniu. | +| **Błędy ścieżki pliku** | Ścieżki względne mogą rozwiązywać się do nieoczekiwanych katalogów. | Używaj `Path.Combine` i `Environment.CurrentDirectory` do budowania ścieżek bezwzględnych. | +| **Nadpisywanie obrazów** | Ponowne użycie tej samej nazwy pliku w pętli nadpisuje poprzednie wyniki. | Dodawaj unikalne identyfikatory (np. GTIN lub znacznik czasu) do nazwy pliku. | +| **Brak pakietu NuGet** | Kod kompiluje się, ale w czasie wykonywania rzuca `FileNotFoundException`. | Zweryfikuj, że `Aspose.BarCode` jest zainstalowany i projekt go referuje. | + +## Pełny działający przykład + +Poniżej znajduje się kompletny program, który możesz skopiować do aplikacji konsolowej. Zawiera wszystkie kroki, metody pomocnicze oraz obsługę błędów. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Uruchomienie tego programu + + +## Co powinieneś nauczyć się dalej? + +Poniższe samouczki obejmują ściśle powiązane tematy, które rozwijają techniki przedstawione w tym przewodniku. Każdy zasób zawiera kompletne działające przykłady kodu z wyjaśnieniami krok po kroku, aby pomóc Ci opanować dodatkowe funkcje API i odkrywać alternatywne podejścia implementacyjne w własnych projektach. + +- [Create Barcode Custom Height – One-Dimensional Barcodes](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Create barcode image C# – GS1 DataMatrix Example](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/polish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/polish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..fc86f117e --- /dev/null +++ b/barcode/polish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,226 @@ +--- +category: general +date: 2026-08-09 +description: Utwórz obraz kodu kreskowego za pomocą generatora kodów kreskowych w + C# i naucz się generować wiele kodów kreskowych o niestandardowych proporcjach w + ciągu kilku minut. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: pl +lastmod: 2026-08-09 +og_description: Utwórz obraz kodu kreskowego za pomocą generatora kodów kreskowych + w C#. Ten samouczek pokazuje, jak generować wiele kodów kreskowych, dostosowywać + proporcje i efektywnie zapisywać pliki PNG. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Utwórz obraz kodu kreskowego przy użyciu generatora kodów kreskowych w C# + – szybki przewodnik +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Tworzenie obrazu kodu kreskowego przy użyciu generatora kodów kreskowych w + C# – przewodnik +url: /pl/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Utwórz obraz kodu kreskowego przy użyciu generatora kodów kreskowych C# – przewodnik + +Jeśli potrzebujesz szybko **utworzyć obraz kodu kreskowego**, ten przewodnik pokaże Ci, jak zrobić to za pomocą generatora kodów kreskowych C#. Nauczysz się generować wiele kodów kreskowych, zmieniać współczynnik proporcji i zapisywać każdy obraz jako plik PNG. + +Generowanie obrazów kodów kreskowych jest powszechnym zadaniem przy tworzeniu systemów inwentaryzacji, terminali punktu sprzedaży lub etykiet wysyłkowych. Po zakończeniu tego samouczka będziesz mieć dwa gotowe do użycia pliki PNG, które demonstrują różne współczynniki proporcji, oraz zrozumiesz, jak rozszerzyć podejście na dowolną liczbę kodów kreskowych. + +## Wymagania wstępne + +* .NET 6.0 SDK lub nowszy zainstalowany +* Visual Studio 2022 (lub dowolne IDE obsługujące C#) +* Odwołanie do biblioteki kodów kreskowych, która obsługuje DataBar Stacked Omnidirectional (na przykład, **Aspose.BarCode for .NET**). Fragmenty kodu używają API Aspose, ale koncepcje mają zastosowanie do każdej biblioteki o podobnych właściwościach. + +Nie potrzebujesz osobnej bazy danych ani serwera WWW — to jest zwykła aplikacja konsolowa. + +## Krok 1: Skonfiguruj projekt konsolowy + +Utwórz nowy projekt konsolowy i dodaj bibliotekę kodów kreskowych za pomocą NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +Polecenie `dotnet add package` pobiera najnowszą stabilną wersję **Aspose.BarCode**, która udostępnia klasę `BarcodeGenerator` używaną później. + +## Krok 2: Napisz pełny program + +Otwórz *Program.cs* i zamień jego zawartość na kompletny przykład poniżej. Program tworzy **obraz kodu kreskowego**, zmienia współczynnik proporcji i zapisuje dwa pliki PNG. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Dlaczego każdy element ma znaczenie + +* **Create barcode image** – Konstruktor `BarcodeGenerator` inicjalizuje obiekt z żądaną symbologią i danymi. +* **c# barcode generator** – Właściwość `Parameters` daje pełną kontrolę nad opcjami renderowania; ustawienie `XDimension.Pixels` zapewnia wyraźne paski na ekranie. +* **generate multiple barcodes** – Zmieniając `DataBar.AspectRatio` pomiędzy zapisami, ta sama instancja generatora tworzy dwa odrębne obrazy bez ponownego tworzenia obiektu, co jest bardziej wydajne. + +## Krok 3: Uruchom program i zobacz wyniki + +Uruchom aplikację: + +```bash +dotnet run +``` + +Powinieneś zobaczyć wyjście konsoli podobne do: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Otwórz folder `BarcodeOutputs`. Znajdziesz tam dwa pliki PNG: + +* **DatabarAspectRatio15.png** – kompaktowy kod kreskowy odpowiedni dla etykiet o ograniczonej wysokości. +* **DatabarAspectRatio30.png** – wyższy kod kreskowy, który wiele skanerów odczytuje bardziej niezawodnie z większej odległości. + +Oba obrazy są gotowe do osadzenia w plikach PDF, wydrukowania na paragonach lub wysłania do aplikacji mobilnej. + +## Krok 4: Rozszerz rozwiązanie, aby generować dowolną liczbę kodów kreskowych + +Powyższy wzorzec łatwo skaluje się: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – Pętla iteruje po tablicy współczynników proporcji, tworząc odrębny **obraz kodu kreskowego** dla każdej wartości. +* Dostosuj `EncodeTypes` lub zakodowany ciąg, aby generować kody QR, Code 128 lub inne symbologie bez zmiany otaczającej logiki. + +## Praktyczne wskazówki i typowe pułapki + +| Wskazówka | Wyjaśnienie | +|-----|-------------| +| **Reuse the same generator** | Ponowne inicjalizowanie `BarcodeGenerator` dla każdego obrazu dodaje niepotrzebny narzut. Zmienianie parametrów pomiędzy wywołaniami `Save` jest szybsze i zużywa mniej pamięci. | +| **Validate the output folder** | Zawsze wywołuj `Directory.CreateDirectory` przed zapisem; w przeciwnym razie `Save` zgłosi `DirectoryNotFoundException`. | +| **Choose an appropriate X‑dimension** | Bardzo niskie wartości pikseli (np. 1) mogą sprawić, że kod kreskowy będzie nieczytelny na ekranach o niskiej rozdzielczości. Wartości 2–3 działają dobrze dla większości drukarek. | +| **Mind the encoding** | GS1 DataBar wymaga wiodącego `(01)` dla GTIN. Jeśli pominiesz nawiasy, biblioteka może wygenerować nieprawidłowy kod kreskowy. | +| **Test with a real scanner** | Samo oglądanie nie wystarczy. Przetestuj pliki PNG na rzeczywistym sprzęcie skanującym, którego zamierzasz używać. | + +## Oczekiwany wynik (opis wizualny) + +*Oba pliki PNG wyświetlają ciemny na jasnym kod DataBar Stacked Omnidirectional. Wersja z współczynnikiem proporcji 15 jest krótsza, podczas gdy wersja z współczynnikiem 30 jest mniej więcej dwa razy wyższa.* + +Jeśli osadzisz obrazy w dokumencie, będą renderowane ostro, ponieważ ustawiliśmy `XDimension.Pixels = 2`. + +## Zakończenie + +Teraz wiesz, jak **utworzyć pliki obrazu kodu kreskowego** przy użyciu **generatora kodów kreskowych C#**, i możesz **generować wiele kodów kreskowych** poprzez dostosowanie współczynnika proporcji lub dowolnego innego parametru. Pełny, działający przykład demonstruje najlepsze praktyki, takie jak ponowne użycie instancji generatora, obsługa katalogów wyjściowych oraz weryfikacja tworzenia plików. + +Następnie możesz zbadać: + +* Dodawanie własnych kolorów za pomocą `generator.Parameters.Barcode.Color` (słowo kluczowe drugorzędne: **c# barcode generator**) +* Eksport do innych formatów, takich jak JPEG lub SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Integracja logiki tworzenia kodów kreskowych z Web API w celu udostępniania obrazów na żądanie (słowo kluczowe drugorzędne + +## Co powinieneś nauczyć się dalej? + +Poniższe samouczki obejmują ściśle powiązane tematy, które rozwijają techniki przedstawione w tym przewodniku. Każde źródło zawiera kompletne działające przykłady kodu z wyjaśnieniami krok po kroku, aby pomóc Ci opanować dodatkowe funkcje API i zbadać alternatywne podejścia implementacyjne w własnych projektach. + +- [Utwórz kod kreskowy PNG – Współczynnik proporcji DataMatrix – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [samouczek generatora kodów kreskowych c# – Dostosuj współczynniki proporcji kodu 16K przy użyciu Aspose.BarCode dla .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Jak wygenerować kod Aztec z niestandardowym współczynnikiem proporcji przy użyciu Aspose.BarCode dla .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/portuguese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/portuguese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..dc3c416c6 --- /dev/null +++ b/barcode/portuguese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,239 @@ +--- +category: general +date: 2026-08-09 +description: Crie um código de barras databar de 4 colunas em C# rapidamente com Aspose.BarCode. + Aprenda como configurar colunas, linhas e salvar imagens PNG neste guia conciso. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: pt +lastmod: 2026-08-09 +og_description: Crie um código de barras databar de 4 colunas em C# usando Aspose.BarCode, + personalize as linhas e exporte imagens PNG para seu aplicativo. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Crie código de barras databar de 4 colunas em C# – tutorial rápido +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Criar código de barras databar de 4 colunas em C# – guia passo a passo +url: /pt/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Criar código de barras databar de 4 colunas em C# – guia passo a passo + +Se você precisa **criar um código de barras databar de 4 colunas** em C#, este tutorial mostra exatamente como fazer. Vamos percorrer a geração de um código de barras DataBar Expanded Stacked, configurando quatro colunas e salvando o resultado como uma imagem PNG. + +Neste guia você aprenderá como: + +* Inicializar o `BarcodeGenerator` para um símbolo **DataBar Expanded Stacked**. +* Definir a contagem de colunas para 4 (o requisito principal). +* Ajustar a contagem de linhas quando precisar de um layout empilhado com três linhas. +* Exportar o código de barras como PNG usando o **formato de imagem de código de barras** apropriado. + +Você só precisa da biblioteca Aspose.BarCode for .NET (versão 23.10 ou posterior) e de um ambiente de desenvolvimento .NET 6+ como o Visual Studio 2022. Nenhuma dependência adicional é necessária. + +--- + +## Como criar código de barras databar de 4 colunas + +O primeiro passo é criar uma instância de `BarcodeGenerator` que tenha como alvo a simbologia **DataBar Expanded Stacked**. Esta classe encapsula todas as opções de renderização, facilitando a troca entre layouts baseados em colunas e em linhas. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Por que isso funciona:** +`EncodeTypes.DatabarExpandedStacked` indica ao Aspose.BarCode que produza a versão empilhada da família DataBar. A propriedade `DataBar.Columns` controla quantos módulos verticais o código de barras ocupa. Definir isso para 4 corresponde ao requisito de **criar um código de barras databar de 4 colunas**. Por fim, `Save` grava a representação visual no disco usando o **formato de imagem de código de barras** `Png`. + +### Configurar colunas do DataBar Expanded Stacked + +Se você precisar de uma contagem de colunas diferente, basta alterar o número inteiro atribuído a `Columns`. A propriedade aceita valores de 1 a 4 para a variante expanded stacked. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Dica profissional:* Sempre teste o código de barras gerado com um scanner que suporte a família DataBar, pois a aparência visual sozinha não garante a legibilidade. + +### Salvar a imagem do código de barras + +A enumeração `BarCodeImageFormat` oferece várias opções (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG é sem perdas e funciona bem na maioria dos cenários web e desktop. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Se você precisar de um formato diferente, substitua `Png` pelo valor de enum desejado. O arquivo salvo pode ser incorporado diretamente em HTML, PDFs ou impresso em etiquetas. + +## Criar um código de barras com linhas personalizadas + +Às vezes, um layout empilhado é necessário com um número específico de linhas em vez de colunas. A mesma classe `BarcodeGenerator` expõe uma propriedade `Rows` para esse propósito. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Por que as linhas são importantes:** +Quando o código de barras empilhado é mais alto que largo, a propriedade `Rows` determina em quantas fatias horizontais o símbolo será dividido. Definir `Rows = 3` cria um código de barras empilhado de três linhas, útil para larguras estreitas de etiqueta. + +### Definir linhas do código de barras dinamicamente + +Você pode calcular a contagem de linhas em tempo de execução com base nos dados de entrada: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Essa flexibilidade permite que você **defina linhas do código de barras** sem recompilar a aplicação. + +## Exemplo completo de ponta a ponta + +A seguir, um programa único que gera tanto um código de barras de 4 colunas quanto um de 3 linhas, demonstrando como as duas configurações coexistem. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Saída esperada:** +Dois arquivos PNG aparecem no diretório de trabalho da aplicação: + +* `DatabarCols4.png` – um código de barras DataBar Expanded Stacked com quatro colunas verticais. +* `DatabarRows3.png` – a mesma simbologia organizada em três linhas horizontais. + +Ambas as imagens podem ser abertas em qualquer visualizador de imagens ou incorporadas em um controle de UI. + +--- + +## Perguntas comuns e casos de borda + +| Pergunta | Resposta | +|----------|----------| +| *Posso usar uma simbologia de código de barras diferente?* | Sim. Substitua `EncodeTypes.DatabarExpandedStacked` por outro valor de `EncodeTypes` (por exemplo, `EncodeTypes.QR`), mas as propriedades `Columns` e `Rows` são específicas das famílias DataBar. | +| *E se a string de dados exceder o comprimento máximo?* | A simbologia DataBar Expanded Stacked suporta até 61 caracteres numéricos. Exceder esse limite lança uma `ArgumentException`. Valide a entrada antes de atribuí‑la ao gerador. | +| *Preciso descartar o `BarcodeGenerator`?* | `BarcodeGenerator` implementa `IDisposable`. Em um serviço de longa duração, envolva‑o em um bloco `using` ou chame `Dispose()` manualmente para liberar recursos nativos. | +| *Posso gerar SVG em vez de PNG?* | Absolutamente. Use `BarCodeImageFormat.Svg` no método `Save`. | +| *A biblioteca é compatível com .NET Core?* | Aspose.BarCode for .NET suporta .NET Core 3.1, .NET 5, .NET 6 e posteriores. Nenhuma alteração de código é necessária. | + +## Conclusão + +Agora você sabe como **criar um código de barras databar de 4 colunas** em C# usando Aspose.BarCode, como ajustar o layout com linhas e como exportar o resultado em um conveniente **formato de imagem de código de barras**. O exemplo completo mostra tanto configurações baseadas em colunas quanto em linhas, proporcionando uma base sólida para qualquer cenário de impressão de etiquetas ou digitalização móvel. + +**Próximos passos** + +* Experimente diferentes cargas de dados e verifique a compatibilidade com scanners. +* Explore opções adicionais de estilo, como cores de primeiro plano/fundo (`generator.Parameters.Barcode.Color`). +* Combine o código de barras com outros gráficos usando a API `Graphics` para designs de etiquetas personalizados. + +Sinta‑se à vontade para adaptar o código para projetos ASP.NET Core, Windows Forms ou Xamarin — Aspose.BarCode funciona em todas as plataformas .NET. Boa codificação! + +## O que você deve aprender a seguir? + +Os tutoriais a seguir abordam tópicos estreitamente relacionados que ampliam as técnicas demonstradas neste guia. Cada recurso inclui exemplos de código completos e funcionais com explicações passo a passo para ajudá‑lo a dominar recursos adicionais da API e explorar abordagens de implementação alternativas em seus próprios projetos. + +- [Criar imagem de código de barras DotCode – linhas e colunas (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Criar imagem de código de barras c# – Configurar linhas e colunas do Codablock F](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Como criar texto de código estendido dotcode com Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/portuguese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/portuguese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..c8bdf0d66 --- /dev/null +++ b/barcode/portuguese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,305 @@ +--- +category: general +date: 2026-08-09 +description: Crie imagem de código de barras em C# com este guia passo a passo. Aprenda + como gerar código de barras, ajustar a altura do código de barras em pixels e criar + múltiplos códigos de barras de forma eficiente. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: pt +lastmod: 2026-08-09 +og_description: Crie rapidamente uma imagem de código de barras em C#. Siga este tutorial + para aprender como gerar códigos de barras, definir a altura em pixels do código + de barras e produzir múltiplos códigos de barras. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Crie imagem de código de barras em C# – guia completo para desenvolvedores +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Criar imagem de código de barras em C# – guia completo de programação +url: /pt/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Criar imagem de código de barras em C# – guia completo de programação + +Se você precisa **criar imagem de código de barras** em uma aplicação .NET, este guia mostra exatamente **como gerar código de barras** usando a biblioteca Aspose.BarCode. Você verá como controlar os **pixels de altura do código de barras**, salvar a imagem e produzir **múltiplos códigos de barras** sem duplicar código. + +O tutorial cobre tudo, desde a instalação do pacote até a personalização das dimensões, para que você possa copiar‑colar um exemplo pronto‑para‑executar em seu projeto hoje. + +## Pré-requisitos + +Antes de começar, certifique-se de que você tem: + +* .NET 6.0 SDK ou posterior instalado +* Visual Studio 2022 (ou qualquer IDE C#) +* Pacote NuGet `Aspose.BarCode` – instale com + +```bash +dotnet add package Aspose.BarCode +``` + +Nenhuma dependência adicional é necessária. + +## Como gerar imagem de código de barras com BarcodeGenerator C# + +A classe principal para criar uma imagem de código de barras é `BarcodeGenerator`. Ela encapsula o tipo de codificação, a string de dados e todos os parâmetros de renderização. + +### Etapa 1: Definir a pasta de saída + +Escolha uma pasta onde os arquivos PNG gerados serão armazenados. Usar um caminho absoluto evita surpresas de permissão. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Por quê?** Criar a pasta programaticamente garante que as chamadas subsequentes de `Save` sejam bem‑sucedidas mesmo em uma máquina nova. + +### Etapa 2: Instanciar o gerador de código de barras + +Para um código de barras DataBar Omnidirectional, passe `EncodeTypes.DatabarOmniDirectional` e a string de dados GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Nota:** O objeto `BarcodeGenerator` é reutilizável; você pode alterar seus parâmetros entre salvamentos para **criar múltiplos códigos de barras** a partir dos mesmos dados. + +### Etapa 3: Definir parâmetros comuns do código de barras + +Os ajustes visuais mais comuns são a X‑dimension (largura do módulo) e a altura da barra. Ambos são expressos em pixels. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Por que definir X‑dimension?** Uma X‑dimension menor produz maior resolução, o que é importante quando a imagem será impressa ou exibida em telas de alta DPI. + +### Etapa 4: Salvar a primeira imagem de código de barras + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +O arquivo `DatabarBarHeight30Pixels.png` agora contém um código de barras DataBar Omnidirectional com 30 pixels de altura. + +### Etapa 5: Ajustar os pixels de altura do código de barras + +Alterar a altura não requer uma nova instância de `BarcodeGenerator`—basta modificar o parâmetro. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Etapa 6: Salvar a segunda imagem de código de barras + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Agora você tem dois arquivos PNG com diferentes **pixels de altura do código de barras**, demonstrando como é fácil criar variações de **imagem de código de barras**. + +## Definindo pixels de altura do código de barras dinamicamente + +Frequentemente você precisa de uma série de códigos de barras com alturas que correspondam a elementos de UI ou etiquetas impressas. O método auxiliar a seguir abstrai a mudança de altura: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Agora você pode chamar `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` para **criar imagem de código de barras** com altura de 45 pixels em uma única linha. + +## Criando múltiplos códigos de barras em um loop + +Quando você tem uma coleção de identificadores de produto, um loop `foreach` elimina código repetitivo. Este exemplo mostra como **criar múltiplos códigos de barras** a partir de um array de GTINs. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +O loop produz três arquivos PNG, cada um com um valor distinto de **pixels de altura do código de barras**. Como o auxiliar `SaveBarcodeWithHeight` encapsula a mudança de altura, o loop principal permanece limpo e focado nos dados. + +### Saída esperada + +Após executar o exemplo completo, a pasta `Barcodes` contém: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Abrir qualquer PNG mostra um código de barras DataBar Omnidirectional nítido que pode ser escaneado por aplicativos móveis padrão. + +## Armadilhas comuns e dicas avançadas + +| Problema | Por que acontece | Como evitar | +|----------|------------------|--------------| +| **EncodeTypes errado** | Usar um tipo 1D para um DataBar produzirá uma imagem ilegível. | Sempre escolha `EncodeTypes.DatabarOmniDirectional` (ou outra variante DataBar) para cargas úteis GS1‑128. | +| **X‑dimension insuficiente** | X‑dimension muito baixa pode fazer as barras finas desaparecerem em monitores de baixa resolução. | Mantenha `XDimension.Pixels` ≥ 2 para exibição em tela; aumente para 3‑4 para impressão. | +| **Erros de caminho de arquivo** | Caminhos relativos podem resolver para diretórios inesperados. | Use `Path.Combine` e `Environment.CurrentDirectory` para construir caminhos absolutos. | +| **Sobrescrita de imagens** | Reutilizar o mesmo nome de arquivo em um loop sobrescreve resultados anteriores. | Inclua identificadores únicos (ex.: GTIN ou timestamp) no nome do arquivo. | +| **Pacote NuGet ausente** | O código compila mas lança `FileNotFoundException` em tempo de execução. | Verifique se `Aspose.BarCode` está instalado e o projeto o referencia. | + +## Exemplo completo em funcionamento + +Abaixo está o programa completo que você pode copiar para uma aplicação console. Ele inclui todas as etapas, métodos auxiliares e tratamento de erros. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Executando este programa + +## O que você deve aprender a seguir? + +Os tutoriais a seguir abordam tópicos estreitamente relacionados que se baseiam nas técnicas demonstradas neste guia. Cada recurso inclui exemplos de código completos e funcionais com explicações passo a passo para ajudá‑lo a dominar recursos adicionais da API e explorar abordagens de implementação alternativas em seus próprios projetos. + +- [Criar código de barras com altura personalizada – códigos de barras unidimensionais](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Criar imagem de código de barras C# – Exemplo GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Criar imagem de código de barras DotCode – linhas & colunas (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/portuguese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/portuguese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..0f3c8c8da --- /dev/null +++ b/barcode/portuguese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-09 +description: Crie imagens de códigos de barras com um gerador de códigos de barras + em C# e aprenda a gerar múltiplos códigos de barras com proporções personalizadas + em minutos. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: pt +lastmod: 2026-08-09 +og_description: Crie imagem de código de barras usando um gerador de códigos de barras + em C#. Este tutorial mostra como gerar múltiplos códigos de barras, ajustar proporções + e salvar arquivos PNG de forma eficiente. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Crie imagem de código de barras com gerador de códigos de barras C# – guia + rápido +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Criar imagem de código de barras com gerador de código de barras C# – guia +url: /pt/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Criar imagem de código de barras com gerador de código de barras C# – guia + +Se você precisa **criar imagem de código de barras** rapidamente, este guia mostra como fazer isso com um gerador de código de barras C#. Você aprenderá a gerar múltiplos códigos de barras, alterar a proporção e salvar cada imagem como um arquivo PNG. + +Gerar imagens de códigos de barras é uma tarefa comum ao construir sistemas de inventário, terminais de ponto de venda ou etiquetas de envio. Ao final deste tutorial você terá dois arquivos PNG prontos para uso que demonstram diferentes proporções, e entenderá como estender a abordagem para qualquer número de códigos de barras. + +## Prerequisites + +* .NET 6.0 SDK ou posterior instalado +* Visual Studio 2022 (ou qualquer IDE que suporte C#) +* Uma referência a uma biblioteca de códigos de barras que suporte DataBar Stacked Omnidirectional (por exemplo, **Aspose.BarCode for .NET**). Os trechos de código usam a API Aspose, mas os conceitos se aplicam a qualquer biblioteca com propriedades semelhantes. + +Você não precisa de um banco de dados ou servidor web separado — esta é uma aplicação console simples. + +## Passo 1: Configurar o projeto console + +Crie um novo projeto console e adicione a biblioteca de códigos de barras via NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +O comando `dotnet add package` obtém a versão estável mais recente do **Aspose.BarCode**, que fornece a classe `BarcodeGenerator` usada posteriormente. + +## Passo 2: Escrever o programa completo + +Abra *Program.cs* e substitua seu conteúdo pelo exemplo completo abaixo. O programa cria uma **imagem de código de barras**, altera a proporção e salva dois arquivos PNG. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Por que cada parte importa + +* **Create barcode image** – O construtor `BarcodeGenerator` inicializa o objeto com a simbologia e os dados desejados. +* **c# barcode generator** – A propriedade `Parameters` fornece controle total sobre as opções de renderização; definir `XDimension.Pixels` garante que cada barra fique nítida na tela. +* **generate multiple barcodes** – Ao alterar `DataBar.AspectRatio` entre as gravações, a mesma instância do gerador produz duas imagens distintas sem recriar o objeto, o que é mais eficiente. + +## Passo 3: Executar o programa e visualizar os resultados + +Execute a aplicação: + +```bash +dotnet run +``` + +Você deverá ver uma saída no console semelhante a: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Abra a pasta `BarcodeOutputs`. Você encontrará dois arquivos PNG: + +* **DatabarAspectRatio15.png** – um código de barras compacto adequado para etiquetas de altura limitada. +* **DatabarAspectRatio30.png** – um código de barras mais alto que muitos scanners leem de forma mais confiável à distância. + +Ambas as imagens estão prontas para serem incorporadas em PDFs, impressas em recibos ou enviadas para um aplicativo móvel. + +## Passo 4: Estender a solução para gerar qualquer número de códigos de barras + +O padrão mostrado acima escala facilmente: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – O loop itera sobre um array de proporções, criando uma **imagem de código de barras** distinta para cada valor. +* Ajuste o `EncodeTypes` ou a string codificada para gerar QR codes, Code 128 ou outras simbologias sem alterar a lógica circundante. + +## Dicas práticas e armadilhas comuns + +| Tip | Explanation | +|-----|-------------| +| **Reutilizar o mesmo gerador** | Reinicializar o `BarcodeGenerator` para cada imagem adiciona sobrecarga desnecessária. Alterar os parâmetros entre chamadas de `Save` é mais rápido e consome menos memória. | +| **Validar a pasta de saída** | Sempre chame `Directory.CreateDirectory` antes de salvar; caso contrário, `Save` lança uma `DirectoryNotFoundException`. | +| **Escolher uma X‑dimension apropriada** | Valores de pixel muito baixos (ex.: 1) podem tornar o código de barras ilegível em telas de baixa resolução. Valores entre 2 e 3 funcionam bem na maioria das impressoras. | +| **Prestar atenção à codificação** | O GS1 DataBar espera um prefixo `(01)` para GTIN. Se você omitir os parênteses, a biblioteca pode gerar um código de barras inválido. | +| **Testar com um scanner real** | A inspeção visual não é suficiente. Teste os arquivos PNG com o hardware de scanner real que você pretende usar. | + +## Saída esperada (descrição visual) + +*Ambos os arquivos PNG exibem um código de barras DataBar Stacked Omnidirectional escuro sobre fundo claro. A versão com proporção 15 é mais curta, enquanto a versão com proporção 30 é aproximadamente duas vezes mais alta.* + +Se você incorporar as imagens em um documento, elas serão renderizadas nítidas porque definimos `XDimension.Pixels = 2`. + +## Conclusão + +Agora você sabe como **criar arquivos de imagem de código de barras** usando um **gerador de código de barras C#**, e pode **gerar múltiplos códigos de barras** ajustando a proporção ou qualquer outro parâmetro. O exemplo completo e executável demonstra boas práticas, como reutilizar a instância do gerador, lidar com diretórios de saída e verificar a criação dos arquivos. + +Em seguida, você pode explorar: + +* Adicionar cores personalizadas com `generator.Parameters.Barcode.Color` (palavra‑chave secundária: **c# barcode generator**) +* Exportar para outros formatos como JPEG ou SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Integrar a lógica de criação de códigos de barras em uma Web API para servir imagens sob demanda (palavra‑chave secundária + +## O que você deve aprender a seguir? + +Os tutoriais a seguir abordam tópicos estreitamente relacionados que se baseiam nas técnicas demonstradas neste guia. Cada recurso inclui exemplos de código completos e funcionais com explicações passo a passo para ajudá‑lo a dominar recursos adicionais da API e explorar abordagens alternativas de implementação em seus próprios projetos. + +- [Criar Barcode PNG – Proporção do DataMatrix – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [tutorial de gerador de barcode c# – Personalizar proporções de código 16K com Aspose.BarCode para .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Como gerar código de barras Aztec com proporção personalizada usando Aspose.BarCode para .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/russian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/russian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..3730f2f5f --- /dev/null +++ b/barcode/russian/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,239 @@ +--- +category: general +date: 2026-08-09 +description: Создайте 4‑колоночный датабар‑код в C# быстро с Aspose.BarCode. Узнайте, + как настроить столбцы, строки и сохранить PNG‑изображения в этом кратком руководстве. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: ru +lastmod: 2026-08-09 +og_description: Создайте 4‑колоночный датабар‑код в C# с использованием Aspose.BarCode, + затем настройте строки и экспортируйте PNG‑изображения для вашего приложения. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Создайте 4‑колоночный штрих‑код Databar в C# – быстрый учебник +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Создание 4‑колоночного штрих‑кода Databar в C# – пошаговое руководство +url: /ru/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Создание 4‑колоночного штрих‑кода DataBar в C# – пошаговое руководство + +Если вам нужно **создать 4‑колоночный штрих‑код DataBar** в C#, этот учебник покажет вам, как это сделать. Мы пройдем процесс генерации штрих‑кода DataBar Expanded Stacked, настройки четырёх колонок и сохранения результата в виде PNG‑изображения. + +В этом руководстве вы узнаете, как: + +* Инициализировать `BarcodeGenerator` для символа **DataBar Expanded Stacked**. +* Установить количество колонок равным 4 (основное требование). +* Настроить количество строк, когда нужен стековый макет с тремя строками. +* Экспортировать штрих‑код в PNG, используя соответствующий **barcode image format**. + +Вам понадобится только библиотека Aspose.BarCode for .NET (версии 23.10 или новее) и среда разработки .NET 6+ вроде Visual Studio 2022. Дополнительные зависимости не требуются. + +--- + +## Как создать 4‑колоночный штрих‑код DataBar + +Первый шаг — создать экземпляр `BarcodeGenerator`, который использует символьную схему **DataBar Expanded Stacked**. Этот класс инкапсулирует все параметры рендеринга, что упрощает переключение между макетами на основе колонок и строк. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Почему это работает:** +`EncodeTypes.DatabarExpandedStacked` указывает Aspose.BarCode генерировать стековую версию семейства DataBar. Свойство `DataBar.Columns` определяет, сколько вертикальных модулей занимает штрих‑код. Установка значения 4 соответствует требованию **создать 4‑колоночный штрих‑код DataBar**. Наконец, `Save` сохраняет визуальное представление на диск, используя **barcode image format** `Png`. + +### Настройка колонок DataBar Expanded Stacked + +Если требуется другое количество колонок, просто измените целое число, присвоенное `Columns`. Свойство принимает значения от 1 до 4 для варианта expanded stacked. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro tip:* Всегда проверяйте сгенерированный штрих‑код сканером, поддерживающим семейство DataBar, так как только визуальный вид не гарантирует читаемость. + +### Сохранение изображения штрих‑кода + +Перечисление `BarCodeImageFormat` предоставляет несколько вариантов (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG — без потерь и хорошо подходит для большинства веб‑ и десктоп‑сценариев. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Если нужен другой формат, замените `Png` на требуемое значение перечисления. Сохранённый файл можно напрямую встраивать в HTML, PDF или печатать на этикетках. + +## Создание штрих‑кода с пользовательскими строками + +Иногда требуется стековый макет с определённым количеством строк вместо колонок. Класс `BarcodeGenerator` предоставляет свойство `Rows` для этой цели. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Почему строки важны:** +Когда стековый штрих‑код выше, чем шире, свойство `Rows` определяет, на сколько горизонтальных секций делится символ. Установка `Rows = 3` создаёт трехстрочный стековый штрих‑код, что полезно для узких этикеток. + +### Динамическая установка строк штрих‑кода + +Вы можете вычислять количество строк во время выполнения на основе входных данных: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Эта гибкость позволяет **устанавливать строки штрих‑кода** без перекомпиляции приложения. + +## Полный сквозной пример + +Ниже представлен один пример программы, который генерирует как 4‑колоночный штрих‑код, так и 3‑строчный, демонстрируя, как обе конфигурации могут сосуществовать. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Ожидаемый результат:** +В рабочем каталоге приложения появятся два PNG‑файла: + +* `DatabarCols4.png` – штрих‑код DataBar Expanded Stacked с четырьмя вертикальными колонками. +* `DatabarRows3.png` – тот же символ, расположенный в три горизонтальные строки. + +Оба изображения можно открыть в любом просмотрщике изображений или встроить в элемент управления UI. + +--- + +## Часто задаваемые вопросы и особые случаи + +| Вопрос | Ответ | +|----------|--------| +| *Можно ли использовать другую символьную схему штрих‑кода?* | Да. Замените `EncodeTypes.DatabarExpandedStacked` другим значением `EncodeTypes` (например, `EncodeTypes.QR`), однако свойства `Columns` и `Rows` специфичны для семейств DataBar. | +| *Что делать, если строка данных превышает максимальную длину?* | Символьная схема DataBar Expanded Stacked поддерживает до 61 числового символа. Превышение этого лимита вызывает `ArgumentException`. Проверьте входные данные перед передачей их генератору. | +| *Нужно ли освобождать `BarcodeGenerator`?* | `BarcodeGenerator` реализует `IDisposable`. В длительно работающем сервисе оберните его в блок `using` или вызовите `Dispose()` вручную, чтобы освободить нативные ресурсы. | +| *Можно ли генерировать SVG вместо PNG?* | Конечно. Используйте `BarCodeImageFormat.Svg` в методе `Save`. | +| *Совместима ли библиотека с .NET Core?* | Aspose.BarCode for .NET поддерживает .NET Core 3.1, .NET 5, .NET 6 и более новые версии. Изменения кода не требуются. | + +## Заключение + +Теперь вы знаете, как **создать 4‑колоночный штрих‑код DataBar** в C# с помощью Aspose.BarCode, как настроить макет с помощью строк и как экспортировать результат в удобный **barcode image format**. Полный пример демонстрирует как конфигурацию на основе колонок, так и на основе строк, предоставляя прочную основу для любых сценариев печати этикеток или мобильного сканирования. + +**Следующие шаги** + +* Экспериментировать с различными данными и проверять совместимость со сканером. +* Исследовать дополнительные параметры оформления, такие как цвета переднего/фонового плана (`generator.Parameters.Barcode.Color`). +* Комбинировать штрих‑код с другими графическими элементами, используя API `Graphics` для создания пользовательских дизайнов этикеток. + +Не стесняйтесь адаптировать код для проектов ASP.NET Core, Windows Forms или Xamarin — Aspose.BarCode работает на всех платформах .NET. Приятного кодинга! + +## Что изучать дальше? + +Следующие учебники охватывают тесно связанные темы, основанные на техниках, продемонстрированных в этом руководстве. Каждый ресурс содержит полностью рабочие примеры кода с пошаговыми объяснениями, помогающие вам освоить дополнительные возможности API и исследовать альтернативные подходы к реализации в ваших проектах. + +- [Создать изображение штрих‑кода DotCode – строки и колонки (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Создать изображение штрих‑кода c# – Настройка строк и колонок Codablock F](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Как создать расширенный код текста dotcode с Aspose.BarCode для .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/russian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/russian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..e446ddc41 --- /dev/null +++ b/barcode/russian/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,303 @@ +--- +category: general +date: 2026-08-09 +description: Создайте изображение штрихкода в C# с этим пошаговым руководством. Узнайте, + как генерировать штрихкод, регулировать высоту штрихкода в пикселях и эффективно + создавать несколько штрихкодов. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: ru +lastmod: 2026-08-09 +og_description: Создайте изображение штрихкода в C# быстро. Следуйте этому руководству, + чтобы узнать, как генерировать штрихкод, задавать высоту штрихкода в пикселях и + создавать несколько штрихкодов. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Создание изображения штрих‑кода в C# – полное руководство для разработчиков +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Создание изображения штрих‑кода в C# — полное руководство по программированию +url: /ru/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Создание изображения штрих‑кода в C# – полное руководство по программированию + +Если вам нужно **создать изображение штрих‑кода** в приложении .NET, это руководство покажет вам точно **как генерировать штрих‑код** с использованием библиотеки Aspose.BarCode. Вы увидите, как управлять **пикселями высоты штрих‑кода**, сохранять изображение и создавать **несколько штрих‑кодов** без дублирования кода. + +В руководстве рассматривается всё — от установки пакета до настройки размеров, так что вы можете скопировать‑вставить готовый пример, готовый к запуску, в свой проект уже сегодня. + +## Предварительные требования + +* .NET 6.0 SDK или более поздняя версия, установленная +* Visual Studio 2022 (или любой IDE для C#) +* Пакет NuGet `Aspose.BarCode` – установить с помощью + +```bash +dotnet add package Aspose.BarCode +``` + +Дополнительные зависимости не требуются. + +## Как сгенерировать изображение штрих‑кода с помощью BarcodeGenerator C# + +Основным классом для создания изображения штрих‑кода является `BarcodeGenerator`. Он инкапсулирует тип кодирования, строку данных и все параметры рендеринга. + +### Шаг 1: Определите папку вывода + +Выберите папку, в которой будут сохраняться сгенерированные PNG‑файлы. Использование абсолютного пути избавляет от неожиданностей с правами доступа. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Почему?** Программное создание папки гарантирует, что последующие вызовы `Save` будут успешными даже на чистой машине. + +### Шаг 2: Создайте экземпляр генератора штрих‑кода + +Для штрих‑кода DataBar Omnidirectional передайте `EncodeTypes.DatabarOmniDirectional` и строку данных GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Примечание:** Объект `BarcodeGenerator` можно переиспользовать; вы можете менять его параметры между сохранениями, чтобы **создавать несколько штрих‑кодов** из одних и тех же данных. + +### Шаг 3: Установите общие параметры штрих‑кода + +Самыми распространёнными визуальными настройками являются X‑размер (ширина модуля) и высота штриха. Оба параметра задаются в пикселях. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Зачем задавать X‑размер?** Меньший X‑размер дает более высокое разрешение, что важно, когда изображение будет печататься или отображаться на экранах с высоким DPI. + +### Шаг 4: Сохраните первое изображение штрих‑кода + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +Файл `DatabarBarHeight30Pixels.png` теперь содержит DataBar Omnidirectional штрих‑код высотой 30 пикселей. + +### Шаг 5: Измените высоту штрих‑кода в пикселях + +Изменение высоты не требует создания нового экземпляра `BarcodeGenerator` — достаточно изменить параметр. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Шаг 6: Сохраните второе изображение штрих‑кода + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Теперь у вас есть два PNG‑файла с разными **пикселями высоты штрих‑кода**, демонстрирующие, насколько просто создавать варианты **изображения штрих‑кода**. + +## Динамическая установка высоты штрих‑кода в пикселях + +Часто требуется серия штрих‑кодов с высотой, соответствующей элементам UI или печатным этикеткам. Ниже приведён вспомогательный метод, абстрагирующий изменение высоты: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Теперь вы можете вызвать `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");`, чтобы **создать изображение штрих‑кода** высотой 45 пикселей одной строкой. + +## Создание нескольких штрих‑кодов в цикле + +Когда у вас есть коллекция идентификаторов продуктов, цикл `foreach` устраняет повторяющийся код. Этот пример показывает, как **создавать несколько штрих‑кодов** из массива GTIN. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +Цикл создаёт три PNG‑файла, каждый с отдельным значением **пикселей высоты штрих‑кода**. Поскольку вспомогательный метод `SaveBarcodeWithHeight` инкапсулирует изменение высоты, основной цикл остаётся чистым и сосредоточенным на данных. + +### Ожидаемый результат + +После выполнения полного примера в папке `Barcodes` будет: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Открытие любого PNG‑файла покажет чёткий DataBar Omnidirectional штрих‑код, который может быть считан стандартными мобильными приложениями. + +## Распространённые ошибки и профессиональные советы + +| Проблема | Почему происходит | Как избежать | +|----------|-------------------|--------------| +| **Неправильные EncodeTypes** | Использование 1D‑типа для DataBar приводит к нечитаемому изображению. | Всегда выбирайте `EncodeTypes.DatabarOmniDirectional` (или другую вариацию DataBar) для полезных данных GS1‑128. | +| **Недостаточный X‑dimension** | Очень маленький X‑dimension может привести к исчезновению тонких штрихов на мониторах с низким разрешением. | Держите `XDimension.Pixels` ≥ 2 для отображения на экране; увеличьте до 3‑4 для печати. | +| **Ошибки пути к файлу** | Относительные пути могут разрешаться в неожиданные каталоги. | Используйте `Path.Combine` и `Environment.CurrentDirectory` для построения абсолютных путей. | +| **Перезапись изображений** | Повторное использование одного и того же имени файла в цикле перезаписывает предыдущие результаты. | Включайте уникальные идентификаторы (например, GTIN или метку времени) в имя файла. | +| **Отсутствующий пакет NuGet** | Код компилируется, но во время выполнения бросает `FileNotFoundException`. | Убедитесь, что `Aspose.BarCode` установлен и проект ссылается на него. | + +## Полный рабочий пример + +Ниже представлен полный код программы, который вы можете скопировать в консольное приложение. Он включает все шаги, вспомогательные методы и обработку ошибок. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Запуск этой программы + +## Что изучать дальше? + +Следующие руководства охватывают тесно связанные темы, опирающиеся на техники, продемонстрированные в этом руководстве. Каждый ресурс включает полностью работающие примеры кода с пошаговыми объяснениями, чтобы помочь вам освоить дополнительные возможности API и изучить альтернативные подходы к реализации в собственных проектах. + +- [Создать штрих‑код с пользовательской высотой – Одномерные штрих‑коды](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Создать изображение штрих‑кода C# – Пример GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Создать изображение штрих‑кода DotCode – строки и столбцы (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/russian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/russian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..8f8bfca61 --- /dev/null +++ b/barcode/russian/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-09 +description: Создайте изображение штрихкода с помощью генератора штрихкодов на C# + и научитесь генерировать несколько штрихкодов с пользовательскими соотношениями + сторон за считанные минуты. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: ru +lastmod: 2026-08-09 +og_description: Создайте изображение штрихкода с помощью генератора штрихкодов на + C#. Этот учебник показывает, как генерировать несколько штрихкодов, регулировать + соотношения сторон и эффективно сохранять файлы PNG. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Создайте изображение штрихкода с помощью генератора штрихкодов на C# – краткое + руководство +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Создание изображения штрихкода с помощью генератора штрихкодов на C# – руководство +url: /ru/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Создание изображения штрихкода с помощью C# barcode generator – руководство + +Если вам нужно **create barcode image** быстро, это руководство покажет, как сделать это с помощью C# barcode generator. Вы научитесь генерировать несколько штрихкодов, менять соотношение сторон и сохранять каждое изображение в файл PNG. + +Генерация изображений штрихкодов — распространённая задача при построении систем учёта, точек продаж или этикеток для отправки. К концу этого руководства у вас будет два готовых PNG‑файла, демонстрирующих разные соотношения сторон, и вы поймёте, как расширить подход для любого количества штрихкодов. + +## Prerequisites + +Перед началом убедитесь, что у вас есть: + +* .NET 6.0 SDK или более поздняя версия +* Visual Studio 2022 (или любая IDE, поддерживающая C#) +* Ссылка на библиотеку штрихкодов, поддерживающую DataBar Stacked Omnidirectional (например, **Aspose.BarCode for .NET**). В примерах используется API Aspose, но концепции применимы к любой библиотеке с аналогичными свойствами. + +Отдельную базу данных или веб‑сервер не требуется — это обычное консольное приложение. + +## Step 1: Set up the console project + +Создайте новый консольный проект и добавьте библиотеку штрихкодов через NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +Команда `dotnet add package` загружает последнюю стабильную версию **Aspose.BarCode**, которая предоставляет класс `BarcodeGenerator`, используемый далее. + +## Step 2: Write the full program + +Откройте *Program.cs* и замените его содержимое полным примером ниже. Программа создаёт **barcode image**, меняет соотношение сторон и сохраняет два PNG‑файла. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Why each part matters + +* **Create barcode image** – Конструктор `BarcodeGenerator` инициализирует объект с нужной символьностью и данными. +* **c# barcode generator** – Свойство `Parameters` даёт полный контроль над параметрами рендеринга; установка `XDimension.Pixels` гарантирует чёткость каждой полосы на экране. +* **generate multiple barcodes** – Изменяя `DataBar.AspectRatio` между сохранениями, один экземпляр генератора создаёт два разных изображения без повторного создания объекта, что более эффективно. + +## Step 3: Run the program and view the results + +Запустите приложение: + +```bash +dotnet run +``` + +Вы должны увидеть вывод в консоли, похожий на: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Откройте папку `BarcodeOutputs`. Вы найдёте два PNG‑файла: + +* **DatabarAspectRatio15.png** – компактный штрихкод, подходящий для этикеток с ограниченной высотой. +* **DatabarAspectRatio30.png** – более высокий штрихкод, который многие сканеры читают надёжнее с расстояния. + +Оба изображения готовы к внедрению в PDF, печати на чеках или отправке в мобильное приложение. + +## Step 4: Extend the solution to generate any number of barcodes + +Показанный выше шаблон легко масштабируется: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – Цикл проходит по массиву соотношений сторон, создавая отдельное **barcode image** для каждого значения. +* Измените `EncodeTypes` или строку для кодирования, чтобы получать QR‑коды, Code 128 или другие символьности без изменения основной логики. + +## Practical tips and common pitfalls + +| Tip | Explanation | +|-----|-------------| +| **Reuse the same generator** | Повторная инициализация `BarcodeGenerator` для каждого изображения добавляет лишние затраты. Изменение параметров между вызовами `Save` быстрее и требует меньше памяти. | +| **Validate the output folder** | Всегда вызывайте `Directory.CreateDirectory` перед сохранением; иначе `Save` бросит `DirectoryNotFoundException`. | +| **Choose an appropriate X‑dimension** | Очень низкие пиксельные значения (например, 1) могут сделать штрихкод нечитаемым на экранах с низким разрешением. Значения 2–3 хорошо работают для большинства принтеров. | +| **Mind the encoding** | GS1 DataBar ожидает ведущий `(01)` для GTIN. Если опустить скобки, библиотека может сгенерировать недействительный штрихкод. | +| **Test with a real scanner** | Визуальная проверка недостаточна. Тестируйте PNG‑файлы на реальном сканере, который планируете использовать. | + +## Expected output (visual description) + +*Оба PNG‑файла показывают темный на светлом DataBar Stacked Omnidirectional штрихкод. Версия с соотношением 15 короче, а версия с соотношением 30 примерно вдвое выше.* + +Если вы вставите изображения в документ, они отобразятся чётко, потому что мы задали `XDimension.Pixels = 2`. + +## Conclusion + +Теперь вы знаете, как **create barcode image** файлы с помощью **C# barcode generator**, и как **generate multiple barcodes**, меняя соотношение сторон или любой другой параметр. Полный, готовый к запуску пример демонстрирует лучшие практики, такие как повторное использование экземпляра генератора, обработка каталогов вывода и проверка создания файлов. + +Далее вы можете изучить: + +* Добавление пользовательских цветов через `generator.Parameters.Barcode.Color` (вторичное ключевое слово: **c# barcode generator**) +* Экспорт в другие форматы, такие как JPEG или SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Интеграцию логики создания штрихкода в Web API для обслуживания изображений по запросу (вторичное ключевое слово + +## What Should You Learn Next? + +Следующие руководства охватывают тесно связанные темы, которые развивают техники, продемонстрированные в этом руководстве. Каждый ресурс включает полностью рабочие примеры кода с пошаговыми объяснениями, помогающими освоить дополнительные возможности API и исследовать альтернативные подходы в ваших проектах. + +- [Create Barcode PNG – DataMatrix Aspect Ratio – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Customize Code 16K Barcode Aspect Ratios with Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/spanish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/spanish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..9c531baf6 --- /dev/null +++ b/barcode/spanish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,242 @@ +--- +category: general +date: 2026-08-09 +description: Crea un código de barras databar de 4 columnas en C# rápidamente con + Aspose.BarCode. Aprende a configurar columnas, filas y guardar imágenes PNG en esta + guía concisa. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: es +lastmod: 2026-08-09 +og_description: Crea un código de barras databar de 4 columnas en C# usando Aspose.BarCode, + luego personaliza filas y exporta imágenes PNG para tu aplicación. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Crear código de barras databar de 4 columnas en C# – tutorial rápido +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Crear código de barras databar de 4 columnas en C# – guía paso a paso +url: /es/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Crear código de barras databar de 4 columnas en C# – guía paso a paso + +Si necesitas **crear un código de barras databar de 4 columnas** en C#, este tutorial te muestra exactamente cómo hacerlo. Recorreremos la generación de un código de barras DataBar Expanded Stacked, la configuración de cuatro columnas y el guardado del resultado como una imagen PNG. + +En esta guía aprenderás a: + +* Inicializar el `BarcodeGenerator` para un símbolo **DataBar Expanded Stacked**. +* Establecer el recuento de columnas a 4 (el requisito principal). +* Ajustar el recuento de filas cuando necesites un diseño apilado con tres filas. +* Exportar el código de barras como PNG usando el **formato de imagen de código de barras** adecuado. + +Solo necesitas la biblioteca Aspose.BarCode para .NET (versión 23.10 o posterior) y un entorno de desarrollo .NET 6+ como Visual Studio 2022. No se requieren dependencias adicionales. + +--- + +## Cómo crear un código de barras databar de 4 columnas + +El primer paso es crear una instancia de `BarcodeGenerator` que apunte a la simbología **DataBar Expanded Stacked**. Esta clase encapsula todas las opciones de renderizado, lo que facilita cambiar entre diseños basados en columnas y en filas. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Por qué funciona:** +`EncodeTypes.DatabarExpandedStacked` indica a Aspose.BarCode que produzca la versión apilada de la familia DataBar. La propiedad `DataBar.Columns` controla cuántos módulos verticales ocupa el código de barras. Establecerla en 4 coincide con el requisito de **crear un código de barras databar de 4 columnas**. Finalmente, `Save` escribe la representación visual en disco usando el **formato de imagen de código de barras** `Png`. + +### Configurar columnas de DataBar Expanded Stacked + +Si necesitas un recuento de columnas diferente, simplemente cambia el entero asignado a `Columns`. La propiedad acepta valores de 1 a 4 para la variante expandida apilada. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Consejo profesional:* Siempre prueba el código de barras generado con un escáner que admita la familia DataBar, porque la apariencia visual por sí sola no garantiza la legibilidad. + +### Guardar la imagen del código de barras + +La enumeración `BarCodeImageFormat` ofrece varias opciones (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG es sin pérdida y funciona bien para la mayoría de los escenarios web y de escritorio. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Si necesitas un formato diferente, reemplaza `Png` por el valor de enumeración deseado. El archivo guardado puede incrustarse directamente en HTML, PDFs o imprimirse en etiquetas. + +## Crear un código de barras con filas personalizadas + +A veces se requiere un diseño apilado con un número específico de filas en lugar de columnas. La misma clase `BarcodeGenerator` expone una propiedad `Rows` para este propósito. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Por qué importan las filas:** +Cuando el código de barras apilado es más alto que ancho, la propiedad `Rows` determina cuántas secciones horizontales divide el símbolo. Establecer `Rows = 3` crea un código de barras apilado de tres filas, lo que es útil para etiquetas de ancho estrecho. + +### Establecer filas del código de barras dinámicamente + +Puedes calcular el número de filas en tiempo de ejecución según los datos de entrada: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Esta flexibilidad te permite **establecer filas del código de barras** sin recompilar la aplicación. + +## Ejemplo completo de extremo a extremo + +A continuación se muestra un programa único que genera tanto un código de barras de 4 columnas como uno de 3 filas, demostrando cómo coexisten ambas configuraciones. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Salida esperada:** +Dos archivos PNG aparecen en el directorio de trabajo de la aplicación: + +* `DatabarCols4.png` – un código de barras DataBar Expanded Stacked con cuatro columnas verticales. +* `DatabarRows3.png` – la misma simbología organizada en tres filas horizontales. + +Ambas imágenes pueden abrirse en cualquier visor de imágenes o incrustarse en un control de UI. + +--- + +## Preguntas frecuentes y casos límite + +| Pregunta | Respuesta | +|----------|-----------| +| *¿Puedo usar una simbología de código de barras diferente?* | Sí. Reemplaza `EncodeTypes.DatabarExpandedStacked` por otro valor de `EncodeTypes` (p. ej., `EncodeTypes.QR`), pero las propiedades `Columns` y `Rows` son específicas de las familias DataBar. | +| *¿Qué ocurre si la cadena de datos supera la longitud máxima?* | La simbología DataBar Expanded Stacked admite hasta 61 caracteres numéricos. Superar este límite lanza una `ArgumentException`. Valida la entrada antes de asignarla al generador. | +| *¿Necesito disponer de `BarcodeGenerator`?* | `BarcodeGenerator` implementa `IDisposable`. En un servicio de larga ejecución, envuélvelo en un bloque `using` o llama a `Dispose()` manualmente para liberar recursos nativos. | +| *¿Puedo generar SVG en lugar de PNG?* | Por supuesto. Usa `BarCodeImageFormat.Svg` en el método `Save`. | +| *¿La biblioteca es compatible con .NET Core?* | Aspose.BarCode para .NET soporta .NET Core 3.1, .NET 5, .NET 6 y versiones posteriores. No se requieren cambios de código. | + +--- + +## Conclusión + +Ahora sabes cómo **crear un código de barras databar de 4 columnas** en C# usando Aspose.BarCode, cómo ajustar el diseño con filas y cómo exportar el resultado en un **formato de imagen de código de barras** conveniente. El ejemplo completo muestra configuraciones basadas en columnas y en filas, dándote una base sólida para cualquier escenario de impresión de etiquetas o escaneo móvil. + +**Próximos pasos** + +* Experimenta con diferentes cargas de datos y verifica la compatibilidad del escáner. +* Explora opciones de estilo adicionales como colores de primer plano/fondo (`generator.Parameters.Barcode.Color`). +* Combina el código de barras con otros gráficos usando la API `Graphics` para diseños de etiquetas personalizados. + +Siéntete libre de adaptar el código para proyectos ASP.NET Core, Windows Forms o Xamarin—Aspose.BarCode funciona en todas las plataformas .NET. ¡Feliz codificación! + +## ¿Qué deberías aprender a continuación? + +Los siguientes tutoriales cubren temas estrechamente relacionados que amplían las técnicas demostradas en esta guía. Cada recurso incluye ejemplos de código completos y explicaciones paso a paso para ayudarte a dominar funciones adicionales de la API y explorar enfoques de implementación alternativos en tus propios proyectos. + +- [Crear imagen de código de barras DotCode – filas y columnas (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Crear imagen de código de barras c# – Configurar filas y columnas de Codablock F](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Cómo crear texto de código extendido dotcode con Aspose.BarCode para .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/spanish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/spanish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..9ac545965 --- /dev/null +++ b/barcode/spanish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,306 @@ +--- +category: general +date: 2026-08-09 +description: Crea una imagen de código de barras en C# con esta guía paso a paso. + Aprende a generar códigos de barras, ajustar la altura del código de barras en píxeles + y crear múltiples códigos de barras de manera eficiente. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: es +lastmod: 2026-08-09 +og_description: Crea una imagen de código de barras en C# rápidamente. Sigue este + tutorial para aprender a generar códigos de barras, establecer la altura del código + de barras en píxeles y producir múltiples códigos de barras. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Crear imagen de código de barras en C# – guía completa para desarrolladores +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Crear imagen de código de barras en C# – guía completa de programación +url: /es/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Crear imagen de código de barras en C# – guía completa de programación + +Si necesitas **crear una imagen de código de barras** en una aplicación .NET, esta guía te muestra exactamente **cómo generar códigos de barras** usando la biblioteca Aspose.BarCode. Verás cómo controlar los **píxeles de altura del código de barras**, guardar la imagen y producir **múltiples códigos de barras** sin duplicar código. + +El tutorial cubre todo, desde la instalación del paquete hasta la personalización de dimensiones, para que puedas copiar‑pegar un ejemplo listo para ejecutar en tu proyecto hoy mismo. + +## Requisitos previos + +Antes de comenzar, asegúrate de tener: + +* SDK .NET 6.0 o posterior instalado +* Visual Studio 2022 (o cualquier IDE de C#) +* Paquete NuGet `Aspose.BarCode` – instalar con + +```bash +dotnet add package Aspose.BarCode +``` + +No se requieren dependencias adicionales. + +## Cómo generar una imagen de código de barras con BarcodeGenerator C# + +La clase principal para crear una imagen de código de barras es `BarcodeGenerator`. Encapsula el tipo de codificación, la cadena de datos y todos los parámetros de renderizado. + +### Paso 1: Definir la carpeta de salida + +Elige una carpeta donde se almacenarán los archivos PNG generados. Usar una ruta absoluta evita sorpresas de permisos. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **¿Por qué?** Crear la carpeta programáticamente garantiza que las llamadas posteriores a `Save` tengan éxito incluso en una máquina nueva. + +### Paso 2: Instanciar el generador de códigos de barras + +Para un código de barras DataBar Omnidirectional, pasa `EncodeTypes.DatabarOmniDirectional` y la cadena de datos GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Nota:** El objeto `BarcodeGenerator` es reutilizable; puedes cambiar sus parámetros entre guardados para **crear múltiples códigos de barras** a partir de los mismos datos. + +### Paso 3: Establecer los parámetros comunes del código de barras + +Los ajustes visuales más comunes son la X‑dimension (ancho del módulo) y la altura de la barra. Ambos se expresan en píxeles. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **¿Por qué establecer la X‑dimension?** Una X‑dimension más pequeña produce mayor resolución, lo cual es importante cuando la imagen se imprimirá o mostrará en pantallas de alta DPI. + +### Paso 4: Guardar la primera imagen de código de barras + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +El archivo `DatabarBarHeight30Pixels.png` ahora contiene un código de barras DataBar Omnidirectional de 30 píxeles de altura. + +### Paso 5: Ajustar los píxeles de altura del código de barras + +Cambiar la altura no requiere una nueva instancia de `BarcodeGenerator`, solo modifica el parámetro. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Paso 6: Guardar la segunda imagen de código de barras + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Ahora tienes dos archivos PNG con diferentes **píxeles de altura del código de barras**, demostrando lo fácil que es crear variaciones de **imagen de código de barras**. + +## Configurar dinámicamente los píxeles de altura del código de barras + +A menudo necesitas una serie de códigos de barras con alturas que coincidan con elementos de UI o etiquetas impresas. El siguiente método auxiliar abstrae el cambio de altura: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Ahora puedes llamar a `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` para **crear una imagen de código de barras** con una altura de 45 píxeles en una sola línea. + +## Crear múltiples códigos de barras en un bucle + +Cuando tienes una colección de identificadores de producto, un bucle `foreach` elimina el código repetitivo. Este ejemplo muestra cómo **crear múltiples códigos de barras** a partir de un arreglo de GTINs. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +El bucle produce tres archivos PNG, cada uno con un valor distinto de **píxeles de altura del código de barras**. Como el método auxiliar `SaveBarcodeWithHeight` encapsula el cambio de altura, el bucle principal se mantiene limpio y centrado en los datos. + +### Resultado esperado + +Después de ejecutar el ejemplo completo, la carpeta `Barcodes` contiene: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Abrir cualquier PNG muestra un código de barras DataBar Omnidirectional nítido que puede ser escaneado por aplicaciones móviles estándar. + +## Errores comunes y consejos profesionales + +| Problema | Por qué ocurre | Cómo evitarlo | +|----------|----------------|---------------| +| **EncodeTypes incorrectos** | Usar un tipo 1D para un DataBar producirá una imagen ilegible. | Siempre elige `EncodeTypes.DatabarOmniDirectional` (u otra variante DataBar) para cargas útiles GS1‑128. | +| **X‑dimension insuficiente** | Una X‑dimension muy baja puede hacer que las barras finas desaparezcan en monitores de baja resolución. | Mantén `XDimension.Pixels` ≥ 2 para visualización en pantalla; aumenta a 3‑4 para impresión. | +| **Errores de ruta de archivo** | Las rutas relativas pueden resolverse a directorios inesperados. | Usa `Path.Combine` y `Environment.CurrentDirectory` para construir rutas absolutas. | +| **Sobrescritura de imágenes** | Reutilizar el mismo nombre de archivo en un bucle sobrescribe resultados anteriores. | Incluye identificadores únicos (p. ej., GTIN o marca de tiempo) en el nombre del archivo. | +| **Paquete NuGet faltante** | El código compila pero lanza `FileNotFoundException` en tiempo de ejecución. | Verifica que `Aspose.BarCode` esté instalado y que el proyecto lo referencie. | + +## Ejemplo completo en funcionamiento + +A continuación se muestra el programa completo que puedes copiar en una aplicación de consola. Incluye todos los pasos, métodos auxiliares y manejo de errores. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Ejecutando este programa + + +## ¿Qué deberías aprender a continuación? + +Los siguientes tutoriales cubren temas estrechamente relacionados que se basan en las técnicas demostradas en esta guía. Cada recurso incluye ejemplos de código completos y funcionales con explicaciones paso a paso para ayudarte a dominar funciones adicionales de la API y explorar enfoques de implementación alternativos en tus propios proyectos. + +- [Crear código de barras con altura personalizada – Códigos de barras unidimensionales](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Crear imagen de código de barras C# – Ejemplo GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Crear imagen de código de barras DotCode – filas y columnas (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/spanish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/spanish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..6c6d33d19 --- /dev/null +++ b/barcode/spanish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,226 @@ +--- +category: general +date: 2026-08-09 +description: Crea una imagen de código de barras con un generador de códigos de barras + en C# y aprende a generar múltiples códigos de barras con relaciones de aspecto + personalizadas en minutos. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: es +lastmod: 2026-08-09 +og_description: Crea una imagen de código de barras usando un generador de códigos + de barras en C#. Este tutorial muestra cómo generar múltiples códigos de barras, + ajustar las proporciones y guardar archivos PNG de manera eficiente. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Crear imagen de código de barras con generador de códigos de barras en C# + – guía rápida +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Crear imagen de código de barras con generador de códigos de barras en C# – + guía +url: /es/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Crear imagen de código de barras con generador de códigos de barras C# – guía + +Si necesitas **crear imagen de código de barras** rápidamente, esta guía te muestra cómo hacerlo con un generador de códigos de barras C#. Aprenderás a generar múltiples códigos de barras, cambiar la relación de aspecto y guardar cada imagen como un archivo PNG. + +Generar imágenes de códigos de barras es una tarea común al crear sistemas de inventario, terminales punto de venta o etiquetas de envío. Al final de este tutorial tendrás dos archivos PNG listos para usar que demuestran diferentes relaciones de aspecto, y comprenderás cómo ampliar el enfoque a cualquier número de códigos de barras. + +## Requisitos previos + +* .NET 6.0 SDK o posterior instalado +* Visual Studio 2022 (o cualquier IDE que soporte C#) +* Una referencia a una biblioteca de códigos de barras que soporte DataBar Stacked Omnidirectional (por ejemplo, **Aspose.BarCode for .NET**). Los fragmentos de código usan la API de Aspose, pero los conceptos se aplican a cualquier biblioteca con propiedades similares. + +No necesitas una base de datos o servidor web separado; esto es una aplicación de consola simple. + +## Paso 1: Configurar el proyecto de consola + +Crea un nuevo proyecto de consola y agrega la biblioteca de códigos de barras mediante NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +El comando `dotnet add package` descarga la última versión estable de **Aspose.BarCode**, que proporciona la clase `BarcodeGenerator` utilizada más adelante. + +## Paso 2: Escribir el programa completo + +Abre *Program.cs* y reemplaza su contenido con el ejemplo completo a continuación. El programa crea una **imagen de código de barras**, cambia la relación de aspecto y guarda dos archivos PNG. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Por qué cada parte es importante + +* **Create barcode image** – El constructor `BarcodeGenerator` inicializa el objeto con la simbología y los datos deseados. +* **c# barcode generator** – La propiedad `Parameters` te brinda control total sobre las opciones de renderizado; establecer `XDimension.Pixels` garantiza que cada barra sea nítida en pantalla. +* **generate multiple barcodes** – Al cambiar `DataBar.AspectRatio` entre guardados, la misma instancia del generador produce dos imágenes distintas sin recrear el objeto, lo que es más eficiente. + +## Paso 3: Ejecutar el programa y ver los resultados + +Ejecuta la aplicación: + +```bash +dotnet run +``` + +Deberías ver una salida en consola similar a: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Abre la carpeta `BarcodeOutputs`. Encontrarás dos archivos PNG: + +* **DatabarAspectRatio15.png** – un código de barras compacto adecuado para etiquetas de altura limitada. +* **DatabarAspectRatio30.png** – un código de barras más alto que muchos escáneres leen de manera más fiable a distancia. + +Ambas imágenes están listas para incrustarse en PDFs, imprimirse en recibos o enviarse a una aplicación móvil. + +## Paso 4: Extender la solución para generar cualquier número de códigos de barras + +El patrón mostrado arriba escala fácilmente: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – El bucle itera sobre una matriz de relaciones de aspecto, creando una **imagen de código de barras** distinta para cada valor. +* Ajusta `EncodeTypes` o la cadena codificada para generar códigos QR, Code 128 u otras simbologías sin cambiar la lógica circundante. + +## Consejos prácticos y errores comunes + +| Consejo | Explicación | +|-----|-------------| +| **Reutilizar el mismo generador** | Re‑inicializar `BarcodeGenerator` para cada imagen añade una sobrecarga innecesaria. Cambiar los parámetros entre llamadas a `Save` es más rápido y usa menos memoria. | +| **Validar la carpeta de salida** | Siempre llama a `Directory.CreateDirectory` antes de guardar; de lo contrario `Save` lanza una `DirectoryNotFoundException`. | +| **Elegir una X‑dimension adecuada** | Valores de píxeles muy bajos (p. ej., 1) pueden hacer que el código de barras sea ilegible en pantallas de baja resolución. Valores de 2–3 funcionan bien para la mayoría de impresoras. | +| **Cuidar la codificación** | GS1 DataBar espera un prefijo `(01)` para GTIN. Si omites los paréntesis, la biblioteca puede generar un código de barras inválido. | +| **Probar con un escáner real** | La inspección visual no es suficiente. Prueba los archivos PNG con el hardware de escáner real que planeas usar. | + +## Resultado esperado (descripción visual) + +*Ambos archivos PNG muestran un código de barras DataBar Stacked Omnidirectional oscuro sobre fondo claro. La versión con relación de aspecto 15 es más corta, mientras que la versión con relación de aspecto 30 es aproximadamente el doble de alta.* + +Si incrustas las imágenes en un documento, se renderizarán nítidamente porque establecimos `XDimension.Pixels = 2`. + +## Conclusión + +Ahora sabes cómo **crear archivos de imagen de código de barras** usando un **generador de códigos de barras C#**, y puedes **generar múltiples códigos de barras** ajustando la relación de aspecto o cualquier otro parámetro. El ejemplo completo y ejecutable demuestra buenas prácticas como reutilizar la instancia del generador, manejar directorios de salida y verificar la creación de archivos. + +Next, you might explore: + +* Añadir colores personalizados con `generator.Parameters.Barcode.Color` (palabra clave secundaria: **c# barcode generator**) +* Exportar a otros formatos como JPEG o SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Integrar la lógica de creación de códigos de barras en una Web API para servir imágenes bajo demanda (palabra clave secundaria + +## ¿Qué deberías aprender a continuación? + +Los siguientes tutoriales cubren temas estrechamente relacionados que se basan en las técnicas demostradas en esta guía. Cada recurso incluye ejemplos de código completos y funcionales con explicaciones paso a paso para ayudarte a dominar funciones adicionales de la API y explorar enfoques de implementación alternativos en tus propios proyectos. + +- [Crear PNG de código de barras – Relación de aspecto DataMatrix – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [tutorial de generador de códigos de barras c# – Personalizar relaciones de aspecto del código 16K con Aspose.BarCode para .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Cómo generar código de barras Aztec con relación de aspecto personalizada usando Aspose.BarCode para .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/swedish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/swedish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..bee6391f2 --- /dev/null +++ b/barcode/swedish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,242 @@ +--- +category: general +date: 2026-08-09 +description: Skapa 4‑kolumns databar-kodstreck i C# snabbt med Aspose.BarCode. Lär + dig hur du konfigurerar kolumner, rader och sparar PNG‑bilder i den här kortfattade + guiden. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: sv +lastmod: 2026-08-09 +og_description: Skapa en 4‑kolumns databar‑streckkod i C# med Aspose.BarCode, anpassa + sedan rader och exportera PNG‑bilder för din app. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Skapa 4‑kolumns databar‑streckkod i C# – snabb handledning +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Skapa 4‑kolumns databar‑streckkod i C# – steg‑för‑steg‑guide +url: /sv/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Skapa 4‑kolumns databar streckkod i C# – steg‑för‑steg guide + +Om du behöver **skapa 4‑kolumns databar streckkod** i C#, visar den här handledningen exakt hur du gör. Vi går igenom att generera en DataBar Expanded Stacked streckkod, konfigurera fyra kolumner och spara resultatet som en PNG‑bild. + +I den här guiden kommer du att lära dig hur du: + +* Initierar `BarcodeGenerator` för en **DataBar Expanded Stacked**‑symbol. +* Ställer in kolumnantalet till 4 (huvudkravet). +* Justerar radantalet när du behöver en staplad layout med tre rader. +* Exporterar streckkoden som en PNG med det lämpliga **barcode image format**. + +Du behöver bara Aspose.BarCode for .NET‑biblioteket (version 23.10 eller senare) och en .NET 6+ utvecklingsmiljö såsom Visual Studio 2022. Inga ytterligare beroenden krävs. + +--- + +## Så skapar du 4‑kolumns databar streckkod + +Det första steget är att skapa en `BarcodeGenerator`‑instans som riktar sig mot **DataBar Expanded Stacked**‑symboliken. Denna klass kapslar in alla renderingsalternativ, vilket gör det enkelt att växla mellan kolumn‑baserade och rad‑baserade layouter. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Varför detta fungerar:** +`EncodeTypes.DatabarExpandedStacked` talar om för Aspose.BarCode att producera den staplade versionen av DataBar‑familjen. `DataBar.Columns`‑egenskapen styr hur många vertikala moduler streckkoden upptar. Att sätta den till 4 uppfyller kravet att **skapa 4‑kolumns databar streckkod**. Slutligen skriver `Save` den visuella representationen till disk med **barcode image format** `Png`. + +### Konfigurera DataBar Expanded Stacked‑kolumner + +Om du behöver ett annat kolumnantal, ändra helt enkelt heltalet som tilldelas `Columns`. Egenskapen accepterar värden från 1 till 4 för den expanderade staplade varianten. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Pro tip:* Testa alltid den genererade streckkoden med en scanner som stöder DataBar‑familjen, eftersom enbart det visuella utseendet inte garanterar läsbarhet. + +### Spara streckkodbilden + +`BarCodeImageFormat`‑enumerationen erbjuder flera alternativ (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG är förlustfri och fungerar bra för de flesta webb‑ och desktop‑scenarier. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Om du behöver ett annat format, ersätt `Png` med önskat enum‑värde. Den sparade filen kan bäddas in direkt i HTML, PDF‑filer eller skrivas ut på etiketter. + +## Skapa en streckkod med anpassade rader + +Ibland krävs en staplad layout med ett specifikt antal rader istället för kolumner. Samma `BarcodeGenerator`‑klass exponerar en `Rows`‑egenskap för detta ändamål. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Varför rader är viktiga:** +När den staplade streckkoden är högre än den är bred, bestämmer `Rows`‑egenskapen hur många horisontella segment symbolen delas in i. Att sätta `Rows = 3` skapar en staplad streckkod med tre rader, vilket är användbart för smala etikettbredder. + +### Ställ in streckkodens rader dynamiskt + +Du kan beräkna radantalet vid körning baserat på indata: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Denna flexibilitet låter dig **ställa in streckkodens rader** utan att behöva kompilera om applikationen. + +## Fullständigt end‑to‑end‑exempel + +Nedan är ett enda program som genererar både en 4‑kolumns streckkod och en 3‑radig streckkod, vilket demonstrerar hur de två konfigurationerna kan samexistera. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Förväntat resultat:** +Två PNG‑filer visas i applikationens arbetskatalog: + +* `DatabarCols4.png` – en DataBar Expanded Stacked‑streckkod med fyra vertikala kolumner. +* `DatabarRows3.png` – samma symbolik arrangerad i tre horisontella rader. + +Båda bilderna kan öppnas i vilken bildvisare som helst eller bäddas in i en UI‑kontroll. + +--- + +## Vanliga frågor och edge cases + +| Question | Answer | +|----------|--------| +| *Kan jag använda en annan streckkodssymbol?* | Ja. Ersätt `EncodeTypes.DatabarExpandedStacked` med ett annat `EncodeTypes`‑värde (t.ex. `EncodeTypes.QR`), men `Columns`‑ och `Rows`‑egenskaperna är specifika för DataBar‑familjer. | +| *Vad händer om datasträngen överskrider maximal längd?* | DataBar Expanded Stacked‑symboliken stödjer upp till 61 numeriska tecken. Att överskrida denna gräns kastar ett `ArgumentException`. Validera indata innan du tilldelar den till generatorn. | +| *Behöver jag avlasta `BarcodeGenerator`?* | `BarcodeGenerator` implementerar `IDisposable`. I en långvarig tjänst, omslut den i ett `using`‑block eller anropa `Dispose()` manuellt för att frigöra inhemska resurser. | +| *Kan jag generera SVG istället för PNG?* | Absolut. Använd `BarCodeImageFormat.Svg` i `Save`‑metoden. | +| *Är biblioteket kompatibelt med .NET Core?* | Aspose.BarCode for .NET stödjer .NET Core 3.1, .NET 5, .NET 6 och senare. Inga kodändringar krävs. | + +--- + +## Slutsats + +Du vet nu hur du **skapar 4‑kolumns databar streckkod** i C# med Aspose.BarCode, hur du justerar layouten med rader, och hur du exporterar resultatet i ett bekvämt **barcode image format**. Det kompletta exemplet visar både kolumn‑baserade och rad‑baserade konfigurationer, vilket ger dig en solid grund för alla etikett‑utskrift‑ eller mobil‑scanningsscenarier. + +**Nästa steg** + +* Experimentera med olika datapayloads och verifiera scanner‑kompatibilitet. +* Utforska ytterligare stilalternativ såsom förgrunds‑/bakgrundsfärger (`generator.Parameters.Barcode.Color`). +* Kombinera streckkoden med annan grafik via `Graphics`‑API:t för anpassade etikettdesigner. + +Känn dig fri att anpassa koden för ASP.NET Core, Windows Forms eller Xamarin‑projekt—Aspose.BarCode fungerar på alla .NET‑plattformar. Lycka till med kodningen! + +## Vad bör du lära dig härnäst? + +Följande handledningar täcker närbesläktade ämnen som bygger på teknikerna som demonstrerats i denna guide. Varje resurs innehåller kompletta fungerande kodexempel med steg‑för‑steg‑förklaringar för att hjälpa dig bemästra ytterligare API‑funktioner och utforska alternativa implementationsmetoder i dina egna projekt. + +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Create barcode image c# – Configure Codablock F Rows & Columns](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [How to create dotcode extended codetext with Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/swedish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/swedish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..9ace6611d --- /dev/null +++ b/barcode/swedish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,303 @@ +--- +category: general +date: 2026-08-09 +description: Skapa streckkodbild i C# med den här steg‑för‑steg‑guiden. Lär dig hur + du genererar streckkod, justerar streckkodens höjd i pixlar och skapar flera streckkoder + effektivt. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: sv +lastmod: 2026-08-09 +og_description: Skapa streckkodbild i C# snabbt. Följ den här handledningen för att + lära dig hur du genererar streckkod, ställer in streckkodens höjd i pixlar och skapar + flera streckkoder. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Skapa streckkodbild i C# – fullständig guide för utvecklare +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Skapa streckkodbild i C# – komplett programmeringsguide +url: /sv/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Skapa streckkodbild i C# – komplett programmeringsguide + +Om du behöver **create barcode image** i en .NET-applikation, visar den här guiden exakt **how to generate barcode** med hjälp av Aspose.BarCode-biblioteket. Du kommer att se hur du styr **barcode height pixels**, sparar bilden och skapar **multiple barcodes** utan att duplicera kod. + +Handledningen täcker allt från installation av paketet till anpassning av dimensioner, så att du kan copy‑paste ett färdigt exempel som kan köras direkt in i ditt projekt idag. + +## Förutsättningar + +* .NET 6.0 SDK eller senare installerat +* Visual Studio 2022 (eller någon C# IDE) +* NuGet‑paketet `Aspose.BarCode` – installera med + +```bash +dotnet add package Aspose.BarCode +``` + +Inga ytterligare beroenden krävs. + +## Så här genererar du streckkodbild med BarcodeGenerator C# + +Kärnklassen för att skapa en streckkodbild är `BarcodeGenerator`. Den kapslar in kodningstypen, datasträngen och alla renderingsparametrar. + +### Steg 1: Definiera utdatamappen + +Välj en mapp där de genererade PNG‑filerna ska lagras. Att använda en absolut sökväg undviker behörighetsöverraskningar. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Varför?** Att skapa mappen programatiskt garanterar att de efterföljande `Save`‑anropen lyckas även på en ny maskin. + +### Steg 2: Instansiera streckkodsgeneratorn + +För en DataBar Omnidirectional‑streckkod, skicka `EncodeTypes.DatabarOmniDirectional` och GS1‑128‑datasträngen. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Obs:** `BarcodeGenerator`‑objektet är återanvändbart; du kan ändra dess parametrar mellan sparningar för att **create multiple barcodes** från samma data. + +### Steg 3: Ställ in vanliga streckkodparametrar + +De vanligaste visuella justeringarna är X‑dimensionen (modulbredd) och stapelhöjden. Båda uttrycks i pixlar. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Varför sätta X‑dimension?** En mindre X‑dimension ger högre upplösning, vilket är viktigt när bilden ska skrivas ut eller visas på hög‑DPI‑skärmar. + +### Steg 4: Spara den första streckkodbilden + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +Filen `DatabarBarHeight30Pixels.png` innehåller nu en 30‑pixel‑hög DataBar Omnidirectional‑streckkod. + +### Steg 5: Justera streckkodens höjd i pixlar + +Att ändra höjden kräver ingen ny `BarcodeGenerator`‑instans – ändra bara parametern. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Steg 6: Spara den andra streckkodbilden + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Nu har du två PNG‑filer med olika **barcode height pixels**, vilket visar hur enkelt det är att **create barcode image**‑varianter. + +## Ställa in streckkodens höjd i pixlar dynamiskt + +Ofta behöver du en serie streckkoder med höjder som matchar UI‑element eller utskrivna etiketter. Följande hjälpfunktion abstraherar höjdändringen: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Du kan nu anropa `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` för att **create barcode image** med en 45‑pixel hög höjd i ett enda anrop. + +## Skapa flera streckkoder i en loop + +När du har en samling produktidentifierare eliminerar en `foreach`‑loop repetitiv kod. Detta exempel visar hur du **create multiple barcodes** från en array av GTIN‑värden. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +Loopen producerar tre PNG‑filer, var och en med ett distinkt **barcode height pixels**‑värde. Eftersom `SaveBarcodeWithHeight`‑hjälpen kapslar in höjdändringen, förblir huvudloopen ren och fokuserad på data. + +### Förväntad output + +Efter att ha kört hela exemplet innehåller `Barcodes`‑mappen: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Att öppna någon PNG visar en skarp DataBar Omnidirectional‑streckkod som kan skannas av vanliga mobilappar. + +## Vanliga fallgropar och proffstips + +| Problem | Varför det händer | Hur du undviker det | +|---------|-------------------|----------------------| +| **Fel EncodeTypes** | Att använda en 1D‑typ för en DataBar ger en oläslig bild. | Välj alltid `EncodeTypes.DatabarOmniDirectional` (eller en annan DataBar‑variant) för GS1‑128‑payloads. | +| **Otillräcklig X‑dimension** | Mycket låg X‑dimension kan göra tunna staplar osynliga på lågupplösta bildskärmar. | Behåll `XDimension.Pixels` ≥ 2 för skärmvisning; öka till 3‑4 för utskrift. | +| **Fel i filsökväg** | Relativa sökvägar kan lösas till oväntade kataloger. | Använd `Path.Combine` och `Environment.CurrentDirectory` för att bygga absoluta sökvägar. | +| **Överskriva bilder** | Att återanvända samma filnamn i en loop skriver över tidigare resultat. | Inkludera unika identifierare (t.ex. GTIN eller tidsstämpel) i filnamnet. | +| **Saknat NuGet‑paket** | Koden kompileras men kastar `FileNotFoundException` vid körning. | Verifiera att `Aspose.BarCode` är installerat och att projektet refererar till det. | + +## Fullt fungerande exempel + +Nedan är det kompletta programmet som du kan kopiera in i en konsolapplikation. Det inkluderar alla steg, hjälpfunktioner och felhantering. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Att köra detta program + +## Vad bör du lära dig härnäst? + +Följande handledningar täcker närliggande ämnen som bygger på teknikerna som demonstrerats i den här guiden. Varje resurs innehåller kompletta fungerande kodexempel med steg‑för‑steg‑förklaringar för att hjälpa dig bemästra ytterligare API‑funktioner och utforska alternativa implementationsmetoder i dina egna projekt. + +- [Skapa streckkod med anpassad höjd – Endimensionella streckkoder](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Skapa streckkodbild C# – GS1 DataMatrix‑exempel](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Skapa DotCode‑streckkodbild – rader & kolumner (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/swedish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/swedish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..4dc3e62cb --- /dev/null +++ b/barcode/swedish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-09 +description: Skapa streckkodsbilder med en C#‑streckkodsgenerator och lär dig att + generera flera streckkoder med anpassade bildförhållanden på några minuter. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: sv +lastmod: 2026-08-09 +og_description: Skapa streckkodbild med en C#‑streckkodsgenerator. Denna handledning + visar hur du genererar flera streckkoder, justerar bildförhållanden och sparar PNG‑filer + effektivt. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Skapa streckkodbild med C#-streckkodsgenerator – snabbguide +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Skapa streckkodbild med C#-streckkodsgenerator – guide +url: /sv/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Skapa streckkodbild med C# streckkodsgenerator – guide + +Om du snabbt behöver **skapa streckkodbild**, visar den här guiden hur du gör det med en C# streckkodsgenerator. Du kommer att lära dig att generera flera streckkoder, ändra bildförhållandet och spara varje bild som en PNG‑fil. + +Att generera streckkodsbilder är en vanlig uppgift när man bygger lagersystem, kassaterminaler eller fraktetiketter. I slutet av den här handledningen kommer du att ha två färdiga PNG‑filer som demonstrerar olika bildförhållanden, och du kommer att förstå hur du kan utöka metoden till valfritt antal streckkoder. + +## Förutsättningar + +Innan du börjar, se till att du har: + +* .NET 6.0 SDK eller senare installerat +* Visual Studio 2022 (eller någon IDE som stödjer C#) +* En referens till ett streckkodsbibliotek som stödjer DataBar Stacked Omnidirectional (till exempel **Aspose.BarCode for .NET**). Kodsnuttarna använder Aspose‑API:t, men koncepten gäller för alla bibliotek med liknande egenskaper. + +Du behöver ingen separat databas eller webbserver—detta är en enkel konsolapplikation. + +## Steg 1: Ställ in konsolprojektet + +Skapa ett nytt konsolprojekt och lägg till streckkodsbiblioteket via NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +`dotnet add package`‑kommandot hämtar den senaste stabila versionen av **Aspose.BarCode**, som tillhandahåller klassen `BarcodeGenerator` som används senare. + +## Steg 2: Skriv hela programmet + +Öppna *Program.cs* och ersätt dess innehåll med det kompletta exemplet nedan. Programmet skapar en **streckkodbild**, ändrar bildförhållandet och sparar två PNG‑filer. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Varför varje del är viktig + +* **Create barcode image** – `BarcodeGenerator`‑konstruktorn initierar objektet med den önskade symbologin och datan. +* **c# barcode generator** – `Parameters`‑egenskapen ger dig full kontroll över renderingsalternativ; att sätta `XDimension.Pixels` säkerställer att varje stapel är skarp på skärmen. +* **generate multiple barcodes** – Genom att ändra `DataBar.AspectRatio` mellan sparningar producerar samma generatorinstans två olika bilder utan att återskapa objektet, vilket är mer effektivt. + +## Steg 3: Kör programmet och visa resultaten + +Kör applikationen: + +```bash +dotnet run +``` + +Du bör se konsolutdata liknande: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Öppna mappen `BarcodeOutputs`. Du kommer att hitta två PNG‑filer: + +* **DatabarAspectRatio15.png** – en kompakt streckkod lämplig för etiketter med begränsad höjd. +* **DatabarAspectRatio30.png** – en högre streckkod som många skannrar läser mer pålitligt på avstånd. + +Båda bilderna är klara att bäddas in i PDF‑filer, skrivas ut på kvitton eller skickas till en mobilapp. + +## Steg 4: Utöka lösningen för att generera valfritt antal streckkoder + +Mönstret som visas ovan skalar enkelt: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – Loopen itererar över en array av bildförhållanden och skapar en distinkt **barcode image** för varje värde. +* Justera `EncodeTypes` eller den kodade strängen för att producera QR‑koder, Code 128 eller andra symbologier utan att ändra den omgivande logiken. + +## Praktiska tips och vanliga fallgropar + +| Tip | Explanation | +|-----|-------------| +| **Reuse the same generator** | Att återinitiera `BarcodeGenerator` för varje bild lägger till onödig overhead. Att ändra parametrar mellan `Save`‑anrop är snabbare och använder mindre minne. | +| **Validate the output folder** | Anropa alltid `Directory.CreateDirectory` innan du sparar; annars kastar `Save` ett `DirectoryNotFoundException`. | +| **Choose an appropriate X‑dimension** | Mycket låga pixelvärden (t.ex. 1) kan göra streckkoden oläslig på lågupplösta skärmar. Värden på 2–3 fungerar bra för de flesta skrivare. | +| **Mind the encoding** | GS1 DataBar förväntar sig en inledande `(01)` för GTIN. Om du utelämnar parenteserna kan biblioteket generera en ogiltig streckkod. | +| **Test with a real scanner** | Visuell inspektion räcker inte. Testa PNG‑filerna med den faktiska skannerutrustning du planerar att använda. | + +## Förväntat resultat (visuell beskrivning) + +*Båda PNG‑filerna visar en mörk‑på‑ljus DataBar Stacked Omnidirectional‑streckkod. Versionen med bildförhållande 15 är kortare, medan versionen med bildförhållande 30 är ungefär dubbelt så hög.* + +Om du bäddar in bilderna i ett dokument kommer de att renderas skarpt eftersom vi satte `XDimension.Pixels = 2`. + +## Slutsats + +Du vet nu hur du **skapar streckkodbild**‑filer med en **C# streckkodsgenerator**, och du kan **generera flera streckkoder** genom att justera bildförhållandet eller någon annan parameter. Det kompletta, körbara exemplet visar bästa praxis såsom att återanvända generatorinstansen, hantera utdatamappar och verifiera filskapande. + +Nästa steg kan vara att utforska: + +* Lägga till anpassade färger med `generator.Parameters.Barcode.Color` (sekundärt nyckelord: **c# barcode generator**) +* Exportera till andra format som JPEG eller SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Integrera streckkodsskapande logik i ett Web API för att leverera bilder på begäran (sekundärt nyckelord + +## Vad bör du lära dig härnäst? + +Följande handledningar täcker närbesläktade ämnen som bygger på teknikerna som demonstrerats i den här guiden. Varje resurs innehåller kompletta fungerande kodexempel med steg‑för‑steg‑förklaringar för att hjälpa dig bemästra ytterligare API‑funktioner och utforska alternativa implementationsmetoder i dina egna projekt. + +- [Skapa streckkod PNG – DataMatrix Bildförhållande – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Anpassa Code 16K streckkod bildförhållanden med Aspose.BarCode för .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Hur man genererar Aztec‑streckkod med anpassat bildförhållande med Aspose.BarCode för .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/thai/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/thai/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..52e98fe13 --- /dev/null +++ b/barcode/thai/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,239 @@ +--- +category: general +date: 2026-08-09 +description: สร้างบาร์โค้ด databar 4 คอลัมน์ใน C# อย่างรวดเร็วด้วย Aspose.BarCode. + เรียนรู้วิธีตั้งค่าคอลัมน์, แถว, และบันทึกภาพ PNG ในคู่มือสั้นนี้. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: th +lastmod: 2026-08-09 +og_description: สร้างบาร์โค้ด databar 4 คอลัมน์ใน C# ด้วย Aspose.BarCode จากนั้นปรับแต่งแถวและส่งออกภาพ + PNG สำหรับแอปของคุณ +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: สร้างบาร์โค้ด databar 4 คอลัมน์ใน C# – บทแนะนำสั้น +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: สร้างบาร์โค้ด 4‑คอลัมน์ Databar ใน C# – คู่มือแบบทีละขั้นตอน +url: /th/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# สร้างบาร์โค้ด databar 4‑คอลัมน์ใน C# – คู่มือขั้นตอนโดยละเอียด + +หากคุณต้องการ **สร้างบาร์โค้ด databar 4‑คอลัมน์** ใน C# บทแนะนำนี้จะแสดงให้คุณเห็นอย่างละเอียด เราจะอธิบายขั้นตอนการสร้าง DataBar Expanded Stacked barcode, การกำหนดค่าคอลัมน์สี่คอลัมน์, และการบันทึกผลลัพธ์เป็นไฟล์ PNG + +ในคู่มือนี้คุณจะได้เรียนรู้วิธี: + +* เริ่มต้น `BarcodeGenerator` สำหรับสัญลักษณ์ **DataBar Expanded Stacked** +* ตั้งค่าจำนวนคอลัมน์เป็น 4 (เป็นความต้องการหลัก) +* ปรับจำนวนแถวเมื่อคุณต้องการเลย์เอาต์แบบ stacked ที่มีสามแถว +* ส่งออกบาร์โค้ดเป็น PNG โดยใช้ **barcode image format** ที่เหมาะสม + +คุณต้องใช้เพียงไลบรารี Aspose.BarCode for .NET (เวอร์ชัน 23.10 หรือใหม่กว่า) และสภาพแวดล้อมการพัฒนา .NET 6+ เช่น Visual Studio 2022 ไม่จำเป็นต้องมีการพึ่งพาเพิ่มเติมใด ๆ + +--- + +## วิธีสร้างบาร์โค้ด databar 4‑คอลัมน์ + +ขั้นตอนแรกคือการสร้างอินสแตนซ์ `BarcodeGenerator` ที่กำหนดให้ใช้สัญลักษณ์ **DataBar Expanded Stacked** คลาสนี้บรรจุตัวเลือกการเรนเดอร์ทั้งหมด ทำให้การสลับระหว่างเลย์เอาต์แบบคอลัมน์และแถวเป็นเรื่องง่าย + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**ทำไมวิธีนี้ถึงได้ผล:** +`EncodeTypes.DatabarExpandedStacked` บอก Aspose.BarCode ให้สร้างเวอร์ชัน stacked ของตระกูล DataBar คุณสมบัติ `DataBar.Columns` ควบคุมจำนวนโมดูลแนวตั้งที่บาร์โค้ดใช้ การตั้งค่าเป็น 4 ตรงกับความต้องการ **สร้างบาร์โค้ด databar 4‑คอลัมน์** สุดท้าย `Save` จะเขียนภาพที่แสดงผลลงดิสก์โดยใช้ **barcode image format** `Png` + +### กำหนดค่าคอลัมน์ของ DataBar Expanded Stacked + +หากต้องการจำนวนคอลัมน์ที่แตกต่างกัน เพียงเปลี่ยนค่าจำนวนเต็มที่กำหนดให้กับ `Columns` คุณสมบัตินี้รับค่าได้ตั้งแต่ 1 ถึง 4 สำหรับเวอร์ชัน expanded stacked + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*เคล็ดลับ:* ควรทดสอบบาร์โค้ดที่สร้างขึ้นด้วยสแกนเนอร์ที่รองรับตระกูล DataBar เสมอ เพราะรูปลักษณ์ภาพเพียงอย่างเดียวไม่รับประกันว่าจะอ่านได้ + +### บันทึกภาพบาร์โค้ด + +Enumeration `BarCodeImageFormat` มีตัวเลือกหลายแบบ (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`) PNG เป็นแบบ loss‑less และเหมาะกับสถานการณ์เว็บและเดสก์ท็อปส่วนใหญ่ + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +หากต้องการรูปแบบอื่น ให้เปลี่ยน `Png` เป็นค่า enum ที่ต้องการ ไฟล์ที่บันทึกสามารถฝังลงใน HTML, PDF หรือพิมพ์บนฉลากได้โดยตรง + +## สร้างบาร์โค้ดด้วยแถวที่กำหนดเอง + +บางครั้งต้องการเลย์เอาต์แบบ stacked ที่มีจำนวนแถวเฉพาะแทนคอลัมน์ คลาส `BarcodeGenerator` เดียวกันมีคุณสมบัติ `Rows` เพื่อใช้ในกรณีนี้ + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**ทำไมแถวถึงสำคัญ:** +เมื่อบาร์โค้ดแบบ stacked สูงกว่ากว้าง คุณสมบัติ `Rows` จะกำหนดจำนวนส่วนแนวนอนที่สัญลักษณ์ถูกแบ่งออก การตั้งค่า `Rows = 3` จะสร้างบาร์โค้ด stacked ที่มีสามแถว ซึ่งเหมาะกับความกว้างฉลากแคบ + +### ตั้งค่าแถวของบาร์โค้ดแบบไดนามิก + +คุณสามารถคำนวณจำนวนแถวในขณะรันไทม์โดยอิงจากข้อมูลเข้า: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +ความยืดหยุ่นนี้ทำให้คุณ **ตั้งค่าแถวของบาร์โค้ด** ได้โดยไม่ต้องคอมไพล์แอปพลิเคชันใหม่ + +## ตัวอย่างครบวงจรจากต้นจนจบ + +ด้านล่างเป็นโปรแกรมเดียวที่สร้างบาร์โค้ด 4‑คอลัมน์และบาร์โค้ด 3‑แถวพร้อมกัน แสดงให้เห็นว่าการตั้งค่าทั้งสองสามารถทำงานร่วมกันได้อย่างไร + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**ผลลัพธ์ที่คาดหวัง:** +ไฟล์ PNG สองไฟล์จะปรากฏในไดเรกทอรีทำงานของแอปพลิเคชัน: + +* `DatabarCols4.png` – DataBar Expanded Stacked barcode ที่มีสี่คอลัมน์แนวตั้ง +* `DatabarRows3.png` – สัญลักษณ์เดียวกันจัดเรียงเป็นสามแถวแนวนอน + +ทั้งสองภาพสามารถเปิดด้วยโปรแกรมดูภาพใด ๆ หรือฝังในคอนโทรล UI ได้ + +--- + +## คำถามที่พบบ่อยและกรณีขอบ + +| Question | Answer | +|----------|--------| +| *Can I use a different barcode symbology?* | Yes. Replace `EncodeTypes.DatabarExpandedStacked` with another `EncodeTypes` value (e.g., `EncodeTypes.QR`), but the `Columns` and `Rows` properties are specific to DataBar families. | +| *What if the data string exceeds the maximum length?* | The DataBar Expanded Stacked symbology supports up to 61 numeric characters. Exceeding this limit throws an `ArgumentException`. Validate the input before assigning it to the generator. | +| *Do I need to dispose the `BarcodeGenerator`?* | `BarcodeGenerator` implements `IDisposable`. In a long‑running service, wrap it in a `using` block or call `Dispose()` manually to free native resources. | +| *Can I generate SVG instead of PNG?* | Absolutely. Use `BarCodeImageFormat.Svg` in the `Save` method. | +| *Is the library compatible with .NET Core?* | Aspose.BarCode for .NET supports .NET Core 3.1, .NET 5, .NET 6, and later. No code changes are required. | + +## สรุป + +คุณได้เรียนรู้วิธี **สร้างบาร์โค้ด databar 4‑คอลัมน์** ใน C# ด้วย Aspose.BarCode วิธีปรับเลย์เอาต์ด้วยแถว และวิธีส่งออกผลลัพธ์ใน **barcode image format** ที่สะดวก ตัวอย่างครบชุดแสดงการกำหนดค่าทั้งแบบคอลัมน์และแถว ให้คุณมีพื้นฐานที่มั่นคงสำหรับการพิมพ์ฉลากหรือการสแกนบนมือถือ + +**ขั้นตอนต่อไป** + +* ทดลองใช้ข้อมูล payload ต่าง ๆ และตรวจสอบความเข้ากันได้ของสแกนเนอร์ +* สำรวจตัวเลือกการสไตลิ่งเพิ่มเติม เช่น สีพื้นหน้า/พื้นหลัง (`generator.Parameters.Barcode.Color`) +* ผสานบาร์โค้ดกับกราฟิกอื่น ๆ ผ่าน API `Graphics` เพื่อออกแบบฉลากแบบกำหนดเอง + +คุณสามารถปรับโค้ดให้ทำงานกับ ASP.NET Core, Windows Forms หรือโครงการ Xamarin — Aspose.BarCode ทำงานได้บนทุกแพลตฟอร์ม .NET ขอให้สนุกกับการเขียนโค้ด! + +## คุณควรเรียนรู้อะไรต่อไป? + +บทแนะนำต่อไปนี้ครอบคลุมหัวข้อที่เกี่ยวข้องอย่างใกล้ชิดและต่อยอดจากเทคนิคที่แสดงในคู่มือนี้ แต่ละแหล่งรวมตัวอย่างโค้ดทำงานเต็มรูปแบบพร้อมคำอธิบายขั้นตอนเพื่อช่วยคุณเชี่ยวชาญฟีเจอร์ API เพิ่มเติมและสำรวจวิธีการทำงานทางเลือกในโครงการของคุณ + +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Create barcode image c# – Configure Codablock F Rows & Columns](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [How to create dotcode extended codetext with Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/thai/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/thai/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..31f438e80 --- /dev/null +++ b/barcode/thai/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,301 @@ +--- +category: general +date: 2026-08-09 +description: สร้างภาพบาร์โค้ดใน C# ด้วยคู่มือขั้นตอนนี้ เรียนรู้วิธีสร้างบาร์โค้ด + ปรับความสูงของบาร์โค้ดเป็นพิกเซล และสร้างบาร์โค้ดหลายรายการอย่างมีประสิทธิภาพ +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: th +lastmod: 2026-08-09 +og_description: สร้างภาพบาร์โค้ดใน C# อย่างรวดเร็ว ทำตามบทแนะนำนี้เพื่อเรียนรู้วิธีสร้างบาร์โค้ด + ตั้งค่าความสูงของบาร์โค้ดเป็นพิกเซล และสร้างบาร์โค้ดหลายรายการ +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: สร้างภาพบาร์โค้ดใน C# – คู่มือเต็มสำหรับนักพัฒนา +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: สร้างภาพบาร์โค้ดใน C# – คู่มือการเขียนโปรแกรมครบถ้วน +url: /th/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# สร้างภาพบาร์โค้ดด้วย C# – คู่มือการเขียนโปรแกรมแบบครบถ้วน + +หากคุณต้องการ **สร้างภาพบาร์โค้ด** ในแอปพลิเคชัน .NET คู่มือนี้จะแสดงให้คุณเห็นอย่างชัดเจนว่า **วิธีสร้างบาร์โค้ด** ด้วยไลบรารี Aspose.BarCode คุณจะได้เห็นวิธีควบคุม **ความสูงของบาร์โค้ดเป็นพิกเซล**, การบันทึกภาพ, และการสร้าง **บาร์โค้ดหลายรายการ** โดยไม่ต้องทำซ้ำโค้ด + +บทแนะนำนี้ครอบคลุมทุกอย่างตั้งแต่การติดตั้งแพ็กเกจจนถึงการปรับแต่งขนาด, เพื่อให้คุณสามารถคัดลอก‑วางตัวอย่างที่พร้อมใช้งานลงในโปรเจกต์ของคุณได้ทันที + +## ข้อกำหนดเบื้องต้น + +* .NET 6.0 SDK หรือเวอร์ชันที่ใหม่กว่า ติดตั้งแล้ว +* Visual Studio 2022 (หรือ IDE สำหรับ C# ใดก็ได้) +* NuGet package `Aspose.BarCode` – ติดตั้งด้วย + +```bash +dotnet add package Aspose.BarCode +``` + +ไม่ต้องการการพึ่งพาเพิ่มเติม + +## วิธีสร้างภาพบาร์โค้ดด้วย BarcodeGenerator C# + +คลาสหลักสำหรับการสร้างภาพบาร์โค้ดคือ `BarcodeGenerator` ซึ่งบรรจุประเภทการเข้ารหัส, สตริงข้อมูล, และพารามิเตอร์การเรนเดอร์ทั้งหมด + +### ขั้นตอนที่ 1: กำหนดโฟลเดอร์ปลายทาง + +เลือกโฟลเดอร์ที่ไฟล์ PNG ที่สร้างขึ้นจะถูกเก็บไว้ การใช้เส้นทางแบบเต็มจะช่วยหลีกเลี่ยงปัญหาเรื่องสิทธิ์ + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **ทำไม?** การสร้างโฟลเดอร์โดยโปรแกรมจะรับประกันว่าการเรียก `Save` ต่อไปจะสำเร็จแม้บนเครื่องใหม่ + +### ขั้นตอนที่ 2: สร้างอินสแตนซ์ของ barcode generator + +สำหรับบาร์โค้ด DataBar Omnidirectional ให้ส่งค่า `EncodeTypes.DatabarOmniDirectional` และสตริงข้อมูล GS1‑128 + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **หมายเหตุ:** ออบเจ็กต์ `BarcodeGenerator` สามารถใช้ซ้ำได้; คุณสามารถเปลี่ยนพารามิเตอร์ระหว่างการบันทึกเพื่อ **สร้างบาร์โค้ดหลายรายการ** จากข้อมูลเดียวกัน + +### ขั้นตอนที่ 3: ตั้งค่าพารามิเตอร์บาร์โค้ดทั่วไป + +การปรับแต่งภาพที่พบบ่อยที่สุดคือ X‑dimension (ความกว้างของโมดูล) และความสูงของบาร์ ทั้งสองค่าถูกระบุเป็นพิกเซล + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **ทำไมต้องตั้งค่า X‑dimension?** X‑dimension ที่เล็กลงจะให้ความละเอียดสูงขึ้น ซึ่งสำคัญเมื่อภาพจะถูกพิมพ์หรือแสดงบนหน้าจอที่มี DPI สูง + +### ขั้นตอนที่ 4: บันทึกภาพบาร์โค้ดแรก + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +ไฟล์ `DatabarBarHeight30Pixels.png` ตอนนี้มีบาร์โค้ด DataBar Omnidirectional ความสูง 30 พิกเซล + +### ขั้นตอนที่ 5: ปรับความสูงของบาร์โค้ดเป็นพิกเซล + +การเปลี่ยนความสูงไม่จำเป็นต้องสร้างอินสแตนซ์ `BarcodeGenerator` ใหม่—เพียงแก้ไขพารามิเตอร์ + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### ขั้นตอนที่ 6: บันทึกภาพบาร์โค้ดที่สอง + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +ตอนนี้คุณมีไฟล์ PNG สองไฟล์ที่มี **ความสูงของบาร์โค้ดเป็นพิกเซล** ต่างกัน, แสดงให้เห็นว่าการสร้าง **ภาพบาร์โค้ด** แบบหลากหลายเป็นเรื่องง่ายแค่ไหน + +## การตั้งค่าความสูงของบาร์โค้ดเป็นพิกเซลแบบไดนามิก + +บ่อยครั้งคุณต้องการชุดบาร์โค้ดที่มีความสูงตรงกับองค์ประกอบ UI หรือป้ายพิมพ์ วิธีช่วยเหลือด้านล่างนี้ทำให้การเปลี่ยนความสูงเป็นเรื่องง่าย + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +คุณสามารถเรียก `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` เพื่อ **สร้างภาพบาร์โค้ด** ความสูง 45 พิกเซลในบรรทัดเดียว + +## การสร้างบาร์โค้ดหลายรายการในลูป + +เมื่อคุณมีคอลเลกชันของรหัสสินค้า, ลูป `foreach` จะช่วยลดโค้ดที่ซ้ำซ้อน ตัวอย่างนี้แสดงวิธี **สร้างบาร์โค้ดหลายรายการ** จากอาเรย์ของ GTIN + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +ลูปนี้สร้างไฟล์ PNG สามไฟล์, แต่ละไฟล์มีค่า **ความสูงของบาร์โค้ดเป็นพิกเซล** ที่แตกต่างกัน เนื่องจากฟังก์ชันช่วยเหลือ `SaveBarcodeWithHeight` จัดการการเปลี่ยนความสูง, ลูปหลักจึงสะอาดและมุ่งเน้นที่ข้อมูล + +### ผลลัพธ์ที่คาดหวัง + +หลังจากรันตัวอย่างเต็ม, โฟลเดอร์ `Barcodes` จะมี: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +การเปิดไฟล์ PNG ใดก็จะเห็นบาร์โค้ด DataBar Omnidirectional ที่คมชัดและสามารถสแกนได้ด้วยแอปมือถือมาตรฐาน + +## ข้อผิดพลาดทั่วไปและเคล็ดลับระดับมืออาชีพ + +| ปัญหา | สาเหตุที่เกิดขึ้น | วิธีหลีกเลี่ยง | +|-------|-------------------|-----------------| +| **EncodeTypes ผิด** | การใช้ประเภท 1D สำหรับ DataBar จะทำให้ได้ภาพที่อ่านไม่ออก | ควรเลือก `EncodeTypes.DatabarOmniDirectional` (หรือรูปแบบ DataBar อื่น) สำหรับข้อมูล GS1‑128 เสมอ | +| **X‑dimension ไม่เพียงพอ** | X‑dimension ที่ต่ำมากอาจทำให้บาร์บางหายไปบนจอที่ความละเอียดต่ำ | ตั้งค่า `XDimension.Pixels` ≥ 2 สำหรับการแสดงบนหน้าจอ; เพิ่มเป็น 3‑4 สำหรับการพิมพ์ | +| **ข้อผิดพลาดของเส้นทางไฟล์** | เส้นทางแบบ relative อาจชี้ไปยังไดเรกทอรีที่ไม่คาดคิด | ใช้ `Path.Combine` และ `Environment.CurrentDirectory` เพื่อสร้างเส้นทางแบบ absolute | +| **การเขียนทับภาพ** | การใช้ชื่อไฟล์เดียวกันในลูปจะทำให้ผลลัพธ์ก่อนหน้าถูกเขียนทับ | ใส่ตัวระบุที่ไม่ซ้ำกัน (เช่น GTIN หรือ timestamp) ลงในชื่อไฟล์ | +| **ขาดแพ็กเกจ NuGet** | โค้ดคอมไพล์สำเร็จแต่เกิด `FileNotFoundException` ขณะรัน | ตรวจสอบว่าได้ติดตั้ง `Aspose.BarCode` แล้วและโปรเจกต์อ้างอิงถึงมัน | + +## ตัวอย่างการทำงานเต็มรูปแบบ + +ด้านล่างเป็นโปรแกรมเต็มที่คุณสามารถคัดลอกไปใส่ในแอปพลิเคชันคอนโซลได้ รวมทุกขั้นตอน, เมธอดช่วยเหลือ, และการจัดการข้อผิดพลาด + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +การรันโปรแกรมนี้ + +## สิ่งที่คุณควรเรียนต่อไป + +บทแนะนำต่อไปนี้ครอบคลุมหัวข้อที่เกี่ยวข้องอย่างใกล้ชิดและต่อยอดจากเทคนิคที่แสดงในคู่มือนี้ แต่ละแหล่งข้อมูลมีตัวอย่างโค้ดที่ทำงานได้ครบถ้วนพร้อมคำอธิบายทีละขั้นตอน เพื่อช่วยให้คุณเชี่ยวชาญฟีเจอร์ API เพิ่มเติมและสำรวจแนวทางการทำงานแบบอื่นในโปรเจกต์ของคุณ + +- [สร้างบาร์โค้ดความสูงกำหนดเอง – บาร์โค้ดแบบมิติเดียว](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [สร้างภาพบาร์โค้ด C# – ตัวอย่าง GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [สร้างภาพบาร์โค้ด DotCode – แถวและคอลัมน์ (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/thai/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/thai/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..5e675affc --- /dev/null +++ b/barcode/thai/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,223 @@ +--- +category: general +date: 2026-08-09 +description: สร้างภาพบาร์โค้ดด้วยเครื่องสร้างบาร์โค้ด C# และเรียนรู้การสร้างบาร์โค้ดหลายรายการด้วยอัตราส่วนที่กำหนดเองภายในไม่กี่นาที +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: th +lastmod: 2026-08-09 +og_description: สร้างภาพบาร์โค้ดโดยใช้ตัวสร้างบาร์โค้ด C# บทเรียนนี้แสดงวิธีสร้างบาร์โค้ดหลายรายการ + ปรับอัตราส่วนภาพ และบันทึกไฟล์ PNG อย่างมีประสิทธิภาพ +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: สร้างภาพบาร์โค้ดด้วยตัวสร้างบาร์โค้ด C# – คู่มือเร็ว +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: สร้างภาพบาร์โค้ดด้วยตัวสร้างบาร์โค้ด C# – คู่มือ +url: /th/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# สร้างภาพบาร์โค้ดด้วย C# barcode generator – คู่มือ + +หากคุณต้องการ **สร้างภาพบาร์โค้ด** อย่างรวดเร็ว คู่มือนี้จะแสดงวิธีทำด้วย C# barcode generator. คุณจะได้เรียนรู้การสร้างบาร์โค้ดหลายรายการ ปรับอัตราส่วนภาพ และบันทึกแต่ละภาพเป็นไฟล์ PNG. + +การสร้างภาพบาร์โค้ดเป็นงานทั่วไปเมื่อพัฒนาระบบสินค้าคงคลัง, เครื่องจุดขาย, หรือป้ายกำกับการจัดส่ง. เมื่อจบบทเรียนนี้คุณจะมีไฟล์ PNG สองไฟล์พร้อมใช้งานที่แสดงอัตราส่วนภาพที่แตกต่างกัน และคุณจะเข้าใจวิธีขยายวิธีการนี้ให้รองรับบาร์โค้ดจำนวนใดก็ได้. + +## ข้อกำหนดเบื้องต้น + +ก่อนเริ่มทำโปรเจกต์ให้ตรวจสอบว่าคุณมี: + +* .NET 6.0 SDK หรือรุ่นที่ใหม่กว่า ติดตั้งแล้ว +* Visual Studio 2022 (หรือ IDE ใดก็ได้ที่รองรับ C#) +* การอ้างอิงไปยังไลบรารีบาร์โค้ดที่สนับสนุน DataBar Stacked Omnidirectional (เช่น **Aspose.BarCode for .NET**). ตัวอย่างโค้ดใช้ Aspose API แต่แนวคิดสามารถนำไปใช้กับไลบรารีอื่นที่มีคุณสมบัติคล้ายกันได้ + +คุณไม่จำเป็นต้องมีฐานข้อมูลหรือเว็บเซิร์ฟเวอร์แยกต่างหาก — นี้เป็นแอปพลิเคชันคอนโซลธรรมดา. + +## ขั้นตอนที่ 1: ตั้งค่าโปรเจกต์คอนโซล + +สร้างโปรเจกต์คอนโซลใหม่และเพิ่มไลบรารีบาร์โค้ดผ่าน NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +คำสั่ง `dotnet add package` จะดึงเวอร์ชันเสถียรล่าสุดของ **Aspose.BarCode** ซึ่งให้คลาส `BarcodeGenerator` ที่จะใช้ต่อไป. + +## ขั้นตอนที่ 2: เขียนโปรแกรมเต็มรูปแบบ + +เปิดไฟล์ *Program.cs* แล้วแทนที่เนื้อหาด้วยตัวอย่างเต็มด้านล่าง. โปรแกรมจะสร้าง **barcode image**, ปรับอัตราส่วนภาพ, และบันทึกเป็นไฟล์ PNG สองไฟล์. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### ทำไมแต่ละส่วนจึงสำคัญ + +* **Create barcode image** – ตัวสร้าง `BarcodeGenerator` จะเริ่มต้นอ็อบเจ็กต์ด้วยสัญลักษณ์และข้อมูลที่ต้องการ. +* **c# barcode generator** – คุณสมบัติ `Parameters` ให้คุณควบคุมตัวเลือกการเรนเดอร์ได้เต็มที่; การตั้งค่า `XDimension.Pixels` ทำให้แต่ละบาร์คมชัดบนหน้าจอ. +* **generate multiple barcodes** – การเปลี่ยนค่า `DataBar.AspectRatio` ระหว่างการบันทึก ทำให้อินสแตนซ์เดียวของ generator ผลิตภาพที่แตกต่างกันสองภาพโดยไม่ต้องสร้างอ็อบเจ็กต์ใหม่, ซึ่งมีประสิทธิภาพมากกว่า. + +## ขั้นตอนที่ 3: รันโปรแกรมและดูผลลัพธ์ + +เรียกใช้แอปพลิเคชัน: + +```bash +dotnet run +``` + +คุณควรเห็นผลลัพธ์ในคอนโซลคล้ายกับ: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +เปิดโฟลเดอร์ `BarcodeOutputs`. คุณจะพบไฟล์ PNG สองไฟล์: + +* **DatabarAspectRatio15.png** – บาร์โค้ดแบบกะทัดรัด เหมาะกับป้ายที่มีความสูงจำกัด. +* **DatabarAspectRatio30.png** – บาร์โค้ดที่สูงกว่า ทำให้เครื่องสแกนหลายเครื่องอ่านได้เสถียรจากระยะไกลมากขึ้น. + +ทั้งสองภาพพร้อมนำไปฝังใน PDF, พิมพ์บนใบเสร็จ, หรือส่งให้แอปมือถือได้ทันที. + +## ขั้นตอนที่ 4: ขยายโซลูชันเพื่อสร้างบาร์โค้ดจำนวนใดก็ได้ + +รูปแบบที่แสดงด้านบนสามารถขยายได้ง่าย: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – ลูปจะวนผ่านอาเรย์ของอัตราส่วนภาพ, สร้าง **barcode image** ที่แตกต่างกันสำหรับแต่ละค่า. +* ปรับ `EncodeTypes` หรือสตริงที่เข้ารหัสเพื่อสร้าง QR code, Code 128, หรือสัญลักษณ์อื่น ๆ โดยไม่ต้องเปลี่ยนโครงสร้างหลักของโค้ด. + +## เคล็ดลับปฏิบัติและข้อผิดพลาดที่พบบ่อย + +| Tip | Explanation | +|-----|-------------| +| **Reuse the same generator** | การสร้าง `BarcodeGenerator` ใหม่สำหรับแต่ละภาพเพิ่มภาระที่ไม่จำเป็น. การเปลี่ยนพารามิเตอร์ระหว่างการเรียก `Save` จะเร็วกว่าและใช้หน่วยความจำน้อยกว่า. | +| **Validate the output folder** | ควรเรียก `Directory.CreateDirectory` ก่อนบันทึก; มิฉะนั้น `Save` จะโยน `DirectoryNotFoundException`. | +| **Choose an appropriate X‑dimension** | ค่า pixel ที่ต่ำเกินไป (เช่น 1) อาจทำให้บาร์โค้ดอ่านไม่ออกบนหน้าจอความละเอียดต่ำ. ค่า 2–3 ทำงานได้ดีสำหรับเครื่องพิมพ์ส่วนใหญ่. | +| **Mind the encoding** | GS1 DataBar ต้องการคำนำหน้า `(01)` สำหรับ GTIN. หากละวงเล็บ, ไลบรารีอาจสร้างบาร์โค้ดที่ไม่ถูกต้อง. | +| **Test with a real scanner** | การตรวจสอบด้วยสายตาไม่เพียงพอ. ควรทดสอบไฟล์ PNG กับอุปกรณ์สแกนจริงที่คุณจะใช้งาน. | + +## ผลลัพธ์ที่คาดหวัง (คำอธิบายภาพ) + +*ทั้งไฟล์ PNG แสดงบาร์โค้ด DataBar Stacked Omnidirectional สีเข้มบนพื้นสีอ่อน. เวอร์ชันที่มีอัตราส่วน 15 จะสั้นกว่า, ส่วนเวอร์ชันที่มีอัตราส่วน 30 จะสูงประมาณสองเท่า.* + +หากคุณฝังภาพเหล่านี้ในเอกสาร, จะปรากฏคมชัดเนื่องจากเราได้ตั้งค่า `XDimension.Pixels = 2`. + +## สรุป + +ตอนนี้คุณรู้วิธี **สร้างภาพบาร์โค้ด** ด้วย **C# barcode generator**, และสามารถ **สร้างบาร์โค้ดหลายรายการ** โดยปรับอัตราส่วนภาพหรือพารามิเตอร์อื่น ๆ. ตัวอย่างที่สมบูรณ์และสามารถรันได้แสดงแนวทางปฏิบัติที่ดีที่สุด เช่น การใช้ generator ซ้ำ, การจัดการโฟลเดอร์ผลลัพธ์, และการตรวจสอบการสร้างไฟล์. + +ต่อไปคุณอาจสนใจ: + +* เพิ่มสีที่กำหนดเองด้วย `generator.Parameters.Barcode.Color` (คีย์เวิร์ดรอง: **c# barcode generator**) +* ส่งออกเป็นรูปแบบอื่นเช่น JPEG หรือ SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* ผสานตรรกะการสร้างบาร์โค้ดเข้ากับ Web API เพื่อให้บริการภาพตามต้องการ (คีย์เวิร์ดรอง + +## คุณควรเรียนรู้อะไรต่อไป? + +บทแนะนำต่อไปนี้ครอบคลุมหัวข้อที่เกี่ยวข้องอย่างใกล้ชิดและต่อยอดจากเทคนิคที่แสดงในคู่มือนี้. แต่ละแหล่งข้อมูลมีโค้ดตัวอย่างทำงานเต็มรูปแบบพร้อมคำอธิบายทีละขั้นตอน เพื่อช่วยให้คุณเชี่ยวชาญฟีเจอร์ API เพิ่มเติมและสำรวจวิธีการทำงานทางเลือกในโปรเจกต์ของคุณ. + +- [Create Barcode PNG – DataMatrix Aspect Ratio – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Customize Code 16K Barcode Aspect Ratios with Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/turkish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/turkish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..5409335db --- /dev/null +++ b/barcode/turkish/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,242 @@ +--- +category: general +date: 2026-08-09 +description: Aspose.BarCode ile C#'ta 4 sütunlu databar barkodu hızlıca oluşturun. + Bu kısa rehberde sütunları, satırları nasıl yapılandıracağınızı ve PNG görüntülerini + nasıl kaydedeceğinizi öğrenin. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: tr +lastmod: 2026-08-09 +og_description: Aspose.BarCode kullanarak C#'ta 4 sütunlu databar barkod oluşturun, + ardından satırları özelleştirin ve uygulamanız için PNG görüntülerini dışa aktarın. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: C# ile 4 sütunlu databar barkod oluşturma – hızlı öğretici +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: C#'ta 4 sütunlu databar barkod oluşturma – adım adım rehber +url: /tr/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C#’ta 4‑sütunlu databar barkod oluşturma – adım adım rehber + +Eğer C#’ta **4‑sütunlu databar barkod oluşturmanız** gerekiyorsa, bu öğretici tam olarak nasıl yapılacağını gösterir. DataBar Expanded Stacked barkodu oluşturmayı, dört sütunu yapılandırmayı ve sonucu PNG görüntüsü olarak kaydetmeyi adım adım anlatacağız. + +Bu rehberde şunları öğreneceksiniz: + +* **DataBar Expanded Stacked** sembolü için `BarcodeGenerator` nesnesini başlatmak. +* Sütun sayısını 4 olarak ayarlamak (ana gereksinim). +* Üç satır içeren bir yığılmış düzen gerektiğinde satır sayısını ayarlamak. +* Uygun **barkod görüntü formatı** kullanarak barkodu PNG olarak dışa aktarmak. + +Sadece Aspose.BarCode for .NET kütüphanesine (sürüm 23.10 veya daha yenisi) ve Visual Studio 2022 gibi bir .NET 6+ geliştirme ortamına ihtiyacınız var. Başka bir bağımlılık gerekmez. + +--- + +## 4‑sütunlu databar barkod nasıl oluşturulur + +İlk adım, **DataBar Expanded Stacked** sembolünü hedefleyen bir `BarcodeGenerator` örneği oluşturmaktır. Bu sınıf, tüm render seçeneklerini kapsar ve sütun‑tabanlı ile satır‑tabanlı düzenler arasında geçişi kolaylaştırır. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Neden bu şekilde çalışır:** +`EncodeTypes.DatabarExpandedStacked` Aspose.BarCode’e DataBar ailesinin yığılmış versiyonunu üretmesini söyler. `DataBar.Columns` özelliği, barkodun kaç dikey modül kaplayacağını kontrol eder. Bunu 4 olarak ayarlamak, **4‑sütunlu databar barkod oluşturma** gereksinimini karşılar. Son olarak `Save`, görsel temsili **barkod görüntü formatı** `Png` kullanarak diske yazar. + +### DataBar Expanded Stacked sütunlarını yapılandırma + +Farklı bir sütun sayısına ihtiyacınız varsa, sadece `Columns` değişkenine atanan tam sayıyı değiştirin. Bu özellik, yığılmış genişletilmiş varyant için 1‑den 4‑e kadar değerleri kabul eder. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*İpucu:* Oluşturulan barkodu, DataBar ailesini destekleyen bir tarayıcıyla her zaman test edin; çünkü yalnızca görsel görünüm okunabilirliği garanti etmez. + +### Barkod görüntüsünü kaydetme + +`BarCodeImageFormat` enum’u birkaç seçenek sunar (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG kayıpsızdır ve çoğu web ve masaüstü senaryosu için iyidir. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Farklı bir format istiyorsanız, `Png` yerine istediğiniz enum değerini kullanın. Kaydedilen dosya doğrudan HTML, PDF’lere gömülebilir veya etiketlere basılabilir. + +## Özel satırlarla barkod oluşturma + +Bazen sütunlar yerine belirli bir satır sayısı gerektiren bir yığılmış düzen istenir. Aynı `BarcodeGenerator` sınıfı bu amaçla bir `Rows` özelliği sunar. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Satırların önemi:** +Yığılmış barkod genişliğinden daha yüksek olduğunda, `Rows` özelliği sembolün kaç yatay dilime bölüneceğini belirler. `Rows = 3` ayarı, dar etiket genişlikleri için faydalı olan üç satırlı bir yığılmış barkod oluşturur. + +### Barkod satırlarını dinamik olarak ayarlama + +Satır sayısını, giriş verisine göre çalışma zamanında hesaplayabilirsiniz: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Bu esneklik, uygulamayı yeniden derlemeden **barkod satırlarını ayarlamanıza** olanak tanır. + +## Tam uçtan uca örnek + +Aşağıda, hem 4‑sütunlu hem de 3‑satırlı barkod üreten tek bir program yer alıyor; iki konfigürasyonun nasıl birlikte kullanılabileceğini gösteriyor. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Beklenen çıktı:** +Uygulamanın çalışma dizininde iki PNG dosyası oluşur: + +* `DatabarCols4.png` – dört dikey sütunlu bir DataBar Expanded Stacked barkod. +* `DatabarRows3.png` – aynı sembolün üç yatay satır halinde düzenlenmiş hali. + +Her iki görüntü de herhangi bir görüntü görüntüleyicide açılabilir veya bir UI kontrolüne gömülebilir. + +--- + +## Yaygın sorular ve kenar durumları + +| Soru | Cevap | +|------|-------| +| *Farklı bir barkod sembolü kullanabilir miyim?* | Evet. `EncodeTypes.DatabarExpandedStacked` yerine başka bir `EncodeTypes` değeri (ör. `EncodeTypes.QR`) kullanın, ancak `Columns` ve `Rows` özellikleri yalnızca DataBar ailelerine özeldir. | +| *Veri dizesi maksimum uzunluğu aşıyorsa ne olur?* | DataBar Expanded Stacked sembolü en fazla 61 sayısal karakteri destekler. Bu sınır aşılırsa `ArgumentException` fırlatılır. Girişi jeneratöre atamadan önce doğrulayın. | +| *`BarcodeGenerator` nesnesini dispose etmem gerekiyor mu?* | `BarcodeGenerator` `IDisposable` uygular. Uzun‑çalışan bir serviste, `using` bloğu içinde kullanın veya native kaynakları serbest bırakmak için `Dispose()` metodunu manuel olarak çağırın. | +| *PNG yerine SVG üretebilir miyim?* | Kesinlikle. `Save` metodunda `BarCodeImageFormat.Svg` kullanın. | +| *Kütüphane .NET Core ile uyumlu mu?* | Aspose.BarCode for .NET, .NET Core 3.1, .NET 5, .NET 6 ve sonrası sürümleri destekler. Kodda değişiklik yapmanız gerekmez. | + +--- + +## Sonuç + +Artık Aspose.BarCode kullanarak C#’ta **4‑sütunlu databar barkod oluşturmayı**, satırlarla düzeni ayarlamayı ve sonucu kullanışlı bir **barkod görüntü formatı** ile dışa aktarmayı biliyorsunuz. Tam örnek, hem sütun‑tabanlı hem de satır‑tabanlı konfigürasyonları göstererek etiket‑baskısı veya mobil‑tarama senaryoları için sağlam bir temel sunar. + +**Sonraki adımlar** + +* Farklı veri yükleriyle deney yapın ve tarayıcı uyumluluğunu doğrulayın. +* Ön‑arkap renkleri gibi ek stil seçeneklerini keşfedin (`generator.Parameters.Barcode.Color`). +* `Graphics` API’sini kullanarak barkodu diğer grafiklerle birleştirip özel etiket tasarımları oluşturun. + +Kodunuzu ASP.NET Core, Windows Forms veya Xamarin projelerine uyarlamaktan çekinmeyin—Aspose.BarCode tüm .NET platformlarında çalışır. İyi kodlamalar! + +## Bir sonraki öğrenmeniz gerekenler + +Aşağıdaki öğreticiler, bu rehberde gösterilen tekniklere dayanan ve yakından ilgili konuları kapsar. Her kaynak, ek API özelliklerini öğrenmenize ve projelerinizde alternatif uygulama yaklaşımlarını keşfetmenize yardımcı olacak tam çalışan kod örnekleri ve adım adım açıklamalar içerir. + +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Create barcode image c# – Configure Codablock F Rows & Columns](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [How to create dotcode extended codetext with Aspose.BarCode for .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/turkish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/turkish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..fdc9e89cf --- /dev/null +++ b/barcode/turkish/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,303 @@ +--- +category: general +date: 2026-08-09 +description: Bu adım adım rehberle C#'ta barkod resmi oluşturun. Barkod üretmeyi, + barkod yüksekliğini piksel olarak ayarlamayı ve birden fazla barkodu verimli bir + şekilde oluşturmayı öğrenin. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: tr +lastmod: 2026-08-09 +og_description: C#'ta hızlı bir şekilde barkod resmi oluşturun. Bu öğreticiyi izleyerek + barkod nasıl oluşturulur, barkod yüksekliği piksel olarak nasıl ayarlanır ve birden + fazla barkod nasıl üretilir öğrenin. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: C#'ta barkod resmi oluşturma – geliştiriciler için tam rehber +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: C#'ta barkod resmi oluşturma – tam programlama rehberi +url: /tr/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C#’ta barkod resmi oluşturma – tam programlama rehberi + +Bir .NET uygulamasında **barkod resmi oluşturmanız** gerekiyorsa, bu rehber Aspose.BarCode kütüphanesini kullanarak **barkod nasıl oluşturulur** gösterir. **Barkod yüksekliği piksellerini** nasıl kontrol edeceğinizi, resmi nasıl kaydedeceğinizi ve kodu çoğaltmadan **birden fazla barkod** üretmeyi göreceksiniz. + +Bu öğretici, paketi kurmaktan boyutları özelleştirmeye kadar her şeyi kapsar, böylece projenize bugün kopyala‑yapıştır yapabileceğiniz hazır bir örnek alabilirsiniz. + +## Önkoşullar + +* .NET 6.0 SDK veya daha yeni bir sürüm yüklü +* Visual Studio 2022 (veya herhangi bir C# IDE) +* NuGet paketi `Aspose.BarCode` – şu şekilde kurun + +```bash +dotnet add package Aspose.BarCode +``` + +Ek bir bağımlılık gerekmez. + +## BarcodeGenerator C# ile barkod resmi oluşturma + +Barkod resmi oluşturmak için temel sınıf `BarcodeGenerator`dır. Kodlama türünü, veri dizesini ve tüm render parametrelerini kapsar. + +### Adım 1: Çıktı klasörünü tanımlayın + +Oluşturulan PNG dosyalarının saklanacağı bir klasör seçin. Mutlak bir yol kullanmak izin sorunlarını önler. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Neden?** Klasörü programlı olarak oluşturmak, sonraki `Save` çağrılarının yeni bir makinede bile başarılı olmasını garanti eder. + +### Adım 2: Barkod üreticisini örnekleyin + +DataBar Omnidirectional barkodu için `EncodeTypes.DatabarOmniDirectional` ve GS1‑128 veri dizesini geçirin. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Not:** `BarcodeGenerator` nesnesi yeniden kullanılabilir; aynı veriden **birden fazla barkod** oluşturmak için kaydetmeler arasında parametrelerini değiştirebilirsiniz. + +### Adım 3: Ortak barkod parametrelerini ayarlayın + +En yaygın görsel ayarlamalar X‑dimension (modül genişliği) ve çubuk yüksekliğidir. İkisi de piksel cinsinden ifade edilir. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Neden X‑dimension ayarlansın?** Daha küçük bir X‑dimension daha yüksek çözünürlük sağlar; bu, resim yazdırılacak ya da yüksek‑DPI ekranlarda gösterilecekse önemlidir. + +### Adım 4: İlk barkod resmini kaydedin + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +`DatabarBarHeight30Pixels.png` dosyası artık 30 piksel yüksekliğinde bir DataBar Omnidirectional barkod içeriyor. + +### Adım 5: Barkod yüksekliği piksellerini ayarlayın + +Yüksekliği değiştirmek yeni bir `BarcodeGenerator` örneği gerektirmez—sadece parametreyi değiştirin. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Adım 6: İkinci barkod resmini kaydedin + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Artık farklı **barkod yüksekliği piksellerine** sahip iki PNG dosyanız var; bu, **barkod resmi oluşturma** varyasyonlarının ne kadar kolay olduğunu gösterir. + +## Barkod yüksekliği piksellerini dinamik olarak ayarlama + +Genellikle UI öğeleri veya basılı etiketlerle eşleşen yükseklikte bir dizi barkoda ihtiyacınız olur. Aşağıdaki yardımcı yöntem yüksekliğin değişimini soyutlar: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Artık tek bir satırda 45 piksel yüksekliğinde **barkod resmi oluşturmak** için `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` çağrısı yapabilirsiniz. + +## Döngü içinde birden fazla barkod oluşturma + +Ürün tanımlayıcılarından oluşan bir koleksiyonunuz olduğunda, `foreach` döngüsü tekrarlayan kodu ortadan kaldırır. Bu örnek, GTIN dizisinden **birden fazla barkod** oluşturmayı gösterir. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +Döngü, her biri farklı bir **barkod yüksekliği piksel** değerine sahip üç PNG dosyası üretir. `SaveBarcodeWithHeight` yardımcı yöntemi yüksekliğin değişimini kapsadığı için ana döngü temiz ve veriye odaklı kalır. + +### Beklenen çıktı + +Tam örnek çalıştırıldıktan sonra `Barcodes` klasörü şunları içerir: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Herhangi bir PNG'yi açtığınızda, standart mobil uygulamalarla taranabilen net bir DataBar Omnidirectional barkod görürsünüz. + +## Yaygın tuzaklar ve profesyonel ipuçları + +| Issue | Why it happens | How to avoid it | +|-------|----------------|-----------------| +| **Yanlış EncodeTypes** | DataBar için 1D tip kullanmak okunamayan bir görüntü üretir. | `EncodeTypes.DatabarOmniDirectional` (veya başka bir DataBar varyantı) seçin; GS1‑128 yükleri için her zaman bu seçeneği kullanın. | +| **Yetersiz X‑dimension** | Çok düşük X‑dimension, düşük çözünürlüklü monitörlerde ince çubukların kaybolmasına neden olabilir. | `XDimension.Pixels` değerini ekran gösterimi için ≥ 2 tutun; baskı için 3‑4’e yükseltin. | +| **Dosya yolu hataları** | Göreli yollar beklenmedik dizinlere çözülebilir. | Mutlak yollar oluşturmak için `Path.Combine` ve `Environment.CurrentDirectory` kullanın. | +| **Resimlerin üzerine yazılması** | Döngü içinde aynı dosya adını yeniden kullanmak önceki sonuçların üzerine yazar. | Dosya adına benzersiz tanımlayıcılar (ör. GTIN veya zaman damgası) ekleyin. | +| **Eksik NuGet paketi** | Kod derlenir ancak çalışma zamanında `FileNotFoundException` fırlatır. | `Aspose.BarCode`'un yüklü olduğunu ve projenin ona referans verdiğini doğrulayın. | + +## Tam çalışan örnek + +Aşağıda, bir konsol uygulamasına kopyalayabileceğiniz tam program yer alıyor. Tüm adımları, yardımcı yöntemleri ve hata yönetimini içerir. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Bu programı çalıştırmak + +## Sonra Ne Öğrenmelisiniz? + +Aşağıdaki öğreticiler, bu rehberde gösterilen tekniklere dayanarak yakından ilgili konuları kapsar. Her kaynak, ek API özelliklerini öğrenmenize ve kendi projelerinizde alternatif uygulama yaklaşımlarını keşfetmenize yardımcı olacak adım adım açıklamalar içeren tam çalışan kod örnekleri sunar. + +- [Barkod Özel Yükseklik Oluşturma – Tek Boyutlu Barkodlar](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [C# – GS1 DataMatrix Örneği ile barkod resmi oluşturma](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [DotCode barkod resmi oluşturma – satırlar & sütunlar (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/turkish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/turkish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..e481cb18c --- /dev/null +++ b/barcode/turkish/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,223 @@ +--- +category: general +date: 2026-08-09 +description: C# barkod oluşturucu ile barkod resmi oluşturun ve dakikalar içinde özel + en‑boy oranlarıyla birden fazla barkod üretmeyi öğrenin. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: tr +lastmod: 2026-08-09 +og_description: C# barkod oluşturucu kullanarak barkod resmi oluşturun. Bu öğreticide + birden fazla barkod oluşturma, en‑boy oranlarını ayarlama ve PNG dosyalarını verimli + bir şekilde kaydetme gösterilmektedir. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: C# barkod oluşturucu ile barkod resmi oluşturma – hızlı rehber +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: C# barkod oluşturucu ile barkod görüntüsü oluşturma – rehber +url: /tr/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# barcode generator ile barkod görüntüsü oluşturma – rehber + +Eğer **barkod görüntüsü oluştur** istiyorsanız, bu rehber C# barcode generator ile bunu nasıl yapacağınızı gösterir. Birden fazla barkod oluşturmayı, en‑boy oranını değiştirmeyi ve her görüntüyü PNG dosyası olarak kaydetmeyi öğreneceksiniz. + +Barkod görüntüleri oluşturmak, envanter sistemleri, satış noktası terminalleri veya nakliye etiketleri oluştururken yaygın bir görevdir. Bu öğreticinin sonunda, farklı en‑boy oranlarını gösteren iki hazır PNG dosyanız olacak ve bu yaklaşımı istediğiniz sayıda barkoda nasıl genişleteceğinizi anlayacaksınız. + +## Önkoşullar + +* .NET 6.0 SDK veya daha yeni bir sürüm yüklü +* Visual Studio 2022 (veya C# destekleyen herhangi bir IDE) +* DataBar Stacked Omnidirectional'ı destekleyen bir barkod kütüphanesine referans (örneğin, **Aspose.BarCode for .NET**). Kod parçacıkları Aspose API'sini kullanıyor, ancak kavramlar benzer özelliklere sahip herhangi bir kütüphane için geçerlidir. + +Ayrı bir veritabanına veya web sunucusuna ihtiyacınız yok—bu sade bir konsol uygulamasıdır. + +## Adım 1: Konsol projesini kurun + +Yeni bir konsol projesi oluşturun ve barkod kütüphanesini NuGet üzerinden ekleyin. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +`dotnet add package` komutu, daha sonra kullanılan `BarcodeGenerator` sınıfını sağlayan **Aspose.BarCode**'un en son kararlı sürümünü çeker. + +## Adım 2: Tam programı yazın + +*Program.cs* dosyasını açın ve içeriğini aşağıdaki tam örnekle değiştirin. Program bir **barkod görüntüsü** oluşturur, en‑boy oranını değiştirir ve iki PNG dosyası kaydeder. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Her bölümün önemi + +* **Create barcode image** – `BarcodeGenerator` yapıcı (constructor) nesneyi istenen semboloji ve veri ile başlatır. +* **c# barcode generator** – `Parameters` özelliği, render seçenekleri üzerinde tam kontrol sağlar; `XDimension.Pixels` ayarı, her çubuğun ekranda net olmasını garantiler. +* **generate multiple barcodes** – `DataBar.AspectRatio` değerini kaydetmeler arasında değiştirerek, aynı generator örneği nesneyi yeniden oluşturmadan iki farklı görüntü üretir, bu daha verimlidir. + +## Adım 3: Programı çalıştırın ve sonuçları görüntüleyin + +Uygulamayı çalıştırın: + +```bash +dotnet run +``` + +Aşağıdakine benzer bir konsol çıktısı görmelisiniz: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +`BarcodeOutputs` klasörünü açın. İki PNG dosyası bulacaksınız: + +* **DatabarAspectRatio15.png** – sınırlı yükseklikteki etiketler için uygun, kompakt bir barkod. +* **DatabarAspectRatio30.png** – daha uzun bir barkod; birçok tarayıcı bu barkodu uzaktan daha güvenilir okur. + +Her iki görüntü de PDF'lere yerleştirilebilir, makbuzlara yazdırılabilir veya bir mobil uygulamaya gönderilebilir. + +## Adım 4: Çözümü herhangi bir sayıda barkod oluşturacak şekilde genişletin + +Yukarıda gösterilen desen kolayca ölçeklenir: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – Döngü, en‑boy oranları dizisi üzerinde iterasyon yapar ve her değer için ayrı bir **barkod görüntüsü** oluşturur. +* `EncodeTypes` veya kodlanmış dizeyi ayarlayarak, çevreleyen mantığı değiştirmeden QR kodları, Code 128 veya diğer sembolojileri üretebilirsiniz. + +## Pratik ipuçları ve yaygın tuzaklar + +| İpucu | Açıklama | +|-----|-------------| +| **Reuse the same generator** | `BarcodeGenerator`'ı her görüntü için yeniden başlatmak gereksiz bir yük ekler. `Save` çağrıları arasında parametreleri değiştirmek daha hızlıdır ve daha az bellek kullanır. | +| **Validate the output folder** | Kaydetmeden önce her zaman `Directory.CreateDirectory` çağırın; aksi takdirde `Save`, bir `DirectoryNotFoundException` hatası fırlatır. | +| **Choose an appropriate X‑dimension** | Çok düşük piksel değerleri (ör. 1), düşük çözünürlüklü ekranlarda barkodun okunamaz olmasına neden olabilir. 2–3 değerleri çoğu yazıcı için iyi çalışır. | +| **Mind the encoding** | GS1 DataBar, GTIN için ön ek olarak `(01)` bekler. Parantezleri atarsanız, kütüphane geçersiz bir barkod üretebilir. | +| **Test with a real scanner** | Görsel inceleme yeterli değildir. PNG dosyalarını kullanmayı planladığınız gerçek tarayıcı donanımıyla test edin. | + +## Beklenen çıktı (görsel açıklama) + +*Her iki PNG dosyası da koyu‑üst‑açık bir DataBar Stacked Omnidirectional barkod gösterir. En‑boy oranı 15 olan sürüm daha kısadır, en‑boy oranı 30 olan sürüm ise yaklaşık iki kat daha uzundur.* + +Görüntüleri bir belgeye yerleştirirseniz, `XDimension.Pixels = 2` ayarladığımız için net bir şekilde renderlanırlar. + +## Sonuç + +Artık **barkod görüntüsü** dosyalarını **C# barcode generator** kullanarak nasıl oluşturacağınızı biliyorsunuz ve en‑boy oranını veya başka bir parametreyi ayarlayarak **birden fazla barkod** oluşturabilirsiniz. Tam, çalıştırılabilir örnek, generator örneğini yeniden kullanma, çıktı dizinlerini yönetme ve dosya oluşturmayı doğrulama gibi en iyi uygulamaları gösterir. + +Sonraki adımda şunları keşfedebilirsiniz: + +* `generator.Parameters.Barcode.Color` ile özel renkler eklemek (ikincil anahtar kelime: **c# barcode generator**) +* JPEG veya SVG gibi diğer formatlara dışa aktarmak (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Barkod oluşturma mantığını bir Web API'ye entegre ederek isteğe bağlı görüntü sunmak (ikincil anahtar kelime + +## Sonra Ne Öğrenmelisiniz? + +Aşağıdaki öğreticiler, bu rehberde gösterilen tekniklere dayanarak yakından ilgili konuları kapsar. Her kaynak, ek API özelliklerini öğrenmenize ve kendi projelerinizde alternatif uygulama yaklaşımlarını keşfetmenize yardımcı olmak için adım adım açıklamalar içeren tam çalışan kod örnekleri sunar. + +- [Barkod PNG Oluştur – DataMatrix En‑Boy Oranı – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator öğreticisi c# – Aspose.BarCode for .NET ile Code 16K Barkod En‑Boy Oranlarını Özelleştirme](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [Aspose.BarCode for .NET kullanarak özel en‑boy oranı ile Aztec barkod nasıl oluşturulur](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/vietnamese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md b/barcode/vietnamese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..20bade3d6 --- /dev/null +++ b/barcode/vietnamese/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,241 @@ +--- +category: general +date: 2026-08-09 +description: Tạo mã vạch databar 4 cột trong C# nhanh chóng với Aspose.BarCode. Tìm + hiểu cách cấu hình cột, hàng và lưu ảnh PNG trong hướng dẫn ngắn gọn này. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create 4‑column databar barcode +- databar expanded stacked +- barcode generator c# +- set barcode rows +- barcode image format +language: vi +lastmod: 2026-08-09 +og_description: Tạo mã vạch databar 4 cột trong C# bằng Aspose.BarCode, sau đó tùy + chỉnh các hàng và xuất ảnh PNG cho ứng dụng của bạn. +og_image_alt: Screenshot of a 4‑column DataBar Expanded Stacked barcode generated + in C# +og_title: Tạo mã vạch databar 4 cột trong C# – hướng dẫn nhanh +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + headline: Create 4‑column databar barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create 4‑column databar barcode in C# quickly with Aspose.BarCode. + Learn how to configure columns, rows, and save PNG images in this concise guide. + name: Create 4‑column databar barcode in C# – step‑by‑step guide + steps: + - name: Configure DataBar Expanded Stacked columns + text: If you need a different column count, simply change the integer assigned + to `Columns`. The property accepts values from 1 to 4 for the expanded stacked + variant. + - name: Save the barcode image + text: The `BarCodeImageFormat` enumeration provides several options (`Png`, `Jpeg`, + `Bmp`, `Gif`, `Tiff`). PNG is loss‑less and works well for most web and desktop + scenarios. + - name: Set barcode rows dynamically + text: 'You can compute the row count at runtime based on input data:' + type: HowTo +tags: +- barcode +- C# +- Aspose +- DataBar +title: Tạo mã vạch databar 4 cột trong C# – hướng dẫn từng bước +url: /vi/python-java/general/create-4-column-databar-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Tạo mã vạch databar 4‑cột trong C# – hướng dẫn từng bước + +Nếu bạn cần **tạo mã vạch databar 4 cột** trong C#, hướng dẫn này sẽ chỉ cho bạn cách thực hiện. Chúng tôi sẽ hướng dẫn cách tạo mã vạch DataBar Expanded Stacked, cấu hình bốn cột và lưu kết quả dưới dạng ảnh PNG. + +Trong hướng dẫn này bạn sẽ học cách: + +* Khởi tạo `BarcodeGenerator` cho ký hiệu **DataBar Expanded Stacked**. +* Đặt số cột thành 4 (yêu cầu chính). +* Điều chỉnh số hàng khi bạn cần bố cục stacked với ba hàng. +* Xuất mã vạch dưới dạng PNG bằng **định dạng ảnh mã vạch** phù hợp. + +Bạn chỉ cần thư viện Aspose.BarCode cho .NET (phiên bản 23.10 trở lên) và môi trường phát triển .NET 6+ như Visual Studio 2022. Không cần phụ thuộc nào khác. + +--- + +## Cách tạo mã vạch databar 4‑cột + +Bước đầu tiên là tạo một thể hiện `BarcodeGenerator` nhắm tới ký hiệu **DataBar Expanded Stacked**. Lớp này bao gồm tất cả các tùy chọn render, giúp việc chuyển đổi giữa bố cục dựa trên cột và dựa trên hàng trở nên đơn giản. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // 1️⃣ Initialise a generator for DataBar Expanded Stacked + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Set the barcode to use a 4‑column layout + generator.Parameters.Barcode.DataBar.Columns = 4; + + // 3️⃣ Save the image as PNG + generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); + } +} +``` + +**Tại sao cách này hoạt động:** +`EncodeTypes.DatabarExpandedStacked` báo cho Aspose.BarCode tạo ra phiên bản stacked của họ DataBar. Thuộc tính `DataBar.Columns` kiểm soát số mô-đun dọc mà mã vạch chiếm. Đặt nó thành 4 đáp ứng yêu cầu **tạo mã vạch databar 4‑cột**. Cuối cùng, `Save` ghi hình ảnh biểu diễn ra đĩa bằng **định dạng ảnh mã vạch** `Png`. + +### Cấu hình các cột cho DataBar Expanded Stacked + +Nếu bạn cần số cột khác, chỉ cần thay đổi số nguyên gán cho `Columns`. Thuộc tính này chấp nhận giá trị từ 1 đến 4 cho biến thể stacked mở rộng. + +```csharp +// Example: switch to a 2‑column layout +generator.Parameters.Barcode.DataBar.Columns = 2; +``` + +*Mẹo:* Luôn kiểm tra mã vạch đã tạo bằng máy quét hỗ trợ họ DataBar, vì chỉ nhìn thấy hình ảnh không đảm bảo khả năng đọc. + +### Lưu ảnh mã vạch + +Kiểu liệt kê `BarCodeImageFormat` cung cấp một số tùy chọn (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG không mất dữ liệu và hoạt động tốt cho hầu hết các kịch bản web và desktop. + +```csharp +generator.Save("DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Nếu bạn cần định dạng khác, thay `Png` bằng giá trị enum mong muốn. Tệp đã lưu có thể nhúng trực tiếp vào HTML, PDF, hoặc in trên nhãn. + +## Tạo mã vạch với các hàng tùy chỉnh + +Đôi khi cần bố cục stacked với số hàng cụ thể thay vì số cột. Lớp `BarcodeGenerator` cũng cung cấp thuộc tính `Rows` cho mục đích này. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class RowExample +{ + static void Main() + { + // 1️⃣ Initialise a generator for the same symbology + BarcodeGenerator rowGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + + // 2️⃣ Configure the barcode to use a 3‑row layout + rowGenerator.Parameters.Barcode.DataBar.Rows = 3; + + // 3️⃣ Save the image as PNG + rowGenerator.Save("DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Tại sao hàng quan trọng:** +Khi mã vạch stacked cao hơn chiều rộng, thuộc tính `Rows` xác định số lát ngang mà ký hiệu được chia. Đặt `Rows = 3` tạo ra một mã vạch stacked ba hàng, hữu ích cho nhãn có chiều rộng hẹp. + +### Đặt số hàng của mã vạch một cách động + +Bạn có thể tính số hàng tại thời gian chạy dựa trên dữ liệu đầu vào: + +```csharp +int desiredRows = GetRowsFromUser(); // your custom logic +rowGenerator.Parameters.Barcode.DataBar.Rows = desiredRows; +``` + +Tính linh hoạt này cho phép bạn **đặt số hàng của mã vạch** mà không cần biên dịch lại ứng dụng. + +## Ví dụ đầy đủ từ đầu đến cuối + +Dưới đây là một chương trình duy nhất tạo cả mã vạch 4‑cột và mã vạch 3‑hàng, minh họa cách hai cấu hình này cùng tồn tại. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class FullExample +{ + static void Main() + { + // ---------- 4‑column barcode ---------- + BarcodeGenerator colGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + colGen.Parameters.Barcode.DataBar.Columns = 4; // create 4‑column databar barcode + colGen.Save("DatabarCols4.png", BarCodeImageFormat.Png); + + // ---------- 3‑row barcode ---------- + BarcodeGenerator rowGen = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, + "Databar Expanded Stacked long"); + rowGen.Parameters.Barcode.DataBar.Rows = 3; // set barcode rows to 3 + rowGen.Save("DatabarRows3.png", BarCodeImageFormat.Png); + + // Output confirmation + System.Console.WriteLine("Barcodes generated:"); + System.Console.WriteLine(" - DatabarCols4.png (4 columns)"); + System.Console.WriteLine(" - DatabarRows3.png (3 rows)"); + } +} +``` + +**Kết quả mong đợi:** +Hai tệp PNG xuất hiện trong thư mục làm việc của ứng dụng: + +* `DatabarCols4.png` – một mã vạch DataBar Expanded Stacked với bốn cột dọc. +* `DatabarRows3.png` – cùng ký hiệu được sắp xếp thành ba hàng ngang. + +Cả hai ảnh đều có thể mở bằng bất kỳ trình xem ảnh nào hoặc nhúng vào điều khiển UI. + +--- + +## Các câu hỏi thường gặp và các trường hợp đặc biệt + +| Câu hỏi | Trả lời | +|----------|--------| +| *Bạn có thể sử dụng ký hiệu mã vạch khác không?* | Có. Thay `EncodeTypes.DatabarExpandedStacked` bằng một giá trị `EncodeTypes` khác (ví dụ, `EncodeTypes.QR`), nhưng các thuộc tính `Columns` và `Rows` chỉ áp dụng cho họ DataBar. | +| *Nếu chuỗi dữ liệu vượt quá độ dài tối đa thì sao?* | Ký hiệu DataBar Expanded Stacked hỗ trợ tối đa 61 ký tự số. Vượt quá giới hạn này sẽ gây ra `ArgumentException`. Hãy kiểm tra đầu vào trước khi gán cho generator. | +| *Có cần giải phóng `BarcodeGenerator` không?* | `BarcodeGenerator` triển khai `IDisposable`. Trong dịch vụ chạy lâu, hãy bọc nó trong khối `using` hoặc gọi `Dispose()` thủ công để giải phóng tài nguyên gốc. | +| *Có thể tạo SVG thay vì PNG không?* | Chắc chắn. Sử dụng `BarCodeImageFormat.Svg` trong phương thức `Save`. | +| *Thư viện có tương thích với .NET Core không?* | Aspose.BarCode cho .NET hỗ trợ .NET Core 3.1, .NET 5, .NET 6 và các phiên bản sau. Không cần thay đổi mã. | + +--- + +## Kết luận + +Bạn đã biết cách **tạo mã vạch databar 4‑cột** trong C# bằng Aspose.BarCode, cách điều chỉnh bố cục bằng hàng, và cách xuất kết quả dưới dạng **định dạng ảnh mã vạch** tiện lợi. Ví dụ hoàn chỉnh cho thấy cả cấu hình dựa trên cột và dựa trên hàng, cung cấp nền tảng vững chắc cho bất kỳ kịch bản in nhãn hoặc quét di động nào. + +**Các bước tiếp theo** + +* Thử nghiệm với các dữ liệu payload khác nhau và xác minh khả năng tương thích của máy quét. +* Khám phá các tùy chọn định dạng bổ sung như màu nền/màu chữ (`generator.Parameters.Barcode.Color`). +* Kết hợp mã vạch với các đồ họa khác bằng API `Graphics` để thiết kế nhãn tùy chỉnh. + +Bạn có thể tùy chỉnh mã cho các dự án ASP.NET Core, Windows Forms, hoặc Xamarin—Aspose.BarCode hoạt động trên mọi nền tảng .NET. Chúc lập trình vui! + +## Bạn Nên Học Gì Tiếp Theo? + +Các hướng dẫn sau đây đề cập đến các chủ đề liên quan chặt chẽ, xây dựng trên các kỹ thuật được trình bày trong hướng dẫn này. Mỗi tài nguyên bao gồm các ví dụ mã đầy đủ với giải thích từng bước để giúp bạn nắm vững các tính năng API bổ sung và khám phá các cách triển khai thay thế trong dự án của mình. + +- [Tạo ảnh mã vạch DotCode – hàng & cột (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Tạo ảnh mã vạch c# – Cấu hình Codablock F Hàng & Cột](/barcode/english/net/codablock-f-encoding/codablock-f-row-column-configuration/) +- [Cách tạo dotcode với mã mở rộng bằng Aspose.BarCode cho .NET](/barcode/english/net/dotcode-barcode-configuration/dotcode-extended-code-text-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/vietnamese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md b/barcode/vietnamese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md new file mode 100644 index 000000000..0270ede77 --- /dev/null +++ b/barcode/vietnamese/python-java/general/create-barcode-image-in-c-complete-programming-guide/_index.md @@ -0,0 +1,306 @@ +--- +category: general +date: 2026-08-09 +description: Tạo hình ảnh mã vạch trong C# với hướng dẫn từng bước này. Tìm hiểu cách + tạo mã vạch, điều chỉnh độ cao mã vạch tính bằng pixel và tạo nhiều mã vạch một + cách hiệu quả. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- how to generate barcode +- barcode generator c# +- create multiple barcodes +- barcode height pixels +language: vi +lastmod: 2026-08-09 +og_description: Tạo hình ảnh mã vạch trong C# nhanh chóng. Theo dõi hướng dẫn này + để học cách tạo mã vạch, đặt chiều cao mã vạch tính bằng pixel và tạo nhiều mã vạch. +og_image_alt: Screenshot of barcode images generated with C# code showing different + heights +og_title: Tạo hình ảnh mã vạch trong C# – hướng dẫn đầy đủ cho nhà phát triển +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + headline: Create barcode image in C# – complete programming guide + type: TechArticle +- description: Create barcode image in C# with this step-by-step guide. Learn how + to generate barcode, adjust barcode height pixels, and create multiple barcodes + efficiently. + name: Create barcode image in C# – complete programming guide + steps: + - name: Define the output folder + text: Choose a folder where the generated PNG files will be stored. Using an absolute + path avoids permission surprises. + - name: Instantiate the barcode generator + text: For a DataBar Omnidirectional barcode, pass `EncodeTypes.DatabarOmniDirectional` + and the GS1‑128 data string. + - name: Set common barcode parameters + text: The most common visual tweaks are the X‑dimension (module width) and the + bar height. Both are expressed in pixels. + - name: Save the first barcode image + text: '```csharp // Step 4: Save the barcode image with a 30 px height string + file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); barcode.Save(file30, + BarCodeImageFormat.Png); ```' + - name: Adjust the barcode height pixels + text: Changing the height does not require a new `BarcodeGenerator` instance—just + modify the parameter. + - name: Save the second barcode image + text: '```csharp // Step 6: Save the barcode image with the new 60 px height string + file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); barcode.Save(file60, + BarCodeImageFormat.Png); ```' + - name: Expected output + text: 'After running the full sample, the `Barcodes` folder contains:' + type: HowTo +tags: +- barcode +- C# +- image generation +title: Tạo hình ảnh mã vạch trong C# – hướng dẫn lập trình toàn diện +url: /vi/python-java/general/create-barcode-image-in-c-complete-programming-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Tạo hình ảnh mã vạch trong C# – hướng dẫn lập trình đầy đủ + +Nếu bạn cần **tạo hình ảnh mã vạch** trong một ứng dụng .NET, hướng dẫn này sẽ chỉ cho bạn **cách tạo mã vạch** bằng thư viện Aspose.BarCode. Bạn sẽ thấy cách điều chỉnh **độ cao mã vạch tính bằng pixel**, lưu ảnh, và tạo **nhiều mã vạch** mà không cần sao chép lại mã. + +Bài tutorial bao gồm mọi thứ từ cài đặt gói đến tùy chỉnh kích thước, vì vậy bạn có thể sao chép‑dán một ví dụ đã sẵn sàng chạy vào dự án của mình ngay hôm nay. + +## Điều kiện tiên quyết + +Trước khi bắt đầu, hãy chắc chắn rằng bạn có: + +* .NET 6.0 SDK hoặc phiên bản mới hơn đã được cài đặt +* Visual Studio 2022 (hoặc bất kỳ IDE C# nào) +* Gói NuGet `Aspose.BarCode` – cài đặt bằng + +```bash +dotnet add package Aspose.BarCode +``` + +Không cần bất kỳ phụ thuộc bổ sung nào. + +## Cách tạo hình ảnh mã vạch với BarcodeGenerator C# + +Lớp cốt lõi để tạo hình ảnh mã vạch là `BarcodeGenerator`. Nó bao gồm loại mã hoá, chuỗi dữ liệu, và tất cả các tham số render. + +### Bước 1: Xác định thư mục đầu ra + +Chọn một thư mục nơi các tệp PNG được tạo sẽ được lưu. Sử dụng đường dẫn tuyệt đối giúp tránh các vấn đề về quyền truy cập. + +```csharp +// Step 1: Define the output folder +string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); +Directory.CreateDirectory(outputFolder); +``` + +> **Tại sao?** Tạo thư mục bằng chương trình đảm bảo các lệnh `Save` tiếp theo sẽ thành công ngay cả trên máy mới. + +### Bước 2: Khởi tạo barcode generator + +Đối với mã DataBar Omnidirectional, truyền `EncodeTypes.DatabarOmniDirectional` và chuỗi dữ liệu GS1‑128. + +```csharp +// Step 2: Create a DataBar Omnidirectional barcode generator with the data to encode +var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); +``` + +> **Lưu ý:** Đối tượng `BarcodeGenerator` có thể tái sử dụng; bạn có thể thay đổi các tham số giữa các lần lưu để **tạo nhiều mã vạch** từ cùng một dữ liệu. + +### Bước 3: Đặt các tham số chung cho mã vạch + +Các điều chỉnh hình ảnh phổ biến nhất là X‑dimension (độ rộng mô-đun) và chiều cao thanh. Cả hai đều được biểu thị bằng pixel. + +```csharp +// Step 3: Set common barcode parameters (X‑dimension and initial height) +barcode.Parameters.Barcode.XDimension.Pixels = 2; // thin modules for sharper output +barcode.Parameters.Barcode.BarHeight.Pixels = 30; // initial height – 30 px +``` + +> **Tại sao phải đặt X‑dimension?** X‑dimension nhỏ hơn tạo độ phân giải cao hơn, điều này quan trọng khi hình ảnh sẽ được in hoặc hiển thị trên màn hình DPI cao. + +### Bước 4: Lưu hình ảnh mã vạch đầu tiên + +```csharp +// Step 4: Save the barcode image with a 30 px height +string file30 = Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"); +barcode.Save(file30, BarCodeImageFormat.Png); +``` + +Tệp `DatabarBarHeight30Pixels.png` bây giờ chứa một mã DataBar Omnidirectional có chiều cao 30 pixel. + +### Bước 5: Điều chỉnh chiều cao mã vạch tính bằng pixel + +Thay đổi chiều cao không cần tạo một thể hiện `BarcodeGenerator` mới—chỉ cần sửa tham số. + +```csharp +// Step 5: Change the bar height to 60 px for the same barcode +barcode.Parameters.Barcode.BarHeight.Pixels = 60; +``` + +### Bước 6: Lưu hình ảnh mã vạch thứ hai + +```csharp +// Step 6: Save the barcode image with the new 60 px height +string file60 = Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"); +barcode.Save(file60, BarCodeImageFormat.Png); +``` + +Bây giờ bạn có hai tệp PNG với **chiều cao mã vạch tính bằng pixel** khác nhau, minh họa cách dễ dàng **tạo hình ảnh mã vạch** đa dạng. + +## Đặt chiều cao mã vạch tính bằng pixel một cách động + +Thường bạn cần một loạt mã vạch với chiều cao phù hợp với các thành phần UI hoặc nhãn in. Phương thức trợ giúp dưới đây trừu tượng hoá việc thay đổi chiều cao: + +```csharp +/// +/// Saves a barcode image with a custom height. +/// +/// Configured BarcodeGenerator instance. +/// Desired bar height in pixels. +/// Target file name (including path). +void SaveBarcodeWithHeight(BarcodeGenerator generator, int heightPx, string fileName) +{ + generator.Parameters.Barcode.BarHeight.Pixels = heightPx; + generator.Save(fileName, BarCodeImageFormat.Png); +} +``` + +Bạn có thể gọi `SaveBarcodeWithHeight(barcode, 45, "BarHeight45.png");` để **tạo hình ảnh mã vạch** với chiều cao 45 pixel trong một dòng lệnh. + +## Tạo nhiều mã vạch trong vòng lặp + +Khi bạn có một tập hợp các định danh sản phẩm, vòng lặp `foreach` loại bỏ việc lặp lại mã. Ví dụ này cho thấy cách **tạo nhiều mã vạch** từ một mảng GTIN. + +```csharp +string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; +int[] heights = { 30, 45, 60 }; // different heights for visual variety + +for (int i = 0; i < gtins.Length; i++) +{ + // Encode each GTIN as a DataBar Omnidirectional barcode + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + + // Reuse the X‑dimension setting for consistency + gen.Parameters.Barcode.XDimension.Pixels = 2; + + // Choose a height from the heights array (or calculate dynamically) + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); +} +``` + +Vòng lặp tạo ra ba tệp PNG, mỗi tệp có một **giá trị chiều cao mã vạch tính bằng pixel** riêng. Vì phương thức trợ giúp `SaveBarcodeWithHeight` đã bao gói việc thay đổi chiều cao, vòng lặp chính vẫn gọn gàng và tập trung vào dữ liệu. + +### Kết quả mong đợi + +Sau khi chạy toàn bộ mẫu, thư mục `Barcodes` sẽ chứa: + +``` +DatabarBarHeight30Pixels.png +DatabarBarHeight60Pixels.png +Databar_01234567890123_Height30px.png +Databar_09876543210987_Height45px.png +Databar_12345098765432_Height60px.png +``` + +Mở bất kỳ tệp PNG nào sẽ hiển thị một mã DataBar Omnidirectional sắc nét, có thể quét bằng các ứng dụng di động tiêu chuẩn. + +## Những lỗi thường gặp và mẹo chuyên nghiệp + +| Vấn đề | Tại sao xảy ra | Cách tránh | +|-------|----------------|------------| +| **EncodeTypes sai** | Sử dụng loại 1D cho DataBar sẽ tạo ra hình ảnh không đọc được. | Luôn chọn `EncodeTypes.DatabarOmniDirectional` (hoặc biến thể DataBar khác) cho payload GS1‑128. | +| **X‑dimension không đủ** | X‑dimension quá thấp có thể làm cho các thanh mỏng biến mất trên màn hình độ phân giải thấp. | Giữ `XDimension.Pixels` ≥ 2 cho hiển thị trên màn hình; tăng lên 3‑4 cho in ấn. | +| **Lỗi đường dẫn tệp** | Đường dẫn tương đối có thể trỏ tới thư mục không mong muốn. | Sử dụng `Path.Combine` và `Environment.CurrentDirectory` để xây dựng đường dẫn tuyệt đối. | +| **Ghi đè ảnh** | Sử dụng cùng một tên tệp trong vòng lặp sẽ ghi đè kết quả trước đó. | Bao gồm các định danh duy nhất (ví dụ: GTIN hoặc timestamp) trong tên tệp. | +| **Thiếu gói NuGet** | Mã biên dịch nhưng ném `FileNotFoundException` lúc chạy. | Kiểm tra `Aspose.BarCode` đã được cài đặt và dự án đã tham chiếu tới nó. | + +## Ví dụ hoàn chỉnh hoạt động + +Dưới đây là chương trình đầy đủ mà bạn có thể sao chép vào một ứng dụng console. Nó bao gồm tất cả các bước, phương thức trợ giúp, và xử lý lỗi. + +```csharp +using System; +using System.IO; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Prepare output folder + string outputFolder = Path.Combine(Environment.CurrentDirectory, "Barcodes"); + Directory.CreateDirectory(outputFolder); + + // ---------- Single barcode with two heights ---------- + var barcode = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, "(01)12345678901231"); + + barcode.Parameters.Barcode.XDimension.Pixels = 2; + barcode.Parameters.Barcode.BarHeight.Pixels = 30; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight30Pixels.png"), + BarCodeImageFormat.Png); + + barcode.Parameters.Barcode.BarHeight.Pixels = 60; + barcode.Save(Path.Combine(outputFolder, "DatabarBarHeight60Pixels.png"), + BarCodeImageFormat.Png); + + // ---------- Helper for dynamic heights ---------- + void SaveBarcodeWithHeight(BarcodeGenerator gen, int heightPx, string fileName) + { + gen.Parameters.Barcode.BarHeight.Pixels = heightPx; + gen.Save(fileName, BarCodeImageFormat.Png); + } + + // ---------- Multiple barcodes ---------- + string[] gtins = { "01234567890123", "09876543210987", "12345098765432" }; + int[] heights = { 30, 45, 60 }; + + for (int i = 0; i < gtins.Length; i++) + { + var gen = new BarcodeGenerator(EncodeTypes.DatabarOmniDirectional, + $"(01){gtins[i]}"); + gen.Parameters.Barcode.XDimension.Pixels = 2; + + int height = heights[i % heights.Length]; + string filePath = Path.Combine(outputFolder, + $"Databar_{gtins[i]}_Height{height}px.png"); + + SaveBarcodeWithHeight(gen, height, filePath); + } + + Console.WriteLine($"Barcode images created in: {outputFolder}"); + } +} +``` + +Chạy chương trình này + + +## Bạn Nên Học Gì Tiếp Theo? + + +Các tutorial sau đây đề cập đến các chủ đề liên quan chặt chẽ, xây dựng trên các kỹ thuật được trình bày trong hướng dẫn này. Mỗi tài nguyên bao gồm các ví dụ mã hoàn chỉnh với giải thích chi tiết từng bước để giúp bạn nắm vững các tính năng API bổ sung và khám phá các cách triển khai thay thế trong dự án của mình. + +- [Tạo chiều cao tùy chỉnh cho mã vạch – Mã vạch một chiều](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-barcode-height-adjustment/) +- [Tạo hình ảnh mã vạch C# – Ví dụ GS1 DataMatrix](/barcode/english/net/gs1-barcode-encoding/gs1-datamatrix-example/) +- [Tạo hình ảnh mã vạch DotCode – hàng & cột (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/vietnamese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md b/barcode/vietnamese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md new file mode 100644 index 000000000..85b8d976e --- /dev/null +++ b/barcode/vietnamese/python-java/general/create-barcode-image-with-c-barcode-generator-guide/_index.md @@ -0,0 +1,223 @@ +--- +category: general +date: 2026-08-09 +description: Tạo hình ảnh mã vạch bằng trình tạo mã vạch C# và học cách tạo nhiều + mã vạch với tỷ lệ khung tùy chỉnh trong vài phút. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create barcode image +- c# barcode generator +- generate multiple barcodes +- barcode aspect ratio +- barcode image format +language: vi +lastmod: 2026-08-09 +og_description: Tạo hình ảnh mã vạch bằng trình tạo mã vạch C#. Hướng dẫn này cho + thấy cách tạo nhiều mã vạch, điều chỉnh tỷ lệ khung hình và lưu tệp PNG một cách + hiệu quả. +og_image_alt: Example of create barcode image output with aspect ratios 15 and 30 + using C# barcode generator +og_title: Tạo hình ảnh mã vạch bằng trình tạo mã vạch C# – hướng dẫn nhanh +schemas: +- author: Aspose + dateModified: '2026-08-09' + description: Create barcode image with a C# barcode generator and learn to generate + multiple barcodes with custom aspect ratios in minutes. + headline: Create barcode image with C# barcode generator – guide + type: TechArticle +tags: +- barcode +- C# +- image generation +title: Tạo hình ảnh mã vạch bằng trình tạo mã vạch C# – hướng dẫn +url: /vi/python-java/general/create-barcode-image-with-c-barcode-generator-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Tạo hình ảnh mã vạch với trình tạo mã vạch C# – hướng dẫn + +Nếu bạn cần **tạo hình ảnh mã vạch** nhanh chóng, hướng dẫn này sẽ chỉ cho bạn cách thực hiện bằng một trình tạo mã vạch C#. Bạn sẽ học cách tạo nhiều mã vạch, thay đổi tỷ lệ khung hình và lưu mỗi hình ảnh dưới dạng tệp PNG. + +Việc tạo hình ảnh mã vạch là một nhiệm vụ phổ biến khi xây dựng hệ thống quản lý tồn kho, thiết bị điểm bán hàng, hoặc nhãn vận chuyển. Khi kết thúc tutorial này, bạn sẽ có hai tệp PNG sẵn sàng sử dụng, thể hiện các tỷ lệ khung hình khác nhau, và bạn sẽ hiểu cách mở rộng phương pháp này cho bất kỳ số lượng mã vạch nào. + +## Yêu cầu trước + +* .NET 6.0 SDK hoặc phiên bản mới hơn đã được cài đặt +* Visual Studio 2022 (hoặc bất kỳ IDE nào hỗ trợ C#) +* Tham chiếu tới một thư viện mã vạch hỗ trợ DataBar Stacked Omnidirectional (ví dụ, **Aspose.BarCode for .NET**). Các đoạn mã mẫu sử dụng API của Aspose, nhưng các khái niệm áp dụng cho bất kỳ thư viện nào có các thuộc tính tương tự. + +Bạn không cần một cơ sở dữ liệu hoặc máy chủ web riêng—đây là một ứng dụng console đơn giản. + +## Bước 1: Thiết lập dự án console + +Tạo một dự án console mới và thêm thư viện mã vạch qua NuGet. + +```bash +dotnet new console -n BarcodeDemo +cd BarcodeDemo +dotnet add package Aspose.BarCode +``` + +Lệnh `dotnet add package` sẽ tải phiên bản ổn định mới nhất của **Aspose.BarCode**, cung cấp lớp `BarcodeGenerator` được sử dụng sau này. + +## Bước 2: Viết chương trình đầy đủ + +Mở *Program.cs* và thay thế nội dung của nó bằng ví dụ hoàn chỉnh dưới đây. Chương trình tạo một **hình ảnh mã vạch**, thay đổi tỷ lệ khung hình và lưu hai tệp PNG. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // ----------------------------------------------------------------- + // 1️⃣ Create a DataBar Stacked Omnidirectional generator with sample data + // ----------------------------------------------------------------- + // The EncodeTypes enum tells the generator which barcode symbology to use. + // Here we use DataBar Stacked Omnidirectional (GS1 DataBar) and encode + // a sample GTIN (01) followed by a 14‑digit numeric string. + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // ----------------------------------------------------------------- + // 2️⃣ Configure common parameters (pixel size and X‑dimension) + // ----------------------------------------------------------------- + // XDimension.Pixels controls the width of the smallest bar in the image. + // A value of 2 gives a clear, high‑resolution output without increasing file size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // ----------------------------------------------------------------- + // 3️⃣ Set the first aspect ratio (15) and save the image + // ----------------------------------------------------------------- + // AspectRatio influences the height of the barcode relative to its width. + // An aspect ratio of 15 is typical for compact labels. + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + + string outputFolder = "BarcodeOutputs/"; + System.IO.Directory.CreateDirectory(outputFolder); // Ensure folder exists + + string file15 = $"{outputFolder}DatabarAspectRatio15.png"; + generator.Save(file15, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 15 → {file15}"); + + // ----------------------------------------------------------------- + // 4️⃣ Change the aspect ratio to 30 and save a second image + // ----------------------------------------------------------------- + // A larger aspect ratio (e.g., 30) produces a taller barcode, useful for + // scanning devices that expect more vertical space. + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + + string file30 = $"{outputFolder}DatabarAspectRatio30.png"; + generator.Save(file30, BarCodeImageFormat.Png); + Console.WriteLine($"Saved barcode with aspect ratio 30 → {file30}"); + + // ----------------------------------------------------------------- + // 5️⃣ Verify that both files exist + // ----------------------------------------------------------------- + Console.WriteLine("\nVerification:"); + Console.WriteLine($"File 15 exists: {System.IO.File.Exists(file15)}"); + Console.WriteLine($"File 30 exists: {System.IO.File.Exists(file30)}"); + } + } +} +``` + +### Tại sao mỗi phần lại quan trọng + +* **Create barcode image** – Hàm khởi tạo `BarcodeGenerator` khởi tạo đối tượng với ký hiệu và dữ liệu mong muốn. +* **c# barcode generator** – Thuộc tính `Parameters` cho phép bạn kiểm soát toàn bộ các tùy chọn render; việc đặt `XDimension.Pixels` đảm bảo mỗi vạch hiển thị sắc nét trên màn hình. +* **generate multiple barcodes** – Bằng cách thay đổi `DataBar.AspectRatio` giữa các lần lưu, cùng một instance của generator tạo ra hai hình ảnh khác nhau mà không cần tạo lại đối tượng, giúp hiệu quả hơn. + +## Bước 3: Chạy chương trình và xem kết quả + +Thực thi ứng dụng: + +```bash +dotnet run +``` + +Bạn sẽ thấy đầu ra console tương tự như: + +``` +Saved barcode with aspect ratio 15 → BarcodeOutputs/DatabarAspectRatio15.png +Saved barcode with aspect ratio 30 → BarcodeOutputs/DatabarAspectRatio30.png + +Verification: +File 15 exists: True +File 30 exists: True +``` + +Mở thư mục `BarcodeOutputs`. Bạn sẽ thấy hai tệp PNG: + +* **DatabarAspectRatio15.png** – một mã vạch gọn gàng phù hợp cho nhãn có chiều cao hạn chế. +* **DatabarAspectRatio30.png** – một mã vạch cao hơn mà nhiều máy quét có thể đọc một cách đáng tin cậy hơn từ khoảng cách xa. + +Cả hai hình ảnh đều sẵn sàng để nhúng vào PDF, in trên biên lai, hoặc gửi tới ứng dụng di động. + +## Bước 4: Mở rộng giải pháp để tạo bất kỳ số lượng mã vạch nào + +Mẫu đã trình bày ở trên có thể mở rộng dễ dàng: + +```csharp +int[] ratios = { 10, 15, 20, 30, 40 }; +foreach (int ratio in ratios) +{ + generator.Parameters.Barcode.DataBar.AspectRatio = ratio; + string path = $"{outputFolder}DatabarAspectRatio{ratio}.png"; + generator.Save(path, BarCodeImageFormat.Png); + Console.WriteLine($"Saved aspect ratio {ratio} → {path}"); +} +``` + +* **generate multiple barcodes** – Vòng lặp lặp qua một mảng các tỷ lệ khung hình, tạo một **hình ảnh mã vạch** riêng biệt cho mỗi giá trị. +* Điều chỉnh `EncodeTypes` hoặc chuỗi được mã hoá để tạo QR code, Code 128, hoặc các ký hiệu khác mà không cần thay đổi logic xung quanh. + +## Mẹo thực tế và những lỗi thường gặp + +| Mẹo | Giải thích | +|-----|------------| +| **Tái sử dụng cùng một generator** | Khởi tạo lại `BarcodeGenerator` cho mỗi hình ảnh sẽ tạo ra chi phí không cần thiết. Thay đổi các tham số giữa các lần `Save` nhanh hơn và tiêu tốn ít bộ nhớ hơn. | +| **Xác thực thư mục đầu ra** | Luôn gọi `Directory.CreateDirectory` trước khi lưu; nếu không, `Save` sẽ ném ra ngoại lệ `DirectoryNotFoundException`. | +| **Chọn X‑dimension phù hợp** | Giá trị pixel quá thấp (ví dụ, 1) có thể làm cho mã vạch không đọc được trên màn hình độ phân giải thấp. Giá trị 2–3 hoạt động tốt cho hầu hết máy in. | +| **Chú ý tới việc mã hoá** | GS1 DataBar yêu cầu có tiền tố `(01)` cho GTIN. Nếu bạn bỏ qua dấu ngoặc, thư viện có thể tạo ra mã vạch không hợp lệ. | +| **Kiểm tra với máy quét thực tế** | Kiểm tra bằng mắt thường không đủ. Hãy thử các tệp PNG với phần cứng máy quét thực tế mà bạn dự định sử dụng. | + +## Kết quả mong đợi (mô tả hình ảnh) + +*Cả hai tệp PNG đều hiển thị một mã vạch DataBar Stacked Omnidirectional màu tối trên nền sáng. Phiên bản có tỷ lệ khung hình 15 ngắn hơn, trong khi phiên bản có tỷ lệ khung hình 30 cao gấp khoảng đôi.* + +Nếu bạn nhúng các hình ảnh vào tài liệu, chúng sẽ hiển thị sắc nét vì chúng tôi đã đặt `XDimension.Pixels = 2`. + +## Kết luận + +Bây giờ bạn đã biết cách **tạo hình ảnh mã vạch** bằng **trình tạo mã vạch C#**, và bạn có thể **tạo nhiều mã vạch** bằng cách điều chỉnh tỷ lệ khung hình hoặc bất kỳ tham số nào khác. Ví dụ hoàn chỉnh, có thể chạy được này minh họa các thực hành tốt như tái sử dụng instance của generator, xử lý thư mục đầu ra, và xác minh việc tạo tệp. + +Tiếp theo, bạn có thể khám phá: + +* Thêm màu tùy chỉnh bằng `generator.Parameters.Barcode.Color` (từ khóa phụ: **c# barcode generator**) +* Xuất sang các định dạng khác như JPEG hoặc SVG (`BarCodeImageFormat.Jpeg`, `BarCodeImageFormat.Svg`) +* Tích hợp logic tạo mã vạch vào một Web API để phục vụ hình ảnh theo yêu cầu (từ khóa phụ + +## Bạn Nên Học Gì Tiếp Theo? + +Các tutorial sau đây bao gồm các chủ đề liên quan chặt chẽ, xây dựng trên các kỹ thuật được trình bày trong hướng dẫn này. Mỗi tài nguyên đều có các ví dụ mã đầy đủ, hoạt động kèm theo giải thích từng bước để giúp bạn nắm vững các tính năng API bổ sung và khám phá các cách triển khai thay thế trong dự án của mình. + +- [Create Barcode PNG – DataMatrix Aspect Ratio – Aspose.BarCode](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-aspect-ratio-customization/) +- [barcode generator tutorial c# – Customize Code 16K Barcode Aspect Ratios with Aspose.BarCode for .NET](/barcode/english/net/code-16k-encoding/code-16k-aspect-ratio-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file