diff --git a/barcode/arabic/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/arabic/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..944929015 --- /dev/null +++ b/barcode/arabic/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,191 @@ +--- +category: general +date: 2026-08-06 +description: أنشئ شريط بيانات مكدس كود شريطي في C# بسرعة. تعلم كيفية ضبط البُعد X، + وضبط نسبة العرض إلى الارتفاع، وتصدير ملفات PNG باستخدام مولد DataBar Stacked Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: ar +lastmod: 2026-08-06 +og_description: إنشاء شيفرة شريطية مكدسة (databar) في C# باستخدام Aspose.BarCode. + يوضح هذا الدرس كيفية ضبط البُعد X، وتغيير نسبة العرض إلى الارتفاع، وحفظ الصور بصيغة + PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: إنشاء شيفرة شريطية Databar مكدسة في C# – دليل برمجي كامل +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: إنشاء شيفرة باركود Databar مكدسة في C# – دليل خطوة بخطوة +url: /ar/python-java/general/create-databar-stacked-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#، يوضح لك هذا الدليل بالضبط كيفية القيام بذلك باستخدام مكتبة Aspose.BarCode. ستتعلم كيفية ضبط بعد X، وتغيير نسبة أبعاد الشيفرة، وحفظ النتيجة كملفات PNG—كل ذلك في بضع خطوات مختصرة. + +إنشاء شيفرة DataBar مكدسة شائع عندما يتعين عليك ترميز بيانات GS1‑128 للمسح في المتاجر أو لتتبع اللوجستيات. في الأقسام التالية نغطي كل شيء من إعداد المشروع إلى التحقق من المخرجات، بحيث يمكنك دمج الحل في أي تطبيق .NET دون تفويت أي تفصيل. + +## المتطلبات المسبقة + +* **.NET 6.0** (أو أحدث) مثبت – يستهدف الكود مجموعة تطوير حديثة. +* نسخة **مرخصة** من **Aspose.BarCode for .NET**. النسخة التجريبية المجانية تعمل للاختبار لكنها تضيف علامة مائية. +* بيئة تطوير متكاملة مثل **Visual Studio 2022** أو **VS Code** مع امتداد C#. +* إلمام أساسي بصياغة **C#** ومفهوم معرفات تطبيق GS1. + +> **نصيحة احترافية:** إذا كنت تستخدم مدير الحزم NuGet، فإن الأمر `dotnet add package Aspose.BarCode` يحل جميع الاعتمادات تلقائيًا. + +## الخطوة 1: إنشاء مشروع وحدة تحكم جديد + +افتح الطرفية أو وحدة التحكم الخاصة بمدير الحزم ونفّذ: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +أمر `dotnet new console` يُنشئ ملف **Program.cs** بسيط. إضافة حزمة **Aspose.BarCode** تجعل فئة `BarcodeGenerator` متاحة. + +## الخطوة 2: تهيئة مولد DataBar مكدس متعدد الاتجاهات + +افتح **Program.cs** واستبدل المحتوى الافتراضي بالكود التالي. السطر الأول ينشئ كائن **BarcodeGenerator** مُكوَّن للرمز الشريطي **DataBar Stacked Omnidirectional** ويزوده ببيانات حمولة GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**لماذا هذا مهم:** قيمة التعداد `EncodeTypes.DatabarStackedOmniDirectional` تخبر المكتبة بإنتاج **شيفرة شريطية مكدسة DataBar**، وهي النسخة المكدسة من عائلة DataBar متعددة الاتجاهات. يمكن لهذا الرمز أن يحمل حتى 14 حرفًا رقميًا، مما يجعله مثاليًا لأكواد GTIN‑14. + +## الخطوة 3: ضبط بعد X (عرض الوحدة) + +بعد X يتحكم في عرض أصغر شريط (الوحدة). قيمة صغيرة جدًا قد تُظهر بصورة سيئة على الطابعات منخفضة الدقة، بينما قيمة كبيرة جدًا قد تتجاوز مساحة الملصق. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **نصيحة:** الخاصية `Pixels` مريحة للاختبار على الشاشة. للسيناريوهات الموجهة للطباعة، استخدم `generator.Parameters.Barcode.XDimension.Millimeters` بدلاً من ذلك. + +## الخطوة 4: تعديل نسبة الأبعاد وحفظ الصورة الأولى + +تؤثر **نسبة الأبعاد** على العلاقة بين الارتفاع والعرض للرمز المكدس. نوع DataBar Stacked Omnidirectional يدعم نسبًا من 10 إلى 30. سنُنشئ صورتين لتوضيح التأثير البصري. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +استدعاء `generator.Save` يكتب ملف **PNG** إلى دليل العمل الحالي. التعداد `BarCodeImageFormat.Png` يضمن ضغطًا بدون فقد، وهو مثالي للمعالجة اللاحقة أو الإدراج في ملفات PDF. + +## الخطوة 5: تغيير نسبة الأبعاد إلى 30 وحفظ الصورة الثانية + +الآن نزيد ارتفاع الأشرطة المكدسة بتغيير نسبة الأبعاد إلى **30**. هذا يجعل الرمز أطول دون تعديل بعد X. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +تشغيل البرنامج الآن ينتج ملفي PNG: + +* **DatabarAspectRatio15.png** – رمز شريطي مدمج مناسب للملصقات الصغيرة. +* **DatabarAspectRatio30.png** – رمز شريطي أطول يحسّن موثوقية المسح على الأسطح منخفضة التباين. + +يمكنك فتح الصور بأي عارض للتحقق من أن الأشرطة مكدسة بشكل صحيح وأن البيانات المشفرة تتطابق مع سلسلة GS1 الأصلية. + +## الخطوة 6: التحقق من القيمة المشفرة (اختياري) + +إذا كنت بحاجة لتأكيد أن الشيفرة الشريطية تمثل فعلاً السلسلة المدخلة، يمكنك فك تشفيرها باستخدام نفس المكتبة: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +يجب أن يُظهر المُفكك `(01)12345678901231`، مما يثبت أن عملية **إنشاء شيفرة شريطية مكدسة DataBar** حافظت على البيانات. + +## المشكلات الشائعة وكيفية تجنّبها + +| المشكلة | السبب | الحل | +|-------|----------------|-----| +| الشيفرة تظهر ضبابية | تم ضبط بعد X منخفض جدًا بالنسبة لدقة الإخراج | زيادة `XDimension.Pixels` أو استخدام `Millimeters` للطباعة | +| الماسح يُبلغ “الرمز غير موجود” | نسبة الأبعاد خارج النطاق المدعوم 10‑30 | الحفاظ على النسبة بين 10 و30؛ 15 و30 قيم آمنة | +| ملف PNG يحتوي على علامة مائية | استخدام ترخيص التقييم المجاني لـ Aspose.BarCode | شراء ترخيص كامل أو استخدام النسخة التجريبية للاختبار فقط | +| فشل فك التشفير في الصورة الثانية | تم تكوين المُفكك للرمز الشريطي الخطأ | استخدم `DecodeType.DatabarStackedOmniDirectional` عند قراءة الشيفرات المكدسة | + +## الخطوات التالية + +الآن بعد أن أصبحت قادرًا على **إنشاء شيفرة شريطية مكدسة DataBar**، قد ترغب في: + +* **إدراج ملفات PNG في فواتير PDF** باستخدام مكتبة PDF مثل **Aspose.PDF**. +* **إنشاء شيفرات شريطية في الوقت الفعلي عبر واجهة ويب API** – إرجاع بايتات PNG مباشرةً من متحكم ASP.NET Core. +* **تجربة متغيرات DataBar أخرى** (مثل `DatabarExpanded`، `DatabarLimited`) بتغيير تعداد `EncodeTypes`. +* **ضبط الألوان** عبر تعيين `generator.Parameters.Barcode.ForeColor` و `BackColor` لتصاميم مخصصة للعلامة التجارية. + +كل من هذه المواضيع يبني على المفاهيم الأساسية التي تم تغطيتها هنا: تهيئة `BarcodeGenerator`، ضبط المعلمات البصرية، وحفظ النتيجة باستخدام `BarCodeImageFormat`. + +--- + +### الخلاصة + +يوضح هذا الدليل كيفية **إنشاء شيفرة شريطية مكدسة DataBar** بصور في C# باستخدام Aspose.BarCode. تعلمت ضبط **بعد X**، تعديل **نسبة أبعاد الشيفرة الشريطية**، وتصدير النتيجة كملفات **PNG** باستخدام `BarcodeGenerator`. مع خطوة فك التشفير الاختيارية، يمكنك أيضًا التحقق من صحة بيانات GS1 المشفرة. طبّق هذه الأنماط في تطبيقات المخزون، الشحن، أو نقاط البيع الخاصة بك، واستكشف العديد من خيارات التخصيص التي توفرها المكتبة. برمجة سعيدة! + +## ما الذي يجب أن تتعلمه بعد ذلك؟ + +تغطي الدروس التالية مواضيع ذات صلة وثيقة تبني على التقنيات التي تم توضيحها في هذا الدليل. كل مورد يتضمن أمثلة شاملة مع شروح خطوة بخطوة لمساعدتك على إتقان ميزات API إضافية واستكشاف أساليب تنفيذ بديلة في مشاريعك. + +- [ضبط ارتفاع شيفرة DataBar أحادية البعد](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [إنشاء صورة شيفرة شريطية – قسيمة GS1 UPC-A DataBar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/arabic/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..e998f6bc2 --- /dev/null +++ b/barcode/arabic/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,226 @@ +--- +category: general +date: 2026-08-06 +description: إنشاء صورة الباركود في C# باستخدام Aspose.BarCode. تعلّم كيفية إنشاء + Databar، وضبط حجم الباركود المخصص، وتغيير ارتفاع الباركود باستخدام كود بسيط. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: ar +lastmod: 2026-08-06 +og_description: إنشاء صورة باركود في C# باستخدام Aspose.BarCode. يوضح لك هذا الدرس + كيفية إنشاء باركود Databar Omnidirectional، وتخصيص حجمه، وتغيير ارتفاع الباركود + بكفاءة. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: إنشاء صورة الباركود في C# – دليل كامل لـ Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: إنشاء صورة الباركود في C# باستخدام Aspose.BarCode +url: /ar/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# إنشاء صورة باركود في C# باستخدام Aspose.BarCode + +إذا كنت بحاجة إلى **إنشاء صورة باركود** برمجياً، يوضح لك هذا الدليل الخطوات بالضبط. سواءً كنت تبني نظام جرد تجاري أو بوابة تتبع لوجستية، ستشاهد سير العمل الكامل لإنشاء باركود Databar Omnidirectional، تعديل أبعاده، وحفظ النتيجة كملف PNG. + +إنشاء صورة باركود هو طلب شائع، لكن المطورين غالبًا ما يتساءلون **كيف يمكن إنشاء Databar** بالحجم الدقيق الذي يحتاجونه. في هذا الشرح ستتعلم كيفية إنشاء باركود Databar، تخصيص عرضه وارتفاعه، وتغيير ارتفاع الباركود دون إعادة كتابة المولد بالكامل. + +## المتطلبات المسبقة + +قبل أن تبدأ، تأكد من وجود ما يلي: + +* .NET 6.0 SDK أو أحدث (الكود يعمل مع .NET Core و .NET Framework) +* Visual Studio 2022 (أو أي بيئة تطوير تدعم C#) +* ترخيص صالح لـ Aspose.BarCode for .NET (الإصدار التجريبي المجاني يكفي للاختبار) +* إلمام أساسي بصياغة C# + +## الخطوة 1: تثبيت Aspose.BarCode + +أضف حزمة Aspose.BarCode NuGet إلى مشروعك: + +```bash +dotnet add package Aspose.BarCode +``` + +تحتوي الحزمة على الفئة `BarcodeGenerator` المستخدمة طوال هذا الشرح. بعد التثبيت، استعد المشروع لسحب الاعتمادات. + +## الخطوة 2: إنشاء مولد باركود أساسي + +السطر الأول من الكود ينشئ **مولد باركود** سيُنتج رمز Databar Omnidirectional. يحدد تعداد `EncodeTypes.DatabarOmniDirectional` لل مكتبة أي رموز سيستخدمها، ويتبع سلسلة البيانات صيغة معرف التطبيق GS1. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**لماذا هذا مهم:** كائن `BarcodeGenerator` هو نقطة الدخول لكل عملية باركود. باختيار `DatabarOmniDirectional` تضمن أن المخرجات تتوافق مع معيار GS1 للمسح التجاري. + +## الخطوة 3: تعيين X‑dimension مخصص (عرض الوحدة) + +الـ X‑dimension يتحكم في عرض أضيق شريط. ضبطه على قيمة بكسل صغيرة يمنحك باركودًا مدمجًا، بينما القيم الأكبر تزيد العرض الكلي. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**شرح:** X‑dimension بقيمة 2 بكسل هو اختيار شائع للشاشات عالية الدقة. عدّل هذه القيمة إذا كنت تحتاج إلى كثافة بصرية أكثر ضيقًا أو أوسع. + +## الخطوة 4: إنشاء أول صورة باركود بارتفاع محدد + +ارتفاع الباركود مستقل عن X‑dimension. هنا نحدد ارتفاع الشريط إلى **30 px**، ثم نحفظ الصورة كملف PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**النتيجة:** لديك الآن ملف باسم `DatabarBarHeight30Pixels.png` يُظهر باركود Databar بارتفاع 30 px. هذا يوضح قدرة **تخصيص حجم الباركود** لحالة استخدام معينة مثل ملصق صغير. + +## الخطوة 5: تغيير ارتفاع الباركود لإصدار أكبر + +إذا كان من الضروري ظهور نفس الباركود على ملصق أكبر، كل ما عليك هو تعديل خاصية الارتفاع وإعادة استخدام نفس كائن المولد. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**لماذا يمكنك إعادة استخدام المولد:** تغيير `BarHeight.Pixels` يحدث تعديلًا داخليًا في التخطيط دون الحاجة إلى إنشاء كائن جديد، مما يوفر الذاكرة ويحافظ على سلسلة البيانات كما هي. هذه هي الطريقة الموصى بها **لتغيير ارتفاع الباركود** في الوقت الفعلي. + +## الخطوة 6: التحقق من النتيجة + +افتح ملفي PNG في أي عارض صور. يجب أن ترى باركودين Databar Omnidirectional يشفران نفس الـ GTIN لكن يختلفان في الحجم العمودي: + +* `DatabarBarHeight30Pixels.png` – ارتفاع 30 px، مناسب للإيصالات المدمجة. +* `DatabarBarHeight60Pixels.png` – ارتفاع 60 px، مثالي لملصقات حافة الرفوف الأكبر. + +كلا الصورتين تحتفظان بنفس X‑dimension، لذا يبقى نسبة الشريط إلى الفراغ ثابتة بينما يتغير الارتفاع الكلي. + +## الاختلافات الشائعة والحالات الخاصة + +| الحالة | طريقة التعامل | +|-----------|------------------| +| **رمز شريطي مختلف** | استبدل `EncodeTypes.DatabarOmniDirectional` بقيمة تعداد أخرى (مثال: `EncodeTypes.Code128`). يبقى باقي الكود دون تغيير. | +| **أبعاد غير بكسلية** | استخدم `generator.Parameters.Barcode.XDimension.Millimeters` أو `BarHeight.Millimeters` إذا كنت تحتاج إلى قياسات فعلية جاهزة للطباعة. | +| **خلفية شفافة** | ضع `generator.Parameters.ImageBackgroundColor = Color.Transparent;` قبل استدعاء `Save`. | +| **إخراج عالي الدقة** | زد كلًا من `XDimension.Pixels` و `BarHeight.Pixels` بصورة متناسبة، أو احفظ كـ `BarCodeImageFormat.Tiff` للحصول على جودة غير مضغوطة. | +| **عدة باركودات في صورة واحدة** | أنشئ كائنات `BarcodeGenerator` منفصلة، ارسم كل واحدة إلى `Bitmap`، ثم جمعها باستخدام `Graphics.DrawImage`. | + +**نصيحة احترافية:** اختبر دائمًا الباركود المُولد باستخدام ماسح حقيقي قبل نشره في الإنتاج. قد يفسر الماسحات الشرائط الرفيعة جدًا بشكل مختلف حسب الإضاءة وجودة المستشعر. + +## الكود الكامل للمرجعية + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +انسخ الكود إلى مشروع Console جديد، شغّله، وستظهر ملفا PNG في مجلد الإخراج. + +## الأسئلة المتكررة + +**س: هل يمكنني إنشاء باركود دون تثبيت ترخيص؟** +ج: النسخة التجريبية من Aspose.BarCode تعمل بدون ترخيص لكنها تضيف علامة مائية صغيرة. للاستخدام الإنتاجي، قم بتطبيق ترخيص مُشتَرٍ باستخدام `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**س: هل يؤثر تغيير X‑dimension على قابلية القراءة؟** +ج: نعم. قيم X‑dimension الصغيرة جدًا قد تجعل الباركود غير قابل للقراءة على طابعات منخفضة الدقة. يُنصح بحد أدنى 1 px للعرض على الشاشة؛ للطباعة، استخدم على الأقل 0.25 mm. + +**س: ماذا لو أردت إنشاء باركود بصيغة JPEG؟** +ج: استبدل `BarCodeImageFormat.Png` بـ `BarCodeImageFormat.Jpeg`. يمكنك أيضًا ضبط `generator.Parameters.ImageQuality` للتحكم في مستوى الضغط. + +## الخلاصة + +أنت الآن تعرف كيف **تنشئ صورة باركود** في C# باستخدام Aspose.BarCode، كيف **تنشئ باركود Databar**، تضبط **حجم باركود مخصص**، وت **غير ارتفاع الباركود** عند الحاجة. المثال الكامل يُظهر أكثر سير عمل شائع، وجدول الاختلافات يُعِدك للتعامل مع الحالات الواقعية. + +بعد ذلك، استكشف المواضيع ذات الصلة مثل **إدراج باركودات في مستندات PDF**، **إنشاء دفعات متعددة من الباركودات**، و**استخدام رموز QR للدفعات عبر الهاتف المحمول**. كل من هذه السيناريوهات يبني على نفس المبادئ التي تم تغطيتها هنا، لذا يمكنك توسيع معرفتك بثقة. + +برمجة سعيدة، ونتمنى أن تُمسَح باركوداتك بلا أخطاء! + +## ما الذي يجب أن تتعلمه بعد ذلك؟ + +الدروس التالية تغطي مواضيع ذات صلة وثيقة تُكمل التقنيات التي تم توضيحها في هذا الدليل. كل مورد يتضمن أمثلة كود كاملة مع شروحات خطوة بخطوة لمساعدتك على إتقان ميزات API إضافية واستكشاف أساليب تنفيذ بديلة في مشاريعك. + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/arabic/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..874f57d80 --- /dev/null +++ b/barcode/arabic/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,221 @@ +--- +category: general +date: 2026-08-06 +description: كيفية تعيين الأعمدة لباركود Databar Expanded Stacked وتعلم كيفية إنشاء + صور الباركود، وتعيين الصفوف، وحفظ ملف الباركود في C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: ar +lastmod: 2026-08-06 +og_description: كيفية تعيين الأعمدة لباركود Databar Expanded Stacked وتعلم بسرعة كيفية + إنشاء صور الباركود، وتعيين الصفوف، وحفظ ملف الباركود باستخدام Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: كيفية ضبط الأعمدة لباركود Databar Expanded Stacked – دليل خطوة بخطوة بلغة + C# +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: كيفية تعيين الأعمدة لباركود Databar Expanded Stacked – دليل C# الكامل +url: /ar/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# كيفية ضبط الأعمدة لباركود Databar Expanded Stacked – دليل C# كامل + +إذا كنت تحتاج إلى **كيفية ضبط الأعمدة** لباركود Databar Expanded Stacked، فإن هذا الدرس يوضح لك الخطوات الدقيقة. سواءً كنت تبني نظام تسمية تجزئة للبيع بالتجزئة أو تطبيق لوجستي، فإن التحكم في الأعمدة والصفوف يتيح لك ضبط حجم الباركود ودقة القراءة. بالإضافة إلى ذلك، ستتعرف على **كيفية إنشاء صور باركود**، وضبط عدد الصفوف، وحفظ **ملف الباركود** على القرص بشكل صحيح. + +هذا الدليل يمرّ بك عبر: + +* تثبيت مكتبة Aspose.Barcode لـ .NET. +* إنشاء مولّد باركود لنوع Databar Expanded Stacked. +* ضبط عدد الأعمدة، عدد الصفوف، وصيغة الصورة. +* حفظ ملفات PNG الناتجة في دليل مختار. + +لا يلزم أي خبرة سابقة مع Aspose.Barcode—فقط بيئة تطوير C# أساسية. + +## المتطلبات المسبقة + +قبل أن تبدأ، تأكد من وجود: + +* .NET 6.0 SDK أو أحدث مثبت. +* Visual Studio 2022 (أو أي بيئة تطوير تدعم .NET). +* مرجع NuGet إلى **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +جميع مقتطفات الشيفرة تُجمّع باستخدام قالب مشروع وحدة تحكم افتراضي. + +## الخطوة 1: إنشاء مولّد باركود لـ Databar Expanded Stacked + +العملية الأولى هي إنشاء كائن `BarcodeGenerator` باستخدام تعداد `EncodeTypes.DatabarExpandedStacked`. هذا يحدد التخطيط الافتراضي (متراكم) ويجهّز الكائن لمزيد من التكوين. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**لماذا هذا مهم:** المولّد يحتفظ بجميع معلمات العرض. باختيار `DatabarExpandedStacked` تخبر المكتبة باستخدام التخطيط المتراكم، وهو التخطيط الوحيد الذي يدعم تعديل الأعمدة والصفوف. + +## كيفية ضبط الأعمدة لباركود Databar Expanded Stacked + +الآن بعد أن أصبح المولّد موجودًا، يمكنك التحكم في عدد الأعمدة. خاصية `DataBar.Columns` تقبل عددًا صحيحًا بين 1 و 4. ضبطها إلى **4** يخلق أوسع باركود ممكن مع الحفاظ على التخطيط المتراكم. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**نصيحة عملية:** استخدم الحد الأقصى لعدد الأعمدة فقط عندما يتوفر مساحة بيضاء كافية على الملصق. كثرة الأعمدة على ملصق صغير قد تتسبب في مشاكل في القراءة. + +## كيفية إنشاء صور باركود وحفظها + +بعد ضبط الأعمدة، تحتاج إلى عرض الباركود وكتابة الصورة إلى القرص. طريقة `Save` تأخذ مسار ملف وتعداد صيغة صورة. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +يجب أن يكون دليل `output` موجودًا وإلا ستطرح الاستدعاء استثناءً. يمكنك إنشاؤه برمجيًا باستخدام `Directory.CreateDirectory("output");` إذا رغبت. + +## كيفية ضبط الصفوف لباركود Databar Expanded Stacked + +تعمل الصفوف بطريقة مشابهة للأعمدة، لكنها تؤثر على التراكم العمودي لوحدات الباركود. خاصية `DataBar.Rows` تقبل قيمًا من 1 إلى 5. في هذا المثال نستخدم **3** صفوف. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**لماذا الصفوف مهمة:** إضافة صفوف تزيد من ارتفاع الباركود، وهو ما يمكن أن يكون مفيدًا للملصقات ذات الكثافة العالية حيث تحتاج إلى المزيد من الوحدات دون توسيع عرض الباركود. + +## خيارات حفظ ملف الباركود وأفضل الممارسات + +طريقة `Save` تدعم عدة صيغ صور (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG غير مضغوط ويعمل جيدًا لمعظم أجهزة القراءة. إذا كنت تحتاج إلى حجم ملف أصغر وتستطيع تحمل بعض التشويش، اختر JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**حالة خاصة:** عند الحفظ بصيغة JPEG، تأكد من ضبط معامل الجودة بشكل مناسب (القيمة الافتراضية هي 90). الجودة المنخفضة قد تشوش الوحدات الصغيرة، مما يجعل الباركود غير قابل للقراءة. + +## مثال كامل قابل للتنفيذ + +بدمج كل ما سبق، إليك ملف واحد يمكنك نسخه إلى مشروع وحدة تحكم جديد وتشغيله فورًا: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**الناتج المتوقع:** بعد تشغيل البرنامج، يحتوي دليل `output` على ثلاثة ملفات: + +* `DatabarCols4.png` – باركود بـ 4 أعمدة (واسع). +* `DatabarRows3.png` – باركود بـ 3 صفوف (طويل). +* `DatabarRows3.jpg` – نسخة JPEG للباركود ذو 3 صفوف. + +افتح أيًا من ملفات PNG في عارض صور؛ يجب أن ترى باركود Databar Expanded Stacked واضح جاهز للقراءة. + +## الأسئلة الشائعة واستكشاف الأخطاء وإصلاحها + +| السؤال | الإجابة | +|----------|--------| +| *ماذا لو كانت الصورة غير واضحة؟* | تأكد من أنك تستخدم PNG للإخراج غير المضغوط. إذا احتجت JPEG، زد من إعداد الجودة (`new JpegOptions { Quality = 95 }`). | +| *هل يمكنني تغيير نص الباركود؟* | نعم—استبدل الوسيط الثاني في `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *هل تعمل الأعمدة والصفوف معًا؟* | يمكن دمجهما؛ فقط اضبط كل من `DataBar.Columns` و `DataBar.Rows` قبل استدعاء `Save`. | +| *هل هناك حد لعمق الدليل؟* | يجب أن يكون المسار صالحًا لنظام التشغيل. استخدم `Path.Combine` للسلامة عبر الأنظمة. | + +## الخاتمة + +أنت الآن تعرف **كيفية ضبط الأعمدة** لباركود Databar Expanded Stacked، **كيفية ضبط الصفوف**، و**كيفية إنشاء صور باركود** يمكنك **حفظ ملف الباركود** بصيغة PNG أو JPEG. المثال الكامل يوضح كل خطوة مطلوبة، من تثبيت المكتبة إلى التحقق النهائي من الملف. + +بعد ذلك، فكر في استكشاف: + +* **كيفية إنشاء باركود** بمستويات تصحيح الأخطاء لرموز QR. +* خيارات **حفظ ملف الباركود** لتنسيقات متجهة مثل SVG أو PDF. +* دمج الباركودات المولدة في عروض ASP.NET Core MVC للطباعة الديناميكية للملصقات. + +لا تتردد في تجربة تركيبات مختلفة من الأعمدة/الصفوف، صيغ الصور، ومحتوى الباركود لتتناسب مع مواصفات مشروعك. برمجة سعيدة! + +## ما الذي يجب أن تتعلمه بعد ذلك؟ + +الدروس التالية تغطي مواضيع ذات صلة وثيقة تبني على التقنيات التي تم توضيحها في هذا الدليل. كل مورد يتضمن أمثلة شيفرة كاملة مع شروحات خطوة بخطوة لمساعدتك على إتقان ميزات API إضافية واستكشاف أساليب تنفيذ بديلة في مشاريعك. + +- [كيفية إنشاء باركود - أنواع الباركود أحادية البعد](/barcode/english/net/one-dimensional-barcode-types/) +- [كيفية إنشاء باركود – تكوين Code 39 باستخدام Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [كيفية إنشاء باركود Aztec بنسبة أبعاد مخصصة باستخدام Aspose.BarCode لـ .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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/chinese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..aa0ec8fea --- /dev/null +++ b/barcode/chinese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,188 @@ +--- +category: general +date: 2026-08-06 +description: 在 C# 中快速创建 DataBar 堆叠条码。学习设置 X 维度、调整宽高比,并使用 DataBar 堆叠全向生成器导出 PNG 文件。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: zh +lastmod: 2026-08-06 +og_description: 使用 Aspose.BarCode 在 C# 中创建堆叠式数据条码。本教程展示如何配置 X 维度、改变宽高比以及保存 PNG 图像。 +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: 在 C# 中创建 DataBar 堆叠条形码 – 完整编程指南 +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: 在 C# 中创建 Databar 堆叠条码 – 步骤指南 +url: /zh/python-java/general/create-databar-stacked-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# 中创建 databar stacked barcode – 步骤指南 + +如果您需要在 C# 中**创建 databar stacked barcode**图像,本指南将向您展示如何使用 Aspose.BarCode 库完成此操作。您将学习设置 X 维度、修改条形码宽高比,并将结果保存为 PNG 文件——全部只需几个简洁的步骤。 + +在需要为零售扫描或物流跟踪编码 GS1‑128 数据时,生成 DataBar Stacked 条形码是常见需求。以下章节将从项目设置到验证输出全部覆盖,帮助您将该解决方案无缝集成到任何 .NET 应用程序中,细节不遗漏。 + +## 前置条件 + +* **.NET 6.0**(或更高)已安装 – 代码面向现代 SDK。 +* 已获取 **Aspose.BarCode for .NET** 的**授权**副本。免费评估版可用于测试,但会添加水印。 +* 采用 **Visual Studio 2022** 或 **VS Code**(配合 C# 扩展)的 IDE。 +* 对 **C#** 语法以及 GS1 应用标识符概念有基本了解。 + +> **专业提示:** 如果使用 NuGet 包管理器,命令 `dotnet add package Aspose.BarCode` 会自动解析所有依赖。 + +## 步骤 1:创建新控制台项目 + +在终端或 Package Manager Console 中打开并运行: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +`dotnet new console` 命令会生成一个最小的 **Program.cs** 文件。添加 **Aspose.BarCode** 包后即可使用 `BarcodeGenerator` 类。 + +## 步骤 2:初始化 DataBar Stacked Omnidirectional 生成器 + +打开 **Program.cs**,将默认内容替换为以下代码。第一行创建了一个针对 **DataBar Stacked Omnidirectional** 符号并提供 GS1‑128 负载的 **BarcodeGenerator**。 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**为什么重要:** `EncodeTypes.DatabarStackedOmniDirectional` 枚举值指示库生成 **databar stacked barcode**,即全向 DataBar 系列的堆叠变体。该符号最多可容纳 14 位数字,非常适合 GTIN‑14 代码。 + +## 步骤 3:设置 X 维度(模块宽度) + +X 维度决定最小条(模块)的宽度。数值过小可能在低分辨率打印机上呈现不佳,数值过大则可能超出标签空间。 + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **提示:** `Pixels` 属性便于基于屏幕的测试。针对打印场景,请改用 `generator.Parameters.Barcode.XDimension.Millimeters`。 + +## 步骤 4:调整宽高比并保存第一张图像 + +**宽高比**影响堆叠条形码的高宽比例。DataBar Stacked Omnidirectional 类型支持 10 到 30 的比例范围。我们将生成两张图像以展示视觉效果。 + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +调用 `generator.Save` 会将 **PNG** 文件写入当前工作目录。`BarCodeImageFormat.Png` 枚举确保无损压缩,适合后续处理或嵌入 PDF。 + +## 步骤 5:将宽高比改为 30 并保存第二张图像 + +现在我们通过将宽高比改为 **30** 来提升堆叠条的高度。这会在不改变 X 维度的前提下使条形码更高。 + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +运行程序后会生成两个 PNG 文件: + +* **DatabarAspectRatio15.png** – 适用于小标签的紧凑条形码。 +* **DatabarAspectRatio30.png** – 更高的条形码,可提升在低对比度表面上的扫描可靠性。 + +您可以使用任意查看器打开图像,以验证条形是否正确堆叠且编码数据与原始 GS1 字符串一致。 + +## 步骤 6:验证编码值(可选) + +如果需要确认条形码确实对应输入字符串,可使用同一库进行解码: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +解码器应输出 `(01)12345678901231`,证明 **create databar stacked barcode** 过程保留了数据。 + +## 常见陷阱及规避方法 + +| 问题 | 产生原因 | 解决方案 | +|------|----------|----------| +| 条形码模糊 | X 维度设置过低,导致输出分辨率不足 | 增加 `XDimension.Pixels`,或在打印时使用 `Millimeters` | +| 扫描仪报告“未找到符号” | 宽高比超出支持的 10‑30 范围 | 保持宽高比在 10 到 30 之间;15 和 30 为安全默认值 | +| PNG 带有水印 | 使用 Aspose.BarCode 免费评估许可证 | 购买正式许可证,或仅在测试时使用试用版 | +| 第二张图像解码失败 | 解码器配置了错误的符号类型 | 读取堆叠条形码时使用 `DecodeType.DatabarStackedOmniDirectional` | + +## 后续步骤 + +现在您已经能够**创建 databar stacked barcode**图像,接下来可能想要: + +* 使用 **Aspose.PDF** 等 PDF 库将 PNG 嵌入 PDF 发票中。 +* 在 Web API 中实时生成条形码——直接从 ASP.NET Core 控制器返回 PNG 字节。 +* 通过更改 `EncodeTypes` 枚举,尝试其他 DataBar 变体(例如 `DatabarExpanded`、`DatabarLimited`)。 +* 通过设置 `generator.Parameters.Barcode.ForeColor` 和 `BackColor` 来调整颜色,以实现品牌特定的设计。 + +上述每个主题都基于本文所述的核心概念:初始化 `BarcodeGenerator`、配置视觉参数,以及使用 `BarCodeImageFormat` 保存结果。 + +--- + +### 结论 + +本教程演示了如何使用 Aspose.BarCode 在 C# 中**创建 databar stacked barcode**图像。您学习了设置 **X 维度**、修改 **条形码宽高比**,并使用 `BarcodeGenerator` 将结果导出为 **PNG** 文件。通过可选的解码步骤,还可以验证编码的 GS1 数据是否准确。将这些模式应用于您的库存、运输或销售点应用程序,并探索库提供的众多自定义选项。祝编码愉快! + +## 接下来应该学习什么? + +以下教程涵盖与本指南技术密切相关的主题。每个资源都包含完整的可运行代码示例和逐步说明,帮助您掌握更多 API 功能并在项目中探索替代实现方案。 + +- [一维 DataBar 条形码高度调整](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [生成条形码图像 – GS1 优惠券 UPC-A DataBar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/chinese/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..e420bfab2 --- /dev/null +++ b/barcode/chinese/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,221 @@ +--- +category: general +date: 2026-08-06 +description: 使用 Aspose.BarCode 在 C# 中生成条形码图像。了解如何生成 Databar、调整自定义条形码尺寸以及通过简易代码更改条形码高度。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: zh +lastmod: 2026-08-06 +og_description: 使用 Aspose.BarCode 在 C# 中生成条形码图像。本教程展示如何创建 Databar 全向条码、定制其尺寸以及高效地更改条码高度。 +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: 在 C# 中生成条形码图像 – 完整 Aspose.BarCode 指南 +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: 使用 Aspose.BarCode 在 C# 中生成条形码图像 +url: /zh/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 在 C# 中使用 Aspose.BarCode 生成条形码图像 + +如果您需要以编程方式**生成条形码图像**,本指南将准确展示如何操作。无论您是在构建零售库存系统还是物流跟踪门户,您都将看到创建 Databar Omnidirectional 条码、调整其尺寸并将结果保存为 PNG 文件的完整工作流。 + +生成条形码图像是常见需求,但开发者常常想知道**如何生成具有精确尺寸的 Databar**。在本教程中,您将学习创建 Databar 条码、定制其宽度和高度,以及在不重写整个生成器的情况下更改条码高度。 + +## 前提条件 + +* .NET 6.0 SDK 或更高版本(代码兼容 .NET Core 和 .NET Framework) +* Visual Studio 2022(或任何支持 C# 的 IDE) +* 有效的 Aspose.BarCode for .NET 许可证(免费评估版可用于测试) +* 对 C# 语法有基本了解 + +## 第一步:安装 Aspose.BarCode + +将 Aspose.BarCode NuGet 包添加到您的项目中: + +```bash +dotnet add package Aspose.BarCode +``` + +该包包含本教程中使用的 `BarcodeGenerator` 类。安装完成后,恢复项目以获取依赖项。 + +## 第二步:创建基础条码生成器 + +第一行代码创建一个**条码生成器**,用于生成 Databar Omnidirectional 符号。`EncodeTypes.DatabarOmniDirectional` 枚举告诉库使用哪种符号系统,数据字符串遵循 GS1 应用标识符语法。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**为什么这很重要:**`BarcodeGenerator` 对象是所有条码操作的入口。选择 `DatabarOmniDirectional` 可确保输出符合零售扫描的 GS1 标准。 + +## 第三步:设置自定义 X 维度(模块宽度) + +X 维度控制最窄条的宽度。将其设置为较小的像素值可获得紧凑的条码,而较大的值会增加整体宽度。 + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**说明:**2 像素的 X 维度是高分辨率屏幕的常用选择。如果需要更紧凑或更稀疏的视觉密度,请调整此值。 + +## 第四步:生成具有特定高度的首个条码图像 + +条码高度独立于 X 维度。在此我们将条码高度设置为 **30 px**,然后将图像保存为 PNG。 + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**结果:**您现在拥有一个名为 `DatabarBarHeight30Pixels.png` 的文件,显示了高度为 30 px 的 Databar 条码。这演示了针对小标签等特定用例的**自定义条码尺寸**功能。 + +## 第五步:更改条码高度以生成更大版本 + +如果同一条码需要出现在更大的标签上,只需修改高度属性并复用同一生成器实例。 + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**为什么可以复用生成器:**更改 `BarHeight.Pixels` 会更新内部布局,而无需重新创建对象,这可以节省内存并保持数据字符串不变。这是实时**更改条码高度**的推荐方式。 + +## 第六步:验证输出 + +在任意图像查看器中打开这两个 PNG 文件。您应该会看到两个 Databar Omnidirectional 条码,它们编码相同的 GTIN,但垂直尺寸不同: + +* `DatabarBarHeight30Pixels.png` – 高度 30 px,适用于紧凑收据。 +* `DatabarBarHeight60Pixels.png` – 高度 60 px,适用于更大的货架边标签。 + +两个图像保持相同的 X 维度,因此条与空的比例保持一致,仅整体高度按比例放大。 + +## 常见变体和边缘情况 + +| Situation | How to handle it | +|-----------|------------------| +| **不同的条码符号系统** | 将 `EncodeTypes.DatabarOmniDirectional` 替换为其他枚举值(例如 `EncodeTypes.Code128`),其余代码保持不变。 | +| **非像素维度** | 如果需要用于打印的物理尺寸,请使用 `generator.Parameters.Barcode.XDimension.Millimeters` 或 `BarHeight.Millimeters`。 | +| **透明背景** | 在调用 `Save` 之前设置 `generator.Parameters.ImageBackgroundColor = Color.Transparent;`。 | +| **高分辨率输出** | 按比例同时增大 `XDimension.Pixels` 和 `BarHeight.Pixels`,或保存为 `BarCodeImageFormat.Tiff` 以获得无损质量。 | +| **在同一图像中包含多个条码** | 创建多个 `BarcodeGenerator` 实例,将每个渲染为 `Bitmap`,然后使用 `Graphics.DrawImage` 将它们合成。 | + +**专业提示:**在投入生产前,请始终使用真实扫描仪测试生成的条码。扫描仪可能会因光照和传感器质量的不同而对极细的条产生不同的解释。 + +## 完整源代码供参考 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +将代码复制到新的控制台项目中,运行后您将在输出文件夹中看到两个 PNG 文件。 + +## 常见问题 + +**问:我可以在不安装许可证的情况下生成条码吗?** +**答:**Aspose.BarCode 的评估版可以在没有许可证的情况下工作,但会添加小水印。生产环境请使用 `License license = new License(); license.SetLicense("Aspose.BarCode.lic");` 应用购买的许可证。 + +**问:更改 X 维度会影响可读性吗?** +**答:**会。非常小的 X 维度会导致低分辨率打印机无法读取条码。屏幕渲染建议最小 1 px;打印时建议至少 0.25 mm。 + +**问:如果需要以 JPEG 格式生成条码怎么办?** +**答:**将 `BarCodeImageFormat.Png` 替换为 `BarCodeImageFormat.Jpeg`。您还可以设置 `generator.Parameters.ImageQuality` 来控制压缩率。 + +## 结论 + +您现在已经了解如何在 C# 中使用 Aspose.BarCode **生成条码图像**,如何 **创建 Databar 条码**,调整 **自定义条码尺寸**,以及按需 **更改条码高度**。完整示例展示了最常见的工作流,变体表格帮助您应对实际场景中的边缘情况。 + +接下来,您可以探索相关主题,如 **在 PDF 文档中嵌入条码**、**批量生成多个条码**,以及 **使用二维码进行移动支付**。这些场景都基于本指南的相同原理,您可以自信地扩展此知识。 + +祝编码愉快,愿您的条码扫描顺利! + +## 接下来您应该学习什么? + +以下教程涵盖与本指南紧密相关的主题,基于本指南展示的技术。每个资源都包含完整的可运行代码示例和逐步说明,帮助您掌握更多 API 功能并在项目中探索替代实现方法。 + +- [生成条码图像 – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [使用 Aspose.BarCode for .NET 生成自定义宽高比的 Aztec 条码](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [生成条码 – Code 39 配置(使用 Aspose.BarCode)](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/chinese/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..2643a6510 --- /dev/null +++ b/barcode/chinese/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,219 @@ +--- +category: general +date: 2026-08-06 +description: 如何为 Databar Expanded Stacked 条码设置列,并学习如何生成条码图像、设置行以及在 C# 中保存条码文件。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: zh +lastmod: 2026-08-06 +og_description: 如何为 Databar Expanded Stacked 条码设置列,并快速学习如何生成条码图像、设置行以及使用 Aspose.Barcode + 保存条码文件。 +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: 如何为 Databar Expanded Stacked 条码设置列——逐步 C# 指南 +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: 如何为 Databar Expanded Stacked 条码设置列 – 完整 C# 指南 +url: /zh/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 如何为 Databar Expanded Stacked 条形码设置列 – 完整 C# 指南 + +如果您需要**设置列**用于 Databar Expanded Stacked 条形码,本教程将向您展示具体步骤。无论您是在构建零售标签系统还是物流应用,控制列和行都可以微调条形码的尺寸和扫描可靠性。此外,您还将看到**如何生成条形码**图像、调整行数,以及正确**将条形码保存文件**到磁盘。 + +本指南将带您完成: + +* 安装 Aspose.Barcode for .NET 库。 +* 为 Databar Expanded Stacked 类型创建条形码生成器。 +* 设置列数、行数和图像格式。 +* 将生成的 PNG 文件保存到指定目录。 + +无需任何 Aspose.Barcode 经验——只需一个基本的 C# 开发环境。 + +## 前提条件 + +在开始之前,请确保您已具备: + +* .NET 6.0 SDK 或更高版本。 +* Visual Studio 2022(或任何支持 .NET 的 IDE)。 +* 对 **Aspose.Barcode** 的 NuGet 引用 (`dotnet add package Aspose.Barcode`)。 + +所有代码片段均可使用默认的控制台项目模板编译。 + +## Step 1: Create a barcode generator for Databar Expanded Stacked + +第一步是使用 `EncodeTypes.DatabarExpandedStacked` 枚举实例化 `BarcodeGenerator`。这会设置默认布局(堆叠)并为后续配置做好准备。 + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Why this matters:** 生成器保存所有渲染参数。通过选择 `DatabarExpandedStacked`,您告诉库使用堆叠布局,这是唯一支持列和行调整的布局。 + +## 如何为 Databar Expanded Stacked 条形码设置列 + +现在生成器已经创建,您可以控制列数。`DataBar.Columns` 属性接受 1 到 4 之间的整数。将其设置为 **4** 可在保持堆叠布局的前提下生成最宽的条形码。 + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Practical tip:** 仅在标签上有足够的空白时才使用最大列数。标签空间不足时列数过多会导致扫描问题。 + +## 如何生成条形码图像并保存 + +配置列后,您需要渲染条形码并将图像写入磁盘。`Save` 方法接受文件路径和图像格式枚举。 + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +文件夹 `output` 必须已存在,否则调用会抛出异常。如果需要,您可以使用 `Directory.CreateDirectory("output");` 以编程方式创建它。 + +## 如何为 Databar Expanded Stacked 条形码设置行 + +行的工作方式与列类似,但它们影响条形码模块的垂直堆叠。`DataBar.Rows` 属性接受 1 到 5 的值。本示例使用 **3** 行。 + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Why rows matter:** 增加行数会提升条形码的高度,这对于需要在不加宽条形码的情况下增加数据模块的高密度标签非常有用。 + +## 条形码保存文件选项和最佳实践 + +`Save` 方法支持多种图像格式(`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`)。PNG 为无损格式,适用于大多数扫描设备。如果需要更小的文件尺寸且可以接受轻微的压缩伪影,请选择 JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Edge case:** 保存为 JPEG 时,请确保质量参数设置得当(默认 90)。质量过低会模糊小模块,导致条形码无法读取。 + +## 完整、可运行的示例 + +将所有内容整合在一起,以下是一个单文件示例,您可以复制到新的控制台项目并立即运行: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Expected output:** 运行程序后,`output` 文件夹中会出现三个文件: + +* `DatabarCols4.png` – 具有 4 列(宽)的条形码。 +* `DatabarRows3.png` – 具有 3 行(高)的条形码。 +* `DatabarRows3.jpg` – 3 行条形码的 JPEG 版本。 + +在图像查看器中打开任意 PNG 文件,您应能看到清晰的 Databar Expanded Stacked 条形码,已准备好进行扫描。 + +## 常见问题与故障排除 + +| Question | Answer | +|----------|--------| +| *图像模糊怎么办?* | 确认使用 PNG 进行无损输出。如果需要 JPEG,请提高质量设置(`new JpegOptions { Quality = 95 }`)。 | +| *我可以更改条形码文本吗?* | 可以——将 `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")` 中的第二个参数替换为您的文本。 | +| *列和行可以一起使用吗?* | 可以一起使用;只需在调用 `Save` 之前同时设置 `DataBar.Columns` 和 `DataBar.Rows`。 | +| *目录深度有限制吗?* | 路径必须对操作系统有效。使用 `Path.Combine` 可确保跨平台安全。 | + +## 结论 + +您现在已经了解**如何设置列**用于 Databar Expanded Stacked 条形码、**如何设置行**以及**如何生成条形码**图像,并能够**将条形码保存文件**为 PNG 或 JPEG 格式。完整示例展示了从库安装到最终文件验证的每一步所需的全部操作。 + +接下来,您可以进一步探索: + +* **如何生成条形码**,为 QR 码使用错误纠正级别。 +* **将条形码保存文件**为 SVG、PDF 等矢量格式的选项。 +* 将生成的条形码集成到 ASP.NET Core MVC 视图中,实现动态标签打印。 + +欢迎尝试不同的列/行组合、图像格式和条形码内容,以满足项目的具体需求。祝编码愉快! + +## 您接下来应该学习什么? + +以下教程涵盖与本指南技术紧密相关的主题,每个资源都提供完整的可运行代码示例和逐步解释,帮助您掌握更多 API 功能并在自己的项目中探索替代实现方案。 + +- [如何生成条形码 - 一维条形码类型](/barcode/english/net/one-dimensional-barcode-types/) +- [如何生成条形码 – 使用 Aspose.BarCode 的 Code 39 配置](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [如何使用 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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/czech/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..6760fc5ef --- /dev/null +++ b/barcode/czech/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,193 @@ +--- +category: general +date: 2026-08-06 +description: Rychle vytvořte databar stacked čárový kód v C#. Naučte se nastavit rozměr + X, upravit poměr stran a exportovat PNG soubory pomocí generátoru DataBar Stacked + Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: cs +lastmod: 2026-08-06 +og_description: Vytvořte databar naskládaný čárový kód v C# s Aspose.BarCode. Tento + tutoriál ukazuje, jak nastavit rozměr X, změnit poměr stran a uložit PNG obrázky. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Vytvořte vrstvený databar čárový kód v C# – kompletní programovací průvodce +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Vytvořte databar stacked čárový kód v C# – průvodce krok po kroku +url: /cs/python-java/general/create-databar-stacked-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í databar stacked čárového kódu v C# – krok za krokem + +Pokud potřebujete **vytvořit databar stacked čárový kód** v C#, tento průvodce vám ukáže přesně, jak na to pomocí knihovny Aspose.BarCode. Naučíte se nastavit X‑rozměr, změnit poměr stran čárového kódu a uložit výsledek jako PNG soubory – vše během několika stručných kroků. + +Generování DataBar Stacked čárového kódu je běžné, když musíte kódovat data GS1‑128 pro maloobchodní skenování nebo logistické sledování. V následujících sekcích pokryjeme vše od nastavení projektu až po ověření výstupu, takže můžete řešení integrovat do libovolné .NET aplikace bez ztráty detailů. + +## Předpoklady + +Než začnete, ujistěte se, že máte: + +* **.NET 6.0** (nebo novější) nainstalovaný – kód cílí na moderní SDK. +* **Licencovanou** kopii **Aspose.BarCode for .NET**. Bezplatná zkušební verze funguje pro testování, ale přidává vodoznak. +* IDE jako **Visual Studio 2022** nebo **VS Code** s rozšířením C#. +* Základní znalost syntaxe **C#** a konceptu GS1 Application Identifiers. + +> **Tip:** Pokud používáte správce balíčků NuGet, příkaz `dotnet add package Aspose.BarCode` automaticky vyřeší všechny závislosti. + +## Krok 1: Vytvořte nový konzolový projekt + +Otevřete terminál nebo Package Manager Console a spusťte: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +Příkaz `dotnet new console` vytvoří minimální soubor **Program.cs**. Přidání balíčku **Aspose.BarCode** zpřístupní třídu `BarcodeGenerator`. + +## Krok 2: Inicializujte generátor DataBar Stacked Omnidirectional + +Otevřete **Program.cs** a nahraďte výchozí obsah následujícím kódem. První řádek vytvoří **BarcodeGenerator** nakonfigurovaný pro symbologii **DataBar Stacked Omnidirectional** a předá payload GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Proč je to důležité:** Hodnota výčtu `EncodeTypes.DatabarStackedOmniDirectional` říká knihovně, aby vytvořila **databar stacked čárový kód**, což je vrstvená varianta omnidirekcionální rodiny DataBar. Tato symbologie může pojmout až 14 číselných znaků, což ji činí ideální pro kódy GTIN‑14. + +## Krok 3: Nastavte X‑rozměr (šířku modulu) + +X‑rozměr určuje šířku nejmenšího pruhu (modulu). Příliš malá hodnota může vést k špatnému vykreslení na nízkém rozlišení tiskáren, zatímco příliš velká může přesáhnout prostor na štítku. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tip:** Vlastnost `Pixels` je pohodlná pro testování na obrazovce. Pro scénáře zaměřené na tisk použijte místo toho `generator.Parameters.Barcode.XDimension.Millimeters`. + +## Krok 4: Upravit poměr stran a uložit první obrázek + +**Poměr stran** ovlivňuje vztah výšky k šířce vrstveného čárového kódu. Typ DataBar Stacked Omnidirectional podporuje poměry od 10 do 30. Vygenerujeme dva obrázky, abychom ukázali vizuální dopad. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +Volání `generator.Save` zapíše soubor **PNG** do aktuálního pracovního adresáře. Výčet `BarCodeImageFormat.Png` zajišťuje bezztrátovou kompresi, což je ideální pro další zpracování nebo vložení do PDF. + +## Krok 5: Změňte poměr stran na 30 a uložte druhý obrázek + +Nyní zvýšíme výšku vrstvených pruhů změnou poměru stran na **30**. Tím se čárový kód prodlouží, aniž by se změnil X‑rozměr. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Po spuštění programu vzniknou dva PNG soubory: + +* **DatabarAspectRatio15.png** – kompaktní čárový kód vhodný pro malé štítky. +* **DatabarAspectRatio30.png** – vyšší čárový kód, který zlepšuje spolehlivost skenování na nízkokontrastních površích. + +Obrázky můžete otevřít v libovolném prohlížeči a ověřit, že pruhy jsou správně vrstvené a že zakódovaná data odpovídají původnímu řetězci GS1. + +## Krok 6: Ověřte zakódovanou hodnotu (volitelné) + +Pokud potřebujete potvrdit, že čárový kód skutečně představuje vstupní řetězec, můžete jej dekódovat stejnou knihovnou: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Dekodér by měl vypsat `(01)12345678901231`, což dokazuje, že proces **vytvoření databar stacked čárového kódu** zachoval data. + +## Časté problémy a jak se jim vyhnout + +| Problém | Proč k tomu dochází | Řešení | +|---------|----------------------|--------| +| Čárový kód je rozmazaný | X‑rozměr nastaven příliš nízko pro rozlišení výstupu | Zvyšte `XDimension.Pixels` nebo použijte `Millimeters` pro tisk | +| Skener hlásí „symbol not found“ | Poměr stran mimo podporovaný rozsah 10‑30 | Udržujte poměr mezi 10 a 30; 15 a 30 jsou bezpečné výchozí hodnoty | +| PNG obsahuje vodoznak | Používáte bezplatnou evaluační licenci Aspose.BarCode | Zakupte plnou licenci nebo použijte trial pouze pro testování | +| Dekódování selže u druhého obrázku | Dekodér byl nastaven na špatnou symbologii | Použijte `DecodeType.DatabarStackedOmniDirectional` při čtení vrstvených čárových kódů | + +## Další kroky + +Nyní, když umíte **vytvořit databar stacked čárový kód**, můžete: + +* **Vložit PNG do PDF faktur** pomocí PDF knihovny jako **Aspose.PDF**. +* **Generovat čárové kódy za běhu ve webovém API** – vracet PNG bajty přímo z ASP.NET Core kontroleru. +* **Experimentovat s dalšími variantami DataBar** (např. `DatabarExpanded`, `DatabarLimited`) změnou výčtu `EncodeTypes`. +* **Upravit barvy** nastavením `generator.Parameters.Barcode.ForeColor` a `BackColor` pro design podle značky. + +Každé z těchto témat staví na stejných základních konceptech: inicializace `BarcodeGenerator`, konfigurace vizuálních parametrů a uložení výsledku pomocí `BarCodeImageFormat`. + +--- + +### Závěr + +Tento tutoriál ukázal, jak **vytvořit databar stacked čárový kód** v C# pomocí Aspose.BarCode. Naučili jste se nastavit **X‑rozměr**, upravit **poměr stran čárového kódu** a exportovat výsledek jako **PNG** soubory s `BarcodeGenerator`. S volitelným krokem dekódování můžete také ověřit, že zakódovaná data GS1 jsou přesná. Použijte tyto vzory ve svých aplikacích pro inventář, dopravu nebo pokladny a prozkoumejte široké možnosti přizpůsobení, které knihovna nabízí. Šť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 vašich projektech. + +- [Nastavení výšky jednorozměrného Databar čárového kódu](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Generování obrázku čárového kódu – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/czech/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..1b8553ad2 --- /dev/null +++ b/barcode/czech/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-06 +description: Vygenerujte obrázek čárového kódu v C# pomocí Aspose.BarCode. Naučte + se, jak generovat Databar, upravit vlastní velikost čárového kódu a změnit výšku + čárového kódu pomocí jednoduchého kódu. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: cs +lastmod: 2026-08-06 +og_description: Vytvořte obrázek čárového kódu v C# pomocí Aspose.BarCode. Tento tutoriál + vám ukáže, jak vytvořit čárový kód Databar Omnidirectional, přizpůsobit jeho velikost + a efektivně změnit výšku čárového kódu. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Vytvořte obrázek čárového kódu v C# – kompletní průvodce Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Vytvořte obrázek čárového kódu v C# pomocí Aspose.BarCode +url: /cs/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< 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# s Aspose.BarCode + +Pokud potřebujete **vytvořit obrázek čárového kódu** programově, tento průvodce vám přesně ukáže, jak na to. Ať už budujete systém inventarizace v maloobchodě nebo portál pro sledování logistiky, uvidíte kompletní workflow pro vytvoření Databar Omnidirectional čárového kódu, úpravu jeho rozměrů a uložení výsledku jako PNG soubor. + +Vytváření obrázku čárového kódu je běžná potřeba, ale vývojáři se často ptají **jak vytvořit Databar** s přesnou velikostí, kterou potřebují. V tomto tutoriálu se naučíte vytvořit Databar čárový kód, přizpůsobit jeho šířku a výšku a změnit výšku čárového kódu bez přepisování celého generátoru. + +## Požadavky + +* .NET 6.0 SDK nebo novější (kód funguje s .NET Core a .NET Framework) +* Visual Studio 2022 (nebo jakékoli IDE podporující C#) +* Platná licence Aspose.BarCode pro .NET (bezplatná evaluační verze funguje pro testování) +* Základní znalost syntaxe C# + +## Krok 1: Instalace Aspose.BarCode + +Přidejte NuGet balíček Aspose.BarCode do svého projektu: + +```bash +dotnet add package Aspose.BarCode +``` + +Balíček obsahuje třídu `BarcodeGenerator`, která je používána v celém tomto tutoriálu. Po instalaci obnovte projekt, aby se stáhly závislosti. + +## Krok 2: Vytvoření základního generátoru čárových kódů + +První řádek kódu vytváří **generátor čárových kódů**, který bude generovat symbol Databar Omnidirectional. Výčtový typ `EncodeTypes.DatabarOmniDirectional` říká knihovně, kterou symbologii použít, a datový řetězec následuje syntaxi GS1 Application Identifier. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Proč je to důležité:** Objekt `BarcodeGenerator` je vstupním bodem pro každou operaci s čárovým kódem. Výběrem `DatabarOmniDirectional` zajistíte, že výstup bude odpovídat standardu GS1 pro maloobchodní skenování. + +## Krok 3: Nastavení vlastní X‑dimenze (šířka modulu) + +X‑dimenze řídí šířku nejúžšího pruhu. Nastavením malé hodnoty v pixelech získáte kompaktní čárový kód, zatímco větší hodnoty zvětší celkovou šířku. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Vysvětlení:** X‑dimenze 2 pixely je běžná volba pro vysoké rozlišení obrazovek. Upravit tuto hodnotu, pokud potřebujete hustší nebo řidší vizuální hustotu. + +## Krok 4: Vytvoření prvního obrázku čárového kódu s konkrétní výškou + +Výška čárového kódu je nezávislá na X‑dimenzi. Zde nastavíme výšku pruhu na **30 px** a poté uložíme obrázek jako PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Výsledek:** Nyní máte soubor s názvem `DatabarBarHeight30Pixels.png`, který zobrazuje Databar čárový kód vysoký 30 px. Toto demonstruje schopnost **vlastní velikosti čárového kódu** pro konkrétní případ použití, například malý štítek. + +## Krok 5: Změna výšky čárového kódu pro větší verzi + +Pokud se stejný čárový kód musí objevit na větším štítku, stačí upravit vlastnost výšky a znovu použít stejnou instanci generátoru. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Proč můžete generátor znovu použít:** Změna `BarHeight.Pixels` aktualizuje vnitřní rozvržení bez nutnosti znovu vytvářet objekt, což šetří paměť a zachovává datový řetězec beze změny. Toto je doporučený způsob, jak **měnit výšku čárového kódu** za běhu. + +## Krok 6: Ověření výstupu + +Otevřete oba PNG soubory v libovolném prohlížeči obrázků. Měli byste vidět dva Databar Omnidirectional čárové kódy, které kódují stejný GTIN, ale liší se ve vertikální velikosti: + +* `DatabarBarHeight30Pixels.png` – výška 30 px, vhodná pro kompaktní účtenky. +* `DatabarBarHeight60Pixels.png` – výška 60 px, ideální pro větší štítky na okraji regálu. + +Oba obrázky zachovávají stejnou X‑dimenzi, takže poměr pruh‑mezera zůstává konzistentní, zatímco celková výška se mění. + +## Běžné varianty a okrajové případy + +| Situace | Jak to řešit | +|-----------|------------------| +| **Různá symbologie čárového kódu** | Nahraďte `EncodeTypes.DatabarOmniDirectional` jinou hodnotou enumu (např. `EncodeTypes.Code128`). Zbytek kódu zůstane beze změny. | +| **Rozměry jiné než pixely** | Použijte `generator.Parameters.Barcode.XDimension.Millimeters` nebo `BarHeight.Millimeters`, pokud potřebujete fyzické rozměry pro výstup připravený k tisku. | +| **Průhledné pozadí** | Nastavte `generator.Parameters.ImageBackgroundColor = Color.Transparent;` před voláním `Save`. | +| **Výstup ve vysokém rozlišení** | Zvyšte oba parametry `XDimension.Pixels` a `BarHeight.Pixels` proporcionálně, nebo uložte jako `BarCodeImageFormat.Tiff` pro bezztrátovou kvalitu. | +| **Více čárových kódů v jednom obrázku** | Vytvořte samostatné instance `BarcodeGenerator`, vykreslete každou do `Bitmap`, a poté je spojte pomocí `Graphics.DrawImage`. | + +**Pro tip:** Vždy otestujte vygenerovaný čárový kód skutečným skenerem před nasazením do produkce. Skenery mohou interpretovat velmi tenké pruhy odlišně v závislosti na osvětlení a kvalitě senzoru. + +## Úplný zdrojový kód pro referenci + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Zkopírujte kód do nového konzolového projektu, spusťte jej a uvidíte, že se ve výstupní složce objeví dva PNG soubory. + +## Často kladené otázky + +**Q: Mohu generovat čárový kód bez instalace licence?** +A: Evaluační verze Aspose.BarCode funguje bez licence, ale přidává malý vodoznak. Pro produkční použití použijte zakoupenou licenci pomocí `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**Q: Ovlivňuje změna X‑dimenze čitelnost?** +A: Ano. Velmi malé X‑dimenze mohou způsobit, že čárový kód bude nečitelný na tiskárnách s nízkým rozlišením. Doporučuje se minimálně 1 px pro vykreslování na obrazovce; pro tisk použijte alespoň 0,25 mm. + +**Q: Co když potřebuji vygenerovat čárový kód ve formátu JPEG?** +A: Nahraďte `BarCodeImageFormat.Png` za `BarCodeImageFormat.Jpeg`. Můžete také nastavit `generator.Parameters.ImageQuality` pro řízení komprese. + +## Závěr + +Nyní víte, jak **vytvořit obrázek čárového kódu** v C# pomocí Aspose.BarCode, jak **vytvořit Databar čárový kód**, upravit **vlastní velikost čárového kódu** a **změnit výšku čárového kódu** na požádání. Kompletní příklad demonstruje nejběžnější workflow a tabulka variant vás vybaví k řešení reálných okrajových případů. + +Dále prozkoumejte související témata, jako je **vkládání čárových kódů do PDF dokumentů**, **hromadné generování více čárových kódů** a **používání QR kódů pro mobilní platby**. Každý z těchto scénářů staví na stejných principech, které jsou zde popsány, takže můžete toto znalosti rozšířit s jistotou. + +Šťastné programování a ať vaše čárové kódy skenují bezchybně! + +## 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 obrázek čárového kódu – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [Jak vygenerovat 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/) +- [Jak vygenerovat čárový kód – konfigurace Code 39 s Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/czech/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..e8077cf18 --- /dev/null +++ b/barcode/czech/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Jak nastavit sloupce pro čárový kód Databar Expanded Stacked a naučit + se generovat obrázky čárových kódů, nastavit řádky a uložit soubor čárového kódu + v C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: cs +lastmod: 2026-08-06 +og_description: Jak nastavit sloupce pro čárový kód Databar Expanded Stacked a rychle + se naučit, jak generovat obrázky čárových kódů, nastavit řádky a uložit soubor čárového + kódu pomocí Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Jak nastavit sloupce pro čárový kód Databar Expanded Stacked – krok‑za‑krokem + průvodce v C# +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Jak nastavit sloupce pro čárový kód Databar Expanded Stacked – kompletní průvodce + v C# +url: /cs/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Jak nastavit sloupce pro Databar Expanded Stacked čárový kód – kompletní průvodce v C# + +Pokud potřebujete **jak nastavit sloupce** pro Databar Expanded Stacked čárový kód, tento tutoriál vám ukáže přesné kroky. Ať už budujete systém označování v maloobchodě nebo logistickou aplikaci, řízení sloupců a řádků vám umožní jemně doladit velikost čárového kódu a spolehlivost skenování. Navíc uvidíte **jak generovat čárový kód** obrázky, upravíte počet řádků a správně **uložit soubor čárového kódu** na disk. + +Tento průvodce vás provede: + +* Instalací knihovny Aspose.Barcode pro .NET. +* Vytvořením generátoru čárových kódů pro typ Databar Expanded Stacked. +* Nastavením počtu sloupců, počtu řádků a formátu obrázku. +* Uložením výsledných PNG souborů do zvoleného adresáře. + +Předchozí zkušenost s Aspose.Barcode není vyžadována – stačí základní vývojové prostředí C#. + +## Požadavky + +Než začnete, ujistěte se, že máte: + +* .NET 6.0 SDK nebo novější nainstalovaný. +* Visual Studio 2022 (nebo jakékoli IDE podporující .NET). +* Odkaz na NuGet **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Všechny ukázky kódu se kompilují s výchozím šablonou konzolového projektu. + +## Krok 1: Vytvoření generátoru čárových kódů pro Databar Expanded Stacked + +Prvním krokem je vytvořit instanci `BarcodeGenerator` s výčtem `EncodeTypes.DatabarExpandedStacked`. Tím se nastaví výchozí rozložení (stacked) a připraví objekt pro další konfiguraci. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Proč je to důležité:** Generátor obsahuje všechny parametry vykreslování. Výběrem `DatabarExpandedStacked` říkáte knihovně, aby použila rozložení stacked, což je jediné rozložení podporující úpravy sloupců a řádků. + +## Jak nastavit sloupce pro Databar Expanded Stacked čárový kód + +Jakmile je generátor vytvořen, můžete řídit počet sloupců. Vlastnost `DataBar.Columns` přijímá celé číslo mezi 1 a 4. Nastavením na **4** vytvoříte nejširší možný čárový kód, který stále odpovídá rozložení stacked. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Praktický tip:** Maximální počet sloupců používejte jen tehdy, když máte na štítku dostatek volného místa. Příliš mnoho sloupců na malém štítku může způsobit problémy se skenováním. + +## Jak generovat obrázky čárových kódů a uložit je + +Po nastavení sloupců musíte vygenerovat čárový kód a zapsat obrázek na disk. Metoda `Save` přijímá cestu k souboru a výčet formátu obrázku. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Složka `output` musí existovat, jinak volání vyhodí výjimku. Pokud chcete, můžete ji vytvořit programově pomocí `Directory.CreateDirectory("output");`. + +## Jak nastavit řádky pro Databar Expanded Stacked čárový kód + +Řádky fungují podobně jako sloupce, ale ovlivňují vertikální uspořádání modulů čárového kódu. Vlastnost `DataBar.Rows` přijímá hodnoty od 1 do 5. V tomto příkladu používáme **3** řádky. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Proč jsou řádky důležité:** Přidání řádků zvyšuje výšku čárového kódu, což může být užitečné pro vysoce husté štítky, kde potřebujete více datových modulů, aniž byste rozšiřovali šířku čárového kódu. + +## Možnosti uložení souboru čárového kódu a osvědčené postupy + +Metoda `Save` podporuje několik formátů obrázků (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG je bezztrátový a dobře funguje pro většinu skenovacích zařízení. Pokud potřebujete menší velikost souboru a můžete tolerovat mírné artefakty komprese, zvolte JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Speciální případ:** Při ukládání do JPEG se ujistěte, že parametr kvality je nastaven správně (výchozí je 90). Nízká kvalita může rozmazat malé moduly, což způsobí nečitelnost čárového kódu. + +## Kompletní, spustitelný příklad + +Spojením všech částí dohromady získáte jeden soubor, který můžete zkopírovat do nového konzolového projektu a okamžitě spustit: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Očekávaný výstup:** Po spuštění programu obsahuje složka `output` tři soubory: + +* `DatabarCols4.png` – čárový kód se 4 sloupci (široký). +* `DatabarRows3.png` – čárový kód se 3 řádky (vysoký). +* `DatabarRows3.jpg` – JPEG verze 3‑řádkového čárového kódu. + +Otevřete kterýkoli z PNG souborů v prohlížeči obrázků; měli byste vidět jasný Databar Expanded Stacked čárový kód připravený ke skenování. + +## Časté otázky a řešení problémů + +| Question | Answer | +|----------|--------| +| *Co když je obrázek rozmazaný?* | Ověřte, že používáte PNG pro bezztrátový výstup. Pokud potřebujete JPEG, zvyšte nastavení kvality (`new JpegOptions { Quality = 95 }`). | +| *Mohu změnit text čárového kódu?* | Ano – nahraďte druhý argument v `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Fungují sloupce a řádky společně?* | Lze je kombinovat; stačí nastavit jak `DataBar.Columns`, tak `DataBar.Rows` před voláním `Save`. | +| *Existuje limit na hloubku adresářové struktury?* | Cesta musí být platná pro operační systém. Použijte `Path.Combine` pro bezpečnost napříč platformami. | + +## Závěr + +Nyní víte **jak nastavit sloupce** pro Databar Expanded Stacked čárový kód, **jak nastavit řádky** a **jak generovat čárový kód** obrázky, které můžete **uložit soubor čárového kódu** ve formátu PNG nebo JPEG. Kompletní příklad demonstruje každý potřebný krok, od instalace knihovny až po finální ověření souboru. + +Dále můžete zkoumat: + +* **jak generovat čárový kód** s úrovněmi opravy chyb pro QR kódy. +* **uložit soubor čárového kódu** možnosti pro vektorové formáty jako SVG nebo PDF. +* Integrace vygenerovaných čárových kódů do ASP.NET Core MVC pohledů pro dynamické tisknutí štítků. + +Neváhejte experimentovat s různými kombinacemi sloupců/řádků, formáty obrázků a obsahem čárových kódů, aby odpovídaly specifikacím vašeho projektu. Šť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, které vám pomohou zvládnout další funkce API a prozkoumat alternativní přístupy k implementaci ve vašich projektech. + +- [Jak generovat čárový kód – jednorozměrné typy čárových kódů](/barcode/english/net/one-dimensional-barcode-types/) +- [Jak generovat čárový kód – konfigurace Code 39 s Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/dutch/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..edb1682f0 --- /dev/null +++ b/barcode/dutch/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: Maak snel een gestapelde DataBar-barcode in C#. Leer de X‑dimensie instellen, + de beeldverhouding aanpassen en PNG‑bestanden exporteren met de DataBar Stacked + Omnidirectional‑generator. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: nl +lastmod: 2026-08-06 +og_description: Maak een gestapelde databarcode in C# met Aspose.BarCode. Deze tutorial + laat zien hoe je de X-dimensie configureert, de beeldverhouding wijzigt en PNG-afbeeldingen + opslaat. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Maak een gestapelde Databar-barcode in C# – volledige programmeergids +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Maak een gestapelde Databar-barcode in C# – stapsgewijze handleiding +url: /nl/python-java/general/create-databar-stacked-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 een databar stacked barcode in C# – stap‑voor‑stap gids + +Als je **databar stacked barcode** afbeeldingen in C# moet maken, laat deze gids je precies zien hoe je dit doet met de Aspose.BarCode bibliotheek. Je leert de X‑dimensie in te stellen, de aspectratio van de barcode te wijzigen en het resultaat op te slaan als PNG‑bestanden—alles in een paar beknopte stappen. + +Het genereren van een DataBar Stacked barcode is gebruikelijk wanneer je GS1‑128‑gegevens moet coderen voor retail‑scanning of logistieke tracking. In de volgende secties behandelen we alles van project‑opzet tot het verifiëren van de output, zodat je de oplossing in elke .NET‑applicatie kunt integreren zonder een detail te missen. + +## Vereisten + +* **.NET 6.0** (of later) geïnstalleerd – de code richt zich op de moderne SDK. +* Een **gelicentieerde** kopie van **Aspose.BarCode for .NET**. De gratis evaluatie werkt voor testen maar voegt een watermerk toe. +* Een IDE zoals **Visual Studio 2022** of **VS Code** met de C#‑extensie. +* Basiskennis van **C#**‑syntaxis en het concept van GS1 Application Identifiers. + +> **Pro tip:** Als je de NuGet package manager gebruikt, lost het commando `dotnet add package Aspose.BarCode` alle afhankelijkheden automatisch op. + +## Stap 1: Maak een nieuw console‑project + +Open een terminal of de Package Manager Console en voer uit: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +Het commando `dotnet new console` maakt een minimale **Program.cs**‑file aan. Het toevoegen van het **Aspose.BarCode**‑pakket maakt de `BarcodeGenerator`‑klasse beschikbaar. + +## Stap 2: Initialiseert de DataBar Stacked Omnidirectional generator + +Open **Program.cs** en vervang de standaardinhoud door de volgende code. De eerste regel maakt een **BarcodeGenerator** aan die is geconfigureerd voor de **DataBar Stacked Omnidirectional**‑symbool en levert een GS1‑128‑payload. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Waarom dit belangrijk is:** De enum‑waarde `EncodeTypes.DatabarStackedOmniDirectional` vertelt de bibliotheek om een **databar stacked barcode** te produceren, de gestapelde variant van de omnidirectionele DataBar‑familie. Deze symbool kan tot 14 numerieke tekens bevatten, waardoor hij ideaal is voor GTIN‑14‑codes. + +## Stap 3: Stel de X‑dimensie in (module‑breedte) + +De X‑dimensie bepaalt de breedte van de kleinste balk (de module). Een te kleine waarde kan slecht renderen op printers met lage resolutie, terwijl een te grote waarde de labelruimte kan overschrijden. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tip:** De eigenschap `Pixels` is handig voor tests op het scherm. Voor print‑gerichte scenario's gebruik je in plaats daarvan `generator.Parameters.Barcode.XDimension.Millimeters`. + +## Stap 4: Pas de aspectratio aan en sla de eerste afbeelding op + +De **aspectratio** beïnvloedt de hoogte‑tot‑breedte‑verhouding van de gestapelde barcode. Het DataBar Stacked Omnidirectional‑type ondersteunt ratio’s van 10 tot 30. We zullen twee afbeeldingen genereren om de visuele impact te illustreren. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +De aanroep van `generator.Save` schrijft een **PNG**‑bestand naar de huidige werkmap. De enum `BarCodeImageFormat.Png` zorgt voor verliesloze compressie, wat ideaal is voor verdere verwerking of insluiting in PDF‑bestanden. + +## Stap 5: Verander de aspectratio naar 30 en sla de tweede afbeelding op + +Nu verhogen we de hoogte van de gestapelde balken door de aspectratio naar **30** te wijzigen. Dit maakt de barcode hoger zonder de X‑dimensie te veranderen. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Het uitvoeren van het programma genereert nu twee PNG‑bestanden: + +* **DatabarAspectRatio15.png** – een compacte barcode geschikt voor kleine labels. +* **DatabarAspectRatio30.png** – een hogere barcode die de scanbetrouwbaarheid op oppervlakken met laag contrast verbetert. + +Je kunt de afbeeldingen in elke viewer openen om te verifiëren dat de balken correct gestapeld zijn en dat de gecodeerde data overeenkomt met de oorspronkelijke GS1‑string. + +## Stap 6: Verifieer de gecodeerde waarde (optioneel) + +Als je wilt bevestigen dat de barcode daadwerkelijk de invoerstring vertegenwoordigt, kun je deze decoderen met dezelfde bibliotheek: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +De decoder zou `(01)12345678901231` moeten weergeven, wat bewijst dat het **create databar stacked barcode**‑proces de data heeft behouden. + +## Veelvoorkomende valkuilen en hoe ze te vermijden + +| Issue | Why it happens | Fix | +|-------|----------------|-----| +| Barcode is onscherp | X‑dimensie te laag ingesteld voor de uitvoerresolutie | Verhoog `XDimension.Pixels` of gebruik `Millimeters` voor print | +| Scanner meldt “symbool niet gevonden” | Aspectratio buiten het ondersteunde bereik 10‑30 | Houd de ratio tussen 10 en 30; 15 en 30 zijn veilige standaardwaarden | +| PNG bevat een watermerk | Gebruik van de gratis evaluatielicentie van Aspose.BarCode | Koop een volledige licentie of gebruik de proefversie alleen voor testen | +| Decodering mislukt op de tweede afbeelding | De decoder was geconfigureerd voor de verkeerde symbool | Gebruik `DecodeType.DatabarStackedOmniDirectional` bij het lezen van gestapelde barcodes | + +## Volgende stappen + +Nu je **databar stacked barcode** afbeeldingen kunt maken, wil je misschien: + +* **Integreer de PNG‑bestanden in PDF‑facturen** met een PDF‑bibliotheek zoals **Aspose.PDF**. +* **Genereer barcodes on‑the‑fly in een web‑API** – retourneer de PNG‑bytes direct vanuit een ASP.NET Core‑controller. +* **Experimenteer met andere DataBar‑varianten** (bijv. `DatabarExpanded`, `DatabarLimited`) door de `EncodeTypes`‑enum te wijzigen. +* **Pas kleuren aan** door `generator.Parameters.Barcode.ForeColor` en `BackColor` in te stellen voor merkspecifieke ontwerpen. + +Elk van deze onderwerpen bouwt voort op dezelfde kernconcepten die hier behandeld zijn: het initialiseren van `BarcodeGenerator`, het configureren van visuele parameters, en het opslaan van het resultaat met `BarCodeImageFormat`. + +--- + +### Conclusie + +Deze tutorial liet zien hoe je **databar stacked barcode** afbeeldingen in C# kunt maken met Aspose.BarCode. Je leerde de **X‑dimensie** in te stellen, de **barcode aspect ratio** aan te passen, en het resultaat te exporteren als **PNG**‑bestanden met `BarcodeGenerator`. Met de optionele decodeerstap kun je bovendien verifiëren dat de gecodeerde GS1‑data correct is. Pas deze patronen toe in je eigen voorraad‑, verzend‑ of point‑of‑sale‑applicaties, en ontdek de vele aanpassingsmogelijkheden die de bibliotheek biedt. Veel programmeerplezier! + +## 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. + +- [Een-dimensionale Databar barcode hoogte‑aanpassing](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Genereer barcode‑afbeelding – GS1 Coupon UPC‑A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/dutch/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..719f309e2 --- /dev/null +++ b/barcode/dutch/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-06 +description: Genereer barcode‑afbeelding in C# met Aspose.BarCode. Leer hoe je Databar + genereert, de aangepaste barcode‑grootte aanpast en de barcode‑hoogte wijzigt met + eenvoudige code. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: nl +lastmod: 2026-08-06 +og_description: Genereer barcode‑afbeelding in C# met Aspose.BarCode. Deze tutorial + laat zien hoe je een Databar Omnidirectional‑barcode maakt, de grootte aanpast en + de barcodehoogte efficiënt wijzigt. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Barcode‑afbeelding genereren in C# – volledige Aspose.BarCode‑gids +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Barcode‑afbeelding genereren in C# met Aspose.BarCode +url: /nl/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Genereer barcode‑afbeelding in C# met Aspose.BarCode + +Als je programmatically **barcode‑afbeelding moet genereren**, laat deze gids je precies zien hoe. Of je nu een retail‑voorraadsysteem of een logistiek‑trackingportaal bouwt, je ziet de volledige workflow voor het maken van een Databar Omnidirectional barcode, het aanpassen van de afmetingen en het opslaan van het resultaat als een PNG‑bestand. + +Het genereren van een barcode‑afbeelding is een veelvoorkomende eis, maar ontwikkelaars vragen zich vaak af **hoe ze Databar** kunnen genereren met de exacte grootte die ze nodig hebben. In deze tutorial leer je een Databar‑barcode te maken, de breedte en hoogte aan te passen, en de barcode‑hoogte te wijzigen zonder de hele generator opnieuw te schrijven. + +## Voorvereisten + +* .NET 6.0 SDK of later (de code werkt met .NET Core en .NET Framework) +* Visual Studio 2022 (of elke IDE die C# ondersteunt) +* Een geldige Aspose.BarCode for .NET‑licentie (de gratis evaluatie werkt voor testen) +* Basiskennis van C#‑syntaxis + +## Stap 1: Installeer Aspose.BarCode + +Voeg het Aspose.BarCode NuGet‑pakket toe aan je project: + +```bash +dotnet add package Aspose.BarCode +``` + +Het pakket bevat de `BarcodeGenerator`‑klasse die door de hele tutorial wordt gebruikt. Na de installatie herstel je het project om de afhankelijkheden binnen te halen. + +## Stap 2: Maak een basis barcode‑generator + +De eerste regel code maakt een **barcode‑generator** die een Databar Omnidirectional‑symbool produceert. De `EncodeTypes.DatabarOmniDirectional`‑enum vertelt de bibliotheek welke symbologie te gebruiken, en de gegevensreeks volgt de GS1 Application Identifier‑syntaxis. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Waarom dit belangrijk is:** Het `BarcodeGenerator`‑object is het startpunt voor elke barcode‑bewerking. Door `DatabarOmniDirectional` te selecteren, zorg je ervoor dat de output voldoet aan de GS1‑standaard voor retail‑scanning. + +## Stap 3: Stel een aangepaste X‑dimensie in (module‑breedte) + +De X‑dimensie bepaalt de breedte van de smalste balk. Een kleine pixelwaarde levert een compacte barcode op, terwijl grotere waarden de totale breedte vergroten. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Uitleg:** Een X‑dimensie van 2 pixel is een veelgebruikte keuze voor hoge‑resolutieschermen. Pas deze waarde aan als je een dichtere of lossere visuele dichtheid nodig hebt. + +## Stap 4: Genereer de eerste barcode‑afbeelding met een specifieke hoogte + +Barcode‑hoogte is onafhankelijk van de X‑dimensie. Hier stellen we de balkhoogte in op **30 px**, en slaan we de afbeelding op als PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Resultaat:** Je hebt nu een bestand genaamd `DatabarBarHeight30Pixels.png` dat een Databar‑barcode van 30 px hoogte toont. Dit demonstreert de **aangepaste barcode‑grootte**‑functionaliteit voor een specifiek gebruiksgeval, zoals een klein label. + +## Stap 5: Wijzig de barcode‑hoogte voor een grotere versie + +Als dezelfde barcode op een groter label moet verschijnen, hoef je alleen de hoogte‑eigenschap aan te passen en dezelfde generator‑instantie opnieuw te gebruiken. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Waarom je de generator kunt hergebruiken:** Het wijzigen van `BarHeight.Pixels` werkt de interne lay-out bij zonder het object opnieuw te creëren, wat geheugen bespaart en de gegevensreeks intact houdt. Dit is de aanbevolen manier om **barcode‑hoogte** dynamisch te **wijzigen**. + +## Stap 6: Verifieer de output + +Open de twee PNG‑bestanden in een willekeurige afbeeldingsviewer. Je zou twee Databar Omnidirectional‑barcodes moeten zien die dezelfde GTIN coderen maar verschillen in verticale grootte: + +* `DatabarBarHeight30Pixels.png` – 30 px hoog, geschikt voor compacte kassabonnen. +* `DatabarBarHeight60Pixels.png` – 60 px hoog, ideaal voor grotere schap‑rand‑labels. + +Beide afbeeldingen behouden dezelfde X‑dimensie, zodat de balk‑naar‑spatie‑verhouding consistent blijft terwijl de totale hoogte schaalt. + +## Veelvoorkomende variaties en randgevallen + +| Situatie | Hoe je het aanpakt | +|-----------|--------------------| +| **Andere barcode‑symbologie** | Vervang `EncodeTypes.DatabarOmniDirectional` door een andere enum‑waarde (bijv. `EncodeTypes.Code128`). De rest van de code blijft ongewijzigd. | +| **Niet‑pixel afmetingen** | Gebruik `generator.Parameters.Barcode.XDimension.Millimeters` of `BarHeight.Millimeters` als je fysieke metingen nodig hebt voor print‑klare output. | +| **Transparante achtergrond** | Stel `generator.Parameters.ImageBackgroundColor = Color.Transparent;` in vóór het aanroepen van `Save`. | +| **High‑resolution output** | Verhoog zowel `XDimension.Pixels` als `BarHeight.Pixels` proportioneel, of sla op als `BarCodeImageFormat.Tiff` voor verliesvrije kwaliteit. | +| **Meerdere barcodes in één afbeelding** | Maak afzonderlijke `BarcodeGenerator`‑instanties, render elk naar een `Bitmap`, en combineer ze vervolgens met `Graphics.DrawImage`. | + +**Pro tip:** Test de gegenereerde barcode altijd met een echte scanner voordat je deze in productie neemt. Scanners kunnen zeer dunne balken anders interpreteren, afhankelijk van verlichting en sensorkwaliteit. + +## Volledige broncode ter referentie + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Kopieer de code naar een nieuw console‑project, voer het uit, en je ziet de twee PNG‑bestanden verschijnen in de output‑map. + +## Veelgestelde vragen + +**Q: Kan ik een barcode genereren zonder een licentie te installeren?** +A: De evaluatieversie van Aspose.BarCode werkt zonder licentie, maar voegt een klein watermerk toe. Voor productie‑gebruik pas je een aangeschafte licentie toe met `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**Q: Heeft het wijzigen van de X‑dimensie invloed op de leesbaarheid?** +A: Ja. Zeer kleine X‑dimensies kunnen de barcode onleesbaar maken op laag‑resolutie‑printers. Een minimum van 1 px voor schermweergave wordt aanbevolen; voor print gebruik je minstens 0,25 mm. + +**Q: Wat als ik een barcode in JPEG‑formaat moet genereren?** +A: Vervang `BarCodeImageFormat.Png` door `BarCodeImageFormat.Jpeg`. Je kunt ook `generator.Parameters.ImageQuality` instellen om de compressie te regelen. + +## Conclusie + +Je weet nu hoe je **barcode‑afbeelding kunt genereren** in C# met Aspose.BarCode, hoe je een **Databar‑barcode maakt**, een **aangepaste barcode‑grootte** aanpast, en **barcode‑hoogte** op aanvraag wijzigt. Het volledige voorbeeld toont de meest voorkomende workflow, en de variatietabel helpt je real‑world randgevallen aan te pakken. + +Vervolgens kun je gerelateerde onderwerpen verkennen, zoals **barcodes in PDF‑documenten insluiten**, **batch‑generatie van meerdere barcodes**, en **QR‑codes voor mobiele betalingen**. Elk van deze scenario’s bouwt voort op dezelfde principes die hier behandeld zijn, zodat je deze kennis vol vertrouwen kunt uitbreiden. + +Veel programmeerplezier, en moge je barcodes feilloos scannen! + +## 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 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. + +- [Genereer barcode‑afbeelding – GS1 Coupon UPC‑A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [Hoe een Aztec‑barcode te genereren met aangepaste beeldverhouding met Aspose.BarCode voor .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Hoe een Barcode te genereren – Code 39‑configuratie met Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/dutch/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..edcce5efb --- /dev/null +++ b/barcode/dutch/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Hoe kolommen in te stellen voor een Databar Expanded Stacked‑barcode + en leren hoe barcode‑afbeeldingen te genereren, rijen in te stellen en het barcode‑bestand + op te slaan in C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: nl +lastmod: 2026-08-06 +og_description: Hoe stel je kolommen in voor een Databar Expanded Stacked‑barcode + en leer je snel hoe je barcode‑afbeeldingen genereert, rijen instelt en het barcode‑bestand + opslaat met Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Hoe kolommen instellen voor een Databar Expanded Stacked barcode – stap‑voor‑stap + C#‑handleiding +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Hoe stel je kolommen in voor een Databar Expanded Stacked barcode – volledige + C#‑gids +url: /nl/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Hoe kolommen in te stellen voor een Databar Expanded Stacked barcode – volledige C# gids + +Als je **hoe kolommen in te stellen** voor een Databar Expanded Stacked barcode, laat deze tutorial je de exacte stappen zien. Of je nu een retail labelingsysteem of een logistieke applicatie bouwt, het regelen van kolommen en rijen stelt je in staat de barcode‑grootte en scanbetrouwbaarheid fijn af te stemmen. Daarnaast zie je **hoe barcode te genereren** afbeeldingen, het aantal rijen aan te passen, en correct **barcode opslaan bestand** naar schijf. + +Deze gids leidt je door: + +* Installeren van de Aspose.Barcode voor .NET bibliotheek. +* Een barcode‑generator maken voor het Databar Expanded Stacked type. +* Het instellen van het aantal kolommen, rijen en het afbeeldingsformaat. +* Het opslaan van de resulterende PNG‑bestanden naar een gekozen map. + +Ervaring met Aspose.Barcode is niet vereist—alleen een basis C# ontwikkelomgeving. + +## Vereisten + +Voordat je begint, zorg ervoor dat je het volgende hebt: + +* .NET 6.0 SDK of later geïnstalleerd. +* Visual Studio 2022 (of een IDE die .NET ondersteunt). +* Een NuGet‑referentie naar **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Alle code‑fragmenten compileren met de standaard console‑projecttemplate. + +## Stap 1: Maak een barcode‑generator voor Databar Expanded Stacked + +De eerste handeling is het instantieren van `BarcodeGenerator` met de `EncodeTypes.DatabarExpandedStacked` enum. Dit stelt de standaardlay-out (stacked) in en bereidt het object voor verdere configuratie. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Waarom dit belangrijk is:** De generator bevat alle renderingsparameters. Door `DatabarExpandedStacked` te kiezen, vertel je de bibliotheek de stacked‑lay-out te gebruiken, de enige lay-out die kolom‑ en rij‑aanpassingen ondersteunt. + +## Hoe kolommen in te stellen voor een Databar Expanded Stacked barcode + +Nu de generator bestaat, kun je het aantal kolommen regelen. De eigenschap `DataBar.Columns` accepteert een geheel getal tussen 1 en 4. Instellen op **4** maakt de breedste mogelijke barcode die nog steeds in de stacked‑lay-out past. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Praktische tip:** Gebruik het maximale aantal kolommen alleen wanneer je voldoende witruimte op het label hebt. Te veel kolommen op een klein label kunnen scanproblemen veroorzaken. + +## Hoe barcode‑afbeeldingen te genereren en op te slaan + +Na het configureren van de kolommen moet je de barcode renderen en de afbeelding naar schijf schrijven. De `Save`‑methode neemt een bestandspad en een afbeeldingsformaat‑enum. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +De map `output` moet bestaan, anders zal de aanroep een uitzondering veroorzaken. Je kunt deze programmatically aanmaken met `Directory.CreateDirectory("output");` als je dat liever doet. + +## Hoe rijen in te stellen voor een Databar Expanded Stacked barcode + +Rijen werken op dezelfde manier als kolommen, maar ze beïnvloeden de verticale stapeling van de barcode‑modules. De eigenschap `DataBar.Rows` accepteert waarden van 1 tot 5. In dit voorbeeld gebruiken we **3** rijen. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Waarom rijen belangrijk zijn:** Het toevoegen van rijen vergroot de barcode‑hoogte, wat nuttig kan zijn voor high‑density labels waarbij je meer datamodules nodig hebt zonder de barcode te verbreden. + +## Barcode‑opslaan‑bestand opties en best practices + +De `Save`‑methode ondersteunt verschillende afbeeldingsformaten (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG is verliesloos en werkt goed voor de meeste scanapparaten. Als je een kleinere bestandsgrootte nodig hebt en lichte compressie‑artefacten kunt tolereren, kies dan JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Randgeval:** Bij het opslaan als JPEG, zorg ervoor dat de kwaliteitsparameter correct is ingesteld (standaard is 90). Lage kwaliteit kan de kleine modules vervagen, waardoor de barcode onleesbaar wordt. + +## Volledig, uitvoerbaar voorbeeld + +Alles samenvoegend, hier is een enkel bestand dat je kunt kopiëren naar een nieuw console‑project en direct kunt uitvoeren: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Verwachte output:** Na het uitvoeren van het programma bevat de `output`‑map drie bestanden: + +* `DatabarCols4.png` – barcode met 4 kolommen (breed). +* `DatabarRows3.png` – barcode met 3 rijen (hoog). +* `DatabarRows3.jpg` – JPEG‑versie van de 3‑rij barcode. + +Open een van de PNG‑bestanden in een afbeeldingsviewer; je zou een duidelijke Databar Expanded Stacked barcode moeten zien die klaar is om te scannen. + +## Veelgestelde vragen en probleemoplossing + +| Vraag | Antwoord | +|----------|--------| +| *Wat als de afbeelding onscherp is?* | Controleer of je PNG gebruikt voor verliesvrije output. Als je JPEG nodig hebt, verhoog dan de kwaliteitsinstelling (`new JpegOptions { Quality = 95 }`). | +| *Kan ik de barcode‑tekst wijzigen?* | Ja—vervang het tweede argument in `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Werken kolommen en rijen samen?* | Ze kunnen gecombineerd worden; stel gewoon zowel `DataBar.Columns` als `DataBar.Rows` in voordat je `Save` aanroept. | +| *Is er een limiet op de diepte van de map?* | Het pad moet geldig zijn voor het besturingssysteem. Gebruik `Path.Combine` voor cross‑platform veiligheid. | + +## Conclusie + +Je weet nu **hoe kolommen in te stellen** voor een Databar Expanded Stacked barcode, **hoe rijen in te stellen**, en **hoe barcode te genereren** afbeeldingen die je kunt **barcode opslaan bestand** in PNG‑ of JPEG‑formaat. Het volledige voorbeeld toont elke vereiste stap, van bibliotheekinstallatie tot uiteindelijke bestandsverificatie. + +Vervolgens, overweeg om te verkennen: + +* **hoe barcode te genereren** met foutcorrectieniveaus voor QR‑codes. +* **barcode opslaan bestand** opties voor vectorformaten zoals SVG of PDF. +* De gegenereerde barcodes integreren in ASP.NET Core MVC‑views voor dynamisch labelprinten. + +Voel je vrij om te experimenteren met verschillende kolom‑/rij‑combinaties, afbeeldingsformaten en barcode‑inhoud om te voldoen aan de specificaties van je project. 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 getoond. 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. + +- [Hoe barcode te genereren - Eén-dimensionale barcode‑typen](/barcode/english/net/one-dimensional-barcode-types/) +- [Hoe barcode te genereren – Code 39 configuratie met Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [Hoe 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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/english/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..cbadd231b --- /dev/null +++ b/barcode/english/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,195 @@ +--- +category: general +date: 2026-08-06 +description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: en +lastmod: 2026-08-06 +og_description: Create databar stacked barcode in C# with Aspose.BarCode. This tutorial + shows how to configure X dimension, change aspect ratio, and save PNG images. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Create databar stacked barcode in C# – complete programming guide +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Create databar stacked barcode in C# – step‑by‑step guide +url: /python-java/general/create-databar-stacked-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 databar stacked barcode in C# – step‑by‑step guide + +If you need to **create databar stacked barcode** images in C#, this guide shows you exactly how to do it using the Aspose.BarCode library. You’ll learn to set the X dimension, change the barcode aspect ratio, and save the result as PNG files—all in a few concise steps. + +Generating a DataBar Stacked barcode is common when you must encode GS1‑128 data for retail scanning or logistics tracking. In the sections that follow we cover everything from project setup to verifying the output, so you can integrate the solution into any .NET application without missing a detail. + +## Prerequisites + +Before you start, make sure you have: + +* **.NET 6.0** (or later) installed – the code targets the modern SDK. +* A **licensed** copy of **Aspose.BarCode for .NET**. The free evaluation works for testing but adds a watermark. +* An IDE such as **Visual Studio 2022** or **VS Code** with the C# extension. +* Basic familiarity with **C#** syntax and the concept of GS1 Application Identifiers. + +> **Pro tip:** If you use the NuGet package manager, the command `dotnet add package Aspose.BarCode` resolves all dependencies automatically. + +## Step 1: Create a new console project + +Open a terminal or the Package Manager Console and run: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +The `dotnet new console` command scaffolds a minimal **Program.cs** file. Adding the **Aspose.BarCode** package makes the `BarcodeGenerator` class available. + +## Step 2: Initialize the DataBar Stacked Omnidirectional generator + +Open **Program.cs** and replace the default content with the following code. The first line creates a **BarcodeGenerator** configured for the **DataBar Stacked Omnidirectional** symbology and supplies a GS1‑128 payload. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Why this matters:** The `EncodeTypes.DatabarStackedOmniDirectional` enum value tells the library to produce a **databar stacked barcode**, which is the stacked variant of the omnidirectional DataBar family. This symbology can hold up to 14 numeric characters, making it ideal for GTIN‑14 codes. + +## Step 3: Set the X dimension (module width) + +The X dimension controls the width of the smallest bar (the module). A value that’s too small may render poorly on low‑resolution printers, while a value that’s too large can exceed label space. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tip:** The `Pixels` property is convenient for screen‑based testing. For print‑focused scenarios, use `generator.Parameters.Barcode.XDimension.Millimeters` instead. + +## Step 4: Adjust the aspect ratio and save the first image + +The **aspect ratio** influences the height‑to‑width relationship of the stacked barcode. The DataBar Stacked Omnidirectional type supports ratios from 10 to 30. We’ll generate two images to illustrate the visual impact. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +The call to `generator.Save` writes a **PNG** file to the current working directory. The `BarCodeImageFormat.Png` enum ensures lossless compression, which is ideal for further processing or embedding in PDFs. + +## Step 5: Change the aspect ratio to 30 and save the second image + +Now we increase the height of the stacked bars by changing the aspect ratio to **30**. This makes the barcode taller without altering the X dimension. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Running the program now produces two PNG files: + +* **DatabarAspectRatio15.png** – a compact barcode suitable for small labels. +* **DatabarAspectRatio30.png** – a taller barcode that improves scan reliability on low‑contrast surfaces. + +You can open the images in any viewer to verify that the bars are correctly stacked and that the encoded data matches the original GS1 string. + +## Step 6: Verify the encoded value (optional) + +If you need to confirm that the barcode truly represents the input string, you can decode it with the same library: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +The decoder should output `(01)12345678901231`, proving that the **create databar stacked barcode** process preserved the data. + +## Common pitfalls and how to avoid them + +| Issue | Why it happens | Fix | +|-------|----------------|-----| +| Barcode appears blurry | X dimension set too low for the output resolution | Increase `XDimension.Pixels` or use `Millimeters` for print | +| Scanner reports “symbol not found” | Aspect ratio outside the supported 10‑30 range | Keep the ratio between 10 and 30; 15 and 30 are safe defaults | +| PNG contains a watermark | Using the free evaluation license of Aspose.BarCode | Purchase a full license or use the trial for testing only | +| Decoding fails on the second image | The decoder was configured for the wrong symbology | Use `DecodeType.DatabarStackedOmniDirectional` when reading stacked barcodes | + +## Next steps + +Now that you can **create databar stacked barcode** images, you might want to: + +* **Embed the PNGs into PDF invoices** using a PDF library such as **Aspose.PDF**. +* **Generate barcodes on the fly in a web API** – return the PNG bytes directly from an ASP.NET Core controller. +* **Experiment with other DataBar variants** (e.g., `DatabarExpanded`, `DatabarLimited`) by changing the `EncodeTypes` enum. +* **Adjust colors** by setting `generator.Parameters.Barcode.ForeColor` and `BackColor` for brand‑specific designs. + +Each of these topics builds on the same core concepts covered here: initializing `BarcodeGenerator`, configuring visual parameters, and saving the result with `BarCodeImageFormat`. + +--- + +### Conclusion + +This tutorial demonstrated how to **create databar stacked barcode** images in C# using Aspose.BarCode. You learned to set the **X dimension**, modify the **barcode aspect ratio**, and export the result as **PNG** files with `BarcodeGenerator`. With the optional decoding step, you can also verify that the encoded GS1 data is accurate. Apply these patterns to your own inventory, shipping, or point‑of‑sale applications, and explore the many customization options the library provides. 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. + +- [One-Dimensional Databar Barcode Height Adjustment](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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-databar-stacked-barcode-in-c-step-by-step-guide/og-image.png b/barcode/english/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/og-image.png new file mode 100644 index 000000000..3027c6331 Binary files /dev/null and b/barcode/english/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/og-image.png differ diff --git a/barcode/english/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/english/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..af6fc0e42 --- /dev/null +++ b/barcode/english/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,228 @@ +--- +category: general +date: 2026-08-06 +description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: en +lastmod: 2026-08-06 +og_description: Generate barcode image in C# with Aspose.BarCode. This tutorial shows + you how to create a Databar Omnidirectional barcode, customize its size, and change + the barcode height efficiently. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Generate barcode image in C# – full Aspose.BarCode guide +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Generate barcode image in C# with Aspose.BarCode +url: /python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generate barcode image in C# with Aspose.BarCode + +If you need to **generate barcode image** programmatically, this guide shows you exactly how. Whether you are building a retail inventory system or a logistics tracking portal, you’ll see the complete workflow for creating a Databar Omnidirectional barcode, adjusting its dimensions, and saving the result as a PNG file. + +Generating a barcode image is a common requirement, but developers often wonder **how to generate Databar** with the exact size they need. In this tutorial you’ll learn to create a Databar barcode, customize its width and height, and change the barcode height without rewriting the entire generator. + +## Prerequisites + +Before you start, make sure you have: + +* .NET 6.0 SDK or later (the code works with .NET Core and .NET Framework) +* Visual Studio 2022 (or any IDE that supports C#) +* A valid Aspose.BarCode for .NET license (the free evaluation works for testing) +* Basic familiarity with C# syntax + +## Step 1: Install Aspose.BarCode + +Add the Aspose.BarCode NuGet package to your project: + +```bash +dotnet add package Aspose.BarCode +``` + +The package contains the `BarcodeGenerator` class used throughout this tutorial. After the installation, restore the project to pull the dependencies. + +## Step 2: Create a basic barcode generator + +The first line of code creates a **barcode generator** that will produce a Databar Omnidirectional symbol. The `EncodeTypes.DatabarOmniDirectional` enum tells the library which symbology to use, and the data string follows GS1 Application Identifier syntax. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Why this matters:** The `BarcodeGenerator` object is the entry point for every barcode operation. By selecting `DatabarOmniDirectional` you ensure the output complies with the GS1 standard for retail scanning. + +## Step 3: Set a custom X‑dimension (module width) + +The X‑dimension controls the width of the narrowest bar. Setting it to a small pixel value gives you a compact barcode, while larger values increase overall width. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Explanation:** A 2‑pixel X‑dimension is a common choice for high‑resolution screens. Adjust this value if you need a tighter or looser visual density. + +## Step 4: Generate the first barcode image with a specific height + +Barcode height is independent of X‑dimension. Here we set the bar height to **30 px**, then save the image as PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Result:** You now have a file named `DatabarBarHeight30Pixels.png` that shows a Databar barcode 30 px tall. This demonstrates the **custom barcode size** capability for a specific use case such as a small label. + +## Step 5: Change barcode height for a larger version + +If the same barcode must appear on a larger label, you only need to modify the height property and reuse the same generator instance. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Why you can reuse the generator:** Changing `BarHeight.Pixels` updates the internal layout without recreating the object, which saves memory and keeps the data string intact. This is the recommended way to **change barcode height** on the fly. + +## Step 6: Verify the output + +Open the two PNG files in any image viewer. You should see two Databar Omnidirectional barcodes that encode the same GTIN but differ in vertical size: + +* `DatabarBarHeight30Pixels.png` – 30 px tall, suitable for compact receipts. +* `DatabarBarHeight60Pixels.png` – 60 px tall, ideal for larger shelf‑edge labels. + +Both images retain the same X‑dimension, so the bar‑to‑space ratio stays consistent while the overall height scales. + +## Common variations and edge cases + +| Situation | How to handle it | +|-----------|------------------| +| **Different barcode symbology** | Replace `EncodeTypes.DatabarOmniDirectional` with another enum value (e.g., `EncodeTypes.Code128`). The rest of the code remains unchanged. | +| **Non‑pixel dimensions** | Use `generator.Parameters.Barcode.XDimension.Millimeters` or `BarHeight.Millimeters` if you need physical measurements for print‑ready output. | +| **Transparent background** | Set `generator.Parameters.ImageBackgroundColor = Color.Transparent;` before calling `Save`. | +| **High‑resolution output** | Increase both `XDimension.Pixels` and `BarHeight.Pixels` proportionally, or save as `BarCodeImageFormat.Tiff` for lossless quality. | +| **Multiple barcodes in one image** | Create separate `BarcodeGenerator` instances, render each to a `Bitmap`, then compose them using `Graphics.DrawImage`. | + +**Pro tip:** Always test the generated barcode with a real scanner before deploying to production. Scanners may interpret very thin bars differently depending on lighting and sensor quality. + +## Full source code for reference + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Copy the code into a new console project, run it, and you’ll see the two PNG files appear in the output folder. + +## Frequently asked questions + +**Q: Can I generate a barcode without installing a license?** +A: The evaluation version of Aspose.BarCode works without a license but adds a small watermark. For production use, apply a purchased license using `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**Q: Does changing the X‑dimension affect readability?** +A: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution printers. A minimum of 1 px for screen rendering is recommended; for print, use at least 0.25 mm. + +**Q: What if I need to generate a barcode in JPEG format?** +A: Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You may also set `generator.Parameters.ImageQuality` to control compression. + +## Conclusion + +You now know how to **generate barcode image** in C# using Aspose.BarCode, how to **create Databar barcode**, adjust a **custom barcode size**, and **change barcode height** on demand. The complete example demonstrates the most common workflow, and the variations table equips you to handle real‑world edge cases. + +Next, explore related topics such as **embedding barcodes in PDF documents**, **batch generating multiple barcodes**, and **using QR codes for mobile payments**. Each of those scenarios builds on the same principles covered here, so you can extend this knowledge confidently. + +Happy coding, and may your barcodes scan flawlessly! + + +## 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. + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/generate-barcode-image-in-c-with-aspose-barcode/og-image.png b/barcode/english/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/og-image.png new file mode 100644 index 000000000..4e01ba337 Binary files /dev/null and b/barcode/english/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/og-image.png differ diff --git a/barcode/english/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/english/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..4aa39f3f9 --- /dev/null +++ b/barcode/english/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,223 @@ +--- +category: general +date: 2026-08-06 +description: How to set columns for a Databar Expanded Stacked barcode and learn how + to generate barcode images, set rows, and save the barcode file in C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: en +lastmod: 2026-08-06 +og_description: How to set columns for a Databar Expanded Stacked barcode and quickly + learn how to generate barcode images, set rows, and save the barcode file with Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: How to set columns for a Databar Expanded Stacked barcode – step‑by‑step + C# guide +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: How to set columns for a Databar Expanded Stacked barcode – complete C# guide +url: /python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# How to set columns for a Databar Expanded Stacked barcode – complete C# guide + +If you need to **how to set columns** for a Databar Expanded Stacked barcode, this tutorial shows you the exact steps. Whether you are building a retail labeling system or a logistics application, controlling columns and rows lets you fine‑tune the barcode size and scan reliability. In addition, you’ll see **how to generate barcode** images, adjust the number of rows, and correctly **barcode save file** to disk. + +This guide walks you through: + +* Installing the Aspose.Barcode for .NET library. +* Creating a barcode generator for the Databar Expanded Stacked type. +* Setting the column count, row count, and image format. +* Saving the resulting PNG files to a chosen directory. + +No prior experience with Aspose.Barcode is required—just a basic C# development environment. + +## Prerequisites + +Before you start, make sure you have: + +* .NET 6.0 SDK or later installed. +* Visual Studio 2022 (or any IDE that supports .NET). +* A NuGet reference to **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +All code snippets compile with the default console project template. + +## Step 1: Create a barcode generator for Databar Expanded Stacked + +The first operation is to instantiate `BarcodeGenerator` with the `EncodeTypes.DatabarExpandedStacked` enum. This sets the default layout (stacked) and prepares the object for further configuration. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Why this matters:** The generator holds all rendering parameters. By picking `DatabarExpandedStacked` you tell the library to use the stacked layout, which is the only layout that supports column and row adjustments. + +## How to set columns for a Databar Expanded Stacked barcode + +Now that the generator exists, you can control the column count. The `DataBar.Columns` property accepts an integer between 1 and 4. Setting it to **4** creates the widest possible barcode while still fitting the stacked layout. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Practical tip:** Use the maximum column count only when you have enough white space on the label. Too many columns on a small label can cause scanning issues. + +## How to generate barcode images and save them + +After configuring columns, you need to render the barcode and write the image to disk. The `Save` method takes a file path and an image format enum. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +The folder `output` must exist or the call will throw an exception. You can create it programmatically with `Directory.CreateDirectory("output");` if you prefer. + +## How to set rows for a Databar Expanded Stacked barcode + +Rows work similarly to columns, but they affect the vertical stacking of the barcode modules. The `DataBar.Rows` property accepts values from 1 to 5. In this example we use **3** rows. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Why rows matter:** Adding rows increases the barcode height, which can be useful for high‑density labels where you need more data modules without widening the barcode. + +## Barcode save file options and best practices + +The `Save` method supports several image formats (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG is lossless and works well for most scanning devices. If you need a smaller file size and can tolerate slight compression artifacts, choose JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Edge case:** When saving to JPEG, ensure the quality parameter is set appropriately (default is 90). Low quality can blur the small modules, making the barcode unreadable. + +## Complete, runnable example + +Putting everything together, here is a single file you can copy into a new console project and run immediately: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Expected output:** After running the program, the `output` folder contains three files: + +* `DatabarCols4.png` – barcode with 4 columns (wide). +* `DatabarRows3.png` – barcode with 3 rows (tall). +* `DatabarRows3.jpg` – JPEG version of the 3‑row barcode. + +Open any of the PNG files in an image viewer; you should see a clear Databar Expanded Stacked barcode ready for scanning. + +## Common questions and troubleshooting + +| Question | Answer | +|----------|--------| +| *What if the image is blurry?* | Verify you are using PNG for lossless output. If you need JPEG, increase the quality setting (`new JpegOptions { Quality = 95 }`). | +| *Can I change the barcode text?* | Yes—replace the second argument in `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Do columns and rows work together?* | They can be combined; just set both `DataBar.Columns` and `DataBar.Rows` before calling `Save`. | +| *Is there a limit on directory depth?* | The path must be valid for the operating system. Use `Path.Combine` for cross‑platform safety. | + +## Conclusion + +You now know **how to set columns** for a Databar Expanded Stacked barcode, **how to set rows**, and **how to generate barcode** images that you can **barcode save file** in PNG or JPEG format. The complete example demonstrates every required step, from library installation to final file verification. + +Next, consider exploring: + +* **how to generate barcode** with error correction levels for QR codes. +* **barcode save file** options for vector formats like SVG or PDF. +* Integrating the generated barcodes into ASP.NET Core MVC views for dynamic label printing. + +Feel free to experiment with different column/row combinations, image formats, and barcode contents to match your project’s specifications. 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. + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/og-image.png b/barcode/english/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/og-image.png new file mode 100644 index 000000000..8bd349966 Binary files /dev/null and b/barcode/english/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/og-image.png differ diff --git a/barcode/french/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/french/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..e97a106e7 --- /dev/null +++ b/barcode/french/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: Créez rapidement un code‑barres DataBar empilé en C#. Apprenez à définir + la dimension X, à ajuster le rapport d’aspect et à exporter des fichiers PNG à l’aide + du générateur DataBar Stacked Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: fr +lastmod: 2026-08-06 +og_description: Créez un code‑barres Databar empilé en C# avec Aspose.BarCode. Ce + tutoriel montre comment configurer la dimension X, modifier le rapport d’aspect + et enregistrer des images PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Créer un code‑barres Databar empilé en C# – guide complet de programmation +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Créer un code‑barres Databar empilé en C# – guide étape par étape +url: /fr/python-java/general/create-databar-stacked-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 databar stacked barcode en C# – guide étape par étape + +Si vous devez **créer des images de databar stacked barcode** en C#, ce guide vous montre exactement comment le faire en utilisant la bibliothèque Aspose.BarCode. Vous apprendrez à définir la dimension X, à modifier le ratio d’aspect du code‑barres et à enregistrer le résultat au format PNG — le tout en quelques étapes concises. + +Générer un DataBar Stacked barcode est courant lorsque vous devez encoder des données GS1‑128 pour la lecture en magasin ou le suivi logistique. Dans les sections suivantes, nous couvrons tout, de la configuration du projet à la vérification du résultat, afin que vous puissiez intégrer la solution dans n’importe quelle application .NET sans rien manquer. + +## Prérequis + +* **.NET 6.0** (ou version ultérieure) installé – le code cible le SDK moderne. +* Une copie **licenciée** de **Aspose.BarCode for .NET**. L’évaluation gratuite fonctionne pour les tests mais ajoute un filigrane. +* Un IDE tel que **Visual Studio 2022** ou **VS Code** avec l’extension C#. +* Une connaissance de base de la syntaxe **C#** et du concept d’identifiants d’application GS1. + +> **Astuce :** Si vous utilisez le gestionnaire de paquets NuGet, la commande `dotnet add package Aspose.BarCode` résout automatiquement toutes les dépendances. + +## Étape 1 : Créer un nouveau projet console + +Ouvrez un terminal ou la console du gestionnaire de paquets et exécutez : + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +La commande `dotnet new console` crée un fichier **Program.cs** minimal. L’ajout du package **Aspose.BarCode** rend la classe `BarcodeGenerator` disponible. + +## Étape 2 : Initialiser le générateur DataBar Stacked Omnidirectional + +Ouvrez **Program.cs** et remplacez le contenu par défaut par le code suivant. La première ligne crée un **BarcodeGenerator** configuré pour la symbologie **DataBar Stacked Omnidirectional** et fournit une charge utile GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Pourquoi c’est important :** La valeur d’énumération `EncodeTypes.DatabarStackedOmniDirectional` indique à la bibliothèque de produire un **databar stacked barcode**, qui est la variante empilée de la famille DataBar omnidirectionnelle. Cette symbologie peut contenir jusqu’à 14 caractères numériques, ce qui la rend idéale pour les codes GTIN‑14. + +## Étape 3 : Définir la dimension X (largeur du module) + +La dimension X contrôle la largeur de la plus petite barre (le module). Une valeur trop petite peut rendre le code de mauvaise qualité sur des imprimantes basse résolution, tandis qu’une valeur trop grande peut dépasser l’espace disponible sur l’étiquette. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Conseil :** La propriété `Pixels` est pratique pour les tests sur écran. Pour les scénarios d’impression, utilisez plutôt `generator.Parameters.Barcode.XDimension.Millimeters`. + +## Étape 4 : Ajuster le ratio d’aspect et enregistrer la première image + +Le **ratio d’aspect** influence la relation hauteur‑largeur du code‑barres empilé. Le type DataBar Stacked Omnidirectional prend en charge des ratios de 10 à 30. Nous générerons deux images pour illustrer l’impact visuel. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +L’appel à `generator.Save` écrit un fichier **PNG** dans le répertoire de travail actuel. L’énumération `BarCodeImageFormat.Png` garantit une compression sans perte, idéale pour un traitement ultérieur ou l’intégration dans des PDF. + +## Étape 5 : Modifier le ratio d’aspect à 30 et enregistrer la deuxième image + +Nous augmentons maintenant la hauteur des barres empilées en changeant le ratio d’aspect à **30**. Cela rend le code‑barres plus haut sans modifier la dimension X. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +L’exécution du programme génère maintenant deux fichiers PNG : + +* **DatabarAspectRatio15.png** – un code‑barres compact adapté aux petites étiquettes. +* **DatabarAspectRatio30.png** – un code‑barres plus haut qui améliore la fiabilité de la lecture sur des surfaces à faible contraste. + +Vous pouvez ouvrir les images avec n’importe quel visualiseur pour vérifier que les barres sont correctement empilées et que les données encodées correspondent à la chaîne GS1 d’origine. + +## Étape 6 : Vérifier la valeur encodée (facultatif) + +Si vous devez confirmer que le code‑barres représente réellement la chaîne d’entrée, vous pouvez le décoder avec la même bibliothèque : + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Le décodeur devrait renvoyer `(01)12345678901231`, prouvant que le processus de **création d’un databar stacked barcode** a conservé les données. + +## Pièges courants et comment les éviter + +| Problème | Cause | Solution | +|----------|-------|----------| +| Le code‑barres apparaît flou | Dimension X trop faible pour la résolution de sortie | Augmenter `XDimension.Pixels` ou utiliser `Millimeters` pour l’impression | +| Le scanner signale « symbole non trouvé » | Ratio d’aspect en dehors de la plage prise en charge de 10‑30 | Conserver le ratio entre 10 et 30 ; 15 et 30 sont des valeurs sûres | +| Le PNG contient un filigrane | Utilisation de la licence d’évaluation gratuite d’Aspose.BarCode | Acheter une licence complète ou n’utiliser l’essai que pour les tests | +| Le décodage échoue sur la deuxième image | Le décodeur était configuré pour la mauvaise symbologie | Utiliser `DecodeType.DatabarStackedOmniDirectional` lors de la lecture des codes‑barres empilés | + +## Prochaines étapes + +Maintenant que vous pouvez **créer des images de databar stacked barcode**, vous pourriez vouloir : + +* **Intégrer les PNG dans des factures PDF** à l’aide d’une bibliothèque PDF telle que **Aspose.PDF**. +* **Générer des codes‑barres à la volée dans une API web** – renvoyer les octets PNG directement depuis un contrôleur ASP.NET Core. +* **Expérimenter d’autres variantes DataBar** (par ex., `DatabarExpanded`, `DatabarLimited`) en modifiant l’énumération `EncodeTypes`. +* **Ajuster les couleurs** en définissant `generator.Parameters.Barcode.ForeColor` et `BackColor` pour des designs spécifiques à la marque. + +Chaque sujet s’appuie sur les mêmes concepts de base présentés ici : initialiser `BarcodeGenerator`, configurer les paramètres visuels et enregistrer le résultat avec `BarCodeImageFormat`. + +--- + +### Conclusion + +Ce tutoriel a démontré comment **créer des images de databar stacked barcode** en C# en utilisant Aspose.BarCode. Vous avez appris à définir la **dimension X**, à modifier le **ratio d’aspect du code‑barres**, et à exporter le résultat sous forme de fichiers **PNG** avec `BarcodeGenerator`. Avec l’étape de décodage optionnelle, vous pouvez également vérifier que les données GS1 encodées sont exactes. Appliquez ces modèles à vos propres applications d’inventaire, d’expédition ou de point de vente, et explorez les nombreuses options de personnalisation offertes par la bibliothèque. 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 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. + +- [Ajustement de la hauteur du code‑barres Databar unidimensionnel](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Générer une image de code‑barres – Coupon GS1 UPC‑A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/french/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..006d4f860 --- /dev/null +++ b/barcode/french/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: Générez une image de code‑barres en C# avec Aspose.BarCode. Apprenez + à créer un Databar, à ajuster la taille personnalisée du code‑barres et à modifier + la hauteur du code‑barres avec un code simple. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: fr +lastmod: 2026-08-06 +og_description: Générez une image de code‑barres en C# avec Aspose.BarCode. Ce tutoriel + vous montre comment créer un code‑barres Databar omnidirectionnel, personnaliser + sa taille et modifier la hauteur du code‑barres efficacement. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Générer une image de code‑barres en C# – guide complet Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Générer une image de code‑barres en C# avec Aspose.BarCode +url: /fr/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Générer une image de code-barres en C# avec Aspose.BarCode + +Si vous devez **générer une image de code‑barres** de façon programmatique, ce guide vous montre exactement comment faire. Que vous construisiez un système d’inventaire retail ou un portail de suivi logistique, vous verrez le flux complet pour créer un code‑barres Databar Omnidirectionnel, ajuster ses dimensions et enregistrer le résultat au format PNG. + +Générer une image de code‑barres est une exigence courante, mais les développeurs se demandent souvent **comment générer un Databar** avec la taille exacte dont ils ont besoin. Dans ce tutoriel, vous apprendrez à créer un code‑barres Databar, à personnaliser sa largeur et sa hauteur, et à modifier la hauteur du code‑barres sans réécrire tout le générateur. + +## Prérequis + +Avant de commencer, assurez‑vous d’avoir : + +* SDK .NET 6.0 ou ultérieur (le code fonctionne avec .NET Core et .NET Framework) +* Visual Studio 2022 (ou tout IDE supportant C#) +* Une licence valide d’Aspose.BarCode for .NET (l’évaluation gratuite suffit pour les tests) +* Une connaissance de base de la syntaxe C# + +## Étape 1 : Installer Aspose.BarCode + +Ajoutez le package NuGet Aspose.BarCode à votre projet : + +```bash +dotnet add package Aspose.BarCode +``` + +Le package contient la classe `BarcodeGenerator` utilisée tout au long de ce tutoriel. Après l’installation, restaurez le projet pour récupérer les dépendances. + +## Étape 2 : Créer un générateur de code‑barres de base + +La première ligne de code crée un **générateur de code‑barres** qui produira un symbole Databar Omnidirectionnel. L’énumération `EncodeTypes.DatabarOmniDirectional` indique à la bibliothèque quelle symbologie utiliser, et la chaîne de données suit la syntaxe de l’identifiant d’application GS1. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Pourquoi c’est important :** L’objet `BarcodeGenerator` est le point d’entrée pour chaque opération de code‑barres. En sélectionnant `DatabarOmniDirectional`, vous vous assurez que la sortie respecte la norme GS1 pour le scan retail. + +## Étape 3 : Définir une X‑dimension personnalisée (largeur du module) + +La X‑dimension contrôle la largeur de la barre la plus étroite. La régler à une petite valeur en pixels vous donne un code‑barres compact, tandis que des valeurs plus grandes augmentent la largeur globale. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Explication :** Une X‑dimension de 2 pixels est un choix courant pour les écrans haute résolution. Ajustez cette valeur si vous avez besoin d’une densité visuelle plus serrée ou plus lâche. + +## Étape 4 : Générer la première image de code‑barres avec une hauteur spécifique + +La hauteur du code‑barres est indépendante de la X‑dimension. Ici, nous fixons la hauteur des barres à **30 px**, puis enregistrons l’image au format PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Résultat :** Vous disposez maintenant d’un fichier nommé `DatabarBarHeight30Pixels.png` qui montre un code‑barres Databar de 30 px de hauteur. Cela illustre la capacité de **taille de code‑barres personnalisée** pour un cas d’usage tel qu’une petite étiquette. + +## Étape 5 : Modifier la hauteur du code‑barres pour une version plus grande + +Si le même code‑barres doit apparaître sur une étiquette plus grande, il suffit de modifier la propriété de hauteur et de réutiliser la même instance du générateur. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Pourquoi vous pouvez réutiliser le générateur :** Modifier `BarHeight.Pixels` met à jour la mise en page interne sans recréer l’objet, ce qui économise de la mémoire et conserve la chaîne de données intacte. C’est la méthode recommandée pour **modifier la hauteur du code‑barres** à la volée. + +## Étape 6 : Vérifier le résultat + +Ouvrez les deux fichiers PNG dans n’importe quel visualiseur d’images. Vous devriez voir deux codes‑barres Databar Omnidirectionnels qui encodent le même GTIN mais diffèrent par leur taille verticale : + +* `DatabarBarHeight30Pixels.png` – 30 px de hauteur, adapté aux reçus compacts. +* `DatabarBarHeight60Pixels.png` – 60 px de hauteur, idéal pour les étiquettes de bord de rayon plus grandes. + +Les deux images conservent la même X‑dimension, de sorte que le rapport barre‑espace reste constant tandis que la hauteur globale s’ajuste. + +## Variations courantes et cas limites + +| Situation | Comment le gérer | +|-----------|------------------| +| **Symbologie de code‑barres différente** | Remplacez `EncodeTypes.DatabarOmniDirectional` par une autre valeur d’énumération (par ex., `EncodeTypes.Code128`). Le reste du code reste inchangé. | +| **Dimensions non exprimées en pixels** | Utilisez `generator.Parameters.Barcode.XDimension.Millimeters` ou `BarHeight.Millimeters` si vous avez besoin de mesures physiques pour une sortie prête à l’impression. | +| **Arrière‑plan transparent** | Définissez `generator.Parameters.ImageBackgroundColor = Color.Transparent;` avant d’appeler `Save`. | +| **Sortie haute résolution** | Augmentez proportionnellement `XDimension.Pixels` et `BarHeight.Pixels`, ou enregistrez en `BarCodeImageFormat.Tiff` pour une qualité sans perte. | +| **Plusieurs codes‑barres dans une même image** | Créez des instances séparées de `BarcodeGenerator`, rendez chacune dans un `Bitmap`, puis composez‑les avec `Graphics.DrawImage`. | + +**Astuce pro :** Testez toujours le code‑barres généré avec un vrai scanner avant de le déployer en production. Les scanners peuvent interpréter différemment des barres très fines selon l’éclairage et la qualité du capteur. + +## Code source complet à titre de référence + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Copiez le code dans un nouveau projet console, exécutez‑le, et vous verrez les deux fichiers PNG apparaître dans le répertoire de sortie. + +## Questions fréquentes + +**Q : Puis‑je générer un code‑barres sans installer de licence ?** +R : La version d’évaluation d’Aspose.BarCode fonctionne sans licence mais ajoute un petit filigrane. Pour une utilisation en production, appliquez une licence achetée avec `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**Q : Le changement de la X‑dimension affecte‑t‑il la lisibilité ?** +R : Oui. Des X‑dimensions très petites peuvent rendre le code‑barres illisible sur des imprimantes basse résolution. Un minimum de 1 px pour le rendu à l’écran est recommandé ; pour l’impression, utilisez au moins 0,25 mm. + +**Q : Et si je dois générer un code‑barres au format JPEG ?** +R : Remplacez `BarCodeImageFormat.Png` par `BarCodeImageFormat.Jpeg`. Vous pouvez également régler `generator.Parameters.ImageQuality` pour contrôler la compression. + +## Conclusion + +Vous savez maintenant comment **générer une image de code‑barres** en C# avec Aspose.BarCode, comment **créer un code‑barres Databar**, ajuster une **taille de code‑barres personnalisée**, et **modifier la hauteur du code‑barres** à la demande. L’exemple complet montre le flux de travail le plus courant, et le tableau des variations vous prépare à gérer les cas réels. + +Ensuite, explorez des sujets connexes tels que **l’insertion de codes‑barres dans des documents PDF**, **la génération en lot de plusieurs codes‑barres**, et **l’utilisation de QR codes pour les paiements mobiles**. Chacun de ces scénarios s’appuie sur les mêmes principes présentés ici, vous permettant d’étendre vos connaissances en toute confiance. + +Bon codage, et que vos codes‑barres soient toujours lisibles ! + +## Que devez‑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 pas à pas pour vous aider à maîtriser des fonctionnalités API supplémentaires et à explorer des approches d’implémentation alternatives dans vos propres projets. + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/french/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..64db337ae --- /dev/null +++ b/barcode/french/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Comment définir les colonnes pour un code‑barres Databar Expanded Stacked + et apprendre à générer des images de code‑barres, définir les lignes et enregistrer + le fichier de code‑barres en C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: fr +lastmod: 2026-08-06 +og_description: Comment définir les colonnes d’un code‑barres Databar Expanded Stacked + et apprendre rapidement à générer des images de code‑barres, définir les lignes + et enregistrer le fichier de code‑barres avec Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Comment définir les colonnes d’un code‑barres Databar Expanded Stacked – + guide C# étape par étape +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Comment définir les colonnes d’un code‑barres Databar Expanded Stacked – guide + complet C# +url: /fr/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Comment définir les colonnes d'un Databar Expanded Stacked barcode – guide complet C# + +Si vous avez besoin de **comment définir les colonnes** pour un Databar Expanded Stacked barcode, ce tutoriel vous montre les étapes exactes. Que vous construisiez un système d'étiquetage pour le commerce de détail ou une application logistique, contrôler les colonnes et les lignes vous permet d'ajuster finement la taille du code‑barres et la fiabilité du scan. De plus, vous verrez **comment générer des codes‑barres** images, ajuster le nombre de lignes, et correctement **enregistrer le fichier du code‑barres** sur le disque. + +Ce guide vous présente : + +* Installation de la bibliothèque Aspose.Barcode pour .NET. +* Création d'un générateur de code‑barres pour le type Databar Expanded Stacked. +* Définition du nombre de colonnes, du nombre de lignes et du format d'image. +* Enregistrement des fichiers PNG résultants dans un répertoire choisi. + +Aucune expérience préalable avec Aspose.Barcode n'est requise — il suffit d'un environnement de développement C# basique. + +## Prérequis + +Avant de commencer, assurez-vous d'avoir : + +* .NET 6.0 SDK ou version ultérieure installé. +* Visual Studio 2022 (ou tout IDE supportant .NET). +* Une référence NuGet à **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Tous les extraits de code se compilent avec le modèle de projet console par défaut. + +## Étape 1 : Créer un générateur de code‑barres pour Databar Expanded Stacked + +La première opération consiste à instancier `BarcodeGenerator` avec l'énumération `EncodeTypes.DatabarExpandedStacked`. Cela définit la disposition par défaut (empilée) et prépare l'objet pour une configuration supplémentaire. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Pourquoi c'est important :** Le générateur contient tous les paramètres de rendu. En choisissant `DatabarExpandedStacked`, vous indiquez à la bibliothèque d'utiliser la disposition empilée, qui est la seule disposition prenant en charge les ajustements de colonnes et de lignes. + +## Comment définir les colonnes d'un Databar Expanded Stacked barcode + +Maintenant que le générateur existe, vous pouvez contrôler le nombre de colonnes. La propriété `DataBar.Columns` accepte un entier compris entre 1 et 4. La définir à **4** crée le code‑barres le plus large possible tout en restant compatible avec la disposition empilée. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Conseil pratique :** Utilisez le nombre maximal de colonnes uniquement lorsque vous disposez de suffisamment d'espace blanc sur l'étiquette. Trop de colonnes sur une petite étiquette peuvent entraîner des problèmes de lecture. + +## Comment générer des images de code‑barres et les enregistrer + +Après avoir configuré les colonnes, vous devez rendre le code‑barres et écrire l'image sur le disque. La méthode `Save` prend un chemin de fichier et une énumération de format d'image. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Le dossier `output` doit exister sinon l'appel lèvera une exception. Vous pouvez le créer programmatique avec `Directory.CreateDirectory("output");` si vous le souhaitez. + +## Comment définir les lignes d'un Databar Expanded Stacked barcode + +Les lignes fonctionnent de façon similaire aux colonnes, mais elles affectent l'empilement vertical des modules du code‑barres. La propriété `DataBar.Rows` accepte des valeurs de 1 à 5. Dans cet exemple, nous utilisons **3** lignes. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Pourquoi les lignes sont importantes :** Ajouter des lignes augmente la hauteur du code‑barres, ce qui peut être utile pour des étiquettes à haute densité où vous avez besoin de plus de modules de données sans élargir le code‑barres. + +## Options d'enregistrement du fichier de code‑barres et bonnes pratiques + +La méthode `Save` prend en charge plusieurs formats d'image (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG est sans perte et fonctionne bien pour la plupart des appareils de lecture. Si vous avez besoin d'une taille de fichier plus petite et pouvez tolérer de légères artefacts de compression, choisissez JPEG : + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Cas particulier :** Lors de l'enregistrement en JPEG, assurez-vous que le paramètre de qualité est correctement défini (la valeur par défaut est 90). Une qualité basse peut flouter les petits modules, rendant le code‑barres illisible. + +## Exemple complet et exécutable + +En rassemblant tous les éléments, voici un fichier unique que vous pouvez copier dans un nouveau projet console et exécuter immédiatement : + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Sortie attendue :** Après l'exécution du programme, le dossier `output` contient trois fichiers : + +* `DatabarCols4.png` – code‑barres avec 4 colonnes (large). +* `DatabarRows3.png` – code‑barres avec 3 lignes (haut). +* `DatabarRows3.jpg` – version JPEG du code‑barres à 3 lignes. + +Ouvrez l'un des fichiers PNG dans un visualiseur d'images ; vous devriez voir un code‑barres Databar Expanded Stacked clair, prêt à être scanné. + +## Questions fréquentes et dépannage + +| Question | Réponse | +|----------|--------| +| *Et si l'image est floue ?* | Vérifiez que vous utilisez le PNG pour une sortie sans perte. Si vous avez besoin du JPEG, augmentez le paramètre de qualité (`new JpegOptions { Quality = 95 }`). | +| *Puis-je changer le texte du code‑barres ?* | Oui — remplacez le deuxième argument dans `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Les colonnes et les lignes fonctionnent-elles ensemble ?* | Elles peuvent être combinées ; il suffit de définir à la fois `DataBar.Columns` et `DataBar.Rows` avant d'appeler `Save`. | +| *Y a-t-il une limite à la profondeur des répertoires ?* | Le chemin doit être valide pour le système d'exploitation. Utilisez `Path.Combine` pour la sécurité multiplateforme. | + +## Conclusion + +Vous savez maintenant **comment définir les colonnes** pour un Databar Expanded Stacked barcode, **comment définir les lignes**, et **comment générer des images de code‑barres** que vous pouvez **enregistrer le fichier du code‑barres** au format PNG ou JPEG. L'exemple complet montre chaque étape requise, de l'installation de la bibliothèque à la vérification finale du fichier. + +Ensuite, envisagez d'explorer : + +* **comment générer des codes‑barres** avec des niveaux de correction d'erreur pour les QR codes. +* **options d'enregistrement du fichier de code‑barres** pour les formats vectoriels comme SVG ou PDF. +* Intégration des codes‑barres générés dans les vues ASP.NET Core MVC pour l'impression dynamique d'étiquettes. + +N'hésitez pas à expérimenter différentes combinaisons de colonnes/lignes, formats d'image et contenus de code‑barres pour correspondre aux spécifications de votre projet. 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 API supplémentaires et explorer des approches d'implémentation alternatives dans vos propres projets. + +- [Comment générer un code‑barres - Types de codes‑barres unidimensionnels](/barcode/english/net/one-dimensional-barcode-types/) +- [Comment générer un code‑barres – Configuration Code 39 avec Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [Comment générer un code‑barres Aztec avec un ratio 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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/german/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..440e2bbe2 --- /dev/null +++ b/barcode/german/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: Erstellen Sie schnell einen gestapelten Databar-Barcode in C#. Lernen + Sie, die X‑Dimension festzulegen, das Seitenverhältnis anzupassen und PNG‑Dateien + mit dem DataBar Stacked Omnidirectional‑Generator zu exportieren. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: de +lastmod: 2026-08-06 +og_description: Erstellen Sie einen gestapelten Databar-Barcode in C# mit Aspose.BarCode. + Dieses Tutorial zeigt, wie Sie die X‑Dimension konfigurieren, das Seitenverhältnis + ändern und PNG‑Bilder speichern. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Gestapelten Databar‑Barcode in C# erstellen – vollständiger Programmierleitfaden +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Databar‑gestapelten Barcode in C# erstellen – Schritt‑für‑Schritt‑Anleitung +url: /de/python-java/general/create-databar-stacked-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‑Stacked‑Barcode in C# – Schritt‑für‑Schritt‑Anleitung + +Wenn Sie **Databar Stacked Barcode**‑Bilder in C# erstellen müssen, zeigt Ihnen dieses Handbuch genau, wie Sie dies mit der Aspose.BarCode‑Bibliothek tun. Sie lernen, die X‑Dimension festzulegen, das Seitenverhältnis des Barcodes zu ändern und das Ergebnis als PNG‑Dateien zu speichern – alles in wenigen prägnanten Schritten. + +Das Erzeugen eines DataBar Stacked Barcodes ist üblich, wenn Sie GS1‑128‑Daten für den Einzelhandels‑Scan oder die Logistikverfolgung codieren müssen. In den folgenden Abschnitten behandeln wir alles von der Projektkonfiguration bis zur Überprüfung der Ausgabe, sodass Sie die Lösung in jede .NET‑Anwendung integrieren können, ohne ein Detail zu verpassen. + +## Voraussetzungen + +* **.NET 6.0** (oder neuer) installiert – der Code richtet sich an das moderne SDK. +* Eine **lizenzierte** Kopie von **Aspose.BarCode for .NET**. Die kostenlose Evaluierung funktioniert zum Testen, fügt jedoch ein Wasserzeichen hinzu. +* Eine IDE wie **Visual Studio 2022** oder **VS Code** mit der C#‑Erweiterung. +* Grundlegende Vertrautheit mit der **C#**‑Syntax und dem Konzept der GS1‑Anwendungskennzeichen. + +> **Profi‑Tipp:** Wenn Sie den NuGet‑Paket‑Manager verwenden, löst der Befehl `dotnet add package Aspose.BarCode` alle Abhängigkeiten automatisch auf. + +## Schritt 1: Neues Konsolenprojekt erstellen + +Öffnen Sie ein Terminal oder die Package Manager Console und führen Sie aus: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +Der Befehl `dotnet new console` erzeugt eine minimale **Program.cs**‑Datei. Das Hinzufügen des **Aspose.BarCode**‑Pakets stellt die Klasse `BarcodeGenerator` bereit. + +## Schritt 2: DataBar Stacked Omnidirectional‑Generator initialisieren + +Öffnen Sie **Program.cs** und ersetzen Sie den Standardinhalt durch den folgenden Code. Die erste Zeile erstellt einen **BarcodeGenerator**, der für die **DataBar Stacked Omnidirectional**‑Symbologie konfiguriert ist und eine GS1‑128‑Payload bereitstellt. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Warum das wichtig ist:** Der Enum‑Wert `EncodeTypes.DatabarStackedOmniDirectional` weist die Bibliothek an, einen **databar stacked barcode** zu erzeugen, der die gestapelte Variante der omnidirektionalen DataBar‑Familie ist. Diese Symbologie kann bis zu 14 numerische Zeichen aufnehmen und ist damit ideal für GTIN‑14‑Codes. + +## Schritt 3: X‑Dimension festlegen (Modulbreite) + +Die X‑Dimension steuert die Breite des kleinsten Balkens (des Moduls). Ein zu kleiner Wert kann auf Niedrigauflösungs‑Druckern schlecht dargestellt werden, während ein zu großer Wert den Etikettenplatz überschreiten kann. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tipp:** Die Eigenschaft `Pixels` ist für bildschirmbasierte Tests praktisch. Für druckorientierte Szenarien verwenden Sie stattdessen `generator.Parameters.Barcode.XDimension.Millimeters`. + +## Schritt 4: Seitenverhältnis anpassen und erstes Bild speichern + +Das **Seitenverhältnis** beeinflusst das Höhen‑zu‑Breiten‑Verhältnis des gestapelten Barcodes. Der Typ DataBar Stacked Omnidirectional unterstützt Verhältnisse von 10 bis 30. Wir erzeugen zwei Bilder, um die visuelle Auswirkung zu veranschaulichen. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +Der Aufruf `generator.Save` schreibt eine **PNG**‑Datei in das aktuelle Arbeitsverzeichnis. Das Enum `BarCodeImageFormat.Png` sorgt für verlustfreie Kompression, was ideal für weitere Verarbeitung oder das Einbetten in PDFs ist. + +## Schritt 5: Seitenverhältnis auf 30 ändern und zweites Bild speichern + +Jetzt erhöhen wir die Höhe der gestapelten Balken, indem wir das Seitenverhältnis auf **30** ändern. Dadurch wird der Barcode höher, ohne die X‑Dimension zu verändern. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Das Ausführen des Programms erzeugt nun zwei PNG‑Dateien: + +* **DatabarAspectRatio15.png** – ein kompakter Barcode, geeignet für kleine Etiketten. +* **DatabarAspectRatio30.png** – ein höherer Barcode, der die Scan‑Zuverlässigkeit auf kontrastarmen Oberflächen verbessert. + +Sie können die Bilder in einem beliebigen Betrachter öffnen, um zu überprüfen, dass die Balken korrekt gestapelt sind und dass die codierten Daten mit dem ursprünglichen GS1‑String übereinstimmen. + +## Schritt 6: Kodierten Wert überprüfen (optional) + +Wenn Sie bestätigen müssen, dass der Barcode tatsächlich die Eingabezeichenfolge darstellt, können Sie ihn mit derselben Bibliothek dekodieren: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Der Decoder sollte `(01)12345678901231` ausgeben, was beweist, dass der **create databar stacked barcode**‑Prozess die Daten erhalten hat. + +## Häufige Fallstricke und wie man sie vermeidet + +| Problem | Warum es passiert | Lösung | +|-------|----------------|-----| +| Barcode erscheint unscharf | X‑Dimension zu niedrig für die Ausgaberesolution eingestellt | Erhöhen Sie `XDimension.Pixels` oder verwenden Sie `Millimeters` für den Druck | +| Scanner meldet „Symbol nicht gefunden“ | Seitenverhältnis außerhalb des unterstützten Bereichs 10‑30 | Halten Sie das Verhältnis zwischen 10 und 30; 15 und 30 sind sichere Vorgaben | +| PNG enthält ein Wasserzeichen | Verwendung der kostenlosen Evaluierungslizenz von Aspose.BarCode | Kaufen Sie eine Volllizenz oder verwenden Sie die Testversion nur zum Testen | +| Dekodierung schlägt beim zweiten Bild fehl | Der Decoder war für die falsche Symbologie konfiguriert | Verwenden Sie `DecodeType.DatabarStackedOmniDirectional` beim Lesen gestapelter Barcodes | + +## Nächste Schritte + +Jetzt, da Sie **create databar stacked barcode**‑Bilder erzeugen können, möchten Sie vielleicht: + +* **Betten Sie die PNGs in PDF‑Rechnungen ein** mithilfe einer PDF‑Bibliothek wie **Aspose.PDF**. +* **Generieren Sie Barcodes on the fly in einer Web‑API** – geben Sie die PNG‑Bytes direkt von einem ASP.NET Core‑Controller zurück. +* **Experimentieren Sie mit anderen DataBar‑Varianten** (z. B. `DatabarExpanded`, `DatabarLimited`), indem Sie das `EncodeTypes`‑Enum ändern. +* **Passen Sie Farben an**, indem Sie `generator.Parameters.Barcode.ForeColor` und `BackColor` für markenspezifische Designs setzen. + +Jedes dieser Themen baut auf denselben Kernkonzepten auf, die hier behandelt wurden: Initialisierung von `BarcodeGenerator`, Konfiguration visueller Parameter und Speichern des Ergebnisses mit `BarCodeImageFormat`. + +--- + +### Fazit + +Dieses Tutorial zeigte, wie man **create databar stacked barcode**‑Bilder in C# mit Aspose.BarCode erstellt. Sie haben gelernt, die **X‑Dimension** festzulegen, das **Barcode‑Seitenverhältnis** zu ändern und das Ergebnis als **PNG**‑Dateien mit `BarcodeGenerator` zu exportieren. Mit dem optionalen Dekodierungsschritt können Sie zudem überprüfen, dass die codierten GS1‑Daten korrekt sind. Wenden Sie diese Muster in Ihren eigenen Bestands‑, Versand‑ oder Point‑of‑Sale‑Anwendungen an und entdecken Sie die zahlreichen Anpassungsoptionen, die die Bibliothek bietet. 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 Codebeispiele mit Schritt‑für‑Schritt‑Erklärungen, um Ihnen zu helfen, zusätzliche API‑Funktionen zu meistern und alternative Implementierungsansätze in Ihren eigenen Projekten zu erkunden. + +- [Ein‑dimensionaler Databar‑Barcode-Höhenanpassung](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Barcode‑Bild erzeugen – GS1‑Coupon‑UPC‑A‑Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/german/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..2bbc8ac34 --- /dev/null +++ b/barcode/german/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: Barcode-Bild in C# mit Aspose.BarCode generieren. Erfahren Sie, wie Sie + Databar erzeugen, die benutzerdefinierte Barcode‑Größe anpassen und die Barcode‑Höhe + mit einfachem Code ändern. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: de +lastmod: 2026-08-06 +og_description: Erzeugen Sie ein Barcode‑Bild in C# mit Aspose.BarCode. Dieses Tutorial + zeigt Ihnen, wie Sie einen Databar‑Omnidirectional‑Barcode erstellen, seine Größe + anpassen und die Barcode‑Höhe effizient ändern. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Barcode-Bild in C# generieren – vollständige Aspose.BarCode-Anleitung +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Barcode-Bild in C# mit Aspose.BarCode generieren +url: /de/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Barcode‑Bild in C# mit Aspose.BarCode erzeugen + +Wenn Sie **Barcode‑Bilder** programmgesteuert **generieren** müssen, zeigt Ihnen dieses Handbuch genau, wie es geht. Egal, ob Sie ein Einzelhandels‑Inventarsystem oder ein Logistik‑Tracking‑Portal bauen – Sie sehen den kompletten Workflow zum Erstellen eines Databar‑Omnidirectional‑Barcodes, zum Anpassen seiner Abmessungen und zum Speichern des Ergebnisses als PNG‑Datei. + +Das Erzeugen eines Barcode‑Bildes ist ein häufiges Anforderungs­szenario, doch Entwickler fragen sich oft **wie man Databar** mit exakt der benötigten Größe erzeugt. In diesem Tutorial lernen Sie, einen Databar‑Barcode zu erstellen, seine Breite und Höhe anzupassen und die Barcode‑Höhe zu ändern, ohne den gesamten Generator neu zu schreiben. + +## Voraussetzungen + +Bevor Sie beginnen, stellen Sie sicher, dass Sie folgendes haben: + +* .NET 6.0 SDK oder neuer (der Code funktioniert mit .NET Core und .NET Framework) +* Visual Studio 2022 (oder jede IDE, die C# unterstützt) +* Eine gültige Aspose.BarCode‑für‑.NET‑Lizenz (die kostenlose Evaluierung funktioniert zum Testen) +* Grundkenntnisse in C#‑Syntax + +## Schritt 1: Aspose.BarCode installieren + +Fügen Sie das Aspose.BarCode‑NuGet‑Paket zu Ihrem Projekt hinzu: + +```bash +dotnet add package Aspose.BarCode +``` + +Das Paket enthält die Klasse `BarcodeGenerator`, die im gesamten Tutorial verwendet wird. Nach der Installation führen Sie eine Wiederherstellung des Projekts durch, um die Abhängigkeiten zu holen. + +## Schritt 2: Einen einfachen Barcode‑Generator erstellen + +Die erste Code‑Zeile erzeugt einen **Barcode‑Generator**, der ein Databar‑Omnidirectional‑Symbol produziert. Der Enum‑Wert `EncodeTypes.DatabarOmniDirectional` teilt der Bibliothek mit, welche Symbolik verwendet werden soll, und die Datenzeichenfolge folgt der GS1‑Application‑Identifier‑Syntax. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Warum das wichtig ist:** Das Objekt `BarcodeGenerator` ist der Einstiegspunkt für jede Barcode‑Operation. Durch die Auswahl von `DatabarOmniDirectional` stellen Sie sicher, dass die Ausgabe dem GS1‑Standard für Einzelhandels‑Scans entspricht. + +## Schritt 3: Eine benutzerdefinierte X‑Dimension (Modulbreite) festlegen + +Die X‑Dimension steuert die Breite des schmalsten Strichs. Wird ein kleiner Pixelwert gesetzt, erhalten Sie einen kompakten Barcode; größere Werte vergrößern die Gesamtabmessung. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Erläuterung:** Eine X‑Dimension von 2 Pixel ist eine gängige Wahl für hochauflösende Bildschirme. Passen Sie diesen Wert an, wenn Sie eine dichtere oder lockerere optische Dichte benötigen. + +## Schritt 4: Das erste Barcode‑Bild mit einer bestimmten Höhe erzeugen + +Die Barcode‑Höhe ist unabhängig von der X‑Dimension. Hier setzen wir die Strich‑Höhe auf **30 px** und speichern das Bild als PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Ergebnis:** Sie erhalten jetzt eine Datei namens `DatabarBarHeight30Pixels.png`, die einen Databar‑Barcode mit 30 px Höhe zeigt. Das demonstriert die **benutzerdefinierte Barcode‑Größe** für Anwendungsfälle wie ein kleines Etikett. + +## Schritt 5: Barcode‑Höhe für eine größere Version ändern + +Muss derselbe Barcode auf einem größeren Etikett erscheinen, ändern Sie einfach die Höhen‑Eigenschaft und verwenden dieselbe Generator‑Instanz erneut. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Warum Sie den Generator wiederverwenden können:** Das Ändern von `BarHeight.Pixels` aktualisiert das interne Layout, ohne das Objekt neu zu erzeugen, was Speicher spart und die Datenzeichenfolge unverändert lässt. Das ist der empfohlene Weg, um **die Barcode‑Höhe** zur Laufzeit zu ändern. + +## Schritt 6: Ausgabe überprüfen + +Öffnen Sie die beiden PNG‑Dateien in einem Bildbetrachter. Sie sollten zwei Databar‑Omnidirectional‑Barcodes sehen, die dieselbe GTIN kodieren, sich jedoch in der vertikalen Größe unterscheiden: + +* `DatabarBarHeight30Pixels.png` – 30 px hoch, geeignet für kompakte Kassenbons. +* `DatabarBarHeight60Pixels.png` – 60 px hoch, ideal für größere Regalkanten‑Etiketten. + +Beide Bilder behalten dieselbe X‑Dimension bei, sodass das Strich‑zu‑Leer‑Verhältnis konsistent bleibt, während die Gesamthöhe skaliert wird. + +## Häufige Varianten und Sonderfälle + +| Situation | Vorgehensweise | +|-----------|----------------| +| **Andere Barcode‑Symbolik** | Ersetzen Sie `EncodeTypes.DatabarOmniDirectional` durch einen anderen Enum‑Wert (z. B. `EncodeTypes.Code128`). Der restliche Code bleibt unverändert. | +| **Nicht‑Pixel‑Abmessungen** | Verwenden Sie `generator.Parameters.Barcode.XDimension.Millimeters` oder `BarHeight.Millimeters`, wenn Sie physische Maße für druckfertige Ausgaben benötigen. | +| **Transparenter Hintergrund** | Setzen Sie `generator.Parameters.ImageBackgroundColor = Color.Transparent;` bevor Sie `Save` aufrufen. | +| **High‑Resolution‑Ausgabe** | Erhöhen Sie sowohl `XDimension.Pixels` als auch `BarHeight.Pixels` proportional oder speichern Sie als `BarCodeImageFormat.Tiff` für verlustfreie Qualität. | +| **Mehrere Barcodes in einem Bild** | Erzeugen Sie separate `BarcodeGenerator`‑Instanzen, rendern Sie jede zu einem `Bitmap` und setzen Sie sie anschließend mit `Graphics.DrawImage` zusammen. | + +**Pro‑Tipp:** Testen Sie den erzeugten Barcode immer mit einem echten Scanner, bevor Sie ihn in die Produktion geben. Scanner können sehr dünne Striche je nach Beleuchtung und Sensorqualität unterschiedlich interpretieren. + +## Vollständiger Quellcode zum Nachschlagen + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Kopieren Sie den Code in ein neues Konsolen‑Projekt, führen Sie ihn aus, und Sie sehen die beiden PNG‑Dateien im Ausgabeverzeichnis erscheinen. + +## Häufig gestellte Fragen + +**F: Kann ich einen Barcode ohne Lizenz erzeugen?** +A: Die Evaluierungs‑Version von Aspose.BarCode funktioniert ohne Lizenz, fügt jedoch ein kleines Wasserzeichen hinzu. Für den Produktionseinsatz verwenden Sie eine gekaufte Lizenz mit `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**F: Beeinflusst das Ändern der X‑Dimension die Lesbarkeit?** +A: Ja. Sehr kleine X‑Dimensionen können den Barcode auf Niedrig‑Auflösungs‑Druckern unlesbar machen. Für die Bildschirmdarstellung wird ein Minimum von 1 px empfohlen; für den Druck mindestens 0,25 mm. + +**F: Was, wenn ich einen Barcode im JPEG‑Format erzeugen muss?** +A: Ersetzen Sie `BarCodeImageFormat.Png` durch `BarCodeImageFormat.Jpeg`. Sie können zudem `generator.Parameters.ImageQuality` setzen, um die Kompression zu steuern. + +## Fazit + +Sie wissen jetzt, wie man **Barcode‑Bilder** in C# mit Aspose.BarCode **generiert**, wie man **Databar‑Barcodes** erstellt, eine **benutzerdefinierte Barcode‑Größe** anpasst und **die Barcode‑Höhe** bei Bedarf ändert. Das vollständige Beispiel demonstriert den gängigsten Workflow, und die Variationstabelle befähigt Sie, reale Sonderfälle zu bewältigen. + +Als Nächstes können Sie verwandte Themen erkunden, etwa **Barcodes in PDF‑Dokumenten einbetten**, **mehrere Barcodes stapelweise erzeugen** und **QR‑Codes für mobile Zahlungen verwenden**. All diese Szenarien bauen auf denselben Prinzipien auf, sodass Sie dieses Wissen sicher erweitern können. + +Viel Spaß beim Coden und möge Ihr Barcode stets fehlerfrei gescannt werden! + +## 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, damit Sie weitere API‑Funktionen meistern und alternative Implementierungs‑Ansätze in Ihren Projekten erkunden können. + +- [Generate barcode image – GS1 Coupon UPC‑A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/german/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..54a6831eb --- /dev/null +++ b/barcode/german/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Wie man Spalten für einen Databar Expanded Stacked‑Barcode festlegt und + lernt, wie man Barcode‑Bilder erzeugt, Zeilen festlegt und die Barcode‑Datei in + C# speichert. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: de +lastmod: 2026-08-06 +og_description: Wie man Spalten für einen Databar Expanded Stacked‑Barcode festlegt + und schnell lernt, wie man Barcode‑Bilder erzeugt, Zeilen festlegt und die Barcode‑Datei + mit Aspose.Barcode speichert. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Wie man Spalten für einen Databar Expanded Stacked Barcode festlegt – Schritt‑für‑Schritt + C#‑Leitfaden +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Wie man Spalten für einen Databar Expanded Stacked Barcode festlegt – vollständige + C#‑Anleitung +url: /de/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Wie man Spalten für einen Databar Expanded Stacked Barcode festlegt – vollständige C#‑Anleitung + +Wenn Sie **wie man Spalten festlegt** für einen Databar Expanded Stacked Barcode benötigen, zeigt Ihnen dieses Tutorial die genauen Schritte. Egal, ob Sie ein Einzelhandelskennzeichnungssystem oder eine Logistikanwendung erstellen, das Steuern von Spalten und Zeilen ermöglicht es Ihnen, die Barcode‑Größe und die Scan‑Zuverlässigkeit fein abzustimmen. Zusätzlich sehen Sie **wie man Barcode generiert** Bilder, die Anzahl der Zeilen anzupassen und **Barcode‑Datei speichern** korrekt auf die Festplatte. + +Dieser Leitfaden führt Sie durch: + +* Installation der Aspose.Barcode für .NET Bibliothek. +* Erstellung eines Barcode‑Generators für den Databar Expanded Stacked Typ. +* Festlegen der Spaltenanzahl, Zeilenanzahl und des Bildformats. +* Speichern der resultierenden PNG‑Dateien in ein ausgewähltes Verzeichnis. + +Vorkenntnisse mit Aspose.Barcode sind nicht erforderlich – nur eine grundlegende C#‑Entwicklungsumgebung. + +## Voraussetzungen + +Bevor Sie beginnen, stellen Sie sicher, dass Sie folgendes haben: + +* .NET 6.0 SDK oder neuer installiert. +* Visual Studio 2022 (oder eine beliebige IDE, die .NET unterstützt). +* Einen NuGet‑Verweis auf **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Alle Code‑Snippets kompilieren mit der Standard‑Konsolen‑Projektvorlage. + +## Schritt 1: Erstellen eines Barcode‑Generators für Databar Expanded Stacked + +Der erste Vorgang besteht darin, `BarcodeGenerator` mit dem Enum `EncodeTypes.DatabarExpandedStacked` zu instanziieren. Dies legt das Standard‑Layout (gestapelt) fest und bereitet das Objekt für weitere Konfigurationen vor. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Warum das wichtig ist:** Der Generator enthält alle Rendering‑Parameter. Durch die Auswahl von `DatabarExpandedStacked` teilen Sie der Bibliothek mit, das gestapelte Layout zu verwenden, das einzige Layout, das Spalten‑ und Zeilenanpassungen unterstützt. + +## Wie man Spalten für einen Databar Expanded Stacked Barcode festlegt + +Jetzt, da der Generator existiert, können Sie die Spaltenanzahl steuern. Die Eigenschaft `DataBar.Columns` akzeptiert eine ganze Zahl zwischen 1 und 4. Das Setzen auf **4** erzeugt den breitesten möglichen Barcode, der dennoch in das gestapelte Layout passt. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Praktischer Hinweis:** Verwenden Sie die maximale Spaltenanzahl nur, wenn Sie genügend Weißraum auf dem Etikett haben. Zu viele Spalten auf einem kleinen Etikett können Scan‑Probleme verursachen. + +## Wie man Barcode‑Bilder generiert und speichert + +Nachdem Sie die Spalten konfiguriert haben, müssen Sie den Barcode rendern und das Bild auf die Festplatte schreiben. Die Methode `Save` erwartet einen Dateipfad und ein Bildformat‑Enum. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Der Ordner `output` muss existieren, sonst wirft der Aufruf eine Ausnahme. Sie können ihn programmgesteuert mit `Directory.CreateDirectory("output");` erstellen, falls gewünscht. + +## Wie man Zeilen für einen Databar Expanded Stacked Barcode festlegt + +Zeilen funktionieren ähnlich wie Spalten, beeinflussen jedoch das vertikale Stapeln der Barcode‑Module. Die Eigenschaft `DataBar.Rows` akzeptiert Werte von 1 bis 5. In diesem Beispiel verwenden wir **3** Zeilen. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Warum Zeilen wichtig sind:** Das Hinzufügen von Zeilen erhöht die Barcode‑Höhe, was bei hochdichten Etiketten nützlich sein kann, wenn Sie mehr Datenmodule benötigen, ohne den Barcode zu verbreitern. + +## Barcode‑Speicheroptionen und bewährte Verfahren + +Die Methode `Save` unterstützt mehrere Bildformate (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG ist verlustfrei und funktioniert gut mit den meisten Scan‑Geräten. Wenn Sie eine kleinere Dateigröße benötigen und leichte Kompressionsartefakte tolerieren können, wählen Sie JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Sonderfall:** Beim Speichern als JPEG stellen Sie sicher, dass der Qualitätsparameter angemessen gesetzt ist (Standard ist 90). Niedrige Qualität kann die kleinen Module verwischen und den Barcode unlesbar machen. + +## Vollständiges, ausführbares Beispiel + +Wenn Sie alles zusammenführen, finden Sie hier eine einzelne Datei, die Sie in ein neues Konsolenprojekt kopieren und sofort ausführen können: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Erwartete Ausgabe:** Nach dem Ausführen des Programms enthält der Ordner `output` drei Dateien: + +* `DatabarCols4.png` – Barcode mit 4 Spalten (breit). +* `DatabarRows3.png` – Barcode mit 3 Zeilen (hoch). +* `DatabarRows3.jpg` – JPEG‑Version des 3‑Zeilen‑Barcodes. + +Öffnen Sie eine der PNG‑Dateien in einem Bildbetrachter; Sie sollten einen klaren Databar Expanded Stacked Barcode sehen, der scanbereit ist. + +## Häufige Fragen und Fehlerbehebung + +| Frage | Antwort | +|----------|--------| +| *Was ist, wenn das Bild unscharf ist?* | Stellen Sie sicher, dass Sie PNG für verlustfreie Ausgabe verwenden. Wenn Sie JPEG benötigen, erhöhen Sie die Qualitätseinstellung (`new JpegOptions { Quality = 95 }`). | +| *Kann ich den Barcode‑Text ändern?* | Ja – ersetzen Sie das zweite Argument in `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Arbeiten Spalten und Zeilen zusammen?* | Sie können sie kombinieren; setzen Sie einfach sowohl `DataBar.Columns` als auch `DataBar.Rows` bevor Sie `Save` aufrufen. | +| *Gibt es ein Limit für die Verzeichnistiefe?* | Der Pfad muss für das Betriebssystem gültig sein. Verwenden Sie `Path.Combine` für plattformübergreifende Sicherheit. | + +## Fazit + +Sie wissen jetzt, **wie man Spalten festlegt** für einen Databar Expanded Stacked Barcode, **wie man Zeilen festlegt** und **wie man Barcode‑Bilder generiert**, die Sie **Barcode‑Datei speichern** können im PNG‑ oder JPEG‑Format. Das vollständige Beispiel demonstriert jeden erforderlichen Schritt, von der Bibliotheksinstallation bis zur abschließenden Dateiverifizierung. + +Als Nächstes sollten Sie Folgendes erkunden: + +* **wie man Barcode generiert** mit Fehlerkorrektur‑Stufen für QR‑Codes. +* **Barcode‑Speicheroptionen** für Vektorformate wie SVG oder PDF. +* Integration der generierten Barcodes in ASP.NET Core MVC‑Views für dynamisches Etikettendrucken. + +Fühlen Sie sich frei, mit verschiedenen Spalten/Zeilen‑Kombinationen, Bildformaten und Barcode‑Inhalten zu experimentieren, um die Spezifikationen Ihres Projekts zu erfüllen. 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 Codebeispiele 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. + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/greek/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..c05a736d7 --- /dev/null +++ b/barcode/greek/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: Δημιουργήστε γρήγορα στοίβαγμα DataBar barcode σε C#. Μάθετε πώς να ορίζετε + τη διάσταση X, να ρυθμίζετε την αναλογία διαστάσεων και να εξάγετε αρχεία PNG χρησιμοποιώντας + τη γεννήτρια DataBar Stacked Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: el +lastmod: 2026-08-06 +og_description: Δημιουργήστε στοιβαγμένο barcode τύπου databar σε C# με το Aspose.BarCode. + Αυτό το σεμινάριο δείχνει πώς να ρυθμίσετε τη διάσταση X, να αλλάξετε την αναλογία + διαστάσεων και να αποθηκεύσετε εικόνες PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Δημιουργία στοιβαγμένου barcode databar σε C# – πλήρης οδηγός προγραμματισμού +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Δημιουργία στοίβακτου barcode Databar σε C# – βήμα‑βήμα οδηγός +url: /el/python-java/general/create-databar-stacked-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 stacked barcode σε C# – οδηγός βήμα‑βήμα + +Αν χρειάζεστε **create databar stacked barcode** εικόνες σε C#, αυτός ο οδηγός σας δείχνει ακριβώς πώς να το κάνετε χρησιμοποιώντας τη βιβλιοθήκη Aspose.BarCode. Θα μάθετε να ορίζετε τη διάσταση X, να αλλάζετε την αναλογία διαστάσεων του barcode και να αποθηκεύετε το αποτέλεσμα ως αρχεία PNG — όλα σε λίγα σύντομα βήματα. + +Η δημιουργία DataBar Stacked barcode είναι συνηθισμένη όταν πρέπει να κωδικοποιήσετε δεδομένα GS1‑128 για σάρωση λιανικής ή παρακολούθηση logistics. Στις επόμενες ενότητες καλύπτουμε τα πάντα, από τη ρύθμιση του έργου μέχρι την επαλήθευση του αποτελέσματος, ώστε να μπορείτε να ενσωματώσετε τη λύση σε οποιαδήποτε εφαρμογή .NET χωρίς να χάσετε λεπτομέρεια. + +## Προαπαιτούμενα + +* **.NET 6.0** (ή νεότερο) εγκατεστημένο – ο κώδικας στοχεύει στο σύγχρονο SDK. +* Μια **licensed** αντίγραφο του **Aspose.BarCode for .NET**. Η δωρεάν αξιολόγηση λειτουργεί για δοκιμές αλλά προσθέτει υδατογράφημα. +* Ένα IDE όπως το **Visual Studio 2022** ή το **VS Code** με την επέκταση C#. +* Βασική εξοικείωση με τη σύνταξη **C#** και την έννοια των GS1 Application Identifiers. + +> **Pro tip:** Αν χρησιμοποιείτε το NuGet package manager, η εντολή `dotnet add package Aspose.BarCode` επιλύει αυτόματα όλες τις εξαρτήσεις. + +## Βήμα 1: Δημιουργία νέου έργου console + +Ανοίξτε ένα τερματικό ή το Package Manager Console και εκτελέστε: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +Η εντολή `dotnet new console` δημιουργεί ένα ελάχιστο αρχείο **Program.cs**. Η προσθήκη του πακέτου **Aspose.BarCode** καθιστά διαθέσιμη την κλάση `BarcodeGenerator`. + +## Βήμα 2: Αρχικοποίηση του γεννήτριας DataBar Stacked Omnidirectional + +Ανοίξτε το **Program.cs** και αντικαταστήστε το προεπιλεγμένο περιεχόμενο με τον παρακάτω κώδικα. Η πρώτη γραμμή δημιουργεί ένα **BarcodeGenerator** ρυθμισμένο για τη συμβολολογία **DataBar Stacked Omnidirectional** και παρέχει ένα φορτίο GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Γιατί είναι σημαντικό:** Η τιμή enum `EncodeTypes.DatabarStackedOmniDirectional` ενημερώνει τη βιβλιοθήκη να παράγει ένα **databar stacked barcode**, που είναι η στοίβαξη παραλλαγή της omnidirectional οικογένειας DataBar. Αυτή η συμβολολογία μπορεί να περιέχει έως 14 αριθμητικούς χαρακτήρες, καθιστώντας την ιδανική για κωδικούς GTIN‑14. + +## Βήμα 3: Ορισμός της διάστασης X (πλάτος μονάδας) + +Η διάσταση X ελέγχει το πλάτος της μικρότερης γραμμής (του μονάδας). Μια τιμή που είναι πολύ μικρή μπορεί να αποτυπώνεται κακά σε εκτυπωτές χαμηλής ανάλυσης, ενώ μια τιμή που είναι πολύ μεγάλη μπορεί να υπερβαίνει το χώρο της ετικέτας. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tip:** Η ιδιότητα `Pixels` είναι βολική για δοκιμές σε οθόνη. Για σενάρια που εστιάζουν στην εκτύπωση, χρησιμοποιήστε το `generator.Parameters.Barcode.XDimension.Millimeters`. + +## Βήμα 4: Προσαρμογή της αναλογίας διαστάσεων και αποθήκευση της πρώτης εικόνας + +Η **aspect ratio** επηρεάζει τη σχέση ύψος‑πλάτος του stacked barcode. Ο τύπος DataBar Stacked Omnidirectional υποστηρίζει αναλογίες από 10 έως 30. Θα δημιουργήσουμε δύο εικόνες για να δείξουμε την οπτική επίδραση. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +Η κλήση στο `generator.Save` γράφει ένα αρχείο **PNG** στον τρέχοντα φάκελο εργασίας. Το enum `BarCodeImageFormat.Png` εξασφαλίζει συμπίεση χωρίς απώλειες, ιδανική για περαιτέρω επεξεργασία ή ενσωμάτωση σε PDF. + +## Βήμα 5: Αλλαγή της αναλογίας διαστάσεων σε 30 και αποθήκευση της δεύτερης εικόνας + +Τώρα αυξάνουμε το ύψος των στοίβακων γραμμών αλλάζοντας την αναλογία διαστάσεων σε **30**. Αυτό κάνει το barcode ψηλότερο χωρίς να αλλάζει τη διάσταση X. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Η εκτέλεση του προγράμματος τώρα παράγει δύο αρχεία PNG: + +* **DatabarAspectRatio15.png** – ένα συμπαγές barcode κατάλληλο για μικρές ετικέτες. +* **DatabarAspectRatio30.png** – ένα ψηλότερο barcode που βελτιώνει την αξιοπιστία σάρωσης σε επιφάνειες χαμηλής αντίθεσης. + +Μπορείτε να ανοίξετε τις εικόνες σε οποιονδήποτε προβολέα για να επαληθεύσετε ότι οι γραμμές είναι σωστά στοίβαγμένες και ότι τα κωδικοποιημένα δεδομένα ταιριάζουν με το αρχικό GS1 string. + +## Βήμα 6: Επαλήθευση της κωδικοποιημένης τιμής (προαιρετικό) + +Αν χρειάζεστε επιβεβαίωση ότι το barcode πραγματικά αντιπροσωπεύει το εισαγόμενο string, μπορείτε να το αποκωδικοποιήσετε με την ίδια βιβλιοθήκη: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Ο αποκωδικοποιητής θα πρέπει να εμφανίσει `(01)12345678901231`, αποδεικνύοντας ότι η διαδικασία **create databar stacked barcode** διατήρησε τα δεδομένα. + +## Συνηθισμένα προβλήματα και πώς να τα αποφύγετε + +| Issue | Why it happens | Fix | +|-------|----------------|-----| +| Το barcode εμφανίζεται θολό | Η διάσταση X ορίστηκε πολύ χαμηλή για την ανάλυση εξόδου | Αυξήστε το `XDimension.Pixels` ή χρησιμοποιήστε `Millimeters` για εκτύπωση | +| Ο scanner αναφέρει “symbol not found” | Η αναλογία διαστάσεων εκτός του υποστηριζόμενου εύρους 10‑30 | Κρατήστε την αναλογία μεταξύ 10 και 30· 15 και 30 είναι ασφαλείς προεπιλογές | +| Το PNG περιέχει υδατογράφημα | Χρήση της δωρεάν άδειας αξιολόγησης του Aspose.BarCode | Αγοράστε πλήρη άδεια ή χρησιμοποιήστε τη δοκιμαστική έκδοση μόνο για δοκιμές | +| Η αποκωδικοποίηση αποτυγχάνει στη δεύτερη εικόνα | Ο αποκωδικοποιητής ρυθμίστηκε για λανθασμένη συμβολολογία | Χρησιμοποιήστε το `DecodeType.DatabarStackedOmniDirectional` όταν διαβάζετε stacked barcodes | + +## Επόμενα βήματα + +Τώρα που μπορείτε να **create databar stacked barcode** εικόνες, ίσως θέλετε να: + +* **Ενσωμάτωση των PNG σε PDF τιμολόγια** χρησιμοποιώντας μια βιβλιοθήκη PDF όπως το **Aspose.PDF**. +* **Δημιουργία barcode σε πραγματικό χρόνο σε web API** – επιστρέψτε τα bytes PNG απευθείας από έναν ελεγκτή ASP.NET Core. +* **Πειραματισμός με άλλες παραλλαγές DataBar** (π.χ., `DatabarExpanded`, `DatabarLimited`) αλλάζοντας το enum `EncodeTypes`. +* **Ρύθμιση χρωμάτων** ορίζοντας `generator.Parameters.Barcode.ForeColor` και `BackColor` για σχεδιασμούς ειδικούς για το brand. + +Κάθε ένα από αυτά τα θέματα βασίζεται στις ίδιες βασικές έννοιες που καλύφθηκαν εδώ: η αρχικοποίηση του `BarcodeGenerator`, η ρύθμιση των οπτικών παραμέτρων και η αποθήκευση του αποτελέσματος με `BarCodeImageFormat`. + +--- + +### Συμπέρασμα + +Αυτό το tutorial έδειξε πώς να **create databar stacked barcode** εικόνες σε C# χρησιμοποιώντας το Aspose.BarCode. Μάθατε να ορίζετε τη **διάσταση X**, να τροποποιείτε την **αναλογία διαστάσεων του barcode** και να εξάγετε το αποτέλεσμα ως αρχεία **PNG** με το `BarcodeGenerator`. Με το προαιρετικό βήμα αποκωδικοποίησης, μπορείτε επίσης να επαληθεύσετε ότι τα κωδικοποιημένα δεδομένα GS1 είναι ακριβή. Εφαρμόστε αυτά τα μοτίβα στη δική σας απογραφή, αποστολή ή εφαρμογές σημείου πώλησης, και εξερευνήστε τις πολλές επιλογές προσαρμογής που προσφέρει η βιβλιοθήκη. Καλή προγραμματιστική! + +## Τι πρέπει να μάθετε στη συνέχεια; + +Τα παρακάτω tutorials καλύπτουν στενά συναφή θέματα που βασίζονται στις τεχνικές που παρουσιάστηκαν σε αυτόν τον οδηγό. Κάθε πόρος περιλαμβάνει πλήρη παραδείγματα κώδικα με βήμα‑βήμα εξηγήσεις για να σας βοηθήσει να κατακτήσετε πρόσθετες δυνατότητες API και να εξερευνήσετε εναλλακτικές προσεγγίσεις υλοποίησης στα δικά σας έργα. + +- [Ρύθμιση ύψους One-Dimensional Databar Barcode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Δημιουργία εικόνας barcode – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/greek/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..edaaecccd --- /dev/null +++ b/barcode/greek/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-06 +description: Δημιουργήστε εικόνα barcode σε C# χρησιμοποιώντας το Aspose.BarCode. + Μάθετε πώς να δημιουργείτε Databar, να προσαρμόζετε το προσαρμοσμένο μέγεθος του + barcode και να αλλάζετε το ύψος του barcode με απλό κώδικα. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: el +lastmod: 2026-08-06 +og_description: Δημιουργήστε εικόνα barcode σε C# με το Aspose.BarCode. Αυτό το σεμινάριο + σας δείχνει πώς να δημιουργήσετε ένα barcode Databar Omnidirectional, να προσαρμόσετε + το μέγεθός του και να αλλάξετε το ύψος του barcode αποδοτικά. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Δημιουργία εικόνας barcode σε C# – πλήρης οδηγός Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Δημιουργία εικόνας barcode σε C# με το Aspose.BarCode +url: /el/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Δημιουργία εικόνας barcode σε C# με Aspose.BarCode + +Αν χρειάζεστε **δημιουργία εικόνας barcode** προγραμματιστικά, αυτός ο οδηγός σας δείχνει ακριβώς πώς. Είτε δημιουργείτε σύστημα αποθεμάτων λιανικής είτε portal παρακολούθησης logistics, θα δείτε τη πλήρη ροή εργασίας για τη δημιουργία ενός Databar Omnidirectional barcode, τη ρύθμιση των διαστάσεών του και την αποθήκευση του αποτελέσματος ως αρχείο PNG. + +Η δημιουργία εικόνας barcode είναι μια συνηθισμένη απαίτηση, αλλά οι προγραμματιστές συχνά αναρωτιούνται **πώς να δημιουργήσουν Databar** με το ακριβές μέγεθος που χρειάζονται. Σε αυτό το tutorial θα μάθετε να δημιουργείτε ένα Databar barcode, να προσαρμόζετε το πλάτος και το ύψος του, και να αλλάζετε το ύψος του barcode χωρίς να ξαναγράψετε ολόκληρο τον γεννήτρια. + +## Προαπαιτούμενα + +* .NET 6.0 SDK ή νεότερο (ο κώδικας λειτουργεί με .NET Core και .NET Framework) +* Visual Studio 2022 (ή οποιοδήποτε IDE που υποστηρίζει C#) +* Ένα έγκυρο license Aspose.BarCode for .NET (η δωρεάν έκδοση evaluation λειτουργεί για δοκιμές) +* Βασική εξοικείωση με τη σύνταξη C# + +## Βήμα 1: Εγκατάσταση Aspose.BarCode + +Προσθέστε το πακέτο NuGet Aspose.BarCode στο έργο σας: + +```bash +dotnet add package Aspose.BarCode +``` + +Το πακέτο περιέχει την κλάση `BarcodeGenerator` που χρησιμοποιείται σε όλο το tutorial. Μετά την εγκατάσταση, επαναφέρετε το έργο για να ληφθούν οι εξαρτήσεις. + +## Βήμα 2: Δημιουργία βασικού barcode generator + +Η πρώτη γραμμή κώδικα δημιουργεί έναν **barcode generator** που θα παράγει ένα σύμβολο Databar Omnidirectional. Το enum `EncodeTypes.DatabarOmniDirectional` ενημερώνει τη βιβλιοθήκη ποια συμβολική γραμματοσειρά να χρησιμοποιήσει, και η συμβολοσειρά δεδομένων ακολουθεί τη σύνταξη του GS1 Application Identifier. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Γιατί είναι σημαντικό:** Το αντικείμενο `BarcodeGenerator` είναι το σημείο εισόδου για κάθε λειτουργία barcode. Επιλέγοντας `DatabarOmniDirectional` εξασφαλίζετε ότι το αποτέλεσμα συμμορφώνεται με το πρότυπο GS1 για σάρωση λιανικής. + +## Βήμα 3: Ορισμός προσαρμοσμένης X‑διάστασης (πλάτος μονάδας) + +Η X‑διάσταση ελέγχει το πλάτος της πιο στενής γραμμής. Ορίζοντας μια μικρή τιμή pixel λαμβάνετε ένα συμπαγές barcode, ενώ μεγαλύτερες τιμές αυξάνουν το συνολικό πλάτος. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Εξήγηση:** Μια X‑διάσταση 2 pixel είναι μια κοινή επιλογή για οθόνες υψηλής ανάλυσης. Προσαρμόστε αυτή την τιμή αν χρειάζεστε πιο πυκνή ή πιο αραιή οπτική πυκνότητα. + +## Βήμα 4: Δημιουργία της πρώτης εικόνας barcode με συγκεκριμένο ύψος + +Το ύψος του barcode είναι ανεξάρτητο από την X‑διάσταση. Εδώ ορίζουμε το ύψος της γραμμής σε **30 px**, και στη συνέχεια αποθηκεύουμε την εικόνα ως PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Αποτέλεσμα:** Τώρα έχετε ένα αρχείο με όνομα `DatabarBarHeight30Pixels.png` που εμφανίζει ένα Databar barcode ύψους 30 px. Αυτό δείχνει τη δυνατότητα **προσαρμοσμένου μεγέθους barcode** για μια συγκεκριμένη περίπτωση χρήσης όπως μια μικρή ετικέτα. + +## Βήμα 5: Αλλαγή ύψους barcode για μεγαλύτερη έκδοση + +Αν το ίδιο barcode πρέπει να εμφανιστεί σε μεγαλύτερη ετικέτα, χρειάζεται μόνο να τροποποιήσετε την ιδιότητα ύψους και να επαναχρησιμοποιήσετε την ίδια παρουσία του generator. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Γιατί μπορείτε να επαναχρησιμοποιήσετε το generator:** Η αλλαγή του `BarHeight.Pixels` ενημερώνει τη εσωτερική διάταξη χωρίς να δημιουργήσετε ξανά το αντικείμενο, εξοικονομώντας μνήμη και διατηρώντας αμετάβλητη τη συμβολοσειρά δεδομένων. Αυτή είναι η προτεινόμενη μέθοδος για **αλλαγή ύψους barcode** σε πραγματικό χρόνο. + +## Βήμα 6: Επαλήθευση του αποτελέσματος + +Ανοίξτε τα δύο αρχεία PNG σε οποιονδήποτε προβολέα εικόνων. Θα πρέπει να δείτε δύο Databar Omnidirectional barcodes που κωδικοποιούν το ίδιο GTIN αλλά διαφέρουν στο κατακόρυφο μέγεθος: + +* `DatabarBarHeight30Pixels.png` – 30 px ύψος, κατάλληλο για συμπαγείς αποδείξεις. +* `DatabarBarHeight60Pixels.png` – 60 px ύψος, ιδανικό για μεγαλύτερες ετικέτες άκρου ραφής. + +Και οι δύο εικόνες διατηρούν την ίδια X‑διάσταση, έτσι ο λόγος μπάρας‑σε‑χώρο παραμένει συνεπής ενώ το συνολικό ύψος κλιμακώνεται. + +## Κοινές παραλλαγές και ειδικές περιπτώσεις + +| Κατάσταση | Πώς να το αντιμετωπίσετε | +|-----------|--------------------------| +| **Διαφορετική συμβολική γραμματοσειρά barcode** | Αντικαταστήστε το `EncodeTypes.DatabarOmniDirectional` με άλλη τιμή enum (π.χ., `EncodeTypes.Code128`). Το υπόλοιπο του κώδικα παραμένει αμετάβλητο. | +| **Διαστάσεις μη‑pixel** | Χρησιμοποιήστε `generator.Parameters.Barcode.XDimension.Millimeters` ή `BarHeight.Millimeters` εάν χρειάζεστε φυσικές μετρήσεις για έξοδο έτοιμο για εκτύπωση. | +| **Διαφανές φόντο** | Ορίστε `generator.Parameters.ImageBackgroundColor = Color.Transparent;` πριν καλέσετε το `Save`. | +| **Έξοδος υψηλής ανάλυσης** | Αυξήστε και τις `XDimension.Pixels` και `BarHeight.Pixels` αναλογικά, ή αποθηκεύστε ως `BarCodeImageFormat.Tiff` για απώλεια‑από‑ποιότητας. | +| **Πολλαπλά barcodes σε μία εικόνα** | Δημιουργήστε ξεχωριστές εμφανίσεις `BarcodeGenerator`, αποδώστε καθεμία σε ένα `Bitmap`, και στη συνέχεια συνθέστε τις χρησιμοποιώντας `Graphics.DrawImage`. | + +**Συμβουλή επαγγελματία:** Πάντα δοκιμάζετε το παραγόμενο barcode με πραγματικό σαρωτή πριν το αναπτύξετε στην παραγωγή. Οι σαρωτές μπορεί να ερμηνεύσουν πολύ λεπτές γραμμές διαφορετικά ανάλογα με το φωτισμό και την ποιότητα του αισθητήρα. + +## Πλήρης κώδικας πηγής για αναφορά + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Αντιγράψτε τον κώδικα σε ένα νέο έργο console, εκτελέστε το, και θα δείτε τα δύο αρχεία PNG να εμφανίζονται στο φάκελο εξόδου. + +## Συχνές ερωτήσεις + +**Q: Μπορώ να δημιουργήσω barcode χωρίς εγκατάσταση license;** +A: Η έκδοση evaluation του Aspose.BarCode λειτουργεί χωρίς license αλλά προσθέτει μικρό υδατογράφημα. Για χρήση στην παραγωγή, εφαρμόστε μια αγορασμένη άδεια χρησιμοποιώντας `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**Q: Επηρεάζει η αλλαγή της X‑διάστασης την αναγνωσιμότητα;** +A: Ναι. Πολύ μικρές X‑διαστάσεις μπορούν να κάνουν το barcode μη αναγνώσιμο σε εκτυπωτές χαμηλής ανάλυσης. Συνιστάται ελάχιστο 1 px για απόδοση στην οθόνη· για εκτύπωση, χρησιμοποιήστε τουλάχιστον 0,25 mm. + +**Q: Τι γίνεται αν χρειαστεί να δημιουργήσω barcode σε μορφή JPEG;** +A: Αντικαταστήστε το `BarCodeImageFormat.Png` με `BarCodeImageFormat.Jpeg`. Μπορείτε επίσης να ορίσετε `generator.Parameters.ImageQuality` για να ελέγξετε τη συμπίεση. + +## Συμπέρασμα + +Τώρα γνωρίζετε πώς να **δημιουργήσετε εικόνα barcode** σε C# χρησιμοποιώντας Aspose.BarCode, πώς να **δημιουργήσετε Databar barcode**, να προσαρμόσετε ένα **προσαρμοσμένο μέγεθος barcode**, και να **αλλάξετε το ύψος barcode** κατά απαίτηση. Το πλήρες παράδειγμα δείχνει τη πιο κοινή ροή εργασίας, και ο πίνακας παραλλαγών σας εξοπλίζει για την αντιμετώπιση πραγματικών ειδικών περιπτώσεων. + +Στη συνέχεια, εξερευνήστε συναφή θέματα όπως **ενσωμάτωση barcodes σε έγγραφα PDF**, **μαζική δημιουργία πολλαπλών barcodes**, και **χρήση QR codes για κινητές πληρωμές**. Κάθε ένα από αυτά τα σενάρια βασίζεται στις ίδιες αρχές που καλύφθηκαν εδώ, ώστε να μπορείτε να επεκτείνετε αυτή τη γνώση με σιγουριά. + +Καλή προγραμματιστική δουλειά, και εύχομαι τα barcodes σας να σαρώνουν άψογα! + +## Τι Θα Πρέπει Να Μάθετε Στη Σειρά; + +Τα παρακάτω tutorials καλύπτουν στενά σχετιζόμενα θέματα που βασίζονται στις τεχνικές που παρουσιάστηκαν σε αυτόν τον οδηγό. Κάθε πόρος περιλαμβάνει πλήρη λειτουργικά παραδείγματα κώδικα με βήμα‑βήμα εξηγήσεις για να σας βοηθήσουν να κατακτήσετε πρόσθετες δυνατότητες API και να εξερευνήσετε εναλλακτικές προσεγγίσεις υλοποίησης στα δικά σας έργα. + +- [Δημιουργία εικόνας barcode – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [Πώς να δημιουργήσετε Aztec barcode με προσαρμοσμένη αναλογία διαστάσεων χρησιμοποιώντας Aspose.BarCode για .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Πώς να δημιουργήσετε Barcode – Ρύθμιση Code 39 με Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/greek/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..85f0ed105 --- /dev/null +++ b/barcode/greek/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Πώς να ορίσετε στήλες για ένα barcode Databar Expanded Stacked και να + μάθετε πώς να δημιουργείτε εικόνες barcode, να ορίζετε σειρές και να αποθηκεύετε + το αρχείο barcode σε C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: el +lastmod: 2026-08-06 +og_description: Πώς να ορίσετε στήλες για ένα barcode Databar Expanded Stacked και + να μάθετε γρήγορα πώς να δημιουργείτε εικόνες barcode, να ορίζετε σειρές και να + αποθηκεύετε το αρχείο barcode με το Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Πώς να ορίσετε στήλες για έναν κωδικό Databar Expanded Stacked – βήμα‑βήμα + οδηγός C# +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Πώς να ορίσετε στήλες για ένα barcode Databar Expanded Stacked – πλήρης οδηγός + C# +url: /el/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Πώς να ορίσετε στήλες για ένα Databar Expanded Stacked barcode – πλήρης οδηγός C# + +Αν χρειάζεστε **πώς να ορίσετε στήλες** για ένα Databar Expanded Stacked barcode, αυτό το tutorial σας δείχνει τα ακριβή βήματα. Είτε δημιουργείτε σύστημα ετικετών λιανικής είτε εφαρμογή logistics, ο έλεγχος των στηλών και των γραμμών σας επιτρέπει να ρυθμίσετε το μέγεθος του barcode και την αξιοπιστία σάρωσης. Επιπλέον, θα δείτε **πώς να δημιουργήσετε εικόνες barcode**, πώς να προσαρμόσετε τον αριθμό των γραμμών και πώς να **αποθηκεύσετε το barcode σε αρχείο** στο δίσκο. + +Αυτός ο οδηγός καλύπτει: + +* Εγκατάσταση της βιβλιοθήκης Aspose.Barcode for .NET. +* Δημιουργία ενός barcode generator για τον τύπο Databar Expanded Stacked. +* Ορισμός του αριθμού στηλών, γραμμών και μορφής εικόνας. +* Αποθήκευση των παραγόμενων αρχείων PNG σε επιλεγμένο φάκελο. + +Δεν απαιτείται προηγούμενη εμπειρία με το Aspose.Barcode—απλώς ένα βασικό περιβάλλον ανάπτυξης C#. + +## Προαπαιτούμενα + +Πριν ξεκινήσετε, βεβαιωθείτε ότι έχετε: + +* .NET 6.0 SDK ή νεότερη έκδοση εγκατεστημένη. +* Visual Studio 2022 (ή οποιοδήποτε IDE που υποστηρίζει .NET). +* Αναφορά NuGet στο **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Όλα τα αποσπάσματα κώδικα μεταγλωττίζονται με το προεπιλεγμένο πρότυπο έργου console. + +## Βήμα 1: Δημιουργία barcode generator για Databar Expanded Stacked + +Η πρώτη ενέργεια είναι η δημιουργία ενός αντικειμένου `BarcodeGenerator` με την τιμή `EncodeTypes.DatabarExpandedStacked` του enum. Αυτό ορίζει τη προεπιλεγμένη διάταξη (stacked) και προετοιμάζει το αντικείμενο για περαιτέρω ρυθμίσεις. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Γιατί είναι σημαντικό:** Ο generator κρατά όλες τις παραμέτρους απόδοσης. Επιλέγοντας `DatabarExpandedStacked` λέτε στη βιβλιοθήκη να χρησιμοποιήσει τη στοίβαξη, η οποία είναι η μοναδική διάταξη που υποστηρίζει ρυθμίσεις στηλών και γραμμών. + +## Πώς να ορίσετε στήλες για ένα Databar Expanded Stacked barcode + +Τώρα που υπάρχει ο generator, μπορείτε να ελέγξετε τον αριθμό των στηλών. Η ιδιότητα `DataBar.Columns` δέχεται έναν ακέραιο μεταξύ 1 και 4. Ορίζοντάς την σε **4** δημιουργείται το πιο πλατύ δυνατό barcode, διατηρώντας τη στοίβαξη. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Πρακτική συμβουλή:** Χρησιμοποιείτε τον μέγιστο αριθμό στηλών μόνο όταν έχετε αρκετό λευκό χώρο στην ετικέτα. Πάρα πολλές στήλες σε μικρή ετικέτα μπορούν να προκαλέσουν προβλήματα σάρωσης. + +## Πώς να δημιουργήσετε εικόνες barcode και να τις αποθηκεύσετε + +Αφού ρυθμίσετε τις στήλες, πρέπει να αποδώσετε το barcode και να γράψετε την εικόνα στο δίσκο. Η μέθοδος `Save` δέχεται διαδρομή αρχείου και enum μορφής εικόνας. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Ο φάκελος `output` πρέπει να υπάρχει, αλλιώς η κλήση θα πετάξει εξαίρεση. Μπορείτε να τον δημιουργήσετε προγραμματιστικά με `Directory.CreateDirectory("output");` αν προτιμάτε. + +## Πώς να ορίσετε γραμμές για ένα Databar Expanded Stacked barcode + +Οι γραμμές λειτουργούν παρόμοια με τις στήλες, αλλά επηρεάζουν την κατακόρυφη στοίβαξη των μονάδων του barcode. Η ιδιότητα `DataBar.Rows` δέχεται τιμές από 1 έως 5. Σε αυτό το παράδειγμα χρησιμοποιούμε **3** γραμμές. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Γιατί οι γραμμές έχουν σημασία:** Η προσθήκη γραμμών αυξάνει το ύψος του barcode, κάτι χρήσιμο για ετικέτες υψηλής πυκνότητας όπου χρειάζεστε περισσότερες μονάδες δεδομένων χωρίς να διευρύνετε το barcode. + +## Επιλογές αποθήκευσης αρχείου barcode και βέλτιστες πρακτικές + +Η μέθοδος `Save` υποστηρίζει πολλές μορφές εικόνας (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). Το PNG είναι lossless και λειτουργεί καλά για τις περισσότερες συσκευές σάρωσης. Αν χρειάζεστε μικρότερο μέγεθος αρχείου και μπορείτε να ανεχθείτε ελαφρά συμπίεση, επιλέξτε JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Ακραία περίπτωση:** Κατά την αποθήκευση σε JPEG, βεβαιωθείτε ότι η παράμετρος ποιότητας είναι σωστή (η προεπιλογή είναι 90). Χαμηλή ποιότητα μπορεί να θολώσει τις μικρές μονάδες, καθιστώντας το barcode μη αναγνώσιμο. + +## Πλήρες, εκτελέσιμο παράδειγμα + +Συνδυάζοντας όλα τα παραπάνω, ακολουθεί ένα μοναδικό αρχείο που μπορείτε να αντιγράψετε σε ένα νέο έργο console και να τρέξετε αμέσως: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Αναμενόμενο αποτέλεσμα:** Μετά την εκτέλεση του προγράμματος, ο φάκελος `output` περιέχει τρία αρχεία: + +* `DatabarCols4.png` – barcode με 4 στήλες (πλατύ). +* `DatabarRows3.png` – barcode με 3 γραμμές (ψηλό). +* `DatabarRows3.jpg` – έκδοση JPEG του barcode με 3 γραμμές. + +Ανοίξτε οποιοδήποτε από τα PNG αρχεία σε προβολή εικόνας· θα πρέπει να δείτε ένα καθαρό Databar Expanded Stacked barcode έτοιμο για σάρωση. + +## Συχνές ερωτήσεις και αντιμετώπιση προβλημάτων + +| Ερώτηση | Απάντηση | +|----------|--------| +| *Τι γίνεται αν η εικόνα είναι θολή;* | Επαληθεύστε ότι χρησιμοποιείτε PNG για lossless έξοδο. Αν χρειάζεστε JPEG, αυξήστε τη ρύθμιση ποιότητας (`new JpegOptions { Quality = 95 }`). | +| *Μπορώ να αλλάξω το κείμενο του barcode;* | Ναι—αντικαταστήστε το δεύτερο όρισμα στο `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Λειτουργούν οι στήλες και οι γραμμές μαζί;* | Μπορούν να συνδυαστούν· απλώς ορίστε και τις δύο `DataBar.Columns` και `DataBar.Rows` πριν καλέσετε το `Save`. | +| *Υπάρχει όριο στο βάθος του καταλόγου;* | Η διαδρομή πρέπει να είναι έγκυρη για το λειτουργικό σύστημα. Χρησιμοποιήστε `Path.Combine` για διασφάλιση διαπλατφορμικής ασφάλειας. | + +## Συμπέρασμα + +Τώρα γνωρίζετε **πώς να ορίσετε στήλες** για ένα Databar Expanded Stacked barcode, **πώς να ορίσετε γραμμές**, και **πώς να δημιουργήσετε εικόνες barcode** που μπορείτε να **αποθηκεύσετε το barcode σε αρχείο** σε μορφή PNG ή JPEG. Το πλήρες παράδειγμα δείχνει κάθε απαιτούμενο βήμα, από την εγκατάσταση της βιβλιοθήκης μέχρι την τελική επαλήθευση του αρχείου. + +Στη συνέχεια, εξετάστε: + +* **πώς να δημιουργήσετε barcode** με επίπεδα διόρθωσης σφαλμάτων για QR codes. +* **επιλογές αποθήκευσης barcode** για διανυσματικές μορφές όπως SVG ή PDF. +* Ενσωμάτωση των παραγόμενων barcode σε προβολές ASP.NET Core MVC για δυναμική εκτύπωση ετικετών. + +Πειραματιστείτε με διαφορετικούς συνδυασμούς στήλης/γραμμής, μορφές εικόνας και περιεχόμενα barcode ώστε να ταιριάζουν στις προδιαγραφές του έργου σας. Καλή προγραμματιστική δουλειά! + +## Τι πρέπει να μάθετε στη συνέχεια; + +Τα παρακάτω tutorials καλύπτουν στενά συναφή θέματα που επεκτείνουν τις τεχνικές που παρουσιάστηκαν σε αυτόν τον οδηγό. Κάθε πόρος περιλαμβάνει πλήρη λειτουργικά παραδείγματα κώδικα με βήμα‑βήμα εξηγήσεις για να σας βοηθήσει να κυριαρχήσετε επιπλέον δυνατότητες του API και να εξερευνήσετε εναλλακτικές προσεγγίσεις υλοποίησης στα δικά σας έργα. + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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/hindi/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/hindi/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..6f187cbef --- /dev/null +++ b/barcode/hindi/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,194 @@ +--- +category: general +date: 2026-08-06 +description: C# में जल्दी से डेटाबार स्टैक्ड बारकोड बनाएं। X डाइमेंशन सेट करना, एस्पेक्ट + रेशियो समायोजित करना, और DataBar Stacked Omnidirectional जेनरेटर का उपयोग करके PNG + फ़ाइलें निर्यात करना सीखें। +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: hi +lastmod: 2026-08-06 +og_description: Aspose.BarCode के साथ C# में डेटाबार स्टैक्ड बारकोड बनाएं। यह ट्यूटोरियल + दिखाता है कि X डाइमेंशन कैसे कॉन्फ़िगर करें, एस्पेक्ट रेशियो बदलें, और PNG इमेजेज़ + को सहेजें। +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: C# में डेटाबार स्टैक्ड बारकोड बनाएं – पूर्ण प्रोग्रामिंग गाइड +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: C# में डेटाबार स्टैक्ड बारकोड बनाएं – चरण‑दर‑चरण मार्गदर्शिका +url: /hi/python-java/general/create-databar-stacked-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# में डेटाबार स्टैक्ड बारकोड बनाएं – चरण‑दर‑चरण गाइड + +यदि आपको **डेटाबार स्टैक्ड बारकोड** छवियां C# में बनानी हैं, तो यह गाइड Aspose.BarCode लाइब्रेरी का उपयोग करके इसे ठीक‑ठीक कैसे करें, दिखाता है। आप X डाइमेंशन सेट करना, बारकोड का एस्पेक्ट रेशियो बदलना, और परिणाम को PNG फ़ाइलों के रूप में सहेजना सीखेंगे—सभी कुछ संक्षिप्त चरणों में। + +डेटाबार स्टैक्ड बारकोड बनाना आम है जब आपको रिटेल स्कैनिंग या लॉजिस्टिक्स ट्रैकिंग के लिए GS1‑128 डेटा एन्कोड करना हो। आगे के सेक्शन में हम प्रोजेक्ट सेटअप से लेकर आउटपुट वेरिफिकेशन तक सब कुछ कवर करेंगे, ताकि आप इस समाधान को किसी भी .NET एप्लिकेशन में बिना किसी विवरण को छोड़े इंटीग्रेट कर सकें। + +## Prerequisites + +शुरू करने से पहले सुनिश्चित करें कि आपके पास है: + +* **.NET 6.0** (या बाद का) स्थापित हो – कोड आधुनिक SDK को लक्षित करता है। +* **Aspose.BarCode for .NET** की **लाइसेंस्ड** कॉपी। फ्री इवैल्यूएशन परीक्षण के लिए काम करता है लेकिन वॉटरमार्क जोड़ता है। +* **Visual Studio 2022** या **VS Code** जैसी IDE, जिसमें C# एक्सटेंशन हो। +* **C#** सिंटैक्स और GS1 एप्लिकेशन आइडेंटिफ़ायर्स की मूल समझ। + +> **Pro tip:** यदि आप NuGet पैकेज मैनेजर का उपयोग करते हैं, तो `dotnet add package Aspose.BarCode` कमांड सभी डिपेंडेंसीज़ को स्वचालित रूप से हल कर देता है। + +## Step 1: Create a new console project + +एक टर्मिनल या पैकेज मैनेजर कंसोल खोलें और चलाएँ: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +`dotnet new console` कमांड एक न्यूनतम **Program.cs** फ़ाइल बनाता है। **Aspose.BarCode** पैकेज जोड़ने से `BarcodeGenerator` क्लास उपलब्ध हो जाता है। + +## Step 2: Initialize the DataBar Stacked Omnidirectional generator + +**Program.cs** खोलें और डिफ़ॉल्ट कंटेंट को नीचे दिए गए कोड से बदल दें। पहली लाइन **DataBar Stacked Omnidirectional** सिम्बोलॉजी के लिए कॉन्फ़िगर किया गया **BarcodeGenerator** बनाती है और एक GS1‑128 पेलोड प्रदान करती है। + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Why this matters:** `EncodeTypes.DatabarStackedOmniDirectional` एन्नम वैल्यू लाइब्रेरी को **डेटाबार स्टैक्ड बारकोड** उत्पन्न करने के लिए बताती है, जो ओम्निडायरेक्शनल DataBar परिवार का स्टैक्ड वेरिएंट है। यह सिम्बोलॉजी अधिकतम 14 संख्यात्मक अक्षर रख सकती है, जिससे यह GTIN‑14 कोड्स के लिए आदर्श है। + +## Step 3: Set the X dimension (module width) + +X डाइमेंशन सबसे छोटे बार (मॉड्यूल) की चौड़ाई को नियंत्रित करता है। बहुत छोटा मान लो‑रिज़ॉल्यूशन प्रिंटरों पर खराब रेंडर हो सकता है, जबकि बहुत बड़ा मान लेबल की जगह से बाहर हो सकता है। + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tip:** `Pixels` प्रॉपर्टी स्क्रीन‑आधारित टेस्टिंग के लिए सुविधाजनक है। प्रिंट‑फ़ोकस्ड परिदृश्यों में `generator.Parameters.Barcode.XDimension.Millimeters` का उपयोग करें। + +## Step 4: Adjust the aspect ratio and save the first image + +**aspect ratio** स्टैक्ड बारकोड की ऊँचाई‑से‑चौड़ाई संबंध को प्रभावित करता है। DataBar Stacked Omnidirectional प्रकार 10 से 30 तक के रेशियो को सपोर्ट करता है। हम दो छवियां जनरेट करेंगे ताकि विज़ुअल इम्पैक्ट दिखाया जा सके। + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +`generator.Save` कॉल वर्तमान कार्य निर्देशिका में एक **PNG** फ़ाइल लिखता है। `BarCodeImageFormat.Png` एन्नम लॉसलेस कॉम्प्रेशन सुनिश्चित करता है, जो आगे की प्रोसेसिंग या PDFs में एम्बेड करने के लिए आदर्श है। + +## Step 5: Change the aspect ratio to 30 and save the second image + +अब हम एस्पेक्ट रेशियो को **30** कर के स्टैक्ड बार्स की ऊँचाई बढ़ाते हैं। इससे X डाइमेंशन बदले बिना बारकोड लंबा हो जाता है। + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +प्रोग्राम चलाने पर अब दो PNG फ़ाइलें बनेंगी: + +* **DatabarAspectRatio15.png** – छोटे लेबलों के लिए उपयुक्त एक कॉम्पैक्ट बारकोड। +* **DatabarAspectRatio30.png** – एक ऊँचा बारकोड जो कम‑कॉन्ट्रास्ट सतहों पर स्कैन विश्वसनीयता बढ़ाता है। + +आप किसी भी व्यूअर में छवियां खोलकर यह सत्यापित कर सकते हैं कि बार सही ढंग से स्टैक्ड हैं और एन्कोडेड डेटा मूल GS1 स्ट्रिंग से मेल खाता है। + +## Step 6: Verify the encoded value (optional) + +यदि आपको यह पुष्टि करनी है कि बारकोड वास्तव में इनपुट स्ट्रिंग को दर्शाता है, तो आप उसी लाइब्रेरी से इसे डिकोड कर सकते हैं: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +डिकोडर को `(01)12345678901231` आउटपुट करना चाहिए, जिससे यह सिद्ध होता है कि **डेटाबार स्टैक्ड बारकोड** प्रक्रिया ने डेटा को संरक्षित रखा। + +## Common pitfalls and how to avoid them + +| Issue | Why it happens | Fix | +|-------|----------------|-----| +| बारकोड धुंधला दिखता है | आउटपुट रिज़ॉल्यूशन के लिए X डाइमेंशन बहुत कम सेट किया गया | `XDimension.Pixels` बढ़ाएँ या प्रिंट के लिए `Millimeters` उपयोग करें | +| स्कैनर रिपोर्ट करता है “symbol not found” | एस्पेक्ट रेशियो समर्थित 10‑30 सीमा से बाहर है | रेशियो को 10 से 30 के बीच रखें; 15 और 30 सुरक्षित डिफ़ॉल्ट हैं | +| PNG में वॉटरमार्क है | Aspose.BarCode की मुफ्त इवैल्यूएशन लाइसेंस का उपयोग | पूरा लाइसेंस खरीदें या केवल परीक्षण के लिए ट्रायल उपयोग करें | +| दूसरी छवि पर डिकोडिंग विफल | डिकोडर गलत सिम्बोलॉजी के लिए कॉन्फ़िगर किया गया | स्टैक्ड बारकोड पढ़ते समय `DecodeType.DatabarStackedOmniDirectional` उपयोग करें | + +## Next steps + +अब जब आप **डेटाबार स्टैक्ड बारकोड** छवियां बना सकते हैं, तो आप चाहेंगे: + +* **Aspose.PDF** जैसी PDF लाइब्रेरी का उपयोग करके PNG को PDF इनवॉइस में एम्बेड करें। +* वेब API में बारकोड तुरंत जेनरेट करें – PNG बाइट्स को सीधे ASP.NET Core कंट्रोलर से रिटर्न करें। +* `EncodeTypes` enum बदलकर अन्य DataBar वैरिएंट्स (जैसे `DatabarExpanded`, `DatabarLimited`) के साथ प्रयोग करें। +* ब्रांड‑विशिष्ट डिज़ाइन के लिए `generator.Parameters.Barcode.ForeColor` और `BackColor` सेट करके रंग समायोजित करें। + +इनमें से प्रत्येक विषय यहाँ कवर किए गए मूल कॉन्सेप्ट्स पर आधारित है: `BarcodeGenerator` को इनिशियलाइज़ करना, विज़ुअल पैरामीटर्स कॉन्फ़िगर करना, और `BarCodeImageFormat` के साथ परिणाम सहेजना। + +--- + +### Conclusion + +इस ट्यूटोरियल ने दिखाया कि कैसे Aspose.BarCode का उपयोग करके C# में **डेटाबार स्टैक्ड बारकोड** छवियां बनाई जा सकती हैं। आपने **X डाइमेंशन** सेट करना, **बारकोड एस्पेक्ट रेशियो** बदलना, और `BarcodeGenerator` के साथ परिणाम को **PNG** फ़ाइलों के रूप में एक्सपोर्ट करना सीखा। वैकल्पिक डिकोडिंग स्टेप के साथ आप एन्कोडेड GS1 डेटा की शुद्धता भी सत्यापित कर सकते हैं। इन पैटर्न को अपने इन्वेंट्री, शिपिंग, या पॉइंट‑ऑफ़‑सेल एप्लिकेशन्स में लागू करें, और लाइब्रेरी द्वारा प्रदान किए गए कई कस्टमाइज़ेशन विकल्पों का अन्वेषण करें। Happy coding! + +## What Should You Learn Next? + +निम्नलिखित ट्यूटोरियल्स करीबी संबंधित विषयों को कवर करते हैं जो इस गाइड में दिखाए गए तकनीकों पर आधारित हैं। प्रत्येक संसाधन में पूर्ण कार्यशील कोड उदाहरण और चरण‑दर‑चरण व्याख्याएँ शामिल हैं, जो आपको अतिरिक्त API फीचर्स में महारत हासिल करने और अपने प्रोजेक्ट्स में वैकल्पिक इम्प्लीमेंटेशन अप्रोचेज़ को एक्सप्लोर करने में मदद करेंगे। + +- [One-Dimensional Databar Barcode Height Adjustment](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/hindi/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..23418daa1 --- /dev/null +++ b/barcode/hindi/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: Aspose.BarCode का उपयोग करके C# में बारकोड इमेज बनाएं। सीखें कि कैसे + Databar जनरेट करें, कस्टम बारकोड आकार समायोजित करें, और सरल कोड से बारकोड की ऊँचाई + बदलें। +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: hi +lastmod: 2026-08-06 +og_description: Aspose.BarCode के साथ C# में बारकोड इमेज बनाएं। यह ट्यूटोरियल आपको + दिखाता है कि कैसे Databar Omnidirectional बारकोड बनाएं, उसका आकार कस्टमाइज़ करें, + और बारकोड की ऊँचाई को प्रभावी ढंग से बदलें। +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: C# में बारकोड इमेज जेनरेट करें – पूर्ण Aspose.BarCode गाइड +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Aspose.BarCode के साथ C# में बारकोड छवि बनाएं +url: /hi/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# में Aspose.BarCode के साथ बारकोड इमेज जेनरेट करें + +यदि आपको प्रोग्रामेटिक रूप से **बारकोड इमेज जेनरेट** करनी है, तो यह गाइड आपको बिल्कुल वही दिखाएगा। चाहे आप रिटेल इन्वेंटरी सिस्टम बना रहे हों या लॉजिस्टिक्स ट्रैकिंग पोर्टल, आप डेटाबार ओम्निडायरेक्शनल बारकोड बनाने, उसके आयाम समायोजित करने, और परिणाम को PNG फ़ाइल के रूप में सहेजने की पूरी वर्कफ़्लो देखेंगे। + +बारकोड इमेज जेनरेट करना एक सामान्य आवश्यकता है, लेकिन डेवलपर्स अक्सर यह सोचते हैं कि **डेटाबार को ठीक उसी आकार में कैसे जेनरेट करें** जिसकी उन्हें जरूरत है। इस ट्यूटोरियल में आप सीखेंगे कि डेटाबार बारकोड कैसे बनाएं, उसकी चौड़ाई और ऊँचाई को कस्टमाइज़ करें, और पूरे जेनरेटर को फिर से लिखे बिना बारकोड की ऊँचाई बदलें। + +## आवश्यकताएँ + +शुरू करने से पहले सुनिश्चित करें कि आपके पास ये हों: + +* .NET 6.0 SDK या बाद का संस्करण (कोड .NET Core और .NET Framework दोनों के साथ काम करता है) +* Visual Studio 2022 (या कोई भी IDE जो C# को सपोर्ट करता हो) +* एक वैध Aspose.BarCode for .NET लाइसेंस (फ़्री इवैल्यूएशन टेस्टिंग के लिए काम करता है) +* C# सिंटैक्स की बेसिक समझ + +## चरण 1: Aspose.BarCode इंस्टॉल करें + +अपने प्रोजेक्ट में Aspose.BarCode NuGet पैकेज जोड़ें: + +```bash +dotnet add package Aspose.BarCode +``` + +यह पैकेज `BarcodeGenerator` क्लास को शामिल करता है जिसका उपयोग इस ट्यूटोरियल में पूरे समय किया जाएगा। इंस्टॉल करने के बाद, प्रोजेक्ट को रिस्टोर करें ताकि सभी डिपेंडेंसीज़ डाउनलोड हो जाएँ। + +## चरण 2: बेसिक बारकोड जेनरेटर बनाएं + +पहली लाइन कोड एक **बारकोड जेनरेटर** बनाती है जो डेटाबार ओम्निडायरेक्शनल सिम्बॉल उत्पन्न करेगा। `EncodeTypes.DatabarOmniDirectional` एनेम लाइब्रेरी को बताता है कि कौन सा सिम्बोलॉजी उपयोग करना है, और डेटा स्ट्रिंग GS1 एप्लिकेशन आइडेंटिफ़ायर सिंटैक्स का पालन करती है। + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**क्यों महत्वपूर्ण है:** `BarcodeGenerator` ऑब्जेक्ट हर बारकोड ऑपरेशन का एंट्री पॉइंट है। `DatabarOmniDirectional` चुनकर आप सुनिश्चित करते हैं कि आउटपुट रिटेल स्कैनिंग के लिए GS1 मानक के अनुरूप हो। + +## चरण 3: कस्टम X‑डायमेंशन (मॉड्यूल चौड़ाई) सेट करें + +X‑डायमेंशन सबसे पतली बार की चौड़ाई को नियंत्रित करता है। इसे छोटे पिक्सेल वैल्यू पर सेट करने से आपको कॉम्पैक्ट बारकोड मिलेगा, जबकि बड़े वैल्यू कुल चौड़ाई बढ़ा देंगे। + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**व्याख्या:** 2‑पिक्सेल X‑डायमेंशन हाई‑रिज़ॉल्यूशन स्क्रीन के लिए एक सामान्य विकल्प है। यदि आपको अधिक घना या कम घना विज़ुअल डेंसिटी चाहिए तो इस वैल्यू को समायोजित करें। + +## चरण 4: विशिष्ट ऊँचाई के साथ पहला बारकोड इमेज जेनरेट करें + +बारकोड की ऊँचाई X‑डायमेंशन से स्वतंत्र होती है। यहाँ हम बार की ऊँचाई **30 px** सेट करते हैं, फिर इमेज को PNG के रूप में सेव करते हैं। + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**परिणाम:** अब आपके पास `DatabarBarHeight30Pixels.png` नाम की फ़ाइल है जिसमें 30 px ऊँचा डेटाबार बारकोड दिखता है। यह **कस्टम बारकोड साइज** क्षमता को दर्शाता है, जो छोटे लेबल जैसे उपयोग मामलों के लिए उपयुक्त है। + +## चरण 5: बड़े संस्करण के लिए बारकोड ऊँचाई बदलें + +यदि वही बारकोड बड़े लेबल पर दिखाना है, तो आपको केवल ऊँचाई प्रॉपर्टी बदलनी होगी और वही जेनरेटर इंस्टेंस दोबारा उपयोग करना होगा। + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**क्यों आप जेनरेटर को री‑यूज़ कर सकते हैं:** `BarHeight.Pixels` को बदलने से आंतरिक लेआउट अपडेट हो जाता है बिना ऑब्जेक्ट को फिर से बनाये, जिससे मेमोरी बचती है और डेटा स्ट्रिंग अपरिवर्तित रहती है। यह **बारकोड ऊँचाई बदलने** का अनुशंसित तरीका है। + +## चरण 6: आउटपुट की जाँच करें + +दोनों PNG फ़ाइलों को किसी भी इमेज व्यूअर में खोलें। आपको दो डेटाबार ओम्निडायरेक्शनल बारकोड दिखेंगे जो एक ही GTIN एन्कोड करते हैं लेकिन ऊँचाई में अलग हैं: + +* `DatabarBarHeight30Pixels.png` – 30 px ऊँचा, कॉम्पैक्ट रसीदों के लिए उपयुक्त। +* `DatabarBarHeight60Pixels.png` – 60 px ऊँचा, बड़े शेल्फ‑एज लेबलों के लिए आदर्श। + +दोनों इमेज में समान X‑डायमेंशन रहता है, इसलिए बार‑टू‑स्पेस अनुपात स्थिर रहता है जबकि कुल ऊँचाई स्केल होती है। + +## सामान्य वैरिएशन और एज केस + +| स्थिति | कैसे निपटें | +|-----------|------------------| +| **विभिन्न बारकोड सिम्बोलॉजी** | `EncodeTypes.DatabarOmniDirectional` को किसी अन्य एनेम वैल्यू (जैसे `EncodeTypes.Code128`) से बदलें। बाकी कोड अपरिवर्तित रहता है। | +| **गैर‑पिक्सेल आयाम** | यदि आपको प्रिंट‑रेडी आउटपुट के लिए फिजिकल माप चाहिए तो `generator.Parameters.Barcode.XDimension.Millimeters` या `BarHeight.Millimeters` का उपयोग करें। | +| **पारदर्शी पृष्ठभूमि** | `generator.Parameters.ImageBackgroundColor = Color.Transparent;` को `Save` कॉल करने से पहले सेट करें। | +| **उच्च‑रिज़ॉल्यूशन आउटपुट** | `XDimension.Pixels` और `BarHeight.Pixels` दोनों को समानुपातिक रूप से बढ़ाएँ, या लॉसलेस क्वालिटी के लिए `BarCodeImageFormat.Tiff` के रूप में सेव करें। | +| **एक इमेज में कई बारकोड** | अलग‑अलग `BarcodeGenerator` इंस्टेंस बनाएँ, प्रत्येक को `Bitmap` में रेंडर करें, फिर `Graphics.DrawImage` से उन्हें एक साथ कंपोज़ करें। | + +**प्रो टिप:** प्रोडक्शन में डिप्लॉय करने से पहले हमेशा वास्तविक स्कैनर से जेनरेटेड बारकोड की टेस्टिंग करें। बहुत पतली बार्स लाइटिंग और सेंसर क्वालिटी के आधार पर अलग‑अलग पढ़ी जा सकती हैं। + +## संदर्भ के लिए पूरा सोर्स कोड + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +कोड को एक नए कंसोल प्रोजेक्ट में कॉपी करें, चलाएँ, और आप आउटपुट फ़ोल्डर में दो PNG फ़ाइलें देखेंगे। + +## अक्सर पूछे जाने वाले प्रश्न + +**प्रश्न: क्या मैं लाइसेंस इंस्टॉल किए बिना बारकोड जेनरेट कर सकता हूँ?** +उत्तर: Aspose.BarCode का इवैल्यूएशन संस्करण लाइसेंस के बिना काम करता है लेकिन एक छोटा वॉटरमार्क जोड़ता है। प्रोडक्शन उपयोग के लिए, `License license = new License(); license.SetLicense("Aspose.BarCode.lic");` का उपयोग करके खरीदा हुआ लाइसेंस लागू करें। + +**प्रश्न: क्या X‑डायमेंशन बदलने से रीडेबिलिटी प्रभावित होती है?** +उत्तर: हाँ। बहुत छोटे X‑डायमेंशन लो‑रिज़ॉल्यूशन प्रिंटर पर बारकोड को पढ़ना मुश्किल बना सकते हैं। स्क्रीन रेंडरिंग के लिए न्यूनतम 1 px और प्रिंट के लिए कम से कम 0.25 mm की सिफारिश की जाती है। + +**प्रश्न: अगर मुझे JPEG फ़ॉर्मेट में बारकोड जेनरेट करना हो तो क्या करें?** +उत्तर: `BarCodeImageFormat.Png` को `BarCodeImageFormat.Jpeg` से बदलें। आप `generator.Parameters.ImageQuality` सेट करके कम्प्रेशन को भी नियंत्रित कर सकते हैं। + +## निष्कर्ष + +अब आप जानते हैं कि C# में Aspose.BarCode का उपयोग करके **बारकोड इमेज कैसे जेनरेट करें**, **डेटाबार बारकोड कैसे बनाएं**, **कस्टम बारकोड साइज कैसे सेट करें**, और **ज़रूरत पड़ने पर बारकोड ऊँचाई कैसे बदलें**। पूरा उदाहरण सबसे सामान्य वर्कफ़्लो को दर्शाता है, और वैरिएशन टेबल आपको वास्तविक दुनिया के एज केस संभालने में मदद करेगी। + +अगला कदम: **PDF दस्तावेज़ों में बारकोड एम्बेड करना**, **एक साथ कई बारकोड जेनरेट करना**, और **मोबाइल पेमेंट्स के लिए QR कोड का उपयोग** जैसे संबंधित टॉपिक्स को एक्सप्लोर करें। ये सभी परिदृश्य यहाँ कवर किए गए सिद्धांतों पर आधारित हैं, इसलिए आप इस ज्ञान को आत्मविश्वास के साथ विस्तारित कर सकते हैं। + +कोडिंग का आनंद लें, और आपके बारकोड हमेशा सही ढंग से स्कैन हों! + +## आप अगला क्या सीखें? + +नीचे दिए गए ट्यूटोरियल्स उन विषयों को कवर करते हैं जो इस गाइड में दिखाए गए तकनीकों पर आधारित हैं। प्रत्येक रिसोर्स में पूर्ण कार्यशील कोड उदाहरण और चरण‑दर‑चरण व्याख्याएँ शामिल हैं, जिससे आप अतिरिक्त API फीचर्स में महारत हासिल कर सकते हैं और अपने प्रोजेक्ट्स में वैकल्पिक इम्प्लीमेंटेशन एप्रोच को एक्सप्लोर कर सकते हैं। + +- [बारकोड इमेज जेनरेट करें – GS1 कूपन UPC-A डेटाबार](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [Aspose.BarCode for .NET के साथ कस्टम एस्पेक्ट रेशियो वाला Aztec बारकोड कैसे जेनरेट करें](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Aspose.BarCode के साथ कोड 39 कॉन्फ़िगरेशन – बारकोड कैसे जेनरेट करें](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/hindi/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..01540fa8e --- /dev/null +++ b/barcode/hindi/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,222 @@ +--- +category: general +date: 2026-08-06 +description: Databar Expanded Stacked बारकोड के लिए कॉलम कैसे सेट करें और बारकोड इमेजेज़ + बनाना, पंक्तियों को सेट करना, तथा C# में बारकोड फ़ाइल को सहेजना सीखें। +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: hi +lastmod: 2026-08-06 +og_description: Databar Expanded Stacked बारकोड के लिए कॉलम कैसे सेट करें और जल्दी + से सीखें कि बारकोड छवियां कैसे बनाएं, पंक्तियों को सेट करें, और Aspose.Barcode के + साथ बारकोड फ़ाइल को सहेजें। +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: डेटाबार एक्सपैंडेड स्टैक्ड बारकोड के लिए कॉलम कैसे सेट करें – चरण‑दर‑चरण + C# गाइड +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: डेटाबार एक्सपैंडेड स्टैक्ड बारकोड के लिए कॉलम कैसे सेट करें – पूर्ण C# गाइड +url: /hi/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Databar Expanded Stacked बारकोड के लिए कॉलम कैसे सेट करें – पूर्ण C# गाइड + +यदि आपको Databar Expanded Stacked बारकोड के लिए **कॉलम कैसे सेट करें** की आवश्यकता है, तो यह ट्यूटोरियल आपको सटीक चरण दिखाता है। चाहे आप रिटेल लेबलिंग सिस्टम बना रहे हों या लॉजिस्टिक्स एप्लिकेशन, कॉलम और रो को नियंत्रित करने से आप बारकोड का आकार और स्कैन विश्वसनीयता को बारीकी से समायोजित कर सकते हैं। इसके अतिरिक्त, आप **बारकोड कैसे जेनरेट करें** छवियों को देखेंगे, रो की संख्या को समायोजित करेंगे, और सही ढंग से **बारकोड फ़ाइल को डिस्क पर सहेजें**। + +यह गाइड आपको निम्नलिखित चरणों से परिचित कराएगा: + +* Aspose.Barcode for .NET लाइब्रेरी को इंस्टॉल करना। +* Databar Expanded Stacked प्रकार के लिए एक barcode generator बनाना। +* कॉलम काउंट, रो काउंट, और इमेज फ़ॉर्मेट सेट करना। +* परिणामी PNG फ़ाइलों को चुनी गई डायरेक्टरी में सहेजना। + +Aspose.Barcode का कोई पूर्व अनुभव आवश्यक नहीं है—बस एक बेसिक C# डेवलपमेंट एनवायरनमेंट चाहिए। + +## Prerequisites + +शुरू करने से पहले सुनिश्चित करें कि आपके पास है: + +* .NET 6.0 SDK या बाद का संस्करण इंस्टॉल हो। +* Visual Studio 2022 (या कोई भी IDE जो .NET सपोर्ट करता हो)। +* **Aspose.Barcode** का NuGet रेफ़रेंस (`dotnet add package Aspose.Barcode`)। + +सभी कोड स्निपेट डिफ़ॉल्ट कंसोल प्रोजेक्ट टेम्प्लेट के साथ कम्पाइल होते हैं। + +## Step 1: Create a barcode generator for Databar Expanded Stacked + +पहला ऑपरेशन `BarcodeGenerator` को `EncodeTypes.DatabarExpandedStacked` एनेम के साथ इंस्टैंशिएट करना है। यह डिफ़ॉल्ट लेआउट (स्टैक्ड) सेट करता है और आगे की कॉन्फ़िगरेशन के लिए ऑब्जेक्ट तैयार करता है। + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Why this matters:** जेनरेटर सभी रेंडरिंग पैरामीटर रखता है। `DatabarExpandedStacked` चुनने से लाइब्रेरी को स्टैक्ड लेआउट उपयोग करने के लिए बताया जाता है, जो कॉलम और रो समायोजन को सपोर्ट करने वाला एकमात्र लेआउट है। + +## How to set columns for a Databar Expanded Stacked barcode + +अब जब जेनरेटर मौजूद है, आप कॉलम काउंट को नियंत्रित कर सकते हैं। `DataBar.Columns` प्रॉपर्टी 1 से 4 के बीच का पूर्णांक स्वीकार करती है। इसे **4** पर सेट करने से सबसे चौड़ा संभव बारकोड बनता है, जबकि अभी भी स्टैक्ड लेआउट में फिट रहता है। + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Practical tip:** अधिकतम कॉलम काउंट तभी उपयोग करें जब लेबल पर पर्याप्त व्हाइट स्पेस हो। छोटे लेबल पर बहुत अधिक कॉलम स्कैनिंग समस्याएँ पैदा कर सकते हैं। + +## How to generate barcode images and save them + +कॉलम कॉन्फ़िगर करने के बाद, आपको बारकोड को रेंडर करना होगा और इमेज को डिस्क पर लिखना होगा। `Save` मेथड फ़ाइल पाथ और इमेज फ़ॉर्मेट एनेम लेता है। + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +फ़ोल्डर `output` मौजूद होना चाहिए, अन्यथा कॉल पर एक्सेप्शन फेंका जाएगा। यदि आप चाहें तो इसे प्रोग्रामेटिकली `Directory.CreateDirectory("output");` से बना सकते हैं। + +## How to set rows for a Databar Expanded Stacked barcode + +रो कॉलम की तरह ही काम करती हैं, लेकिन वे बारकोड मॉड्यूल्स की वर्टिकल स्टैकिंग को प्रभावित करती हैं। `DataBar.Rows` प्रॉपर्टी 1 से 5 के बीच मान लेती है। इस उदाहरण में हम **3** रो उपयोग करते हैं। + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Why rows matter:** रो जोड़ने से बारकोड की ऊँचाई बढ़ती है, जो हाई‑डेंसिटी लेबल्स के लिए उपयोगी है जहाँ आपको बारकोड को चौड़ा किए बिना अधिक डेटा मॉड्यूल्स चाहिए होते हैं। + +## Barcode save file options and best practices + +`Save` मेथड कई इमेज फ़ॉर्मेट्स (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`) को सपोर्ट करता है। PNG लॉसलेस है और अधिकांश स्कैनिंग डिवाइसों के लिए उपयुक्त है। यदि आपको छोटा फ़ाइल साइज चाहिए और हल्की कम्प्रेशन आर्टिफैक्ट्स सहन कर सकते हैं, तो JPEG चुनें: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Edge case:** JPEG में सेव करते समय क्वालिटी पैरामीटर को उचित रूप से सेट करें (डिफ़ॉल्ट 90 है)। कम क्वालिटी छोटे मॉड्यूल्स को ब्लर कर सकती है, जिससे बारकोड पढ़ना मुश्किल हो जाता है। + +## Complete, runnable example + +सब कुछ एक साथ रखने के लिए, यहाँ एक सिंगल फ़ाइल है जिसे आप नए कंसोल प्रोजेक्ट में कॉपी करके तुरंत चला सकते हैं: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Expected output:** प्रोग्राम चलाने के बाद, `output` फ़ोल्डर में तीन फ़ाइलें होंगी: + +* `DatabarCols4.png` – 4 कॉलम (वाइड) वाला बारकोड। +* `DatabarRows3.png` – 3 रो (टॉल) वाला बारकोड। +* `DatabarRows3.jpg` – 3‑रो बारकोड का JPEG संस्करण। + +किसी भी PNG फ़ाइल को इमेज व्यूअर में खोलें; आपको एक स्पष्ट Databar Expanded Stacked बारकोड दिखना चाहिए जो स्कैनिंग के लिए तैयार है। + +## Common questions and troubleshooting + +| Question | Answer | +|----------|--------| +| *What if the image is blurry?* | Verify you are using PNG for lossless output. If you need JPEG, increase the quality setting (`new JpegOptions { Quality = 95 }`). | +| *Can I change the barcode text?* | Yes—replace the second argument in `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Do columns and rows work together?* | They can be combined; just set both `DataBar.Columns` and `DataBar.Rows` before calling `Save`. | +| *Is there a limit on directory depth?* | The path must be valid for the operating system. Use `Path.Combine` for cross‑platform safety. | + +## Conclusion + +आप अब जानते हैं **कॉलम कैसे सेट करें** Databar Expanded Stacked बारकोड के लिए, **रो कैसे सेट करें**, और **बारकोड कैसे जेनरेट करें** इमेजेज़ जिन्हें आप **बारकोड फ़ाइल को डिस्क पर सहेजें** PNG या JPEG फ़ॉर्मेट में। पूरा उदाहरण लाइब्रेरी इंस्टॉलेशन से लेकर अंतिम फ़ाइल वेरिफिकेशन तक हर आवश्यक चरण दर्शाता है। + +अगला, आप निम्नलिखित चीज़ों को एक्सप्लोर कर सकते हैं: + +* QR कोड्स के लिए एरर करेक्शन लेवल्स के साथ **बारकोड कैसे जेनरेट करें**। +* SVG या PDF जैसे वेक्टर फ़ॉर्मेट्स के लिए **बारकोड फ़ाइल सहेजने** विकल्प। +* ASP.NET Core MVC व्यूज़ में जेनरेटेड बारकोड को इंटीग्रेट करना ताकि डायनामिक लेबल प्रिंटिंग हो सके। + +विभिन्न कॉलम/रो कॉम्बिनेशन, इमेज फ़ॉर्मेट, और बारकोड कंटेंट के साथ प्रयोग करने में संकोच न करें ताकि आपके प्रोजेक्ट की स्पेसिफ़िकेशन पूरी हो सके। Happy coding! + +## What Should You Learn Next? + +नीचे दिए गए ट्यूटोरियल्स उन विषयों को कवर करते हैं जो इस गाइड में दिखाए गए तकनीकों पर आधारित हैं। प्रत्येक रिसोर्स में पूर्ण कार्यशील कोड उदाहरण और स्टेप‑बाय‑स्टेप एक्सप्लानेशन शामिल हैं, जिससे आप अतिरिक्त API फीचर्स में महारत हासिल कर सकते हैं और अपने प्रोजेक्ट्स में वैकल्पिक इम्प्लीमेंटेशन अप्रोचेज़ को एक्सप्लोर कर सकते हैं। + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/hongkong/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..99fa30ee2 --- /dev/null +++ b/barcode/hongkong/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,189 @@ +--- +category: general +date: 2026-08-06 +description: 快速在 C# 中建立 DataBar 堆疊條碼。學習設定 X 尺寸、調整長寬比,並使用 DataBar 堆疊全向產生器匯出 PNG 檔案。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: zh-hant +lastmod: 2026-08-06 +og_description: 在 C# 中使用 Aspose.BarCode 建立 DataBar 堆疊條碼。本教學說明如何設定 X 尺寸、變更長寬比,並儲存 PNG + 圖片。 +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: 使用 C# 建立 DataBar 堆疊條碼 – 完整程式設計指南 +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: 使用 C# 建立 DataBar 堆疊條碼 – 逐步指南 +url: /zh-hant/python-java/general/create-databar-stacked-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# 中建立 databar stacked barcode – 步驟說明指南 + +如果您需要在 C# 中**建立 databar stacked barcode**影像,本指南將會示範如何使用 Aspose.BarCode 函式庫完成。您將學會設定 X 維度、變更條碼的長寬比,並將結果儲存為 PNG 檔案——只需簡短的幾個步驟。 + +在必須為零售掃描或物流追蹤編碼 GS1‑128 資料時,產生 DataBar Stacked 條碼是常見需求。以下各節將從專案設定說明到驗證輸出,完整涵蓋所有細節,讓您能將此解決方案整合至任何 .NET 應用程式中。 + +## 前置條件 + +* **.NET 6.0**(或更新版本)已安裝 – 程式碼以現代 SDK 為目標。 +* **授權**版的 **Aspose.BarCode for .NET**。免費評估版可用於測試,但會加上浮水印。 +* 如 **Visual Studio 2022** 或 **VS Code**(搭配 C# 擴充套件)的開發環境。 +* 具備 **C#** 語法的基本認識,以及對 GS1 應用識別碼(Application Identifiers)的概念。 + +> **專業提示:** 若使用 NuGet 套件管理員,指令 `dotnet add package Aspose.BarCode` 會自動解決所有相依性。 + +## 步驟 1:建立新 Console 專案 + +在終端機或套件管理員主控台中執行以下指令: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +`dotnet new console` 指令會產生最小的 **Program.cs** 檔案。加入 **Aspose.BarCode** 套件後,即可使用 `BarcodeGenerator` 類別。 + +## 步驟 2:初始化 DataBar Stacked Omnidirectional 產生器 + +開啟 **Program.cs**,將預設內容取代為以下程式碼。第一行會建立一個針對 **DataBar Stacked Omnidirectional** 符號設定的 **BarcodeGenerator**,並提供 GS1‑128 負載。 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**為什麼重要:** `EncodeTypes.DatabarStackedOmniDirectional` 列舉值告訴函式庫產生 **databar stacked barcode**,即 DataBar 全向族的堆疊變體。此符號最多可容納 14 個數字字元,非常適合 GTIN‑14 代碼。 + +## 步驟 3:設定 X 維度(模組寬度) + +X 維度決定最小條紋(模組)的寬度。若設定過小,低解析度印表機可能無法清晰呈現;若設定過大,則可能超出標籤空間。 + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **提示:** `Pixels` 屬性在螢幕測試時相當方便。若是以列印為主的情境,請改用 `generator.Parameters.Barcode.XDimension.Millimeters`。 + +## 步驟 4:調整長寬比並儲存第一張影像 + +**長寬比** 會影響堆疊條碼的高寬比例。DataBar Stacked Omnidirectional 類型支援 10 至 30 的比例。我們將產生兩張影像以說明視覺差異。 + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +`generator.Save` 會將 **PNG** 檔寫入目前工作目錄。`BarCodeImageFormat.Png` 列舉確保無損壓縮,適合後續處理或嵌入 PDF 中。 + +## 步驟 5:將長寬比改為 30 並儲存第二張影像 + +現在將長寬比改為 **30**,以提升堆疊條紋的高度。這會使條碼變高,但不會改變 X 維度。 + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +執行程式後會產生兩個 PNG 檔案: + +* **DatabarAspectRatio15.png** – 緊湊的條碼,適用於小尺寸標籤。 +* **DatabarAspectRatio30.png** – 較高的條碼,可提升在低對比表面上的掃描可靠度。 + +您可以使用任何檢視器開啟影像,確認條紋正確堆疊且編碼資料與原始 GS1 字串相符。 + +## 步驟 6:驗證編碼值(可選) + +若需確認條碼確實對應輸入字串,可使用相同函式庫進行解碼: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +解碼器應輸出 `(01)12345678901231`,證明 **create databar stacked barcode** 的過程已正確保留資料。 + +## 常見問題與避免方法 + +| 問題 | 發生原因 | 解決方式 | +|-------|----------------|-----| +| 條碼顯示模糊 | X 維度設定過低,導致輸出解析度不足 | 將 `XDimension.Pixels` 提高,或在列印時使用 `Millimeters` | +| 掃描器回報「找不到符號」 | 長寬比超出支援的 10‑30 範圍 | 將長寬比維持在 10 至 30 之間;15 與 30 為安全預設值 | +| PNG 含有浮水印 | 使用 Aspose.BarCode 的免費評估授權 | 購買完整授權,或僅將試用版用於測試 | +| 第二張影像解碼失敗 | 解碼器設定了錯誤的符號類型 | 在讀取堆疊條碼時使用 `DecodeType.DatabarStackedOmniDirectional` | + +## 往後步驟 + +既然您已能 **create databar stacked barcode** 影像,接下來或許想要: + +* **將 PNG 嵌入 PDF 發票**,使用如 **Aspose.PDF** 的 PDF 函式庫。 +* **在 Web API 中即時產生條碼**——直接從 ASP.NET Core 控制器回傳 PNG 位元組。 +* **嘗試其他 DataBar 變體**(例如 `DatabarExpanded`、`DatabarLimited`),只需變更 `EncodeTypes` 列舉。 +* **調整顏色**,透過設定 `generator.Parameters.Barcode.ForeColor` 與 `BackColor` 以符合品牌設計。 + +上述每個主題皆建立在本教學的核心概念之上:初始化 `BarcodeGenerator`、設定視覺參數,並以 `BarCodeImageFormat` 儲存結果。 + +--- + +### 結論 + +本教學示範了如何使用 Aspose.BarCode 在 C# 中 **create databar stacked barcode** 影像。您學會了設定 **X 維度**、調整 **條碼長寬比**,並使用 `BarcodeGenerator` 匯出為 **PNG** 檔案。透過可選的解碼步驟,亦可驗證編碼的 GS1 資料是否正確。將這些模式套用於您的庫存、運輸或 POS 應用程式,並探索函式庫提供的各種客製化選項。祝開發順利! + +## 接下來該學什麼? + +以下教學涵蓋與本指南密切相關的主題,並以步驟說明的完整程式碼範例,協助您精通更多 API 功能,並在專案中探索其他實作方式。 + +- [單維 Databar 條碼高度調整](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [產生條碼影像 – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/hongkong/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..a011a85ee --- /dev/null +++ b/barcode/hongkong/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,222 @@ +--- +category: general +date: 2026-08-06 +description: 使用 Aspose.BarCode 在 C# 中產生條碼影像。學習如何產生 Databar、調整自訂條碼尺寸,以及以簡單程式碼變更條碼高度。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: zh-hant +lastmod: 2026-08-06 +og_description: 使用 Aspose.BarCode 在 C# 中產生條碼影像。本教學將示範如何建立 Databar Omnidirectional + 條碼、客製化其尺寸,以及有效調整條碼高度。 +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: 在 C# 中生成條碼圖像 – 完整 Aspose.BarCode 指南 +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: 使用 Aspose.BarCode 在 C# 中產生條碼圖像 +url: /zh-hant/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 在 C# 中使用 Aspose.BarCode 產生條碼影像 + +如果您需要以程式方式 **產生條碼影像**,本指南將完整說明操作步驟。無論您是建立零售庫存系統或物流追蹤平台,您都會看到建立 Databar Omnidirectional 條碼、調整其尺寸,並將結果儲存為 PNG 檔案的完整工作流程。 + +產生條碼影像是常見需求,但開發人員常常想知道 **如何產生符合特定尺寸的 Databar**。在本教學中,您將學會建立 Databar 條碼、客製化其寬度與高度,並在不重新撰寫整個產生器的情況下變更條碼高度。 + +## 前置條件 + +* .NET 6.0 SDK 或更新版本(此程式碼可在 .NET Core 與 .NET Framework 上執行) +* Visual Studio 2022(或任何支援 C# 的 IDE) +* 有效的 Aspose.BarCode for .NET 授權(免費評估版可用於測試) +* 具備基本的 C# 語法知識 + +## 步驟 1:安裝 Aspose.BarCode + +將 Aspose.BarCode NuGet 套件加入您的專案: + +```bash +dotnet add package Aspose.BarCode +``` + +此套件包含本教學中會使用的 `BarcodeGenerator` 類別。安裝完成後,請還原專案以取得相依性。 + +## 步驟 2:建立基本的條碼產生器 + +第一行程式碼會建立一個 **條碼產生器**,用以產生 Databar Omnidirectional 符號。`EncodeTypes.DatabarOmniDirectional` 列舉告訴函式庫使用哪種符號系統,資料字串則遵循 GS1 應用識別碼語法。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**為什麼這很重要:** `BarcodeGenerator` 物件是所有條碼操作的入口點。選取 `DatabarOmniDirectional` 可確保輸出符合零售掃描的 GS1 標準。 + +## 步驟 3:設定自訂 X‑dimension(模組寬度) + +X‑dimension 控制最窄條的寬度。將其設為較小的像素值可產生緊湊的條碼,較大的值則會增加整體寬度。 + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**說明:** 2 像素的 X‑dimension 是高解析度螢幕的常見選擇。如需更緊密或較寬鬆的視覺密度,請調整此數值。 + +## 步驟 4:產生第一張具特定高度的條碼影像 + +條碼高度與 X‑dimension 無關。此處將條碼高度設為 **30 px**,然後將影像儲存為 PNG。 + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**結果:** 您現在會得到名為 `DatabarBarHeight30Pixels.png` 的檔案,顯示高度為 30 px 的 Databar 條碼。此範例展示了 **自訂條碼尺寸** 的功能,適用於小標籤等特定情境。 + +## 步驟 5:變更條碼高度以產生較大版本 + +若相同條碼需顯示於較大的標籤,只需修改高度屬性並重複使用同一個產生器實例。 + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**為什麼可以重複使用產生器:** 變更 `BarHeight.Pixels` 會更新內部版面配置,而不必重新建立物件,這樣可節省記憶體並保留資料字串不變。這是即時 **變更條碼高度** 的建議做法。 + +## 步驟 6:驗證輸出結果 + +使用任意影像檢視器開啟這兩個 PNG 檔案。您應該會看到兩個 Databar Omnidirectional 條碼,編碼相同的 GTIN,但垂直尺寸不同: + +* `DatabarBarHeight30Pixels.png` – 高 30 px,適用於緊湊的收據。 +* `DatabarBarHeight60Pixels.png` – 高 60 px,適合較大的貨架邊緣標籤。 + +兩張影像皆保留相同的 X‑dimension,因而條與空白的比例保持一致,僅整體高度隨之調整。 + +## 常見變化與邊緣情況 + +| 情況 | 處理方式 | +|-----------|------------------| +| **不同的條碼符號系統** | 將 `EncodeTypes.DatabarOmniDirectional` 替換為其他列舉值(例如 `EncodeTypes.Code128`),其餘程式碼保持不變。 | +| **非像素尺寸** | 若需列印就緒的實體尺寸,可使用 `generator.Parameters.Barcode.XDimension.Millimeters` 或 `BarHeight.Millimeters`。 | +| **透明背景** | 在呼叫 `Save` 之前設定 `generator.Parameters.ImageBackgroundColor = Color.Transparent;`。 | +| **高解析度輸出** | 成比例地增加 `XDimension.Pixels` 與 `BarHeight.Pixels`,或以 `BarCodeImageFormat.Tiff` 儲存以獲得無損品質。 | +| **單一影像內多條條碼** | 建立多個 `BarcodeGenerator` 實例,將每個渲染至 `Bitmap`,再使用 `Graphics.DrawImage` 合成。 | + +**專業提示:** 在投入正式環境前,務必使用實體掃描器測試產生的條碼。掃描器可能會因光線與感測器品質不同而對極細條產生不同的解讀。 + +## 完整原始程式碼供參考 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +將程式碼複製到新的 Console 專案中,執行後您會在輸出資料夾看到兩個 PNG 檔案。 + +## 常見問與答 + +**Q: 我可以在未安裝授權的情況下產生條碼嗎?** +A: Aspose.BarCode 的評估版可在未授權下使用,但會加上小水印。正式環境請使用 `License license = new License(); license.SetLicense("Aspose.BarCode.lic");` 以套用購買的授權。 + +**Q: 變更 X‑dimension 會影響可讀性嗎?** +A: 會。過小的 X‑dimension 可能導致低解析度印表機無法正確讀取條碼。螢幕渲染建議最小 1 px;列印則建議至少 0.25 mm。 + +**Q: 若需產生 JPEG 格式的條碼該怎麼做?** +A: 將 `BarCodeImageFormat.Png` 改為 `BarCodeImageFormat.Jpeg`。亦可設定 `generator.Parameters.ImageQuality` 以控制壓縮程度。 + +## 結論 + +您現在已掌握如何在 C# 中使用 Aspose.BarCode **產生條碼影像**、**建立 Databar 條碼**、調整 **自訂條碼尺寸**,以及依需求 **變更條碼高度**。完整範例示範了最常見的工作流程,變化表格則讓您能應對實務中的各種邊緣情況。 + +接下來,您可以探索相關主題,例如 **在 PDF 文件中嵌入條碼**、**批次產生多條條碼**,以及 **使用 QR Code 進行行動支付**。這些情境皆基於本篇所述的相同原則,讓您能自信地延伸應用此知識。 + +祝程式開發順利,條碼掃描永遠順暢! + +## 接下來該學什麼? + +以下教學涵蓋與本指南密切相關的主題,並以此為基礎延伸技術。每篇資源皆提供完整可執行的程式碼範例與逐步說明,協助您精通更多 API 功能,並在專案中探索替代實作方式。 + +- [產生條碼影像 – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [如何使用 Aspose.BarCode for .NET 產生具自訂長寬比的 Aztec 條碼](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [如何產生條碼 – 使用 Aspose.BarCode 的 Code 39 設定](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/hongkong/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..9830c89f8 --- /dev/null +++ b/barcode/hongkong/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,219 @@ +--- +category: general +date: 2026-08-06 +description: 如何為 Databar Expanded Stacked 條碼設定欄位,並學習如何產生條碼圖像、設定列以及於 C# 中儲存條碼檔案。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: zh-hant +lastmod: 2026-08-06 +og_description: 如何設定 Databar Expanded Stacked 條碼的欄位,並快速學習如何產生條碼影像、設定列,以及使用 Aspose.Barcode + 儲存條碼檔案。 +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: 如何為 Databar Expanded Stacked 條碼設定欄位 – C# 步驟指南 +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: 如何設定 Databar Expanded Stacked 條碼的欄位 – 完整 C# 指南 +url: /zh-hant/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 如何設定 Databar Expanded Stacked 條碼的列數 – 完整 C# 指南 + +如果您需要 **how to set columns** for a Databar Expanded Stacked 條碼,本教學會向您展示確切的步驟。無論您是建立零售標籤系統或物流應用程式,控制列與行都能讓您微調條碼尺寸與掃描可靠性。此外,您還會看到 **how to generate barcode** 圖像、調整行數,以及正確 **barcode save file** 到磁碟。 + +本指南將帶您完成: + +* 安裝 Aspose.Barcode for .NET 程式庫。 +* 為 Databar Expanded Stacked 類型建立條碼產生器。 +* 設定列數、行數和圖像格式。 +* 將產生的 PNG 檔案儲存至指定目錄。 + +不需要先前使用 Aspose.Barcode 的經驗——只需一個基本的 C# 開發環境。 + +## 前置條件 + +在開始之前,請確保您已具備以下條件: + +* .NET 6.0 SDK 或更新版本已安裝。 +* Visual Studio 2022(或任何支援 .NET 的 IDE)。 +* 已加入 **Aspose.Barcode** 的 NuGet 參考(`dotnet add package Aspose.Barcode`)。 + +所有程式碼片段均可於預設的 Console 專案範本編譯。 + +## 步驟 1:為 Databar Expanded Stacked 建立條碼產生器 + +第一步是使用 `EncodeTypes.DatabarExpandedStacked` 列舉實例化 `BarcodeGenerator`。此操作會設定預設佈局(stacked),並為後續設定做好準備。 + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**為什麼這很重要:** 產生器保存所有渲染參數。選擇 `DatabarExpandedStacked` 即告訴函式庫使用 stacked 佈局,這是唯一支援列與行調整的佈局。 + +## 如何設定 Databar Expanded Stacked 條碼的列數 + +現在產生器已建立,您可以控制列數。`DataBar.Columns` 屬性接受 1 到 4 之間的整數。將其設定為 **4** 會產生最寬的條碼,同時仍符合 stacked 佈局。 + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**實用提示:** 僅在標籤上有足夠空白時才使用最大列數。過多列數在小標籤上可能導致掃描問題。 + +## 如何產生條碼圖像並儲存 + +在設定列數後,您需要渲染條碼並將圖像寫入磁碟。`Save` 方法接受檔案路徑與圖像格式列舉。 + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +資料夾 `output` 必須已存在,否則呼叫會拋出例外。若需要,您可以使用 `Directory.CreateDirectory("output");` 程式化建立它。 + +## 如何設定 Databar Expanded Stacked 條碼的行數 + +行數的設定方式與列數類似,但會影響條碼模組的垂直堆疊。`DataBar.Rows` 屬性接受 1 到 5 的值。本範例使用 **3** 行。 + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**為什麼行數重要:** 增加行數會提升條碼高度,對於需要更多資料模組而不想加寬條碼的高密度標籤非常有用。 + +## 條碼儲存檔案選項與最佳實踐 + +`Save` 方法支援多種圖像格式(`Png`、`Jpeg`、`Bmp`、`Gif`、`Tiff`)。PNG 為無損格式,適用於大多數掃描設備。若需要較小的檔案大小且能接受輕微壓縮痕跡,可選擇 JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**特殊情況:** 儲存為 JPEG 時,請確保品質參數設定適當(預設為 90)。品質過低會使小模組模糊,導致條碼無法辨識。 + +## 完整、可執行的範例 + +將所有步驟整合起來,以下是一個單一檔案,您可以直接複製到新的 Console 專案中並立即執行: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**預期輸出:** 執行程式後,`output` 資料夾會包含三個檔案: + +* `DatabarCols4.png` – 具有 4 列的條碼(寬)。 +* `DatabarRows3.png` – 具有 3 行的條碼(高)。 +* `DatabarRows3.jpg` – 3 行條碼的 JPEG 版本。 + +在圖像檢視器中開啟任一 PNG 檔案,您應該會看到清晰的 Databar Expanded Stacked 條碼,已可供掃描。 + +## 常見問題與疑難排解 + +| Question | Answer | +|----------|--------| +| *如果圖像模糊怎麼辦?* | 確認您使用 PNG 以獲得無損輸出。若需要 JPEG,請提升品質設定(`new JpegOptions { Quality = 95 }`)。 | +| *我可以更改條碼文字嗎?* | 可以——將 `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")` 的第二個參數替換為您想要的文字。 | +| *列與行可以同時使用嗎?* | 可以同時設定;只需在呼叫 `Save` 前同時設定 `DataBar.Columns` 與 `DataBar.Rows`。 | +| *目錄深度有上限嗎?* | 路徑必須符合作業系統的規範。使用 `Path.Combine` 可確保跨平台安全。 | + +## 結論 + +您現在已了解如何 **how to set columns** for a Databar Expanded Stacked 條碼、如何 **how to set rows**,以及如何 **how to generate barcode** 圖像,並可將其 **barcode save file** 為 PNG 或 JPEG 格式。完整範例展示了從函式庫安裝到最終檔案驗證的每一步驟。 + +接下來,您可以探索: + +* **how to generate barcode** 搭配 QR Code 的錯誤更正等級。 +* **barcode save file** 的向量格式選項,如 SVG 或 PDF。 +* 將產生的條碼整合至 ASP.NET Core MVC 視圖,以實現動態標籤列印。 + +隨意嘗試不同的列/行組合、圖像格式與條碼內容,以符合您專案的規格。祝開發愉快! + +## 接下來該學什麼? + +以下教學涵蓋與本指南密切相關的主題,並在此基礎上延伸。每個資源皆提供完整可執行的程式碼範例與逐步說明,協助您精通其他 API 功能,並在專案中探索替代實作方式。 + +- [如何產生條碼 - 一維條碼類型](/barcode/english/net/one-dimensional-barcode-types/) +- [如何產生條碼 – Code 39 設定與 Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [如何產生 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/hungarian/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/hungarian/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..7772b9bcf --- /dev/null +++ b/barcode/hungarian/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: Készíts gyorsan DataBar stacked vonalkódot C#-ban. Tanuld meg beállítani + az X-dimenziót, módosítani az oldalarányt, és PNG-fájlokat exportálni a DataBar + Stacked Omnidirectional generátorral. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: hu +lastmod: 2026-08-06 +og_description: Készítsen databar stacked vonalkódot C#-ban az Aspose.BarCode segítségével. + Ez az útmutató bemutatja, hogyan állítható be az X-dimenzió, hogyan változtatható + meg a képarány, és hogyan menthetők PNG képek. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Databar stacked vonalkód létrehozása C#‑ban – teljes programozási útmutató +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Databar stacked vonalkód készítése C#-ban – lépésről lépésre útmutató +url: /hu/python-java/general/create-databar-stacked-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 stacked vonalkód létrehozása C#‑ban – lépésről‑lépésre útmutató + +Ha C#‑ban **databar stacked vonalkód** képeket kell létrehoznod, ez az útmutató pontosan megmutatja, hogyan teheted ezt meg az Aspose.BarCode könyvtár segítségével. Megtanulod beállítani az X dimenziót, módosítani a vonalkód képarányát, és elmenteni az eredményt PNG fájlokként – mindezt néhány tömör lépésben. + +DataBar Stacked vonalkód generálása gyakori, amikor GS1‑128 adatot kell kódolni kiskereskedelmi beolvasáshoz vagy logisztikai nyomon követéshez. Az alábbi szakaszokban mindent lefedünk a projekt beállításától a kimenet ellenőrzéséig, így a megoldást bármely .NET alkalmazásba integrálhatod anélkül, hogy bármit is kihagynál. + +## Előfeltételek + +* **.NET 6.0** (vagy újabb) telepítve – a kód a modern SDK‑ra céloz. +* **Licencelt** példány a **Aspose.BarCode for .NET**‑ből. Az ingyenes értékelő verzió teszteléshez működik, de vízjelet ad hozzá. +* Olyan IDE, mint a **Visual Studio 2022** vagy a **VS Code** a C# kiegészítővel. +* Alapvető ismeretek a **C#** szintaxisról és a GS1 Alkalmazási Azonosítók koncepciójáról. + +> **Pro tipp:** Ha a NuGet csomagkezelőt használod, a `dotnet add package Aspose.BarCode` parancs automatikusan megoldja az összes függőséget. + +## 1. lépés: Új konzolprojekt létrehozása + +Nyiss egy terminált vagy a Package Manager Console‑t, és futtasd: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +A `dotnet new console` parancs egy minimális **Program.cs** fájlt hoz létre. Az **Aspose.BarCode** csomag hozzáadása elérhetővé teszi a `BarcodeGenerator` osztályt. + +## 2. lépés: A DataBar Stacked Omnidirectional generátor inicializálása + +Nyisd meg a **Program.cs** fájlt, és cseréld le az alapértelmezett tartalmat a következő kóddal. Az első sor egy **BarcodeGenerator**‑t hoz létre, amely a **DataBar Stacked Omnidirectional** szimbólumra van konfigurálva, és egy GS1‑128 payload‑ot ad meg. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Miért fontos:** A `EncodeTypes.DatabarStackedOmniDirectional` enum érték azt mondja a könyvtárnak, hogy **databar stacked vonalkód**-ot állítson elő, ami a DataBar omnidirekcionális család stacked változata. Ez a szimbólum legfeljebb 14 numerikus karaktert képes tárolni, így ideális GTIN‑14 kódokhoz. + +## 3. lépés: Az X dimenzió beállítása (modul szélesség) + +Az X dimenzió szabályozza a legkisebb vonal (a modul) szélességét. A túl kicsi érték rosszul jelenhet meg alacsony felbontású nyomtatókon, míg a túl nagy érték meghaladhatja a címke helyét. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tipp:** A `Pixels` tulajdonság kényelmes képernyőalapú teszteléshez. Nyomtatásra fókuszáló esetekben használd inkább a `generator.Parameters.Barcode.XDimension.Millimeters`‑t. + +## 4. lépés: A képarány módosítása és az első kép mentése + +A **képarány** befolyásolja a stacked vonalkód magasság‑szélesség arányát. A DataBar Stacked Omnidirectional típus 10‑30 közötti arányokat támogat. Két képet fogunk generálni, hogy bemutassuk a vizuális hatást. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +A `generator.Save` hívás egy **PNG** fájlt ír a jelenlegi munkakönyvtárba. A `BarCodeImageFormat.Png` enum veszteségmentes tömörítést biztosít, ami ideális további feldolgozáshoz vagy PDF‑ekbe ágyazáshoz. + +## 5. lépés: A képarány 30‑ra változtatása és a második kép mentése + +Most a stacked vonalak magasságát növeljük a képarány **30**‑ra változtatásával. Ez magasabb vonalkódot eredményez anélkül, hogy az X dimenziót módosítaná. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +A program futtatása most két PNG fájlt hoz létre: + +* **DatabarAspectRatio15.png** – egy kompakt vonalkód, amely kis címkékhez alkalmas. +* **DatabarAspectRatio30.png** – egy magasabb vonalkód, amely javítja a beolvasás megbízhatóságát alacsony kontrasztú felületeken. + +A képeket bármely megjelenítővel megnyithatod, hogy ellenőrizd, a vonalak helyesen vannak-e stacked, és hogy a kódolt adat megegyezik-e az eredeti GS1 karakterlánccal. + +## 6. lépés: A kódolt érték ellenőrzése (opcionális) + +Ha meg kell erősítened, hogy a vonalkód valóban a bemeneti karakterláncot reprezentálja, dekódolhatod ugyanazzal a könyvtárral: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +A dekódernek a `(01)12345678901231` értéket kell kiadnia, bizonyítva, hogy a **databar stacked vonalkód létrehozása** folyamat megőrizte az adatot. + +## Gyakori buktatók és hogyan kerüld el őket + +| Probléma | Miért fordul elő | Megoldás | +|----------|------------------|----------| +| A vonalkód elmosódott | Az X dimenzió túl alacsonyra van beállítva a kimeneti felbontáshoz | Növeld a `XDimension.Pixels` értékét, vagy nyomtatáshoz használd a `Millimeters`‑t | +| A szkenner azt jelzi, hogy “szimbólum nem található” | A képarány kívül esik a támogatott 10‑30 tartományon | Tartsd a képarányt 10 és 30 között; a 15 és 30 biztonságos alapértelmezések | +| A PNG vízjelet tartalmaz | Az Aspose.BarCode ingyenes értékelő licencének használata | Vásárolj teljes licencet, vagy csak teszteléshez használd a próbaverziót | +| A dekódolás sikertelen a második képen | A dekódert a helytelen szimbólumra konfigurálták | Használd a `DecodeType.DatabarStackedOmniDirectional`‑t stacked vonalkódok olvasásakor | + +## Következő lépések + +Most, hogy képes vagy **databar stacked vonalkód** képeket létrehozni, esetleg a következőket szeretnéd: + +* **A PNG‑ket PDF számlákba ágyazni** egy PDF könyvtár, például az **Aspose.PDF** segítségével. +* **Vonalkódok generálása menet közben egy web API‑ban** – a PNG bájtokat közvetlenül egy ASP.NET Core vezérlőből adja vissza. +* **Kísérletezni más DataBar változatokkal** (pl. `DatabarExpanded`, `DatabarLimited`) az `EncodeTypes` enum módosításával. +* **Színek beállítása** a `generator.Parameters.Barcode.ForeColor` és `BackColor` beállításával a márkaspecifikus tervezéshez. + +Ezek a témák mind ugyanazokra az alapvető koncepciókra épülnek, amelyeket itt bemutattunk: a `BarcodeGenerator` inicializálása, a vizuális paraméterek konfigurálása, és az eredmény mentése a `BarCodeImageFormat`‑tal. + +--- + +### Következtetés + +Ez az útmutató bemutatta, hogyan lehet **databar stacked vonalkód** képeket létrehozni C#‑ban az Aspose.BarCode használatával. Megtanultad beállítani az **X dimenziót**, módosítani a **vonalkód képarányát**, és exportálni az eredményt **PNG** fájlokként a `BarcodeGenerator`‑rel. Az opcionális dekódolási lépéssel ellenőrizheted is, hogy a kódolt GS1 adatok pontosak-e. Alkalmazd ezeket a mintákat saját készletkezelési, szállítási vagy értékesítési alkalmazásaidban, és fedezd fel a könyvtár által kínált számos testreszabási lehetőséget. Boldog kódolást! + +## Mit érdemes legközelebb megtanulni? + +A következő útmutatók 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. + +- [Egy-dimenziós Databar vonalkód magasság beállítása](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Vonalkód kép generálása – GS1 Kupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/hungarian/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..6ec9d3017 --- /dev/null +++ b/barcode/hungarian/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: C#-ban generáljon vonalkód képet az Aspose.BarCode segítségével. Tanulja + meg, hogyan generáljon Databar kódot, állítson be egyedi vonalkód méretet, és egyszerű + kóddal változtassa meg a vonalkód magasságát. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: hu +lastmod: 2026-08-06 +og_description: C#-ban generáljon vonalkód képet az Aspose.BarCode segítségével. Ez + az útmutató bemutatja, hogyan hozhat létre Databar Omnidirectional vonalkódot, testreszabhatja + a méretét, és hatékonyan módosíthatja a vonalkód magasságát. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Vonalkód kép generálása C#-ban – teljes Aspose.BarCode útmutató +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Vonalkód kép generálása C#-ban az Aspose.BarCode segítségével +url: /hu/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Barcode kép generálása C#‑ban az Aspose.BarCode‑dal + +Ha **programozottan szeretnél barcode képet** generálni, ez az útmutató pontosan megmutatja, hogyan. Akár egy kiskereskedelmi készletkezelő rendszert, akár egy logisztikai nyomkövető portált építesz, láthatod a teljes munkafolyamatot egy Databar Omnidirectional barcode létrehozásához, méretei beállításához és PNG fájlként való mentéséhez. + +A barcode kép generálása gyakori igény, de a fejlesztők gyakran kérdezik, **hogyan generáljunk Databar‑t** a pontos mérettel. Ebben a tutorialban megtanulod, hogyan hozhatsz létre egy Databar barcode‑t, testreszabhatod a szélességét és magasságát, anélkül hogy újraírnád az egész generátort. + +## Előfeltételek + +Mielőtt elkezdenéd, győződj meg róla, hogy a következők rendelkezésre állnak: + +* .NET 6.0 SDK vagy újabb (a kód működik .NET Core‑dal és .NET Framework‑kel is) +* Visual Studio 2022 (vagy bármely C#‑ot támogató IDE) +* Érvényes Aspose.BarCode for .NET licenc (az ingyenes értékelő verzió teszteléshez megfelelő) +* Alapvető C# szintaxis ismeret + +## 1. lépés: Aspose.BarCode telepítése + +Add hozzá az Aspose.BarCode NuGet csomagot a projektedhez: + +```bash +dotnet add package Aspose.BarCode +``` + +A csomag tartalmazza a `BarcodeGenerator` osztályt, amelyet a tutorial során használunk. A telepítés után állítsd vissza a projektet a függőségek lehúzásához. + +## 2. lépés: Alap barcode generátor létrehozása + +Az első kódsor egy **barcode generátort** hoz létre, amely egy Databar Omnidirectional szimbólumot állít elő. Az `EncodeTypes.DatabarOmniDirectional` enum megmondja a könyvtárnak, melyik szimbólumot használja, a data string pedig a GS1 Application Identifier szintaxisát követi. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Miért fontos:** A `BarcodeGenerator` objektum a belépési pont minden barcode művelethez. A `DatabarOmniDirectional` kiválasztásával biztosítod, hogy a kimenet megfeleljen a GS1 kiskereskedelmi szkennelési szabványnak. + +## 3. lépés: Egyedi X‑dimenzió (modul szélesség) beállítása + +Az X‑dimenzió szabályozza a legkeskenyebb vonal szélességét. Kis pixel érték beállítása kompakt barcode‑t eredményez, míg nagyobb értékek növelik a teljes szélességet. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Magyarázat:** A 2‑pixel X‑dimenzió gyakori választás nagy felbontású képernyőkön. Állítsd ezt az értéket, ha szorosabb vagy lazább vizuális sűrűségre van szükséged. + +## 4. lépés: Az első barcode kép generálása meghatározott magassággal + +A barcode magassága független az X‑dimenziótól. Itt a vonalmagasságot **30 px**‑re állítjuk, majd PNG‑ként mentjük a képet. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Eredmény:** Most már van egy `DatabarBarHeight30Pixels.png` nevű fájlod, amely egy 30 px magas Databar barcode‑t mutat. Ez demonstrálja a **testreszabott barcode méret** lehetőségét egy konkrét felhasználási esethez, például egy kis címkéhez. + +## 5. lépés: Barcode magasság módosítása nagyobb verzióhoz + +Ha ugyanaz a barcode egy nagyobb címkén kell megjelenjen, csak a magasság tulajdonságot kell módosítanod, és újra felhasználhatod a már létező generátor példányt. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Miért használhatod újra a generátort:** A `BarHeight.Pixels` módosítása frissíti a belső elrendezést anélkül, hogy új objektumot hoznál létre, ez memóriahatékony, és a data string érintetlen marad. Ez a javasolt módja a **barcode magasság** dinamikus változtatásának. + +## 6. lépés: Az eredmény ellenőrzése + +Nyisd meg a két PNG fájlt bármely képnézőben. Két Databar Omnidirectional barcode‑t kell látnod, amelyek ugyanazt a GTIN‑t kódolják, de függőleges méretük különbözik: + +* `DatabarBarHeight30Pixels.png` – 30 px magas, alkalmas kompakt nyugtákhoz. +* `DatabarBarHeight60Pixels.png` – 60 px magas, ideális nagyobb polcról nyíló címkékhez. + +Mindkét kép ugyanazt az X‑dimenziót tartja meg, így a vonal‑szóköz arány konzisztens, csak a teljes magasság skálázódik. + +## Gyakori variációk és szélhelyzetek + +| Helyzet | Hogyan kezeljük | +|-----------|------------------| +| **Másik barcode szimbólum** | Cseréld le a `EncodeTypes.DatabarOmniDirectional`‑t egy másik enum értékre (pl. `EncodeTypes.Code128`). A kód többi része változatlan marad. | +| **Nem pixel alapú méretek** | Használd a `generator.Parameters.Barcode.XDimension.Millimeters` vagy `BarHeight.Millimeters` értékeket, ha nyomtatásra kész fizikai mérésekre van szükség. | +| **Átlátszó háttér** | Állítsd be a `generator.Parameters.ImageBackgroundColor = Color.Transparent;` sort a `Save` hívása előtt. | +| **Nagy felbontású kimenet** | Növeld arányosan mind az `XDimension.Pixels`, mind a `BarHeight.Pixels` értékét, vagy mentsd `BarCodeImageFormat.Tiff`‑ként a veszteségmentes minőségért. | +| **Több barcode egy képen** | Hozz létre külön `BarcodeGenerator` példányokat, rendereld őket egy `Bitmap`‑re, majd kombináld őket a `Graphics.DrawImage` segítségével. | + +**Pro tipp:** Mindig teszteld a generált barcode‑t egy valós szkennerrel, mielőtt éles környezetbe helyeznéd. A szkennerek a nagyon vékony vonalakat a megvilágítás és a szenzor minősége függvényében másként értelmezhetik. + +## Teljes forráskód referenciaként + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Másold a kódot egy új konzolprojektbe, futtasd, és a két PNG fájl megjelenik a kimeneti mappában. + +## Gyakran ismételt kérdések + +**K: Generálhatok barcode‑t licenc telepítése nélkül?** +V: Az Aspose.BarCode értékelő verziója licenc nélkül működik, de kis vízjelet ad hozzá. Termeléshez alkalmazz vásárolt licencet a `License license = new License(); license.SetLicense("Aspose.BarCode.lic");` kóddal. + +**K: Befolyásolja az X‑dimenzió változtatása a olvashatóságot?** +V: Igen. Nagyon kicsi X‑dimenziók a alacsony felbontású nyomtatókon olvashatatlanná tehetik a barcode‑t. Minimum 1 px képernyőre, nyomtatásra pedig legalább 0,25 mm ajánlott. + +**K: Hogyan generálhatok barcode‑t JPEG formátumban?** +V: Cseréld le a `BarCodeImageFormat.Png`‑t `BarCodeImageFormat.Jpeg`‑re. Emellett beállíthatod a `generator.Parameters.ImageQuality`‑t a tömörítés szabályozásához. + +## Összegzés + +Most már tudod, hogyan **generálj barcode képet** C#‑ban az Aspose.BarCode‑dal, hogyan **hozz létre Databar barcode‑t**, hogyan állíts be **testreszabott barcode méretet**, és hogyan **változtasd meg a barcode magasságát** igény szerint. A teljes példa bemutatja a leggyakoribb munkafolyamatot, a variációs táblázat pedig felkészít a valós életbeli szélhelyzetek kezelésére. + +Ezután fedezd fel a kapcsolódó témákat, mint a **barcode‑k beágyazása PDF dokumentumokba**, **tömeges barcode generálás**, és **QR kódok használata mobil fizetésekhez**. Mindegyik szituáció az itt bemutatott elvekre épül, így magabiztosan bővítheted a tudásodat. + +Boldog kódolást, és legyenek a barcode‑jaid hibátlanul olvashatóak! + +## Mit tanulj meg legközelebb? + +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 komplett, működő kódrészleteket és lépésről‑lépésre magyarázatokat tartalmaz, hogy könnyedén elsajátíthasd az API további funkcióit és alternatív megvalósítási megközelítéseket a saját projektjeidben. + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/hungarian/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..7069ade15 --- /dev/null +++ b/barcode/hungarian/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Hogyan állítsuk be az oszlopokat egy Databar Expanded Stacked vonalkódhoz, + és tanuljuk meg, hogyan generáljunk vonalkód képeket, állítsunk be sorokat, valamint + hogyan mentsük el a vonalkód fájlt C#‑ban. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: hu +lastmod: 2026-08-06 +og_description: Hogyan állítsuk be az oszlopokat egy Databar Expanded Stacked vonalkódhoz, + és gyorsan megtanuljuk, hogyan generáljunk vonalkódképeket, állítsunk be sorokat, + valamint mentsük el a vonalkód fájlt az Aspose.Barcode segítségével. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Hogyan állítsuk be az oszlopokat egy Databar Expanded Stacked vonalkódhoz + – lépésről lépésre C# útmutató +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Hogyan állítsuk be az oszlopokat egy Databar Expanded Stacked vonalkódhoz – + teljes C# útmutató +url: /hu/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Hogyan állítsuk be az oszlopokat egy Databar Expanded Stacked vonalkódhoz – teljes C# útmutató + +Ha **hogyan állítsuk be az oszlopokat** egy Databar Expanded Stacked vonalkódhoz, ez a bemutató pontos lépéseket mutat. Akár kiskereskedelmi címkézési rendszert, akár logisztikai alkalmazást építesz, az oszlopok és sorok vezérlése lehetővé teszi a vonalkód méretének és a beolvasási megbízhatóság finomhangolását. Emellett megmutatjuk, **hogyan generáljunk vonalkód** képeket, állítsuk be a sorok számát, és helyesen **vonalkód fájl mentése** a lemezre. + +Ez az útmutató a következőket mutatja be: + +* Az Aspose.Barcode for .NET könyvtár telepítése. +* A Databar Expanded Stacked típusú vonalkódgenerátor létrehozása. +* Az oszlopszám, sorok száma és kéformátum beállítása. +* A létrehozott PNG fájlok mentése a kiválasztott könyvtárba. + +Előzetes tapasztalat az Aspose.Barcode használatában nem szükséges – csak egy alap C# fejlesztői környezet. + +## Előkövetelmények + +Mielőtt elkezdenéd, győződj meg róla, hogy rendelkezel: + +* .NET 6.0 SDK vagy újabb telepítve. +* Visual Studio 2022 (vagy bármely .NET‑et támogató IDE). +* NuGet hivatkozás az **Aspose.Barcode** csomagra (`dotnet add package Aspose.Barcode`). + +Minden kódrészlet a default konzolos projekt sablonnal fordítható. + +## 1. lépés: Vonalkódgenerátor létrehozása a Databar Expanded Stacked típushoz + +Az első művelet a `BarcodeGenerator` példányosítása a `EncodeTypes.DatabarExpandedStacked` enumerációval. Ez állítja be az alapértelmezett elrendezést (stacked) és előkészíti az objektumot a további konfigurációhoz. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Miért fontos:** A generátor tárolja az összes megjelenítési paramétert. A `DatabarExpandedStacked` kiválasztásával a könyvtár a stacked elrendezést használja, ami az egyetlen elrendezés, amely támogatja az oszlop‑ és sor‑beállításokat. + +## Hogyan állítsuk be az oszlopokat egy Databar Expanded Stacked vonalkódhoz + +Miután a generátor létezik, vezérelheted az oszlopszámot. A `DataBar.Columns` tulajdonság egy 1 és 4 közötti egész számot fogad el. **4** beállítása a legszélesebb lehetséges vonalkódot hozza létre, miközben még a stacked elrendezésbe illeszkedik. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Gyakorlati tipp:** A maximális oszlopszámot csak akkor használd, ha elegendő fehér hely áll rendelkezésre a címkén. Túl sok oszlop egy kis címkén beolvasási problémákat okozhat. + +## Hogyan generáljunk vonalkód képeket és mentjük őket + +Az oszlopok beállítása után renderelned kell a vonalkódot, és a képet lemezre írni. A `Save` metódus egy fájlútvonalat és egy képképformátum enumerációt vár. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +A `output` mappának léteznie kell, különben a hívás kivételt dob. Programból létrehozhatod a `Directory.CreateDirectory("output");` paranccsal, ha szeretnéd. + +## Hogyan állítsuk be a sorokat egy Databar Expanded Stacked vonalkódhoz + +A sorok hasonlóan működnek, mint az oszlopok, de a vonalkód moduljainak függőleges halmozását befolyásolják. A `DataBar.Rows` tulajdonság 1‑től 5‑ig terjedő értékeket fogad el. Ebben a példában **3** sort használunk. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Miért fontosak a sorok:** A sorok hozzáadása növeli a vonalkód magasságát, ami hasznos lehet nagy sűrűségű címkéknél, ahol több adatmodulra van szükség a szélesség növelése nélkül. + +## Vonalkód fájl mentése – beállítások és legjobb gyakorlatok + +A `Save` metódus több képképformátumot támogat (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). A PNG veszteségmentes, és a legtöbb beolvasó eszközzel jól működik. Ha kisebb fájlméretre van szükséged, és elviselhető a könnyű tömörítési torzítás, válaszd a JPEG‑et: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Szélsőséges eset:** JPEG‑ként mentéskor győződj meg róla, hogy a minőségi paraméter megfelelően van beállítva (alapértelmezett 90). Alacsony minőség elmoshatja a kis modulokat, így a vonalkód olvashatatlanná válhat. + +## Teljes, futtatható példa + +Mindent összegezve, itt egy egyetlen fájl, amelyet beilleszthetsz egy új konzolos projektbe, és azonnal futtathatsz: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Várt kimenet:** A program futtatása után az `output` mappában három fájl lesz: + +* `DatabarCols4.png` – 4 oszlopos (széles) vonalkód. +* `DatabarRows3.png` – 3 soros (magas) vonalkód. +* `DatabarRows3.jpg` – a 3‑soros vonalkód JPEG verziója. + +Nyisd meg bármelyik PNG fájlt egy képnézőben; tiszta Databar Expanded Stacked vonalkódot kell látnod, amely készen áll a beolvasásra. + +## Gyakori kérdések és hibaelhárítás + +| Kérdés | Válasz | +|----------|--------| +| *Mi a teendő, ha a kép elmosódott?* | Ellenőrizd, hogy PNG‑t használsz-e veszteségmentes kimenethez. JPEG‑nél növeld a minőségi beállítást (`new JpegOptions { Quality = 95 }`). | +| *Megváltoztathatom a vonalkód szövegét?* | Igen – cseréld ki a második argumentumot a `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")` hívásban. | +| *Az oszlopok és sorok együtt működnek?* | Kombinálhatók; csak állítsd be mind a `DataBar.Columns`, mind a `DataBar.Rows` értékét a `Save` hívása előtt. | +| *Van korlátozás a könyvtár mélységére?* | Az útvonalnak érvényesnek kell lennie az operációs rendszer számára. Használd a `Path.Combine`‑t a platform‑független biztonságért. | + +## Következtetés + +Most már tudod, **hogyan állítsuk be az oszlopokat** egy Databar Expanded Stacked vonalkódhoz, **hogyan állítsuk be a sorokat**, és **hogyan generáljunk vonalkód** képeket, amelyeket **vonalkód fájl mentése** PNG vagy JPEG formátumban végezhetsz. A teljes példa bemutatja a szükséges minden lépést, a könyvtár telepítésétől a végső fájl ellenőrzéséig. + +További felfedezések: + +* **hogyan generáljunk vonalkód** hibajavítási szintekkel QR kódokhoz. +* **vonalkód fájl mentése** opciók vektorformátumokhoz, például SVG vagy PDF. +* A generált vonalkódok integrálása ASP.NET Core MVC nézetekbe dinamikus címkenyomtatáshoz. + +Nyugodtan kísérletezz különböző oszlop‑/sor‑kombinációkkal, képképformátumokkal és vonalkód tartalmakkal, hogy megfeleljenek projekted specifikációinak. Boldog kódolást! + +## Mit érdemes legközelebb megtanulni? + +A következő oktatóanyagok szorosan kapcsolódó témákat fednek le, amelyek a jelen útmutató technikáira épülnek. Minden forrás teljesen működő kódrészleteket tartalmaz lépésről‑lépésre magyarázatokkal, hogy elsajátíthasd az API további funkcióit, és alternatív megvalósítási megközelítéseket is felfedezhess saját projektjeidben. + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/indonesian/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..ea84d5339 --- /dev/null +++ b/barcode/indonesian/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: Buat barcode databar bertumpuk dalam C# dengan cepat. Pelajari cara mengatur + dimensi X, menyesuaikan rasio aspek, dan mengekspor file PNG menggunakan generator + DataBar Stacked Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: id +lastmod: 2026-08-06 +og_description: Buat kode batang databar bertumpuk di C# dengan Aspose.BarCode. Tutorial + ini menunjukkan cara mengatur dimensi X, mengubah rasio aspek, dan menyimpan gambar + PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Buat kode batang databar bertumpuk di C# – panduan pemrograman lengkap +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Buat kode batang databar bertumpuk di C# – panduan langkah demi langkah +url: /id/python-java/general/create-databar-stacked-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 databar stacked barcode di C# – panduan langkah demi langkah + +Jika Anda perlu **create databar stacked barcode** gambar di C#, panduan ini menunjukkan secara tepat cara melakukannya menggunakan library Aspose.BarCode. Anda akan belajar mengatur dimensi X, mengubah rasio aspek barcode, dan menyimpan hasilnya sebagai file PNG—semua dalam beberapa langkah singkat. + +Membuat DataBar Stacked barcode umum ketika Anda harus mengkodekan data GS1‑128 untuk pemindaian ritel atau pelacakan logistik. Pada bagian-bagian berikut kami membahas semuanya mulai dari penyiapan proyek hingga verifikasi output, sehingga Anda dapat mengintegrasikan solusi ke dalam aplikasi .NET apa pun tanpa melewatkan detail. + +## Prasyarat + +* **.NET 6.0** (atau lebih baru) terpasang – kode menargetkan SDK modern. +* Salinan **licensed** dari **Aspose.BarCode for .NET**. Evaluasi gratis dapat digunakan untuk pengujian tetapi menambahkan watermark. +* IDE seperti **Visual Studio 2022** atau **VS Code** dengan ekstensi C#. +* Familiaritas dasar dengan sintaks **C#** dan konsep GS1 Application Identifiers. + +> **Pro tip:** Jika Anda menggunakan NuGet package manager, perintah `dotnet add package Aspose.BarCode` menyelesaikan semua dependensi secara otomatis. + +## Langkah 1: Buat proyek konsol baru + +Buka terminal atau Package Manager Console dan jalankan: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +Perintah `dotnet new console` membuat file **Program.cs** minimal. Menambahkan paket **Aspose.BarCode** membuat kelas `BarcodeGenerator` tersedia. + +## Langkah 2: Inisialisasi generator DataBar Stacked Omnidirectional + +Buka **Program.cs** dan ganti konten default dengan kode berikut. Baris pertama membuat **BarcodeGenerator** yang dikonfigurasi untuk simbol **DataBar Stacked Omnidirectional** dan menyediakan payload GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Mengapa ini penting:** Nilai enum `EncodeTypes.DatabarStackedOmniDirectional` memberi tahu library untuk menghasilkan **databar stacked barcode**, yang merupakan varian stacked dari keluarga DataBar omnidirectional. Simbol ini dapat menampung hingga 14 karakter numerik, menjadikannya ideal untuk kode GTIN‑14. + +## Langkah 3: Atur dimensi X (lebar modul) + +Dimensi X mengontrol lebar bar terkecil (modul). Nilai yang terlalu kecil dapat menghasilkan gambar yang buruk pada printer beresolusi rendah, sementara nilai yang terlalu besar dapat melebihi ruang label. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tip:** Properti `Pixels` nyaman untuk pengujian berbasis layar. Untuk skenario fokus cetak, gunakan `generator.Parameters.Barcode.XDimension.Millimeters` sebagai gantinya. + +## Langkah 4: Sesuaikan rasio aspek dan simpan gambar pertama + +Rasio **aspect ratio** memengaruhi hubungan tinggi‑lebar dari barcode stacked. Tipe DataBar Stacked Omnidirectional mendukung rasio dari 10 hingga 30. Kami akan menghasilkan dua gambar untuk menggambarkan dampak visual. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +Pemanggilan `generator.Save` menulis file **PNG** ke direktori kerja saat ini. Enum `BarCodeImageFormat.Png` memastikan kompresi lossless, yang ideal untuk pemrosesan lanjutan atau penyematan dalam PDF. + +## Langkah 5: Ubah rasio aspek menjadi 30 dan simpan gambar kedua + +Sekarang kami meningkatkan tinggi bar stacked dengan mengubah rasio aspek menjadi **30**. Ini membuat barcode lebih tinggi tanpa mengubah dimensi X. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Menjalankan program sekarang menghasilkan dua file PNG: + +* **DatabarAspectRatio15.png** – barcode kompak yang cocok untuk label kecil. +* **DatabarAspectRatio30.png** – barcode lebih tinggi yang meningkatkan keandalan pemindaian pada permukaan berkontras rendah. + +Anda dapat membuka gambar di penampil apa pun untuk memverifikasi bahwa bar terstack dengan benar dan data yang dikodekan cocok dengan string GS1 asli. + +## Langkah 6: Verifikasi nilai yang dikodekan (opsional) + +Jika Anda perlu memastikan bahwa barcode benar-benar mewakili string input, Anda dapat mendekodenya dengan library yang sama: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Dekoder harus menghasilkan `(01)12345678901231`, membuktikan bahwa proses **create databar stacked barcode** mempertahankan data. + +## Kesalahan umum dan cara menghindarinya + +| Masalah | Mengapa terjadi | Solusi | +|-------|----------------|-----| +| Barcode tampak buram | Dimensi X diatur terlalu rendah untuk resolusi output | Tingkatkan `XDimension.Pixels` atau gunakan `Millimeters` untuk pencetakan | +| Pemindai melaporkan “symbol tidak ditemukan” | Rasio aspek di luar rentang 10‑30 yang didukung | Pertahankan rasio antara 10 dan 30; 15 dan 30 adalah nilai default yang aman | +| PNG berisi watermark | Menggunakan lisensi evaluasi gratis Aspose.BarCode | Beli lisensi penuh atau gunakan trial hanya untuk pengujian | +| Dekode gagal pada gambar kedua | Dekoder dikonfigurasi untuk simbol yang salah | Gunakan `DecodeType.DatabarStackedOmniDirectional` saat membaca barcode stacked | + +## Langkah selanjutnya + +Setelah Anda dapat **create databar stacked barcode** gambar, Anda mungkin ingin: + +* **Menyematkan PNG ke dalam faktur PDF** menggunakan library PDF seperti **Aspose.PDF**. +* **Menghasilkan barcode secara langsung dalam web API** – mengembalikan byte PNG langsung dari controller ASP.NET Core. +* **Mencoba varian DataBar lainnya** (mis., `DatabarExpanded`, `DatabarLimited`) dengan mengubah enum `EncodeTypes`. +* **Menyesuaikan warna** dengan mengatur `generator.Parameters.Barcode.ForeColor` dan `BackColor` untuk desain sesuai merek. + +Setiap topik ini dibangun di atas konsep inti yang sama yang dibahas di sini: inisialisasi `BarcodeGenerator`, konfigurasi parameter visual, dan menyimpan hasil dengan `BarCodeImageFormat`. + +--- + +### Kesimpulan + +Tutorial ini menunjukkan cara **create databar stacked barcode** gambar di C# menggunakan Aspose.BarCode. Anda belajar mengatur **dimensi X**, memodifikasi **rasio aspek barcode**, dan mengekspor hasil sebagai file **PNG** dengan `BarcodeGenerator`. Dengan langkah dekode opsional, Anda juga dapat memverifikasi bahwa data GS1 yang dikodekan akurat. Terapkan pola ini ke inventaris, pengiriman, atau aplikasi point‑of‑sale Anda, dan jelajahi banyak opsi kustomisasi yang disediakan library. Selamat coding! + +## Apa yang Harus Anda Pelajari Selanjutnya? + +Tutorial berikut mencakup topik terkait erat yang dibangun di atas teknik yang ditunjukkan dalam panduan ini. Setiap sumber mencakup 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. + +- [Penyesuaian Tinggi Barcode Databar Satu Dimensi](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Hasilkan gambar barcode – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/indonesian/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..411523b74 --- /dev/null +++ b/barcode/indonesian/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: Hasilkan gambar barcode di C# menggunakan Aspose.BarCode. Pelajari cara + menghasilkan Databar, menyesuaikan ukuran barcode khusus, dan mengubah tinggi barcode + dengan kode sederhana. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: id +lastmod: 2026-08-06 +og_description: Hasilkan gambar barcode dalam C# dengan Aspose.BarCode. Tutorial ini + menunjukkan cara membuat barcode Databar Omnidirectional, menyesuaikan ukurannya, + dan mengubah tinggi barcode secara efisien. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Buat gambar barcode di C# – panduan lengkap Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Buat gambar barcode di C# dengan Aspose.BarCode +url: /id/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Menghasilkan gambar barcode di C# dengan Aspose.BarCode + +Jika Anda perlu **menghasilkan gambar barcode** secara programatik, panduan ini menunjukkan cara melakukannya secara tepat. Baik Anda sedang membangun sistem inventaris ritel maupun portal pelacakan logistik, Anda akan melihat alur kerja lengkap untuk membuat barcode Databar Omnidirectional, menyesuaikan dimensinya, dan menyimpan hasilnya sebagai file PNG. + +Menghasilkan gambar barcode adalah kebutuhan umum, tetapi para pengembang sering bertanya **bagaimana cara menghasilkan Databar** dengan ukuran tepat yang mereka butuhkan. Dalam tutorial ini Anda akan belajar membuat barcode Databar, menyesuaikan lebar dan tinggi, serta mengubah tinggi barcode tanpa menulis ulang seluruh generator. + +## Prasyarat + +Sebelum memulai, pastikan Anda memiliki: + +* .NET 6.0 SDK atau yang lebih baru (kode ini bekerja dengan .NET Core dan .NET Framework) +* Visual Studio 2022 (atau IDE apa pun yang mendukung C#) +* Lisensi Aspose.BarCode for .NET yang valid (versi evaluasi gratis dapat digunakan untuk pengujian) +* Familiaritas dasar dengan sintaks C# + +## Langkah 1: Instal Aspose.BarCode + +Tambahkan paket NuGet Aspose.BarCode ke proyek Anda: + +```bash +dotnet add package Aspose.BarCode +``` + +Paket ini berisi kelas `BarcodeGenerator` yang digunakan sepanjang tutorial ini. Setelah instalasi, pulihkan proyek untuk mengambil dependensi. + +## Langkah 2: Buat generator barcode dasar + +Baris kode pertama membuat **generator barcode** yang akan menghasilkan simbol Databar Omnidirectional. Enum `EncodeTypes.DatabarOmniDirectional` memberi tahu perpustakaan simbol apa yang akan digunakan, dan string data mengikuti sintaks GS1 Application Identifier. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Mengapa ini penting:** Objek `BarcodeGenerator` adalah titik masuk untuk setiap operasi barcode. Dengan memilih `DatabarOmniDirectional` Anda memastikan output mematuhi standar GS1 untuk pemindaian ritel. + +## Langkah 3: Atur X‑dimension khusus (lebar modul) + +X‑dimension mengontrol lebar bar paling sempit. Menetapkannya ke nilai piksel kecil menghasilkan barcode yang kompak, sementara nilai yang lebih besar meningkatkan lebar keseluruhan. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Penjelasan:** X‑dimension 2 piksel adalah pilihan umum untuk layar beresolusi tinggi. Sesuaikan nilai ini jika Anda memerlukan kepadatan visual yang lebih rapat atau lebih longgar. + +## Langkah 4: Hasilkan gambar barcode pertama dengan tinggi tertentu + +Tinggi barcode bersifat independen dari X‑dimension. Di sini kita mengatur tinggi bar menjadi **30 px**, lalu menyimpan gambar sebagai PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Hasil:** Sekarang Anda memiliki file bernama `DatabarBarHeight30Pixels.png` yang menampilkan barcode Databar setinggi 30 px. Ini menunjukkan kemampuan **ukuran barcode khusus** untuk kasus penggunaan tertentu seperti label kecil. + +## Langkah 5: Ubah tinggi barcode untuk versi yang lebih besar + +Jika barcode yang sama harus muncul pada label yang lebih besar, Anda hanya perlu memodifikasi properti tinggi dan menggunakan kembali instance generator yang sama. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Mengapa Anda dapat menggunakan kembali generator:** Mengubah `BarHeight.Pixels` memperbarui tata letak internal tanpa membuat ulang objek, yang menghemat memori dan menjaga string data tetap utuh. Ini adalah cara yang disarankan untuk **mengubah tinggi barcode** secara dinamis. + +## Langkah 6: Verifikasi output + +Buka kedua file PNG di penampil gambar apa pun. Anda harus melihat dua barcode Databar Omnidirectional yang mengkodekan GTIN yang sama tetapi berbeda dalam ukuran vertikal: + +* `DatabarBarHeight30Pixels.png` – setinggi 30 px, cocok untuk struk kompak. +* `DatabarBarHeight60Pixels.png` – setinggi 60 px, ideal untuk label rak yang lebih besar. + +Kedua gambar mempertahankan X‑dimension yang sama, sehingga rasio bar‑to‑space tetap konsisten sementara tinggi keseluruhan berubah skala. + +## Variasi umum dan kasus tepi + +| Situasi | Cara menanganinya | +|-----------|------------------| +| **Simbol barcode yang berbeda** | Ganti `EncodeTypes.DatabarOmniDirectional` dengan nilai enum lain (misalnya `EncodeTypes.Code128`). Sisanya tetap tidak berubah. | +| **Dimensi bukan piksel** | Gunakan `generator.Parameters.Barcode.XDimension.Millimeters` atau `BarHeight.Millimeters` jika Anda memerlukan ukuran fisik untuk output siap cetak. | +| **Latar belakang transparan** | Set `generator.Parameters.ImageBackgroundColor = Color.Transparent;` sebelum memanggil `Save`. | +| **Output resolusi tinggi** | Tingkatkan baik `XDimension.Pixels` maupun `BarHeight.Pixels` secara proporsional, atau simpan sebagai `BarCodeImageFormat.Tiff` untuk kualitas lossless. | +| **Beberapa barcode dalam satu gambar** | Buat instance `BarcodeGenerator` terpisah, render masing‑masing ke `Bitmap`, lalu gabungkan menggunakan `Graphics.DrawImage`. | + +**Tips pro:** Selalu uji barcode yang dihasilkan dengan pemindai nyata sebelum diterapkan ke produksi. Pemindai dapat menafsirkan bar yang sangat tipis secara berbeda tergantung pada pencahayaan dan kualitas sensor. + +## Kode sumber lengkap untuk referensi + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Salin kode ke proyek konsol baru, jalankan, dan Anda akan melihat dua file PNG muncul di folder output. + +## Pertanyaan yang sering diajukan + +**T: Bisakah saya menghasilkan barcode tanpa memasang lisensi?** +J: Versi evaluasi Aspose.BarCode dapat digunakan tanpa lisensi tetapi menambahkan watermark kecil. Untuk penggunaan produksi, terapkan lisensi yang dibeli dengan `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**T: Apakah mengubah X‑dimension memengaruhi keterbacaan?** +J: Ya. X‑dimension yang sangat kecil dapat membuat barcode tidak terbaca pada printer beresolusi rendah. Minimum 1 px untuk rendering layar disarankan; untuk cetak, gunakan setidaknya 0.25 mm. + +**T: Bagaimana jika saya perlu menghasilkan barcode dalam format JPEG?** +J: Ganti `BarCodeImageFormat.Png` dengan `BarCodeImageFormat.Jpeg`. Anda juga dapat mengatur `generator.Parameters.ImageQuality` untuk mengontrol kompresi. + +## Kesimpulan + +Anda kini tahu cara **menghasilkan gambar barcode** di C# menggunakan Aspose.BarCode, cara **membuat barcode Databar**, menyesuaikan **ukuran barcode khusus**, dan **mengubah tinggi barcode** sesuai kebutuhan. Contoh lengkap memperlihatkan alur kerja paling umum, dan tabel variasi mempersiapkan Anda menghadapi kasus tepi dunia nyata. + +Selanjutnya, jelajahi topik terkait seperti **menyematkan barcode dalam dokumen PDF**, **menghasilkan batch barcode**, dan **menggunakan QR code untuk pembayaran seluler**. Setiap skenario tersebut dibangun di atas prinsip yang sama yang dibahas di sini, sehingga Anda dapat memperluas pengetahuan ini dengan percaya diri. + +Selamat coding, semoga barcode Anda selalu ter-scan dengan sempurna! + +## Apa yang Harus Anda Pelajari Selanjutnya? + +Tutorial berikut mencakup topik yang sangat terkait dan membangun teknik yang ditunjukkan dalam panduan ini. Setiap sumber menyertakan contoh kode lengkap dengan penjelasan langkah demi langkah untuk membantu Anda menguasai fitur API tambahan dan mengeksplorasi pendekatan implementasi alternatif dalam proyek Anda. + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/indonesian/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..80283ab4f --- /dev/null +++ b/barcode/indonesian/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Cara mengatur kolom untuk barcode Databar Expanded Stacked dan mempelajari + cara menghasilkan gambar barcode, mengatur baris, serta menyimpan file barcode dalam + C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: id +lastmod: 2026-08-06 +og_description: Cara mengatur kolom untuk barcode Databar Expanded Stacked dan dengan + cepat mempelajari cara menghasilkan gambar barcode, mengatur baris, serta menyimpan + file barcode dengan Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Cara mengatur kolom untuk barcode Databar Expanded Stacked – panduan langkah + demi langkah C# +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Cara mengatur kolom untuk barcode Databar Expanded Stacked – panduan lengkap + C# +url: /id/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Cara mengatur kolom untuk Databar Expanded Stacked barcode – panduan lengkap C# + +Jika Anda perlu **how to set columns** untuk barcode Databar Expanded Stacked, tutorial ini menunjukkan langkah‑langkah tepatnya. Baik Anda membangun sistem pelabelan ritel atau aplikasi logistik, mengontrol kolom dan baris memungkinkan Anda menyesuaikan ukuran barcode dan keandalan pemindaian. Selain itu, Anda akan melihat **how to generate barcode** gambar, menyesuaikan jumlah baris, dan dengan benar **barcode save file** ke disk. + +Panduan ini akan memandu Anda melalui: + +* Menginstal pustaka Aspose.Barcode untuk .NET. +* Membuat generator barcode untuk tipe Databar Expanded Stacked. +* Menetapkan jumlah kolom, jumlah baris, dan format gambar. +* Menyimpan file PNG yang dihasilkan ke direktori pilihan. + +Tidak diperlukan pengalaman sebelumnya dengan Aspose.Barcode—hanya lingkungan pengembangan C# dasar. + +## Prasyarat + +Sebelum Anda mulai, pastikan Anda memiliki: + +* .NET 6.0 SDK atau yang lebih baru terinstal. +* Visual Studio 2022 (atau IDE apa pun yang mendukung .NET). +* Referensi NuGet ke **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Semua potongan kode dapat dikompilasi dengan templat proyek konsol default. + +## Langkah 1: Buat generator barcode untuk Databar Expanded Stacked + +Operasi pertama adalah menginstansiasi `BarcodeGenerator` dengan enum `EncodeTypes.DatabarExpandedStacked`. Ini menetapkan tata letak default (stacked) dan menyiapkan objek untuk konfigurasi lebih lanjut. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Why this matters:** Generator menyimpan semua parameter rendering. Dengan memilih `DatabarExpandedStacked` Anda memberi tahu pustaka untuk menggunakan tata letak stacked, satu‑satunya tata letak yang mendukung penyesuaian kolom dan baris. + +## Cara mengatur kolom untuk barcode Databar Expanded Stacked + +Sekarang generator sudah ada, Anda dapat mengontrol jumlah kolom. Properti `DataBar.Columns` menerima bilangan bulat antara 1 dan 4. Menetapkannya ke **4** menghasilkan barcode seluas mungkin sambil tetap cocok dengan tata letak stacked. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Practical tip:** Gunakan jumlah kolom maksimum hanya ketika Anda memiliki cukup ruang putih pada label. Terlalu banyak kolom pada label kecil dapat menyebabkan masalah pemindaian. + +## Cara menghasilkan gambar barcode dan menyimpannya + +Setelah mengonfigurasi kolom, Anda perlu merender barcode dan menulis gambar ke disk. Metode `Save` menerima jalur file dan enum format gambar. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Folder `output` harus ada atau pemanggilan akan melempar pengecualian. Anda dapat membuatnya secara programatis dengan `Directory.CreateDirectory("output");` jika diinginkan. + +## Cara mengatur baris untuk barcode Databar Expanded Stacked + +Baris bekerja mirip dengan kolom, tetapi memengaruhi penumpukan vertikal modul barcode. Properti `DataBar.Rows` menerima nilai dari 1 hingga 5. Dalam contoh ini kami menggunakan **3** baris. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Why rows matter:** Menambahkan baris meningkatkan tinggi barcode, yang dapat berguna untuk label ber‑densitas tinggi di mana Anda memerlukan lebih banyak modul data tanpa memperlebar barcode. + +## Opsi penyimpanan file barcode dan praktik terbaik + +Metode `Save` mendukung beberapa format gambar (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG bersifat lossless dan bekerja baik untuk kebanyakan perangkat pemindai. Jika Anda memerlukan ukuran file lebih kecil dan dapat mentolerir artefak kompresi ringan, pilih JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Edge case:** Saat menyimpan ke JPEG, pastikan parameter kualitas diatur dengan tepat (default 90). Kualitas rendah dapat membuat modul kecil menjadi blur, sehingga barcode tidak terbaca. + +## Contoh lengkap yang dapat dijalankan + +Menggabungkan semua langkah, berikut satu file yang dapat Anda salin ke proyek konsol baru dan jalankan segera: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Expected output:** Setelah menjalankan program, folder `output` berisi tiga file: + +* `DatabarCols4.png` – barcode dengan 4 kolom (lebar). +* `DatabarRows3.png` – barcode dengan 3 baris (tinggi). +* `DatabarRows3.jpg` – versi JPEG dari barcode 3‑baris. + +Buka salah satu file PNG di penampil gambar; Anda akan melihat barcode Databar Expanded Stacked yang jelas dan siap dipindai. + +## Pertanyaan umum dan pemecahan masalah + +| Question | Answer | +|----------|--------| +| *Bagaimana jika gambar menjadi buram?* | Pastikan Anda menggunakan PNG untuk output lossless. Jika Anda memerlukan JPEG, tingkatkan pengaturan kualitas (`new JpegOptions { Quality = 95 }`). | +| *Apakah saya dapat mengubah teks barcode?* | Ya—ganti argumen kedua dalam `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Apakah kolom dan baris dapat bekerja bersama?* | Mereka dapat digabungkan; cukup atur kedua `DataBar.Columns` dan `DataBar.Rows` sebelum memanggil `Save`. | +| *Apakah ada batasan kedalaman direktori?* | Path harus valid untuk sistem operasi. Gunakan `Path.Combine` untuk keamanan lintas‑platform. | + +## Kesimpulan + +Anda kini tahu **how to set columns** untuk barcode Databar Expanded Stacked, **how to set rows**, dan **how to generate barcode** gambar yang dapat Anda **barcode save file** dalam format PNG atau JPEG. Contoh lengkap menunjukkan setiap langkah yang diperlukan, mulai dari instalasi pustaka hingga verifikasi file akhir. + +Selanjutnya, pertimbangkan untuk menjelajahi: + +* **how to generate barcode** dengan level koreksi kesalahan untuk QR code. +* **barcode save file** opsi untuk format vektor seperti SVG atau PDF. +* Mengintegrasikan barcode yang dihasilkan ke dalam tampilan ASP.NET Core MVC untuk pencetakan label dinamis. + +Silakan bereksperimen dengan kombinasi kolom/baris yang berbeda, format gambar, dan konten barcode untuk menyesuaikan spesifikasi proyek Anda. Selamat coding! + +## Apa yang Harus Anda Pelajari Selanjutnya? + +Tutorial berikut mencakup topik terkait 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 mengeksplorasi pendekatan implementasi alternatif dalam proyek Anda sendiri. + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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/italian/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/italian/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..7bdb03d3e --- /dev/null +++ b/barcode/italian/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: Crea rapidamente un codice a barre DataBar impilato in C#. Impara a impostare + la dimensione X, regolare il rapporto d'aspetto e esportare file PNG utilizzando + il generatore DataBar Stacked Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: it +lastmod: 2026-08-06 +og_description: Crea un codice a barre databar impilato in C# con Aspose.BarCode. + Questo tutorial mostra come configurare la dimensione X, modificare il rapporto + d'aspetto e salvare immagini PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Crea codice a barre databar impilato in C# – guida completa di programmazione +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Crea codice a barre Databar impilato in C# – guida passo passo +url: /it/python-java/general/create-databar-stacked-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 databar stacked barcode in C# – guida passo‑passo + +Se hai bisogno di **creare databar stacked barcode** immagini in C#, questa guida ti mostra esattamente come farlo usando la libreria Aspose.BarCode. Imparerai a impostare la dimensione X, modificare il rapporto d'aspetto del barcode e salvare il risultato come file PNG—tutto in pochi passaggi concisi. + +Generare un DataBar Stacked barcode è comune quando devi codificare dati GS1‑128 per la scansione al dettaglio o il tracciamento logistico. Nelle sezioni successive copriamo tutto, dalla configurazione del progetto alla verifica dell'output, così potrai integrare la soluzione in qualsiasi applicazione .NET senza perdere alcun dettaglio. + +## Prerequisiti + +* **.NET 6.0** (o successivo) installato – il codice è destinato al moderno SDK. +* Una copia **licenziata** di **Aspose.BarCode for .NET**. La valutazione gratuita funziona per i test ma aggiunge una filigrana. +* Un IDE come **Visual Studio 2022** o **VS Code** con l'estensione C#. +* Familiarità di base con la sintassi **C#** e il concetto di Identificatori di Applicazione GS1. + +> **Suggerimento professionale:** Se usi il gestore di pacchetti NuGet, il comando `dotnet add package Aspose.BarCode` risolve automaticamente tutte le dipendenze. + +## Passo 1: Crea un nuovo progetto console + +Apri un terminale o la Console di Gestione Pacchetti e esegui: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +Il comando `dotnet new console` genera un file **Program.cs** minimale. Aggiungere il pacchetto **Aspose.BarCode** rende disponibile la classe `BarcodeGenerator`. + +## Passo 2: Inizializza il generatore DataBar Stacked Omnidirectional + +Apri **Program.cs** e sostituisci il contenuto predefinito con il codice seguente. La prima riga crea un **BarcodeGenerator** configurato per la simbologia **DataBar Stacked Omnidirectional** e fornisce un payload GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Perché è importante:** Il valore enum `EncodeTypes.DatabarStackedOmniDirectional` indica alla libreria di produrre un **databar stacked barcode**, che è la variante stacked della famiglia DataBar omnidirezionale. Questa simbologia può contenere fino a 14 caratteri numerici, rendendola ideale per i codici GTIN‑14. + +## Passo 3: Imposta la dimensione X (larghezza del modulo) + +La dimensione X controlla la larghezza della barra più piccola (il modulo). Un valore troppo piccolo può risultare poco leggibile su stampanti a bassa risoluzione, mentre un valore troppo grande può superare lo spazio disponibile sull'etichetta. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Suggerimento:** La proprietà `Pixels` è comoda per i test basati su schermo. Per scenari focalizzati sulla stampa, usa invece `generator.Parameters.Barcode.XDimension.Millimeters`. + +## Passo 4: Regola il rapporto d'aspetto e salva la prima immagine + +Il **rapporto d'aspetto** influenza la relazione altezza‑larghezza del barcode stacked. Il tipo DataBar Stacked Omnidirectional supporta rapporti da 10 a 30. Genereremo due immagini per illustrare l'impatto visivo. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +La chiamata a `generator.Save` scrive un file **PNG** nella directory di lavoro corrente. L'enum `BarCodeImageFormat.Png` garantisce una compressione senza perdita, ideale per ulteriori elaborazioni o per l'incorporamento in PDF. + +## Passo 5: Cambia il rapporto d'aspetto a 30 e salva la seconda immagine + +Ora aumentiamo l'altezza delle barre stacked modificando il rapporto d'aspetto a **30**. Questo rende il barcode più alto senza alterare la dimensione X. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Eseguendo il programma ora produce due file PNG: + +* **DatabarAspectRatio15.png** – un barcode compatto adatto a etichette piccole. +* **DatabarAspectRatio30.png** – un barcode più alto che migliora l'affidabilità della scansione su superfici a basso contrasto. + +Puoi aprire le immagini con qualsiasi visualizzatore per verificare che le barre siano correttamente impilate e che i dati codificati corrispondano alla stringa GS1 originale. + +## Passo 6: Verifica il valore codificato (opzionale) + +Se devi confermare che il barcode rappresenta effettivamente la stringa di input, puoi decodificarlo con la stessa libreria: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Il decodificatore dovrebbe restituire `(01)12345678901231`, dimostrando che il processo di **creare databar stacked barcode** ha preservato i dati. + +## Problemi comuni e come evitarli + +| Problema | Perché succede | Soluzione | +|----------|----------------|-----------| +| Il barcode appare sfocato | Dimensione X impostata troppo bassa per la risoluzione di output | Aumentare `XDimension.Pixels` o usare `Millimeters` per la stampa | +| Lo scanner segnala “simbolo non trovato” | Rapporto d'aspetto fuori dall'intervallo supportato 10‑30 | Mantenere il rapporto tra 10 e 30; 15 e 30 sono valori predefiniti sicuri | +| Il PNG contiene una filigrana | Uso della licenza di valutazione gratuita di Aspose.BarCode | Acquistare una licenza completa o usare la versione di prova solo per i test | +| Decodifica fallita nella seconda immagine | Il decodificatore era configurato per la simbologia errata | Usare `DecodeType.DatabarStackedOmniDirectional` quando si leggono barcode stacked | + +## Prossimi passi + +Ora che puoi **creare databar stacked barcode** immagini, potresti voler: + +* **Incorpora i PNG in fatture PDF** usando una libreria PDF come **Aspose.PDF**. +* **Genera barcode al volo in una Web API** – restituisci i byte PNG direttamente da un controller ASP.NET Core. +* **Sperimenta con altre varianti DataBar** (ad es., `DatabarExpanded`, `DatabarLimited`) modificando l'enum `EncodeTypes`. +* **Regola i colori** impostando `generator.Parameters.Barcode.ForeColor` e `BackColor` per design specifici del brand. + +Ognuno di questi argomenti si basa sugli stessi concetti fondamentali trattati qui: inizializzare `BarcodeGenerator`, configurare i parametri visivi e salvare il risultato con `BarCodeImageFormat`. + +--- + +### Conclusione + +Questo tutorial ha dimostrato come **creare databar stacked barcode** immagini in C# usando Aspose.BarCode. Hai imparato a impostare la **dimensione X**, modificare il **rapporto d'aspetto del barcode** e esportare il risultato come file **PNG** con `BarcodeGenerator`. Con il passaggio opzionale di decodifica, puoi anche verificare che i dati GS1 codificati siano accurati. Applica questi modelli alle tue applicazioni di inventario, spedizione o punto vendita, ed esplora le numerose opzioni di personalizzazione offerte dalla libreria. Buon coding! + +## Cosa dovresti imparare dopo? + +I tutorial seguenti 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. + +- [Regolazione altezza Databar unidimensionale](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Genera immagine barcode – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/italian/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..6cbb109bd --- /dev/null +++ b/barcode/italian/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: Genera un'immagine di codice a barre in C# usando Aspose.BarCode. Scopri + come generare Databar, regolare la dimensione personalizzata del codice a barre + e modificare l'altezza del codice a barre con un codice semplice. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: it +lastmod: 2026-08-06 +og_description: Genera immagine di codice a barre in C# con Aspose.BarCode. Questo + tutorial ti mostra come creare un codice a barre Databar Omnidirezionale, personalizzare + le sue dimensioni e modificare l'altezza del codice a barre in modo efficiente. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Genera immagine di codice a barre in C# – guida completa ad Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Genera immagine di codice a barre in C# con Aspose.BarCode +url: /it/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generare immagine di codice a barre in C# con Aspose.BarCode + +Se hai bisogno di **generare un'immagine di codice a barre** programmaticamente, questa guida ti mostra esattamente come fare. Che tu stia costruendo un sistema di inventario al dettaglio o un portale di tracciamento logistico, vedrai l'intero flusso di lavoro per creare un codice a barre Databar Omnidirectional, regolare le sue dimensioni e salvare il risultato come file PNG. + +Generare un'immagine di codice a barre è una necessità comune, ma gli sviluppatori spesso si chiedono **come generare Databar** con le dimensioni esatte di cui hanno bisogno. In questo tutorial imparerai a creare un codice a barre Databar, personalizzarne larghezza e altezza e a modificare l'altezza del codice a barre senza riscrivere l'intero generatore. + +## Prerequisiti + +Prima di iniziare, assicurati di avere: + +* SDK .NET 6.0 o successivo (il codice funziona con .NET Core e .NET Framework) +* Visual Studio 2022 (o qualsiasi IDE che supporti C#) +* Una licenza valida di Aspose.BarCode per .NET (la valutazione gratuita funziona per i test) +* Familiarità di base con la sintassi C# + +## Step 1: Install Aspose.BarCode + +Aggiungi il pacchetto NuGet Aspose.BarCode al tuo progetto: + +```bash +dotnet add package Aspose.BarCode +``` + +Il pacchetto contiene la classe `BarcodeGenerator` utilizzata in tutto il tutorial. Dopo l'installazione, ripristina il progetto per scaricare le dipendenze. + +## Step 2: Create a basic barcode generator + +La prima riga di codice crea un **barcode generator** che produrrà un simbolo Databar Omnidirectional. L'enumerazione `EncodeTypes.DatabarOmniDirectional` indica alla libreria quale simbologia utilizzare, e la stringa dei dati segue la sintassi dell'Identificatore di Applicazione GS1. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Perché è importante:** L'oggetto `BarcodeGenerator` è il punto di ingresso per ogni operazione di codice a barre. Selezionando `DatabarOmniDirectional` garantisci che l'output sia conforme allo standard GS1 per la scansione al dettaglio. + +## Step 3: Set a custom X‑dimension (module width) + +La X‑dimension controlla la larghezza della barra più stretta. Impostarla su un valore di pixel piccolo ti fornisce un codice a barre compatto, mentre valori più grandi aumentano la larghezza complessiva. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Spiegazione:** Una X‑dimension di 2 pixel è una scelta comune per schermi ad alta risoluzione. Regola questo valore se hai bisogno di una densità visiva più stretta o più ampia. + +## Step 4: Generate the first barcode image with a specific height + +L'altezza del codice a barre è indipendente dalla X‑dimension. Qui impostiamo l'altezza della barra a **30 px**, quindi salviamo l'immagine come PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Risultato:** Ora hai un file chiamato `DatabarBarHeight30Pixels.png` che mostra un codice a barre Databar alto 30 px. Questo dimostra la capacità di **dimensionare il codice a barre** per un caso d'uso specifico, come un'etichetta piccola. + +## Step 5: Change barcode height for a larger version + +Se lo stesso codice a barre deve apparire su un'etichetta più grande, devi solo modificare la proprietà dell'altezza e riutilizzare la stessa istanza del generatore. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Perché puoi riutilizzare il generatore:** Cambiare `BarHeight.Pixels` aggiorna il layout interno senza ricreare l'oggetto, risparmiando memoria e mantenendo intatta la stringa dei dati. Questo è il modo consigliato per **modificare l'altezza del codice a barre** al volo. + +## Step 6: Verify the output + +Apri i due file PNG in qualsiasi visualizzatore di immagini. Dovresti vedere due codici a barre Databar Omnidirectional che codificano lo stesso GTIN ma differiscono per dimensione verticale: + +* `DatabarBarHeight30Pixels.png` – 30 px di altezza, adatto per ricevute compatte. +* `DatabarBarHeight60Pixels.png` – 60 px di altezza, ideale per etichette di scaffale più grandi. + +Entrambe le immagini mantengono la stessa X‑dimension, quindi il rapporto barra‑spazio rimane coerente mentre l'altezza complessiva si scala. + +## Common variations and edge cases + +| Situazione | Come gestirla | +|------------|----------------| +| **Simboli di codice a barre diversi** | Sostituisci `EncodeTypes.DatabarOmniDirectional` con un altro valore enum (ad es., `EncodeTypes.Code128`). Il resto del codice rimane invariato. | +| **Dimensioni non in pixel** | Usa `generator.Parameters.Barcode.XDimension.Millimeters` o `BarHeight.Millimeters` se hai bisogno di misurazioni fisiche per output pronto per la stampa. | +| **Sfondo trasparente** | Imposta `generator.Parameters.ImageBackgroundColor = Color.Transparent;` prima di chiamare `Save`. | +| **Output ad alta risoluzione** | Aumenta sia `XDimension.Pixels` sia `BarHeight.Pixels` proporzionalmente, oppure salva come `BarCodeImageFormat.Tiff` per qualità senza perdita. | +| **Più codici a barre in un'immagine** | Crea istanze separate di `BarcodeGenerator`, renderizza ciascuna in un `Bitmap`, poi componile usando `Graphics.DrawImage`. | + +**Consiglio professionale:** Testa sempre il codice a barre generato con uno scanner reale prima di passare in produzione. Gli scanner possono interpretare barre molto sottili in modo diverso a seconda dell'illuminazione e della qualità del sensore. + +## Full source code for reference + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Copia il codice in un nuovo progetto console, eseguilo e vedrai comparire i due file PNG nella cartella di output. + +## Frequently asked questions + +**Q: Posso generare un codice a barre senza installare una licenza?** +A: La versione di valutazione di Aspose.BarCode funziona senza licenza ma aggiunge una piccola filigrana. Per l'uso in produzione, applica una licenza acquistata usando `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**Q: La modifica della X‑dimension influisce sulla leggibilità?** +A: Sì. X‑dimension molto piccole possono rendere il codice a barre illeggibile su stampanti a bassa risoluzione. Si consiglia un minimo di 1 px per il rendering su schermo; per la stampa, utilizza almeno 0,25 mm. + +**Q: E se avessi bisogno di generare un codice a barre in formato JPEG?** +A: Sostituisci `BarCodeImageFormat.Png` con `BarCodeImageFormat.Jpeg`. Puoi anche impostare `generator.Parameters.ImageQuality` per controllare la compressione. + +## Conclusion + +Ora sai come **generare un'immagine di codice a barre** in C# usando Aspose.BarCode, come **creare un codice a barre Databar**, regolare una **dimensione personalizzata del codice a barre** e **modificare l'altezza del codice a barre** su richiesta. L'esempio completo dimostra il flusso di lavoro più comune, e la tabella delle variazioni ti prepara a gestire casi limite del mondo reale. + +Successivamente, esplora argomenti correlati come **incorporare codici a barre in documenti PDF**, **generare in batch più codici a barre** e **utilizzare QR code per pagamenti mobili**. Ognuno di questi scenari si basa sugli stessi principi trattati qui, così potrai estendere questa conoscenza con sicurezza. + +Buona programmazione e che i tuoi codici a barre vengano letti perfettamente! + +## What Should You Learn Next? + +I tutorial seguenti 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. + +- [Generare immagine di codice a barre – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [Come generare un codice a barre Aztec con rapporto d'aspetto personalizzato usando Aspose.BarCode per .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Come generare un codice a barre – Configurazione Code 39 con Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/italian/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..63ec16495 --- /dev/null +++ b/barcode/italian/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Come impostare le colonne per un codice a barre Databar Expanded Stacked + e imparare a generare immagini di codici a barre, impostare le righe e salvare il + file del codice a barre in C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: it +lastmod: 2026-08-06 +og_description: Come impostare le colonne per un codice a barre Databar Expanded Stacked + e apprendere rapidamente come generare immagini di codici a barre, impostare le + righe e salvare il file del codice a barre con Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Come impostare le colonne per un codice a barre Databar Expanded Stacked + – guida passo‑passo in C# +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Come impostare le colonne per un codice a barre Databar Expanded Stacked – + guida completa in C# +url: /it/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Come impostare le colonne per un codice a barre Databar Expanded Stacked – guida completa in C# + +Se hai bisogno di **impostare le colonne** per un codice a barre Databar Expanded Stacked, questo tutorial ti mostra i passaggi esatti. Che tu stia costruendo un sistema di etichettatura retail o un’applicazione logistica, controllare colonne e righe ti consente di perfezionare le dimensioni del codice a barre e l’affidabilità della scansione. Inoltre, vedrai **come generare immagini di codice a barre**, regolare il numero di righe e **salvare correttamente il file del codice a barre** su disco. + +Questa guida ti accompagna attraverso: + +* Installazione della libreria Aspose.Barcode per .NET. +* Creazione di un generatore di codice a barre per il tipo Databar Expanded Stacked. +* Impostazione del conteggio di colonne, righe e del formato immagine. +* Salvataggio dei file PNG risultanti in una directory scelta. + +Non è necessaria alcuna esperienza pregressa con Aspose.Barcode—basta un ambiente di sviluppo C# di base. + +## Prerequisiti + +Prima di iniziare, assicurati di avere: + +* .NET 6.0 SDK o versioni successive installate. +* Visual Studio 2022 (o qualsiasi IDE che supporti .NET). +* Un riferimento NuGet a **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Tutti gli snippet di codice compilano con il modello di progetto console predefinito. + +## Passo 1: Creare un generatore di codice a barre per Databar Expanded Stacked + +La prima operazione è istanziare `BarcodeGenerator` con l’enumerazione `EncodeTypes.DatabarExpandedStacked`. Questo imposta il layout predefinito (stacked) e prepara l’oggetto per ulteriori configurazioni. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Perché è importante:** Il generatore contiene tutti i parametri di rendering. Scegliendo `DatabarExpandedStacked` indichi alla libreria di usare il layout stacked, l’unico layout che supporta la regolazione di colonne e righe. + +## Come impostare le colonne per un codice a barre Databar Expanded Stacked + +Ora che il generatore esiste, puoi controllare il conteggio delle colonne. La proprietà `DataBar.Columns` accetta un intero compreso tra 1 e 4. Impostandola a **4** si ottiene il codice a barre più largo possibile mantenendo comunque il layout stacked. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Consiglio pratico:** Usa il numero massimo di colonne solo quando hai spazio bianco sufficiente sull’etichetta. Troppe colonne su un’etichetta piccola possono causare problemi di scansione. + +## Come generare immagini di codice a barre e salvarle + +Dopo aver configurato le colonne, è necessario renderizzare il codice a barre e scrivere l’immagine su disco. Il metodo `Save` accetta un percorso file e un enum di formato immagine. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +La cartella `output` deve esistere, altrimenti la chiamata genererà un’eccezione. Puoi crearla programmaticamente con `Directory.CreateDirectory("output");` se preferisci. + +## Come impostare le righe per un codice a barre Databar Expanded Stacked + +Le righe funzionano in modo simile alle colonne, ma influenzano l’impilamento verticale dei moduli del codice a barre. La proprietà `DataBar.Rows` accetta valori da 1 a 5. In questo esempio utilizziamo **3** righe. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Perché le righe contano:** Aggiungere righe aumenta l’altezza del codice a barre, utile per etichette ad alta densità dove serve più spazio per i moduli senza allargare il codice a barre. + +## Opzioni di salvataggio del file di codice a barre e best practice + +Il metodo `Save` supporta diversi formati immagine (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG è lossless e funziona bene con la maggior parte dei dispositivi di scansione. Se ti serve un file più piccolo e puoi tollerare leggere artefatti di compressione, scegli JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Caso limite:** Quando salvi in JPEG, assicurati che il parametro di qualità sia impostato correttamente (il valore predefinito è 90). Una qualità bassa può sfocare i piccoli moduli, rendendo il codice a barre illeggibile. + +## Esempio completo, eseguibile + +Mettendo tutto insieme, ecco un singolo file che puoi copiare in un nuovo progetto console e eseguire subito: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Output previsto:** Dopo aver eseguito il programma, la cartella `output` conterrà tre file: + +* `DatabarCols4.png` – codice a barre con 4 colonne (largo). +* `DatabarRows3.png` – codice a barre con 3 righe (alto). +* `DatabarRows3.jpg` – versione JPEG del codice a barre a 3 righe. + +Apri uno dei file PNG in un visualizzatore di immagini; dovresti vedere un chiaro codice a barre Databar Expanded Stacked pronto per la scansione. + +## Domande frequenti e risoluzione dei problemi + +| Domanda | Risposta | +|----------|--------| +| *E se l’immagine è sfocata?* | Verifica di utilizzare PNG per un output lossless. Se hai bisogno di JPEG, aumenta il valore di qualità (`new JpegOptions { Quality = 95 }`). | +| *Posso cambiare il testo del codice a barre?* | Sì—sostituisci il secondo argomento in `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Colonne e righe funzionano insieme?* | Possono essere combinate; imposta sia `DataBar.Columns` che `DataBar.Rows` prima di chiamare `Save`. | +| *Esiste un limite alla profondità delle directory?* | Il percorso deve essere valido per il sistema operativo. Usa `Path.Combine` per garantire la compatibilità cross‑platform. | + +## Conclusione + +Ora sai **come impostare le colonne** per un codice a barre Databar Expanded Stacked, **come impostare le righe** e **come generare immagini di codice a barre** che puoi **salvare** in formato PNG o JPEG. L’esempio completo dimostra ogni passaggio necessario, dall’installazione della libreria alla verifica finale del file. + +Successivamente, considera di approfondire: + +* **come generare barcode** con livelli di correzione degli errori per i codici QR. +* **barcode save file** per formati vettoriali come SVG o PDF. +* Integrazione dei codici a barre generati nelle viste ASP.NET Core MVC per la stampa dinamica di etichette. + +Sentiti libero di sperimentare con diverse combinazioni di colonne/righe, formati immagine e contenuti del codice a barre per adattarli alle specifiche del tuo progetto. 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 ulteriori funzionalità dell’API ed esplorare approcci di implementazione alternativi nei tuoi progetti. + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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/japanese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/japanese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..ff772313d --- /dev/null +++ b/barcode/japanese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,190 @@ +--- +category: general +date: 2026-08-06 +description: C#でデータバー スタック型バーコードをすばやく作成します。X寸法の設定、アスペクト比の調整、DataBar Stacked Omnidirectional + ジェネレータを使用した PNG ファイルのエクスポート方法を学びましょう。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: ja +lastmod: 2026-08-06 +og_description: Aspose.BarCode を使用して C# でデータバー スタック型バーコードを作成します。このチュートリアルでは、X 次元の設定方法、アスペクト比の変更方法、PNG + 画像の保存方法を示します。 +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: C#でデータバー スタックドバーコードを作成する – 完全プログラミングガイド +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: C#でデータバー スタックドバーコードを作成する – ステップバイステップガイド +url: /ja/python-java/general/create-databar-stacked-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# でデータバー スタックド バーコードを作成する – ステップバイステップ ガイド + +C# で **create databar stacked barcode** 画像を作成する必要がある場合、このガイドでは Aspose.BarCode ライブラリを使用して正確に行う方法を示します。X 次元の設定、バーコードのアスペクト比の変更、結果を PNG ファイルとして保存する方法を、簡潔な手順で学べます。 + +DataBar Stacked バーコードの生成は、小売スキャンや物流追跡のために GS1‑128 データをエンコードする必要がある場合に一般的です。以下のセクションでは、プロジェクトのセットアップから出力の検証までをすべてカバーし、詳細を見逃すことなく任意の .NET アプリケーションにソリューションを統合できるようにします。 + +## 前提条件 + +* **.NET 6.0**(またはそれ以降)がインストールされていること – コードは最新の SDK を対象としています。 +* **Aspose.BarCode for .NET** の **licensed** コピー。無料評価版はテストに使用できますが、透かしが追加されます。 +* **Visual Studio 2022** や **VS Code** など、C# 拡張機能がインストールされた IDE。 +* **C#** の構文と GS1 アプリケーション識別子の概念に関する基本的な知識。 + +> **Pro tip:** NuGet パッケージマネージャーを使用する場合、コマンド `dotnet add package Aspose.BarCode` がすべての依存関係を自動的に解決します。 + +## 手順 1: 新しいコンソール プロジェクトを作成する + +ターミナルまたは Package Manager Console を開き、次のコマンドを実行します: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +`dotnet new console` コマンドは最小限の **Program.cs** ファイルを作成します。**Aspose.BarCode** パッケージを追加すると、`BarcodeGenerator` クラスが利用可能になります。 + +## 手順 2: DataBar Stacked Omnidirectional ジェネレータを初期化する + +**Program.cs** を開き、デフォルトの内容を以下のコードに置き換えます。最初の行は **DataBar Stacked Omnidirectional** シンボル用に構成された **BarcodeGenerator** を作成し、GS1‑128 ペイロードを供給します。 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Why this matters:** `EncodeTypes.DatabarStackedOmniDirectional` 列挙値は、ライブラリに **databar stacked barcode** を生成させることを指示します。これは omnidirectional DataBar ファミリーのスタックド バリアントです。このシンボルは最大 14 桁の数字を保持でき、GTIN‑14 コードに最適です。 + +## 手順 3: X 次元(モジュール幅)を設定する + +X 次元は最小バー(モジュール)の幅を制御します。値が小さすぎると低解像度プリンターでの描画が不十分になり、逆に大きすぎるとラベルのスペースを超えてしまう可能性があります。 + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tip:** `Pixels` プロパティは画面ベースのテストに便利です。印刷重視のシナリオでは、代わりに `generator.Parameters.Barcode.XDimension.Millimeters` を使用してください。 + +## 手順 4: アスペクト比を調整し、最初の画像を保存する + +**アスペクト比** はスタックド バーコードの高さと幅の関係に影響します。DataBar Stacked Omnidirectional タイプは 10 から 30 の比率をサポートしています。視覚的な影響を示すために 2 枚の画像を生成します。 + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +`generator.Save` の呼び出しにより、現在の作業ディレクトリに **PNG** ファイルが書き込まれます。`BarCodeImageFormat.Png` 列挙値はロスレス圧縮を保証し、さらなる処理や PDF への埋め込みに最適です。 + +## 手順 5: アスペクト比を 30 に変更し、2 番目の画像を保存する + +ここでは、アスペクト比を **30** に変更してスタックド バーの高さを増やします。これにより X 次元を変更せずにバーコードが高くなります。 + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +プログラムを実行すると、2 つの PNG ファイルが生成されます: + +* **DatabarAspectRatio15.png** – 小さなラベルに適したコンパクトなバーコード。 +* **DatabarAspectRatio30.png** – 低コントラストの表面でスキャン信頼性を向上させる、より高いバーコード。 + +任意のビューアで画像を開き、バーが正しくスタックされていること、エンコードされたデータが元の GS1 文字列と一致していることを確認できます。 + +## 手順 6: エンコードされた値を検証する(オプション) + +バーコードが入力文字列を正しく表していることを確認する必要がある場合、同じライブラリでデコードできます: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +デコーダは `(01)12345678901231` を出力すべきで、**create databar stacked barcode** プロセスがデータを保持したことが証明されます。 + +## よくある落とし穴と回避方法 + +| Issue | Why it happens | Fix | +|-------|----------------|-----| +| バーコードがぼやけて表示される | 出力解像度に対して X 次元が低すぎるため | `XDimension.Pixels` を増やすか、印刷時は `Millimeters` を使用する | +| スキャナーが「シンボルが見つかりません」と報告する | サポートされている 10‑30 の範囲外のアスペクト比であるため | 比率を 10〜30 の間に保つ。15 と 30 は安全なデフォルトです | +| PNG に透かしが入っている | Aspose.BarCode の無料評価ライセンスを使用しているため | フルライセンスを購入するか、テスト目的でトライアルを使用する | +| 2 番目の画像でデコードに失敗する | デコーダが誤ったシンボルに設定されていたため | スタックド バーコードを読む際は `DecodeType.DatabarStackedOmniDirectional` を使用する | + +## 次のステップ + +これで **create databar stacked barcode** 画像を作成できるようになったので、以下を検討できるでしょう: + +* **Aspose.PDF** などの PDF ライブラリを使用して PNG を PDF 請求書に埋め込む。 +* Web API でバーコードをリアルタイムに生成する – ASP.NET Core コントローラから PNG バイト列を直接返す。 +* `EncodeTypes` 列挙体を変更して、他の DataBar バリアント(例:`DatabarExpanded`、`DatabarLimited`)を試す。 +* `generator.Parameters.Barcode.ForeColor` と `BackColor` を設定して、ブランド固有のデザインに合わせて色を調整する。 + +これらのトピックはすべて、ここで扱ったコア概念(`BarcodeGenerator` の初期化、視覚パラメータの設定、`BarCodeImageFormat` での保存)に基づいています。 + +--- + +### 結論 + +このチュートリアルでは、Aspose.BarCode を使用して C# で **create databar stacked barcode** 画像を作成する方法を示しました。**X 次元** の設定、**バーコードのアスペクト比** の変更、`BarcodeGenerator` を使用した **PNG** ファイルへのエクスポートを学びました。オプションのデコード手順により、エンコードされた GS1 データが正確であることも確認できます。これらのパターンを在庫管理、出荷、POS アプリケーションに適用し、ライブラリが提供する多数のカスタマイズオプションを探求してください。コーディングを楽しんで! + +## 次に学ぶべきことは? + +以下のチュートリアルは、本ガイドで示した手法を基にした密接に関連するトピックを取り上げています。各リソースには、ステップバイステップの解説付きの完全な動作コード例が含まれており、追加の API 機能を習得し、独自プロジェクトで代替実装アプローチを検討するのに役立ちます。 + +- [一次元データバーバーコードの高さ調整](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [バーコード画像の生成 – GS1 クーポン UPC-A データバー](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/japanese/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..d5e6f421d --- /dev/null +++ b/barcode/japanese/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Aspose.BarCode を使用して C# でバーコード画像を生成します。Databar の生成方法、カスタムバーコードサイズの調整、バーコードの高さ変更をシンプルなコードで学びましょう。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: ja +lastmod: 2026-08-06 +og_description: Aspose.BarCode を使用して C# でバーコード画像を生成します。このチュートリアルでは、Databar Omnidirectional + バーコードの作成方法、サイズのカスタマイズ、そしてバーコードの高さを効率的に変更する方法を示します。 +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: C#でバーコード画像を生成する – 完全なAspose.BarCodeガイド +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Aspose.BarCode を使用して C# でバーコード画像を生成する +url: /ja/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# で Aspose.BarCode を使用してバーコード画像を生成する + +プログラムで **バーコード画像を生成** する必要がある場合、本ガイドで具体的な手順を示します。小売在庫システムや物流トラッキングポータルを構築している場合でも、Databar Omnidirectional バーコードの作成、サイズ調整、PNG ファイルとして保存するまでの完全なワークフローが確認できます。 + +バーコード画像の生成は一般的な要件ですが、開発者はしばしば **Databar を正確なサイズで生成する方法** に悩みます。このチュートリアルでは、Databar バーコードを作成し、幅と高さをカスタマイズし、ジェネレータ全体を書き直すことなくバーコードの高さを変更する方法を学びます。 + +## 前提条件 + +開始する前に、以下が揃っていることを確認してください。 + +* .NET 6.0 SDK 以降(コードは .NET Core と .NET Framework でも動作します) +* Visual Studio 2022(または C# をサポートする任意の IDE) +* 有効な Aspose.BarCode for .NET ライセンス(評価版でもテストは可能です) +* C# 文法に関する基本的な知識 + +## ステップ 1: Aspose.BarCode のインストール + +プロジェクトに Aspose.BarCode NuGet パッケージを追加します。 + +```bash +dotnet add package Aspose.BarCode +``` + +このパッケージには、本チュートリアル全体で使用する `BarcodeGenerator` クラスが含まれています。インストール後、プロジェクトを復元して依存関係を取得してください。 + +## ステップ 2: 基本的なバーコードジェネレータを作成 + +最初のコード行は、Databar Omnidirectional シンボルを生成する **バーコードジェネレータ** を作成します。`EncodeTypes.DatabarOmniDirectional` 列挙体は使用するシンボロジーを指定し、データ文字列は GS1 アプリケーション識別子構文に従います。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**重要ポイント:** `BarcodeGenerator` オブジェクトはすべてのバーコード操作のエントリーポイントです。`DatabarOmniDirectional` を選択することで、出力が小売スキャン用の GS1 標準に準拠することが保証されます。 + +## ステップ 3: カスタム X‑dimension(モジュール幅)を設定 + +X‑dimension は最細バーの幅を制御します。小さなピクセル値に設定するとコンパクトなバーコードになり、値を大きくすると全体幅が広がります。 + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**解説:** 2 ピクセルの X‑dimension は高解像度画面で一般的に使用される選択肢です。視覚的密度をよりタイトまたはルーズにしたい場合は、この値を調整してください。 + +## ステップ 4: 特定の高さで最初のバーコード画像を生成 + +バーコードの高さは X‑dimension とは独立しています。ここではバーの高さを **30 px** に設定し、PNG として保存します。 + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**結果:** `DatabarBarHeight30Pixels.png` というファイルが生成され、30 px の高さの Databar バーコードが確認できます。これは小さなラベル向けに **カスタムバーコードサイズ** を実現する例です。 + +## ステップ 5: より大きなバージョン用にバーコード高さを変更 + +同じバーコードを大きなラベルに表示する必要がある場合、プロパティの高さだけを変更し、同じジェネレータインスタンスを再利用すれば完了です。 + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**再利用できる理由:** `BarHeight.Pixels` を変更すると、内部レイアウトが更新されオブジェクトの再生成が不要になるため、メモリ節約とデータ文字列の保持が実現します。これは **バーコード高さを動的に変更** する推奨手法です。 + +## ステップ 6: 出力を確認 + +任意の画像ビューアで 2 つの PNG ファイルを開きます。同一の GTIN をエンコードしつつ、垂直サイズが異なる Databar Omnidirectional バーコードが表示されます。 + +* `DatabarBarHeight30Pixels.png` – 30 px の高さ、コンパクトなレシート向け +* `DatabarBarHeight60Pixels.png` – 60 px の高さ、棚エッジラベル向け + +両画像は同じ X‑dimension を保持しているため、バーとスペースの比率は一定で、全体の高さだけがスケールしています。 + +## 一般的なバリエーションとエッジケース + +| 状況 | 対処方法 | +|-----------|------------------| +| **異なるバーコードシンボロジー** | `EncodeTypes.DatabarOmniDirectional` を別の列挙値(例: `EncodeTypes.Code128`)に置き換えます。残りのコードは変更不要です。 | +| **ピクセル以外の単位** | 印刷用に実寸を指定したい場合は、`generator.Parameters.Barcode.XDimension.Millimeters` や `BarHeight.Millimeters` を使用します。 | +| **透明背景** | `Save` 呼び出し前に `generator.Parameters.ImageBackgroundColor = Color.Transparent;` を設定します。 | +| **高解像度出力** | `XDimension.Pixels` と `BarHeight.Pixels` を比例的に増やすか、ロスレス品質のために `BarCodeImageFormat.Tiff` で保存します。 | +| **1 画像に複数バーコード** | 個別の `BarcodeGenerator` インスタンスを作成し、各々を `Bitmap` に描画した後、`Graphics.DrawImage` で合成します。 | + +**プロのコツ:** 本番環境に導入する前に、実際のスキャナで必ず生成バーコードをテストしてください。薄いバーは照明やセンサー品質により読み取りが変わることがあります。 + +## 参考用フルソースコード + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +コードを新しいコンソールプロジェクトに貼り付け、実行すると出力フォルダに 2 つの PNG ファイルが生成されます。 + +## よくある質問 + +**Q: ライセンスをインストールせずにバーコードを生成できますか?** +A: 評価版 Aspose.BarCode はライセンスなしで動作しますが、画像に小さな透かしが入ります。本番利用の場合は `License license = new License(); license.SetLicense("Aspose.BarCode.lic");` のように購入したライセンスを適用してください。 + +**Q: X‑dimension を変更すると可読性に影響しますか?** +A: はい。非常に小さい X‑dimension は低解像度プリンタでの読み取りが困難になることがあります。画面表示の場合は最小 1 px、印刷の場合は少なくとも 0.25 mm を推奨します。 + +**Q: JPEG 形式でバーコードを生成したい場合は?** +A: `BarCodeImageFormat.Png` を `BarCodeImageFormat.Jpeg` に置き換えます。また、`generator.Parameters.ImageQuality` で圧縮率を調整できます。 + +## 結論 + +これで C# と Aspose.BarCode を使用して **バーコード画像を生成** する方法、**Databar バーコードの作成**、**カスタムバーコードサイズの調整**、そして **オンデマンドでバーコード高さを変更** する手順が習得できました。完全なサンプルは最も一般的なワークフローを示しており、表にあるバリエーションは実務でのエッジケースに対応できるようにしています。 + +次は **PDF 文書へのバーコード埋め込み**、**複数バーコードのバッチ生成**、**モバイル決済向け QR コードの活用** などの関連トピックを探求してください。これらのシナリオは本ガイドで学んだ原則に基づいているため、自信を持って応用できます。 + +Happy coding, and may your barcodes scan flawlessly! + +## 次に学ぶべきこと + +以下のチュートリアルは、本ガイドで示したテクニックを基にした、密接に関連するトピックを扱っています。各リソースには、ステップバイステップの解説と完全なコード例が含まれており、API の追加機能をマスターし、プロジェクトで代替実装アプローチを探求するのに役立ちます。 + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/japanese/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..e7c6d8eff --- /dev/null +++ b/barcode/japanese/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,219 @@ +--- +category: general +date: 2026-08-06 +description: Databar Expanded Stacked バーコードの列を設定する方法と、バーコード画像の生成、行の設定、C# でバーコードファイルを保存する方法を学ぶ。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: ja +lastmod: 2026-08-06 +og_description: Databar Expanded Stacked バーコードの列を設定し、バーコード画像の生成、行の設定、そして Aspose.Barcode + を使用したバーコードファイルの保存方法をすぐに学ぶ方法。 +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Databar Expanded Stacked バーコードの列設定方法 – ステップバイステップ C# ガイド +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Databar Expanded Stacked バーコードの列設定方法 – 完全 C# ガイド +url: /ja/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Databar Expanded Stacked バーコードの列設定方法 – 完全な C# ガイド + +Databar Expanded Stacked バーコードの **列設定方法** が必要な場合、このチュートリアルでは正確な手順を示します。小売ラベリングシステムや物流アプリケーションを構築する場合でも、列と行を制御することでバーコードのサイズとスキャン信頼性を微調整できます。さらに、**バーコード生成方法** の画像作成、行数の調整、そして **バーコードのファイル保存** 方法も確認できます。 + +このガイドでは以下を解説します: + +* Aspose.Barcode for .NET ライブラリのインストール。 +* Databar Expanded Stacked タイプのバーコードジェネレーターの作成。 +* 列数、行数、画像フォーマットの設定。 +* 生成された PNG ファイルを任意のディレクトリに保存。 + +Aspose.Barcode の事前経験は不要です—基本的な C# 開発環境さえあれば始められます。 + +## 前提条件 + +開始する前に、以下が揃っていることを確認してください: + +* .NET 6.0 SDK 以降がインストールされていること。 +* Visual Studio 2022(または .NET をサポートする任意の IDE)。 +* **Aspose.Barcode** の NuGet 参照(`dotnet add package Aspose.Barcode`)。 + +すべてのコードスニペットはデフォルトのコンソールプロジェクトテンプレートでコンパイルできます。 + +## Step 1: Create a barcode generator for Databar Expanded Stacked + +最初の操作は `BarcodeGenerator` を `EncodeTypes.DatabarExpandedStacked` 列挙体でインスタンス化することです。これによりデフォルトのレイアウト(スタック)が設定され、以降の構成が可能になります。 + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Why this matters:** ジェネレーターはすべてのレンダリングパラメータを保持します。`DatabarExpandedStacked` を選択することで、列と行の調整をサポートする唯一のスタックレイアウトが使用されます。 + +## Databar Expanded Stacked バーコードの列設定方法 + +ジェネレーターが作成されたので、列数を制御できます。`DataBar.Columns` プロパティは 1 から 4 の整数を受け取ります。**4** に設定すると、スタックレイアウト内で可能な限り幅広のバーコードが生成されます。 + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Practical tip:** ラベル上に十分な余白がある場合にのみ最大列数を使用してください。小さなラベルで列数が多すぎるとスキャンに問題が生じる可能性があります。 + +## バーコード画像の生成と保存方法 + +列を設定したら、バーコードをレンダリングしてディスクに画像を書き出す必要があります。`Save` メソッドはファイルパスと画像フォーマット列挙体を受け取ります。 + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +フォルダー `output` が存在しない場合は例外がスローされます。必要に応じて `Directory.CreateDirectory("output");` でプログラムから作成できます。 + +## Databar Expanded Stacked バーコードの行設定方法 + +行は列と同様に機能しますが、バーコードモジュールの垂直スタックに影響します。`DataBar.Rows` プロパティは 1 から 5 の値を受け取ります。この例では **3** 行を使用します。 + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Why rows matter:** 行を追加するとバーコードの高さが増加し、幅を広げずにデータモジュールを増やしたい高密度ラベルに有用です。 + +## バーコード保存ファイルオプションとベストプラクティス + +`Save` メソッドは複数の画像フォーマット(`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`)をサポートします。PNG はロスレスで、ほとんどのスキャンデバイスで最適に機能します。ファイルサイズを小さくしたい場合で、若干の圧縮アーティファクトが許容できる場合は JPEG を選択してください。 + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Edge case:** JPEG で保存する際は品質パラメータを適切に設定してください(デフォルトは 90)。品質が低すぎると小さなモジュールがぼやけ、バーコードが読めなくなることがあります。 + +## 完全な実行可能サンプル + +すべてをまとめた単一ファイルの例を以下に示します。新しいコンソールプロジェクトにコピーしてすぐに実行できます。 + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Expected output:** プログラム実行後、`output` フォルダーには次の 3 つのファイルが作成されます: + +* `DatabarCols4.png` – 4 列(幅広)のバーコード。 +* `DatabarRows3.png` – 3 行(高さ)のバーコード。 +* `DatabarRows3.jpg` – 3 行バーコードの JPEG バージョン。 + +任意の PNG ファイルを画像ビューアで開くと、スキャン可能な Databar Expanded Stacked バーコードがはっきりと表示されます。 + +## よくある質問とトラブルシューティング + +| 質問 | 回答 | +|----------|--------| +| *画像がぼやけている場合はどうすればいいですか?* | ロスレス出力のために PNG を使用しているか確認してください。JPEG が必要な場合は品質設定を上げます(`new JpegOptions { Quality = 95 }`)。 | +| *バーコードのテキストを変更できますか?* | はい—`new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")` の第2引数を置き換えます。 | +| *列と行は同時に設定できますか?* | 設定可能です。`Save` を呼び出す前に `DataBar.Columns` と `DataBar.Rows` の両方を設定してください。 | +| *ディレクトリの深さに制限はありますか?* | パスは OS で有効な形式である必要があります。クロスプラットフォームの安全性のために `Path.Combine` を使用してください。 | + +## 結論 + +これで **列設定方法** と **行設定方法**、そして **バーコード生成方法** を学び、PNG または JPEG 形式で **バーコードのファイル保存** ができるようになりました。完全なサンプルは、ライブラリのインストールから最終的なファイル検証までのすべての手順を示しています。 + +次に検討すべきこと: + +* **QR コードのエラー訂正レベルを使用したバーコード生成方法**。 +* **SVG や PDF などのベクターフォーマット用のバーコード保存オプション**。 +* 生成したバーコードを ASP.NET Core MVC ビューに統合し、動的ラベル印刷を実現する。 + +さまざまな列/行の組み合わせ、画像フォーマット、バーコード内容を試して、プロジェクトの要件に合わせて最適化してください。コーディングを楽しんでください! + +## 次に学ぶべきことは? + +以下のチュートリアルは、本ガイドで示したテクニックを基にした、密接に関連するトピックをカバーしています。各リソースには、ステップバイステップの解説と完全な動作コード例が含まれており、追加の API 機能を習得し、独自プロジェクトで代替実装アプローチを探求するのに役立ちます。 + +- [バーコード生成方法 - 1 次元バーコードタイプ](/barcode/english/net/one-dimensional-barcode-types/) +- [バーコード生成方法 – Aspose.BarCode を使用した Code 39 設定](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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/korean/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/korean/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..fecf5a8aa --- /dev/null +++ b/barcode/korean/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,190 @@ +--- +category: general +date: 2026-08-06 +description: C#에서 데이터바 스택드 바코드를 빠르게 생성하세요. X 차원을 설정하고, 종횡비를 조정하며, DataBar Stacked + Omnidirectional 생성기를 사용해 PNG 파일을 내보내는 방법을 배워보세요. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: ko +lastmod: 2026-08-06 +og_description: Aspose.BarCode를 사용하여 C#에서 데이터바 스택형 바코드를 생성합니다. 이 튜토리얼에서는 X 차원을 설정하고, + 종횡비를 변경하며, PNG 이미지를 저장하는 방법을 보여줍니다. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: C#에서 데이터바 스택형 바코드 만들기 – 완전 프로그래밍 가이드 +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: C#에서 데이터바 스택형 바코드 만들기 – 단계별 가이드 +url: /ko/python-java/general/create-databar-stacked-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#에서 databar stacked barcode 생성 – 단계별 가이드 + +C#에서 **create databar stacked barcode** 이미지를 생성해야 한다면, 이 가이드는 Aspose.BarCode 라이브러리를 사용하여 정확히 어떻게 하는지 보여줍니다. X 차원 설정, 바코드 종횡비 변경, 결과를 PNG 파일로 저장하는 방법을 몇 단계에 걸쳐 배울 수 있습니다. + +DataBar Stacked 바코드를 생성하는 것은 소매 스캔이나 물류 추적을 위해 GS1‑128 데이터를 인코딩해야 할 때 일반적입니다. 이어지는 섹션에서는 프로젝트 설정부터 출력 검증까지 모든 내용을 다루므로, .NET 애플리케이션에 솔루션을 놓치지 않고 통합할 수 있습니다. + +## 전제 조건 + +* **.NET 6.0**(또는 이후 버전)이 설치되어 있어야 합니다 – 코드는 최신 SDK를 대상으로 합니다. +* **licensed** 복사본의 **Aspose.BarCode for .NET**이 필요합니다. 무료 평가판은 테스트에 사용할 수 있지만 워터마크가 추가됩니다. +* **Visual Studio 2022** 또는 **VS Code**와 같은 IDE에 C# 확장이 설치되어 있어야 합니다. +* **C#** 구문 및 GS1 Application Identifiers 개념에 대한 기본적인 이해가 필요합니다. + +> **Pro tip:** NuGet 패키지 관리자를 사용할 경우 `dotnet add package Aspose.BarCode` 명령이 모든 종속성을 자동으로 해결합니다. + +## 1단계: 새 콘솔 프로젝트 만들기 + +터미널이나 패키지 관리자 콘솔을 열고 다음을 실행합니다: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +`dotnet new console` 명령은 최소한의 **Program.cs** 파일을 생성합니다. **Aspose.BarCode** 패키지를 추가하면 `BarcodeGenerator` 클래스를 사용할 수 있게 됩니다. + +## 2단계: DataBar Stacked Omnidirectional 생성기 초기화 + +**Program.cs**를 열고 기본 내용을 다음 코드로 교체합니다. 첫 번째 줄은 **DataBar Stacked Omnidirectional** 심볼로지를 사용하도록 구성된 **BarcodeGenerator**를 생성하고 GS1‑128 페이로드를 제공합니다. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Why this matters:** `EncodeTypes.DatabarStackedOmniDirectional` 열거형 값은 라이브러리에게 **databar stacked barcode**를 생성하도록 지시합니다. 이는 omnidirectional DataBar 계열의 스택형 변형이며, 최대 14개의 숫자 문자를 저장할 수 있어 GTIN‑14 코드에 적합합니다. + +## 3단계: X 차원 설정 (모듈 폭) + +X 차원은 가장 작은 바(모듈)의 폭을 제어합니다. 값이 너무 작으면 저해상도 프린터에서 품질이 떨어질 수 있고, 너무 크면 라벨 공간을 초과할 수 있습니다. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Tip:** `Pixels` 속성은 화면 기반 테스트에 편리합니다. 인쇄 중심 시나리오에서는 대신 `generator.Parameters.Barcode.XDimension.Millimeters`를 사용하세요. + +## 4단계: 종횡비 조정 및 첫 번째 이미지 저장 + +**aspect ratio**는 스택형 바코드의 높이와 너비 비율에 영향을 줍니다. DataBar Stacked Omnidirectional 유형은 10에서 30 사이의 비율을 지원합니다. 시각적 차이를 보여주기 위해 두 개의 이미지를 생성합니다. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +`generator.Save` 호출은 현재 작업 디렉터리에 **PNG** 파일을 기록합니다. `BarCodeImageFormat.Png` 열거형은 무손실 압축을 보장하므로 추가 처리나 PDF에 삽입하기에 이상적입니다. + +## 5단계: 종횡비를 30으로 변경하고 두 번째 이미지 저장 + +이제 종횡비를 **30**으로 변경하여 스택 바의 높이를 높입니다. 이렇게 하면 X 차원을 변경하지 않고 바코드가 더 높아집니다. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +프로그램을 실행하면 두 개의 PNG 파일이 생성됩니다: + +* **DatabarAspectRatio15.png** – 작은 라벨에 적합한 컴팩트 바코드. +* **DatabarAspectRatio30.png** – 저대비 표면에서 스캔 신뢰성을 높이는 더 높은 바코드. + +이미지를 아무 뷰어에서 열어 바가 올바르게 스택되어 있는지, 인코딩된 데이터가 원본 GS1 문자열과 일치하는지 확인할 수 있습니다. + +## 6단계: 인코딩된 값 확인 (선택 사항) + +바코드가 입력 문자열을 정확히 나타내는지 확인하려면 동일한 라이브러리로 디코딩할 수 있습니다: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +디코더는 `(01)12345678901231`을 출력해야 하며, 이는 **create databar stacked barcode** 과정이 데이터를 보존했음을 증명합니다. + +## 흔히 발생하는 문제와 해결 방법 + +| Issue | Why it happens | Fix | +|-------|----------------|-----| +| 바코드가 흐릿하게 보임 | 출력 해상도에 비해 X 차원이 너무 낮게 설정됨 | `XDimension.Pixels`를 늘리거나 인쇄용으로 `Millimeters`를 사용 | +| 스캐너가 “symbol not found” 보고 | 지원되는 10‑30 범위를 벗어난 종횡비 | 비율을 10~30 사이로 유지; 15와 30이 안전한 기본값 | +| PNG에 워터마크가 포함됨 | Aspose.BarCode 무료 평가 라이선스 사용 | 전체 라이선스를 구매하거나 테스트용으로 체험판을 사용 | +| 두 번째 이미지 디코딩 실패 | 디코더가 잘못된 심볼로지로 설정됨 | 스택 바코드를 읽을 때 `DecodeType.DatabarStackedOmniDirectional` 사용 | + +## 다음 단계 + +이제 **create databar stacked barcode** 이미지를 만들 수 있으니, 다음과 같은 작업을 고려할 수 있습니다: + +* **Embed the PNGs into PDF invoices**를 **Aspose.PDF**와 같은 PDF 라이브러리를 사용하여 수행합니다. +* **Generate barcodes on the fly in a web API** – ASP.NET Core 컨트롤러에서 PNG 바이트를 직접 반환합니다. +* **Experiment with other DataBar variants** (예: `DatabarExpanded`, `DatabarLimited`)를 `EncodeTypes` 열거형을 변경하여 시도합니다. +* **Adjust colors**를 위해 브랜드별 디자인에 맞게 `generator.Parameters.Barcode.ForeColor`와 `BackColor`를 설정합니다. + +이러한 주제들은 모두 여기서 다룬 핵심 개념, 즉 `BarcodeGenerator` 초기화, 시각 매개변수 구성, `BarCodeImageFormat`으로 결과 저장을 기반으로 합니다. + +--- + +### 결론 + +이 튜토리얼에서는 Aspose.BarCode를 사용하여 C#에서 **create databar stacked barcode** 이미지를 만드는 방법을 보여주었습니다. **X dimension** 설정, **barcode aspect ratio** 수정, `BarcodeGenerator`를 이용한 **PNG** 파일 내보내기를 배웠습니다. 선택적인 디코딩 단계로 인코딩된 GS1 데이터가 정확한지 확인할 수도 있습니다. 이러한 패턴을 재고, 배송, POS 애플리케이션에 적용하고, 라이브러리가 제공하는 다양한 커스터마이징 옵션을 탐색해 보세요. 즐거운 코딩 되세요! + +## 다음에 배워야 할 내용은? + +다음 튜토리얼은 이 가이드에서 시연한 기술을 기반으로 하는 밀접한 관련 주제를 다룹니다. 각 자료는 단계별 설명과 함께 완전한 코드 예제를 제공하여 추가 API 기능을 숙달하고 자체 프로젝트에서 대체 구현 방식을 탐색하도록 돕습니다. + +- [일차원 Databar 바코드 높이 조정](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [바코드 이미지 생성 – GS1 쿠폰 UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/korean/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..89aac39b9 --- /dev/null +++ b/barcode/korean/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-06 +description: Aspose.BarCode를 사용하여 C#에서 바코드 이미지를 생성합니다. Databar를 생성하고, 사용자 지정 바코드 크기를 + 조정하며, 간단한 코드로 바코드 높이를 변경하는 방법을 배워보세요. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: ko +lastmod: 2026-08-06 +og_description: Aspose.BarCode를 사용하여 C#에서 바코드 이미지를 생성합니다. 이 튜토리얼에서는 Databar Omnidirectional + 바코드를 만드는 방법, 크기를 맞춤 설정하는 방법, 그리고 바코드 높이를 효율적으로 변경하는 방법을 보여줍니다. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: C#에서 바코드 이미지 생성 – 전체 Aspose.BarCode 가이드 +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Aspose.BarCode를 사용하여 C#에서 바코드 이미지 생성 +url: /ko/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C#와 Aspose.BarCode로 바코드 이미지 생성 + +프로그램matically **바코드 이미지 생성**이 필요하다면, 이 가이드는 정확한 방법을 보여줍니다. 소매 재고 시스템이든 물류 추적 포털이든, Databar Omnidirectional 바코드를 만들고, 크기를 조정한 뒤 PNG 파일로 저장하는 전체 워크플로우를 확인할 수 있습니다. + +바코드 이미지 생성은 흔한 요구 사항이지만, 개발자들은 종종 **필요한 정확한 크기의 Databar**를 어떻게 생성해야 할지 궁금해합니다. 이 튜토리얼에서는 Databar 바코드를 만들고, 너비와 높이를 커스터마이징하며, 전체 생성기를 다시 작성하지 않고 바코드 높이를 변경하는 방법을 배웁니다. + +## Prerequisites + +시작하기 전에 다음이 준비되어 있는지 확인하세요: + +* .NET 6.0 SDK 이상 (코드는 .NET Core 및 .NET Framework에서도 동작) +* Visual Studio 2022 (또는 C#을 지원하는 IDE) +* 유효한 Aspose.BarCode for .NET 라이선스 (무료 평가판으로 테스트 가능) +* C# 문법에 대한 기본적인 이해 + +## Step 1: Install Aspose.BarCode + +프로젝트에 Aspose.BarCode NuGet 패키지를 추가합니다: + +```bash +dotnet add package Aspose.BarCode +``` + +패키지에는 이 튜토리얼 전반에 걸쳐 사용되는 `BarcodeGenerator` 클래스가 포함되어 있습니다. 설치가 끝나면 프로젝트를 복원하여 종속성을 가져옵니다. + +## Step 2: Create a basic barcode generator + +첫 번째 코드는 Databar Omnidirectional 심볼을 생성할 **바코드 생성기**를 만듭니다. `EncodeTypes.DatabarOmniDirectional` 열거형은 라이브러리에 사용할 심볼리지를 알려주며, 데이터 문자열은 GS1 Application Identifier 구문을 따릅니다. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**왜 중요한가:** `BarcodeGenerator` 객체는 모든 바코드 작업의 진입점입니다. `DatabarOmniDirectional`을 선택하면 소매 스캔을 위한 GS1 표준을 준수하는 출력이 보장됩니다. + +## Step 3: Set a custom X‑dimension (module width) + +X‑dimension은 가장 얇은 바의 너비를 제어합니다. 작은 픽셀 값을 설정하면 컴팩트한 바코드가 생성되고, 큰 값을 사용하면 전체 너비가 증가합니다. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**설명:** 2‑픽셀 X‑dimension은 고해상도 화면에서 흔히 선택되는 값입니다. 시각적 밀도가 더 촘촘하거나 넓게 필요하면 이 값을 조정하세요. + +## Step 4: Generate the first barcode image with a specific height + +바코드 높이는 X‑dimension과 독립적입니다. 여기서는 바 높이를 **30 px** 로 설정하고 PNG로 저장합니다. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**결과:** 이제 `DatabarBarHeight30Pixels.png` 라는 파일이 생성되어 높이 30 px인 Databar 바코드가 표시됩니다. 이는 작은 라벨과 같은 특정 사용 사례에 대한 **맞춤 바코드 크기** 기능을 보여줍니다. + +## Step 5: Change barcode height for a larger version + +같은 바코드를 더 큰 라벨에 사용해야 할 경우, 높이 속성만 수정하고 동일한 생성기 인스턴스를 재사용하면 됩니다. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**재사용이 가능한 이유:** `BarHeight.Pixels`를 변경하면 객체를 다시 생성하지 않아도 내부 레이아웃이 업데이트되며, 데이터 문자열은 그대로 유지됩니다. 이는 **바코드 높이**를 실시간으로 변경하는 권장 방법입니다. + +## Step 6: Verify the output + +두 PNG 파일을 이미지 뷰어에서 열어보세요. 동일한 GTIN을 인코딩하지만 세로 크기가 다른 두 개의 Databar Omnidirectional 바코드가 표시됩니다: + +* `DatabarBarHeight30Pixels.png` – 30 px 높이, 컴팩트 영수증에 적합 +* `DatabarBarHeight60Pixels.png` – 60 px 높이, 큰 선반 라벨에 이상적 + +두 이미지 모두 동일한 X‑dimension을 유지하므로 바와 공백 비율은 일관되게 유지되면서 전체 높이만 스케일됩니다. + +## Common variations and edge cases + +| Situation | How to handle it | +|-----------|------------------| +| **Different barcode symbology** | `EncodeTypes.DatabarOmniDirectional`을 다른 열거형 값(예: `EncodeTypes.Code128`)으로 교체합니다. 나머지 코드는 그대로 유지됩니다. | +| **Non‑pixel dimensions** | 인쇄용 물리적 치수가 필요하면 `generator.Parameters.Barcode.XDimension.Millimeters` 또는 `BarHeight.Millimeters`를 사용합니다. | +| **Transparent background** | `Save` 호출 전에 `generator.Parameters.ImageBackgroundColor = Color.Transparent;` 로 설정합니다. | +| **High‑resolution output** | `XDimension.Pixels`와 `BarHeight.Pixels`를 비례적으로 증가시키거나, 무손실 품질을 위해 `BarCodeImageFormat.Tiff`로 저장합니다. | +| **Multiple barcodes in one image** | 별도의 `BarcodeGenerator` 인스턴스를 만들고 각각을 `Bitmap`에 렌더링한 뒤, `Graphics.DrawImage`를 사용해 합성합니다. | + +**Pro tip:** 배포 전에 실제 스캐너로 생성된 바코드를 반드시 테스트하세요. 스캐너는 조명 및 센서 품질에 따라 매우 얇은 바를 다르게 해석할 수 있습니다. + +## Full source code for reference + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +코드를 새 콘솔 프로젝트에 복사하고 실행하면 두 개의 PNG 파일이 출력 폴더에 생성됩니다. + +## Frequently asked questions + +**Q: 라이선스를 설치하지 않고 바코드를 생성할 수 있나요?** +A: Aspose.BarCode 평가 버전은 라이선스 없이도 동작하지만 작은 워터마크가 추가됩니다. 실제 운영 환경에서는 `License license = new License(); license.SetLicense("Aspose.BarCode.lic");` 와 같이 구매한 라이선스를 적용하세요. + +**Q: X‑dimension을 변경하면 가독성에 영향을 미치나요?** +A: 네. 매우 작은 X‑dimension은 저해상도 프린터에서 바코드가 읽히지 않을 수 있습니다. 화면 렌더링 기준 최소 1 px, 인쇄용 최소 0.25 mm를 권장합니다. + +**Q: JPEG 형식으로 바코드를 생성하려면 어떻게 해야 하나요?** +A: `BarCodeImageFormat.Png`를 `BarCodeImageFormat.Jpeg`으로 교체하면 됩니다. 또한 `generator.Parameters.ImageQuality`를 설정해 압축 정도를 조절할 수 있습니다. + +## Conclusion + +이제 C#와 Aspose.BarCode를 사용해 **바코드 이미지 생성**, **Databar 바코드 만들기**, **맞춤 바코드 크기 조정**, 그리고 **필요에 따라 바코드 높이 변경** 방법을 알게 되었습니다. 전체 예제는 가장 일반적인 워크플로우를 보여주며, 변형 표는 실제 상황에서 발생할 수 있는 다양한 엣지 케이스를 처리하는 방법을 제공합니다. + +다음으로 **PDF 문서에 바코드 삽입**, **다수 바코드 일괄 생성**, **모바일 결제를 위한 QR 코드 활용**과 같은 관련 주제를 탐색해 보세요. 이 시나리오들은 모두 여기서 다룬 원리를 기반으로 하므로 자신 있게 확장할 수 있습니다. + +Happy coding, and may your barcodes scan flawlessly! + +## What Should You Learn Next? + +다음 튜토리얼들은 이 가이드에서 시연한 기술을 기반으로 하며, 밀접하게 관련된 주제를 다룹니다. 각 자료에는 완전한 동작 코드 예제와 단계별 설명이 포함되어 있어 추가 API 기능을 마스터하고 프로젝트에 다양한 구현 방식을 적용하는 데 도움이 됩니다. + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/korean/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..69082c681 --- /dev/null +++ b/barcode/korean/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,220 @@ +--- +category: general +date: 2026-08-06 +description: Databar Expanded Stacked 바코드의 열을 설정하는 방법과 바코드 이미지를 생성하고, 행을 설정하며, C#에서 + 바코드 파일을 저장하는 방법을 배웁니다. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: ko +lastmod: 2026-08-06 +og_description: Databar Expanded Stacked 바코드의 열을 설정하고, 바코드 이미지를 생성하며, 행을 설정하고, Aspose.Barcode로 + 바코드 파일을 저장하는 방법을 빠르게 배워보세요. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Databar Expanded Stacked 바코드의 열 설정 방법 – 단계별 C# 가이드 +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Databar Expanded Stacked 바코드의 열 설정 방법 – 완전 C# 가이드 +url: /ko/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Databar Expanded Stacked 바코드의 열 설정 방법 – 완전한 C# 가이드 + +Databar Expanded Stacked 바코드의 **열 설정 방법**이 필요하다면, 이 튜토리얼이 정확한 단계들을 보여줍니다. 소매 라벨링 시스템이든 물류 애플리케이션이든, 열과 행을 제어하면 바코드 크기와 스캔 신뢰성을 미세 조정할 수 있습니다. 또한 **바코드 생성 방법** 이미지 생성, 행 수 조정, 그리고 **바코드 파일 저장**을 디스크에 올바르게 하는 방법을 확인할 수 있습니다. + +이 가이드는 다음을 안내합니다: + +* Aspose.Barcode for .NET 라이브러리 설치. +* Databar Expanded Stacked 유형에 대한 바코드 생성기 만들기. +* 열 수, 행 수 및 이미지 형식 설정. +* 생성된 PNG 파일을 선택한 디렉터리에 저장. + +Aspose.Barcode에 대한 사전 경험은 필요하지 않습니다—기본적인 C# 개발 환경만 있으면 됩니다. + +## 사전 요구 사항 + +시작하기 전에 다음이 설치되어 있는지 확인하세요: + +* .NET 6.0 SDK 이상이 설치되어 있음. +* Visual Studio 2022(또는 .NET을 지원하는 any IDE). +* **Aspose.Barcode**에 대한 NuGet 참조(`dotnet add package Aspose.Barcode`). + +모든 코드 스니펫은 기본 콘솔 프로젝트 템플릿으로 컴파일됩니다. + +## 단계 1: Databar Expanded Stacked용 바코드 생성기 만들기 + +첫 번째 작업은 `EncodeTypes.DatabarExpandedStacked` 열거형을 사용하여 `BarcodeGenerator`를 인스턴스화하는 것입니다. 이는 기본 레이아웃(스택형)을 설정하고 객체를 추가 구성할 수 있도록 준비합니다. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**왜 중요한가:** 생성기는 모든 렌더링 매개변수를 보유합니다. `DatabarExpandedStacked`를 선택하면 라이브러리에게 스택형 레이아웃을 사용하도록 지시하게 되며, 이는 열과 행 조정을 지원하는 유일한 레이아웃입니다. + +## Databar Expanded Stacked 바코드의 열 설정 방법 + +이제 생성기가 존재하므로 열 수를 제어할 수 있습니다. `DataBar.Columns` 속성은 1에서 4 사이의 정수를 허용합니다. **4**로 설정하면 스택형 레이아웃에 맞으면서 가능한 가장 넓은 바코드가 생성됩니다. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**실용적인 팁:** 라벨에 충분한 여백이 있을 때만 최대 열 수를 사용하세요. 작은 라벨에 열이 너무 많으면 스캔 문제가 발생할 수 있습니다. + +## 바코드 이미지 생성 및 저장 방법 + +열을 구성한 후에는 바코드를 렌더링하고 이미지를 디스크에 기록해야 합니다. `Save` 메서드는 파일 경로와 이미지 형식 열거형을 받습니다. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +`output` 폴더가 존재해야 하며, 없으면 예외가 발생합니다. 원한다면 `Directory.CreateDirectory("output");`를 사용해 프로그래밍적으로 만들 수 있습니다. + +## Databar Expanded Stacked 바코드의 행 설정 방법 + +행은 열과 유사하게 작동하지만 바코드 모듈의 수직 스택에 영향을 줍니다. `DataBar.Rows` 속성은 1에서 5까지의 값을 허용합니다. 이 예제에서는 **3** 행을 사용합니다. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**행이 중요한 이유:** 행을 추가하면 바코드 높이가 증가하며, 바코드 폭을 넓히지 않고 더 많은 데이터 모듈이 필요한 고밀도 라벨에 유용합니다. + +## 바코드 파일 저장 옵션 및 모범 사례 + +`Save` 메서드는 여러 이미지 형식(`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`)을 지원합니다. PNG는 무손실이며 대부분의 스캔 장치에 잘 작동합니다. 파일 크기를 줄이고 약간의 압축 아티팩트를 허용할 수 있다면 JPEG를 선택하세요: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**예외 상황:** JPEG로 저장할 때 품질 매개변수가 적절히 설정되었는지 확인하세요(기본값은 90). 품질이 낮으면 작은 모듈이 흐려져 바코드를 읽을 수 없게 됩니다. + +## 완전하고 실행 가능한 예제 + +모든 것을 합치면, 새 콘솔 프로젝트에 복사하여 바로 실행할 수 있는 단일 파일이 아래에 있습니다: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**예상 출력:** 프로그램을 실행하면 `output` 폴더에 세 개의 파일이 생성됩니다: + +* `DatabarCols4.png` – 4열(넓은) 바코드. +* `DatabarRows3.png` – 3행(높은) 바코드. +* `DatabarRows3.jpg` – 3행 바코드의 JPEG 버전. + +PNG 파일 중 하나를 이미지 뷰어로 열면, 스캔 준비가 된 선명한 Databar Expanded Stacked 바코드를 확인할 수 있습니다. + +## 일반적인 질문 및 문제 해결 + +| Question | Answer | +|----------|--------| +| *이미지가 흐릿하면 어떻게 하나요?* | 손실 없는 출력을 위해 PNG를 사용하고 있는지 확인하세요. JPEG가 필요하면 품질 설정을 높이세요(`new JpegOptions { Quality = 95 }`). | +| *바코드 텍스트를 변경할 수 있나요?* | 예—`new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`에서 두 번째 인수를 원하는 텍스트로 교체하면 됩니다. | +| *열과 행을 함께 사용할 수 있나요?* | 둘을 결합해서 사용할 수 있습니다; `Save`를 호출하기 전에 `DataBar.Columns`와 `DataBar.Rows`를 모두 설정하면 됩니다. | +| *디렉터리 깊이에 제한이 있나요?* | 경로는 운영 체제에서 유효해야 합니다. 크로스 플랫폼 안전성을 위해 `Path.Combine`을 사용하세요. | + +## 결론 + +이제 Databar Expanded Stacked 바코드의 **열 설정 방법**, **행 설정 방법**, 그리고 **바코드 생성 방법**을 알고 있으며, PNG 또는 JPEG 형식으로 **바코드 파일 저장**할 수 있습니다. 전체 예제는 라이브러리 설치부터 최종 파일 검증까지 필요한 모든 단계를 보여줍니다. + +다음에 고려해 볼 내용: + +* QR 코드용 오류 정정 레벨을 사용한 **바코드 생성 방법**. +* SVG 또는 PDF와 같은 벡터 형식에 대한 **바코드 파일 저장 옵션**. +* 동적 라벨 인쇄를 위해 ASP.NET Core MVC 뷰에 생성된 바코드 통합. + +프로젝트 사양에 맞게 다양한 열/행 조합, 이미지 형식, 바코드 내용을 자유롭게 실험해 보세요. 즐거운 코딩 되세요! + +## 다음에 배울 내용은? + +다음 튜토리얼은 이 가이드에서 시연한 기술을 기반으로 하는 밀접한 관련 주제를 다룹니다. 각 자료에는 단계별 설명과 함께 완전한 동작 코드 예제가 포함되어 있어 추가 API 기능을 마스터하고 프로젝트에서 대체 구현 방식을 탐색하는 데 도움이 됩니다. + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/polish/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..bb05bd85d --- /dev/null +++ b/barcode/polish/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: Szybko utwórz kod kreskowy DataBar Stacked w C#. Dowiedz się, jak ustawić + wymiar X, dostosować proporcje i eksportować pliki PNG przy użyciu generatora DataBar + Stacked Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: pl +lastmod: 2026-08-06 +og_description: Utwórz kod kreskowy Databar stacked w C# z Aspose.BarCode. Ten samouczek + pokazuje, jak skonfigurować wymiar X, zmienić współczynnik proporcji i zapisać obrazy + PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Tworzenie kodu kreskowego Databar stacked w C# – kompletny przewodnik programistyczny +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Tworzenie kodu kreskowego Databar stacked w C# – przewodnik krok po kroku +url: /pl/python-java/general/create-databar-stacked-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 stacked w C# – przewodnik krok po kroku + +Jeśli potrzebujesz **utworzyć kod kreskowy databar stacked** w C#, ten przewodnik pokaże Ci dokładnie, jak to zrobić przy użyciu biblioteki Aspose.BarCode. Nauczysz się ustawiać wymiar X, zmieniać współczynnik proporcji kodu kreskowego oraz zapisywać wynik jako pliki PNG — wszystko w kilku zwięzłych krokach. + +Generowanie kodu kreskowego DataBar Stacked jest powszechne, gdy trzeba zakodować dane GS1‑128 do skanowania w handlu detalicznym lub śledzenia logistycznego. W kolejnych sekcjach omówimy wszystko, od konfiguracji projektu po weryfikację wyniku, abyś mógł zintegrować rozwiązanie z dowolną aplikacją .NET bez pomijania żadnych szczegółów. + +## Wymagania wstępne + +* **.NET 6.0** (lub nowszy) zainstalowany – kod jest skierowany do nowoczesnego SDK. +* **Licencjonowana** kopia **Aspose.BarCode for .NET**. Darmowa wersja ewaluacyjna działa do testów, ale dodaje znak wodny. +* IDE, takie jak **Visual Studio 2022** lub **VS Code** z rozszerzeniem C#. +* Podstawowa znajomość składni **C#** oraz koncepcji identyfikatorów aplikacji GS1. + +> **Porada:** Jeśli używasz menedżera pakietów NuGet, polecenie `dotnet add package Aspose.BarCode` automatycznie rozwiązuje wszystkie zależności. + +## Krok 1: Utwórz nowy projekt konsolowy + +Otwórz terminal lub konsolę Menedżera Pakietów i uruchom: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +Polecenie `dotnet new console` tworzy minimalny plik **Program.cs**. Dodanie pakietu **Aspose.BarCode** udostępnia klasę `BarcodeGenerator`. + +## Krok 2: Zainicjalizuj generator DataBar Stacked Omnidirectional + +Otwórz **Program.cs** i zamień domyślną zawartość na poniższy kod. Pierwsza linia tworzy **BarcodeGenerator** skonfigurowany dla symboliki **DataBar Stacked Omnidirectional** i podaje ładunek GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Dlaczego to ważne:** Wartość wyliczenia `EncodeTypes.DatabarStackedOmniDirectional` informuje bibliotekę, aby wygenerowała **databar stacked barcode**, czyli wariant stosowany rodziny DataBar omnidirectional. Ta symbolika może pomieścić do 14 znaków numerycznych, co czyni ją idealną dla kodów GTIN‑14. + +## Krok 3: Ustaw wymiar X (szerokość modułu) + +Wymiar X kontroluje szerokość najmniejszego słupka (modułu). Zbyt mała wartość może źle wyglądać na drukarkach o niskiej rozdzielczości, natomiast zbyt duża może przekroczyć dostępne miejsce na etykiecie. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Wskazówka:** Właściwość `Pixels` jest wygodna do testów na ekranie. W scenariuszach skupionych na druku użyj `generator.Parameters.Barcode.XDimension.Millimeters`. + +## Krok 4: Dostosuj współczynnik proporcji i zapisz pierwszy obraz + +**Współczynnik proporcji** wpływa na stosunek wysokości do szerokości kodu kreskowego typu stacked. Typ DataBar Stacked Omnidirectional obsługuje proporcje od 10 do 30. Wygenerujemy dwa obrazy, aby zobrazować wpływ wizualny. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +Wywołanie `generator.Save` zapisuje plik **PNG** w bieżącym katalogu roboczym. Wyliczenie `BarCodeImageFormat.Png` zapewnia bezstratną kompresję, co jest idealne do dalszego przetwarzania lub osadzania w plikach PDF. + +## Krok 5: Zmień współczynnik proporcji na 30 i zapisz drugi obraz + +Teraz zwiększamy wysokość słupków stacked, zmieniając współczynnik proporcji na **30**. To sprawia, że kod kreskowy jest wyższy bez zmiany wymiaru X. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Uruchomienie programu teraz generuje dwa pliki PNG: + +* **DatabarAspectRatio15.png** – kompaktowy kod kreskowy odpowiedni dla małych etykiet. +* **DatabarAspectRatio30.png** – wyższy kod kreskowy, który zwiększa niezawodność skanowania na powierzchniach o niskim kontraście. + +Możesz otworzyć obrazy w dowolnym przeglądarce, aby zweryfikować, że słupki są prawidłowo ułożone i że zakodowane dane odpowiadają oryginalnemu ciągowi GS1. + +## Krok 6: Zweryfikuj zakodowaną wartość (opcjonalnie) + +Jeśli musisz potwierdzić, że kod kreskowy rzeczywiście odzwierciedla wprowadzony ciąg, możesz go odkodować przy użyciu tej samej biblioteki: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Dekoder powinien zwrócić `(01)12345678901231`, co dowodzi, że proces **create databar stacked barcode** zachował dane. + +## Typowe pułapki i jak ich unikać + +| Problem | Dlaczego się dzieje | Rozwiązanie | +|-------|----------------|-----| +| Kod kreskowy jest rozmyty | Wymiar X ustawiony zbyt nisko dla rozdzielczości wyjściowej | Zwiększ `XDimension.Pixels` lub użyj `Millimeters` dla druku | +| Skaner zgłasza „symbol nie znaleziony” | Współczynnik proporcji poza obsługiwanym zakresem 10‑30 | Utrzymuj proporcję w przedziale 10‑30; 15 i 30 są bezpiecznymi wartościami domyślnymi | +| Plik PNG zawiera znak wodny | Używanie darmowej licencji ewaluacyjnej Aspose.BarCode | Kup pełną licencję lub użyj wersji próbnej wyłącznie do testów | +| Dekodowanie nie powodzi się na drugim obrazie | Dekoder został skonfigurowany dla niewłaściwej symboliki | Użyj `DecodeType.DatabarStackedOmniDirectional` przy odczycie kodów stacked | + +## Kolejne kroki + +Teraz, gdy możesz **create databar stacked barcode** obrazy, możesz chcieć: + +* **Osadź pliki PNG w fakturach PDF** przy użyciu biblioteki PDF, takiej jak **Aspose.PDF**. +* **Generuj kody kreskowe w locie w API webowym** – zwracaj bajty PNG bezpośrednio z kontrolera ASP.NET Core. +* **Eksperymentuj z innymi wariantami DataBar** (np. `DatabarExpanded`, `DatabarLimited`) zmieniając wyliczenie `EncodeTypes`. +* **Dostosuj kolory** ustawiając `generator.Parameters.Barcode.ForeColor` i `BackColor` dla projektów specyficznych dla marki. + +Każdy z tych tematów opiera się na tych samych podstawowych koncepcjach omówionych tutaj: inicjalizacji `BarcodeGenerator`, konfigurowaniu parametrów wizualnych oraz zapisywaniu wyniku przy użyciu `BarCodeImageFormat`. + +--- + +### Podsumowanie + +Ten samouczek pokazał, jak **create databar stacked barcode** obrazy w C# przy użyciu Aspose.BarCode. Nauczyłeś się ustawiać **wymiar X**, modyfikować **współczynnik proporcji kodu kreskowego** oraz eksportować wynik jako pliki **PNG** przy użyciu `BarcodeGenerator`. Dzięki opcjonalnemu krokowi dekodowania możesz również zweryfikować, że zakodowane dane GS1 są poprawne. Zastosuj te wzorce w własnych aplikacjach do zarządzania zapasami, wysyłką lub sprzedażą detaliczną i odkryj liczne możliwości dostosowywania, które oferuje biblioteka. Powodzenia w kodowaniu! + +## 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. + +- [Regulacja wysokości jednowymiarowego kodu Databar](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Generowanie obrazu kodu kreskowego – Kupon GS1 UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/polish/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..fa776c625 --- /dev/null +++ b/barcode/polish/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-06 +description: Generuj obraz kodu kreskowego w C# przy użyciu Aspose.BarCode. Dowiedz + się, jak generować Databar, dostosować niestandardowy rozmiar kodu kreskowego oraz + zmienić wysokość kodu kreskowego za pomocą prostego kodu. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: pl +lastmod: 2026-08-06 +og_description: Generuj obraz kodu kreskowego w C# przy użyciu Aspose.BarCode. Ten + samouczek pokazuje, jak stworzyć kod Databar Omnidirectional, dostosować jego rozmiar + i efektywnie zmienić wysokość kodu kreskowego. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Generowanie obrazu kodu kreskowego w C# – pełny przewodnik Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Generowanie obrazu kodu kreskowego w C# przy użyciu Aspose.BarCode +url: /pl/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generowanie obrazu kodu kreskowego w C# z Aspose.BarCode + +Jeśli potrzebujesz **generować obraz kodu kreskowego** programowo, ten przewodnik pokaże Ci dokładnie, jak to zrobić. Niezależnie od tego, czy tworzysz system inwentaryzacji detalicznej, czy portal śledzenia logistycznego, zobaczysz kompletny przepływ pracy tworzenia kodu Databar Omnidirectional, dostosowywania jego wymiarów i zapisywania wyniku jako plik PNG. + +Generowanie obrazu kodu kreskowego jest powszechnym wymaganiem, ale programiści często zastanawiają się **jak wygenerować Databar** o dokładnie potrzebnym rozmiarze. W tym samouczku nauczysz się tworzyć kod Databar, dostosowywać jego szerokość i wysokość oraz zmieniać wysokość kodu kreskowego bez przepisywania całego generatora. + +## Wymagania wstępne + +* .NET 6.0 SDK lub nowszy (kod działa z .NET Core i .NET Framework) +* Visual Studio 2022 (lub dowolne IDE obsługujące C#) +* Ważna licencja Aspose.BarCode for .NET (darmowa wersja ewaluacyjna działa do testów) +* Podstawowa znajomość składni C# + +## Krok 1: Zainstaluj Aspose.BarCode + +Dodaj pakiet NuGet Aspose.BarCode do swojego projektu: + +```bash +dotnet add package Aspose.BarCode +``` + +Pakiet zawiera klasę `BarcodeGenerator` używaną w całym tym samouczku. Po instalacji przywróć projekt, aby pobrać zależności. + +## Krok 2: Utwórz podstawowy generator kodów kreskowych + +Pierwsza linia kodu tworzy **generator kodów kreskowych**, który wygeneruje symbol Databar Omnidirectional. Enum `EncodeTypes.DatabarOmniDirectional` informuje bibliotekę, jaką symbologię użyć, a ciąg danych jest zgodny ze składnią identyfikatora aplikacji GS1. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Dlaczego to ważne:** Obiekt `BarcodeGenerator` jest punktem wejścia dla każdej operacji związanej z kodem kreskowym. Wybierając `DatabarOmniDirectional`, zapewniasz, że wynik jest zgodny ze standardem GS1 dla skanowania w handlu detalicznym. + +## Krok 3: Ustaw niestandardowy wymiar X (szerokość modułu) + +Wymiar X kontroluje szerokość najcieńszego paska. Ustawienie go na małą wartość w pikselach daje kompaktowy kod kreskowy, podczas gdy większe wartości zwiększają ogólną szerokość. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Wyjaśnienie:** Wymiar X o wartości 2 piksele jest powszechnym wyborem dla ekranów o wysokiej rozdzielczości. Dostosuj tę wartość, jeśli potrzebujesz większej lub mniejszej gęstości wizualnej. + +## Krok 4: Wygeneruj pierwszy obraz kodu kreskowego o określonej wysokości + +Wysokość kodu kreskowego jest niezależna od wymiaru X. Tutaj ustawiamy wysokość paska na **30 px**, a następnie zapisujemy obraz jako PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Wynik:** Masz teraz plik o nazwie `DatabarBarHeight30Pixels.png`, który przedstawia kod Databar o wysokości 30 px. To demonstruje możliwość **niestandardowego rozmiaru kodu kreskowego** dla konkretnego zastosowania, takiego jak mała etykieta. + +## Krok 5: Zmień wysokość kodu kreskowego dla większej wersji + +Jeśli ten sam kod kreskowy ma pojawić się na większej etykiecie, wystarczy zmodyfikować właściwość wysokości i ponownie użyć tej samej instancji generatora. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Dlaczego możesz ponownie używać generatora:** Zmiana `BarHeight.Pixels` aktualizuje wewnętrzny układ bez tworzenia nowego obiektu, co oszczędza pamięć i zachowuje niezmieniony ciąg danych. To zalecany sposób **zmiany wysokości kodu kreskowego** w locie. + +## Krok 6: Zweryfikuj wynik + +Otwórz dwa pliki PNG w dowolnym przeglądarce obrazów. Powinieneś zobaczyć dwa kody Databar Omnidirectional, które kodują ten sam GTIN, ale różnią się rozmiarem w pionie: + +* `DatabarBarHeight30Pixels.png` – 30 px wysokości, odpowiedni dla kompaktowych paragonów. +* `DatabarBarHeight60Pixels.png` – 60 px wysokości, idealny dla większych etykiet na krawędzi półki. + +Oba obrazy zachowują ten sam wymiar X, więc stosunek pasków do przerw pozostaje spójny, podczas gdy ogólna wysokość skaluje się. + +## Typowe warianty i przypadki brzegowe + +| Sytuacja | Jak sobie radzić | +|-----------|------------------| +| **Inna symbologia kodu kreskowego** | Zastąp `EncodeTypes.DatabarOmniDirectional` inną wartością wyliczeniową (np. `EncodeTypes.Code128`). Reszta kodu pozostaje niezmieniona. | +| **Wymiary nie‑pikselowe** | Użyj `generator.Parameters.Barcode.XDimension.Millimeters` lub `BarHeight.Millimeters`, jeśli potrzebujesz fizycznych pomiarów do wydruku gotowego. | +| **Przezroczyste tło** | Ustaw `generator.Parameters.ImageBackgroundColor = Color.Transparent;` przed wywołaniem `Save`. | +| **Wyjście wysokiej rozdzielczości** | Zwiększ zarówno `XDimension.Pixels`, jak i `BarHeight.Pixels` proporcjonalnie, lub zapisz jako `BarCodeImageFormat.Tiff` dla jakości bezstratnej. | +| **Wiele kodów kreskowych w jednym obrazie** | Utwórz osobne instancje `BarcodeGenerator`, renderuj każdą do `Bitmap`, a następnie połącz je przy użyciu `Graphics.DrawImage`. | + +**Porada:** Zawsze testuj wygenerowany kod kreskowy rzeczywistym skanerem przed wdrożeniem do produkcji. Skanery mogą różnie interpretować bardzo cienkie paski w zależności od oświetlenia i jakości czujnika. + +## Pełny kod źródłowy do odniesienia + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Skopiuj kod do nowego projektu konsolowego, uruchom go, a zobaczysz dwa pliki PNG pojawiające się w folderze wyjściowym. + +## Najczęściej zadawane pytania + +**Q:** Czy mogę generować kod kreskowy bez instalacji licencji? +**A:** Wersja ewaluacyjna Aspose.BarCode działa bez licencji, ale dodaje mały znak wodny. Do użytku produkcyjnego zastosuj zakupioną licencję używając `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**Q:** Czy zmiana wymiaru X wpływa na czytelność? +**A:** Tak. Bardzo małe wymiary X mogą sprawić, że kod kreskowy będzie nieczytelny na drukarkach o niskiej rozdzielczości. Minimalnie 1 px dla renderowania na ekranie jest zalecane; do druku użyj co najmniej 0,25 mm. + +**Q:** Co zrobić, jeśli potrzebuję wygenerować kod kreskowy w formacie JPEG? +**A:** Zastąp `BarCodeImageFormat.Png` na `BarCodeImageFormat.Jpeg`. Możesz także ustawić `generator.Parameters.ImageQuality`, aby kontrolować kompresję. + +## Zakończenie + +Teraz wiesz, jak **generować obraz kodu kreskowego** w C# przy użyciu Aspose.BarCode, jak **tworzyć kod Databar**, dostosować **niestandardowy rozmiar kodu kreskowego** oraz **zmienić wysokość kodu kreskowego** na żądanie. Pełny przykład demonstruje najczęstszy przepływ pracy, a tabela wariantów przygotowuje Cię do radzenia sobie z rzeczywistymi przypadkami brzegowymi. + +Następnie odkryj powiązane tematy, takie jak **osadzanie kodów kreskowych w dokumentach PDF**, **generowanie wielu kodów kreskowych wsadowo** oraz **używanie kodów QR do płatności mobilnych**. Każdy z tych scenariuszy opiera się na tych samych zasadach przedstawionych tutaj, więc możesz pewnie rozwijać tę wiedzę. + +Szczęśliwego kodowania i niech Twoje kody kreskowe skanują się bezbłędnie! + +## 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. + +- [Generuj obraz kodu kreskowego – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [Jak wygenerować kod Aztec z niestandardowym współczynnikiem proporcji przy użyciu Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Jak wygenerować kod kreskowy – konfiguracja Code 39 z Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/polish/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..e9af279a8 --- /dev/null +++ b/barcode/polish/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Jak ustawić kolumny dla kodu kreskowego Databar Expanded Stacked oraz + dowiedzieć się, jak generować obrazy kodów kreskowych, ustawiać wiersze i zapisywać + plik kodu kreskowego w C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: pl +lastmod: 2026-08-06 +og_description: Jak ustawić kolumny dla kodu kreskowego Databar Expanded Stacked i + szybko nauczyć się generować obrazy kodów kreskowych, ustawiać wiersze oraz zapisywać + plik kodu kreskowego przy użyciu Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Jak ustawić kolumny dla kodu kreskowego Databar Expanded Stacked – krok + po kroku przewodnik C# +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Jak ustawić kolumny dla kodu kreskowego Databar Expanded Stacked – kompletny + przewodnik C# +url: /pl/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Jak ustawić kolumny dla kodu kreskowego Databar Expanded Stacked – kompletny przewodnik C# + +Jeśli potrzebujesz **jak ustawić kolumny** dla kodu kreskowego Databar Expanded Stacked, ten tutorial pokaże Ci dokładne kroki. Niezależnie od tego, czy tworzysz system etykietowania w handlu detalicznym, czy aplikację logistyczną, kontrolowanie kolumn i wierszy pozwala precyzyjnie dostosować rozmiar kodu kreskowego oraz niezawodność skanowania. Dodatkowo zobaczysz **jak generować kod kreskowy** w postaci obrazów, jak dostosować liczbę wierszy oraz jak poprawnie **zapisać plik kodu kreskowego** na dysku. + +Ten przewodnik poprowadzi Cię przez: + +* Instalację biblioteki Aspose.Barcode dla .NET. +* Utworzenie generatora kodu kreskowego dla typu Databar Expanded Stacked. +* Ustawienie liczby kolumn, liczby wierszy oraz formatu obrazu. +* Zapisanie powstałych plików PNG do wybranego katalogu. + +Wcześniejsze doświadczenie z Aspose.Barcode nie jest wymagane — wystarczy podstawowe środowisko programistyczne C#. + +## Wymagania wstępne + +Zanim zaczniesz, upewnij się, że masz: + +* .NET 6.0 SDK lub nowszy zainstalowany. +* Visual Studio 2022 (lub dowolne IDE obsługujące .NET). +* Odwołanie NuGet do **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Wszystkie fragmenty kodu kompilują się przy użyciu domyślnego szablonu projektu konsolowego. + +## Krok 1: Utwórz generator kodu kreskowego dla Databar Expanded Stacked + +Pierwszym krokiem jest utworzenie instancji `BarcodeGenerator` z wyliczeniem `EncodeTypes.DatabarExpandedStacked`. Ustawia to domyślny układ (stacked) i przygotowuje obiekt do dalszej konfiguracji. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Dlaczego to ważne:** Generator przechowuje wszystkie parametry renderowania. Wybierając `DatabarExpandedStacked` informujesz bibliotekę, aby użyła układu stacked, który jest jedynym układem obsługującym regulację kolumn i wierszy. + +## Jak ustawić kolumny dla kodu kreskowego Databar Expanded Stacked + +Teraz, gdy generator istnieje, możesz kontrolować liczbę kolumn. Właściwość `DataBar.Columns` przyjmuje liczbę całkowitą od 1 do 4. Ustawienie jej na **4** tworzy najszerszy możliwy kod kreskowy, nadal pasujący do układu stacked. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Praktyczna wskazówka:** Używaj maksymalnej liczby kolumn tylko wtedy, gdy masz wystarczająco dużo wolnego miejsca na etykiecie. Zbyt wiele kolumn na małej etykiecie może powodować problemy ze skanowaniem. + +## Jak generować obrazy kodów kreskowych i zapisywać je + +Po skonfigurowaniu kolumn musisz wyrenderować kod kreskowy i zapisać obraz na dysku. Metoda `Save` przyjmuje ścieżkę pliku oraz wyliczenie formatu obrazu. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Folder `output` musi istnieć, w przeciwnym razie wywołanie zgłosi wyjątek. Możesz go utworzyć programowo za pomocą `Directory.CreateDirectory("output");`, jeśli wolisz. + +## Jak ustawić wiersze dla kodu kreskowego Databar Expanded Stacked + +Wiersze działają podobnie jak kolumny, ale wpływają na pionowe układanie modułów kodu kreskowego. Właściwość `DataBar.Rows` przyjmuje wartości od 1 do 5. W tym przykładzie używamy **3** wierszy. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Dlaczego wiersze są ważne:** Dodanie wierszy zwiększa wysokość kodu kreskowego, co może być przydatne przy etykietach o wysokiej gęstości, gdzie potrzebujesz więcej modułów danych bez poszerzania kodu. + +## Opcje zapisu pliku kodu kreskowego i najlepsze praktyki + +Metoda `Save` obsługuje kilka formatów obrazu (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG jest bezstratny i dobrze działa na większości urządzeń skanujących. Jeśli potrzebujesz mniejszego rozmiaru pliku i możesz tolerować niewielkie artefakty kompresji, wybierz JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Przypadek brzegowy:** Przy zapisie do JPEG upewnij się, że parametr jakości jest ustawiony odpowiednio (domyślnie 90). Niska jakość może rozmywać małe moduły, czyniąc kod kreskowy nieczytelnym. + +## Kompletny, gotowy do uruchomienia przykład + +Łącząc wszystko razem, oto pojedynczy plik, który możesz skopiować do nowego projektu konsolowego i uruchomić od razu: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Oczekiwany wynik:** Po uruchomieniu programu folder `output` zawiera trzy pliki: + +* `DatabarCols4.png` – kod kreskowy z 4 kolumnami (szeroki). +* `DatabarRows3.png` – kod kreskowy z 3 wierszami (wysoki). +* `DatabarRows3.jpg` – wersja JPEG kodu kreskowego z 3 wierszami. + +Otwórz dowolny z plików PNG w przeglądarce obrazów; powinieneś zobaczyć wyraźny kod kreskowy Databar Expanded Stacked gotowy do skanowania. + +## Częste pytania i rozwiązywanie problemów + +| Pytanie | Odpowiedź | +|----------|--------| +| *Co zrobić, gdy obraz jest rozmyty?* | Sprawdź, czy używasz PNG dla bezstratnego wyjścia. Jeśli potrzebujesz JPEG, zwiększ ustawienie jakości (`new JpegOptions { Quality = 95 }`). | +| *Czy mogę zmienić tekst kodu kreskowego?* | Tak — zamień drugi argument w `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Czy kolumny i wiersze działają razem?* | Mogą być łączone; po prostu ustaw zarówno `DataBar.Columns`, jak i `DataBar.Rows` przed wywołaniem `Save`. | +| *Czy istnieje limit głębokości katalogu?* | Ścieżka musi być prawidłowa dla systemu operacyjnego. Użyj `Path.Combine` dla bezpieczeństwa wieloplatformowego. | + +## Podsumowanie + +Teraz wiesz **jak ustawić kolumny** dla kodu kreskowego Databar Expanded Stacked, **jak ustawić wiersze** oraz **jak generować obrazy kodów kreskowych**, które możesz **zapisać plik kodu kreskowego** w formacie PNG lub JPEG. Kompletny przykład demonstruje każdy wymagany krok, od instalacji biblioteki po ostateczną weryfikację pliku. + +Następnie rozważ eksplorację: + +* **jak generować kod kreskowy** z poziomami korekcji błędów dla kodów QR. +* **opcje zapisu pliku kodu kreskowego** dla formatów wektorowych, takich jak SVG lub PDF. +* Integracja wygenerowanych kodów kreskowych w widokach ASP.NET Core MVC w celu dynamicznego drukowania etykiet. + +Śmiało eksperymentuj z różnymi kombinacjami kolumn/wierszy, formatami obrazów i zawartością kodów kreskowych, aby dopasować je do specyfikacji Twojego projektu. Szczęśliwego kodowania! + +## 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. + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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/portuguese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/portuguese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..b29c43caf --- /dev/null +++ b/barcode/portuguese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: Crie códigos de barras DataBar empilhados em C# rapidamente. Aprenda + a definir a dimensão X, ajustar a proporção e exportar arquivos PNG usando o gerador + DataBar Stacked Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: pt +lastmod: 2026-08-06 +og_description: Crie código de barras Databar empilhado em C# com Aspose.BarCode. + Este tutorial mostra como configurar a dimensão X, alterar a proporção e salvar + imagens PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Crie código de barras Databar empilhado em C# – guia completo de programação +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Crie código de barras Databar empilhado em C# – guia passo a passo +url: /pt/python-java/general/create-databar-stacked-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 databar stacked barcode em C# – guia passo a passo + +Se você precisa **criar databar stacked barcode** imagens em C#, este guia mostra exatamente como fazer isso usando a biblioteca Aspose.BarCode. Você aprenderá a definir a dimensão X, alterar a proporção do código de barras e salvar o resultado como arquivos PNG — tudo em alguns passos concisos. + +Gerar um DataBar Stacked barcode é comum quando você precisa codificar dados GS1‑128 para leitura no varejo ou rastreamento logístico. Nas seções a seguir, cobrimos tudo, desde a configuração do projeto até a verificação da saída, para que você possa integrar a solução em qualquer aplicação .NET sem perder nenhum detalhe. + +## Pré-requisitos + +* **.NET 6.0** (ou posterior) instalado – o código tem como alvo o SDK moderno. +* Uma cópia **licenciada** de **Aspose.BarCode for .NET**. A avaliação gratuita funciona para testes, mas adiciona uma marca d'água. +* Uma IDE como **Visual Studio 2022** ou **VS Code** com a extensão C#. +* Familiaridade básica com a sintaxe **C#** e o conceito de Identificadores de Aplicação GS1. + +> **Dica profissional:** Se você usar o gerenciador de pacotes NuGet, o comando `dotnet add package Aspose.BarCode` resolve todas as dependências automaticamente. + +## Etapa 1: Criar um novo projeto de console + +Abra um terminal ou o Console do Gerenciador de Pacotes e execute: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +O comando `dotnet new console` gera um arquivo **Program.cs** mínimo. Adicionar o pacote **Aspose.BarCode** disponibiliza a classe `BarcodeGenerator`. + +## Etapa 2: Inicializar o gerador DataBar Stacked Omnidirectional + +Abra **Program.cs** e substitua o conteúdo padrão pelo código a seguir. A primeira linha cria um **BarcodeGenerator** configurado para a simbologia **DataBar Stacked Omnidirectional** e fornece uma carga útil GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Por que isso importa:** O valor enum `EncodeTypes.DatabarStackedOmniDirectional` indica à biblioteca que ela deve gerar um **databar stacked barcode**, que é a variante empilhada da família DataBar omnidirecional. Essa simbologia pode conter até 14 caracteres numéricos, tornando‑a ideal para códigos GTIN‑14. + +## Etapa 3: Definir a dimensão X (largura do módulo) + +A dimensão X controla a largura da barra mais fina (o módulo). Um valor muito pequeno pode ser renderizado de forma ruim em impressoras de baixa resolução, enquanto um valor muito grande pode exceder o espaço da etiqueta. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Dica:** A propriedade `Pixels` é conveniente para testes baseados em tela. Para cenários focados em impressão, use `generator.Parameters.Barcode.XDimension.Millimeters` em vez disso. + +## Etapa 4: Ajustar a proporção e salvar a primeira imagem + +A **proporção** influencia a relação altura‑largura do código de barras empilhado. O tipo DataBar Stacked Omnidirectional suporta proporções de 10 a 30. Geraremos duas imagens para ilustrar o impacto visual. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +A chamada a `generator.Save` grava um arquivo **PNG** no diretório de trabalho atual. O enum `BarCodeImageFormat.Png` garante compressão sem perdas, o que é ideal para processamento adicional ou incorporação em PDFs. + +## Etapa 5: Alterar a proporção para 30 e salvar a segunda imagem + +Agora aumentamos a altura das barras empilhadas alterando a proporção para **30**. Isso torna o código de barras mais alto sem mudar a dimensão X. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Executar o programa agora produz dois arquivos PNG: + +* **DatabarAspectRatio15.png** – um código de barras compacto adequado para etiquetas pequenas. +* **DatabarAspectRatio30.png** – um código de barras mais alto que melhora a confiabilidade da leitura em superfícies de baixo contraste. + +Você pode abrir as imagens em qualquer visualizador para verificar se as barras estão corretamente empilhadas e se os dados codificados correspondem à string GS1 original. + +## Etapa 6: Verificar o valor codificado (opcional) + +Se precisar confirmar que o código de barras realmente representa a string de entrada, você pode decodificá‑lo com a mesma biblioteca: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +O decodificador deve exibir `(01)12345678901231`, provando que o processo de **create databar stacked barcode** preservou os dados. + +## Armadilhas comuns e como evitá‑las + +| Problema | Por que acontece | Correção | +|----------|------------------|----------| +| Código de barras aparece borrado | Dimensão X definida muito baixa para a resolução de saída | Aumente `XDimension.Pixels` ou use `Millimeters` para impressão | +| Scanner relata “símbolo não encontrado” | Proporção fora do intervalo suportado de 10‑30 | Mantenha a proporção entre 10 e 30; 15 e 30 são valores padrão seguros | +| PNG contém marca d'água | Usando a licença de avaliação gratuita do Aspose.BarCode | Adquira uma licença completa ou use a versão de teste apenas para testes | +| Decodificação falha na segunda imagem | O decodificador foi configurado para a simbologia errada | Use `DecodeType.DatabarStackedOmniDirectional` ao ler códigos de barras empilhados | + +## Próximos passos + +Agora que você pode **create databar stacked barcode** imagens, talvez queira: + +* **Incorporar os PNGs em faturas PDF** usando uma biblioteca PDF como **Aspose.PDF**. +* **Gerar códigos de barras sob demanda em uma API web** – retornar os bytes PNG diretamente de um controlador ASP.NET Core. +* **Experimentar outras variantes DataBar** (por exemplo, `DatabarExpanded`, `DatabarLimited`) alterando o enum `EncodeTypes`. +* **Ajustar cores** definindo `generator.Parameters.Barcode.ForeColor` e `BackColor` para designs específicos da marca. + +Cada um desses tópicos se baseia nos mesmos conceitos centrais abordados aqui: inicializar `BarcodeGenerator`, configurar parâmetros visuais e salvar o resultado com `BarCodeImageFormat`. + +--- + +### Conclusão + +Este tutorial demonstrou como **create databar stacked barcode** imagens em C# usando Aspose.BarCode. Você aprendeu a definir a **dimensão X**, modificar a **proporção do código de barras** e exportar o resultado como arquivos **PNG** com `BarcodeGenerator`. Com a etapa opcional de decodificação, você também pode verificar se os dados GS1 codificados estão corretos. Aplique esses padrões em seus próprios aplicativos de inventário, envio ou ponto de venda, e explore as diversas opções de personalização que a biblioteca oferece. Feliz codificação! + +## 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. + +- [Ajuste de Altura de Código de Barras Databar Unidimensional](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Gerar imagem de código de barras – Cupom GS1 UPC‑A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/portuguese/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..0bdef5b07 --- /dev/null +++ b/barcode/portuguese/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: Gere imagem de código de barras em C# usando Aspose.BarCode. Aprenda + a gerar Databar, ajustar o tamanho personalizado do código de barras e mudar a altura + do código de barras com código simples. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: pt +lastmod: 2026-08-06 +og_description: Gere imagem de código de barras em C# com Aspose.BarCode. Este tutorial + mostra como criar um código de barras Databar Omnidirecional, personalizar seu tamanho + e alterar a altura do código de barras de forma eficiente. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Gerar imagem de código de barras em C# – guia completo do Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Gerar imagem de código de barras em C# com Aspose.BarCode +url: /pt/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Gerar imagem de código de barras em C# com Aspose.BarCode + +Se você precisa **gerar imagem de código de barras** programaticamente, este guia mostra exatamente como fazer. Seja construindo um sistema de inventário de varejo ou um portal de rastreamento logístico, você verá o fluxo completo para criar um código de barras Databar Omnidirecional, ajustar suas dimensões e salvar o resultado como um arquivo PNG. + +Gerar uma imagem de código de barras é uma necessidade comum, mas os desenvolvedores frequentemente se perguntam **como gerar Databar** com o tamanho exato que precisam. Neste tutorial você aprenderá a criar um código de barras Databar, personalizar sua largura e altura, e alterar a altura do código de barras sem reescrever todo o gerador. + +## Pré‑requisitos + +Antes de começar, certifique‑se de que você tem: + +* .NET 6.0 SDK ou superior (o código funciona com .NET Core e .NET Framework) +* Visual Studio 2022 (ou qualquer IDE que suporte C#) +* Uma licença válida do Aspose.BarCode for .NET (a avaliação gratuita funciona para testes) +* Familiaridade básica com a sintaxe C# + +## Etapa 1: Instalar Aspose.BarCode + +Adicione o pacote NuGet Aspose.BarCode ao seu projeto: + +```bash +dotnet add package Aspose.BarCode +``` + +O pacote contém a classe `BarcodeGenerator` usada ao longo deste tutorial. Após a instalação, restaure o projeto para obter as dependências. + +## Etapa 2: Criar um gerador de código de barras básico + +A primeira linha de código cria um **gerador de código de barras** que produzirá um símbolo Databar Omnidirecional. O enum `EncodeTypes.DatabarOmniDirectional` indica à biblioteca qual simbologia usar, e a string de dados segue a sintaxe do Identificador de Aplicação GS1. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Por que isso importa:** O objeto `BarcodeGenerator` é o ponto de entrada para toda operação de código de barras. Ao selecionar `DatabarOmniDirectional` você garante que a saída esteja em conformidade com o padrão GS1 para leitura no varejo. + +## Etapa 3: Definir uma X‑dimension personalizada (largura do módulo) + +A X‑dimension controla a largura da barra mais estreita. Definir um valor pequeno em pixels gera um código de barras compacto, enquanto valores maiores aumentam a largura total. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Explicação:** Uma X‑dimension de 2 pixels é uma escolha comum para telas de alta resolução. Ajuste esse valor se precisar de uma densidade visual mais apertada ou mais espaçada. + +## Etapa 4: Gerar a primeira imagem de código de barras com altura específica + +A altura do código de barras é independente da X‑dimension. Aqui definimos a altura da barra para **30 px**, então salvamos a imagem como PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Resultado:** Agora você tem um arquivo chamado `DatabarBarHeight30Pixels.png` que mostra um código de barras Databar com 30 px de altura. Isso demonstra a capacidade de **tamanho de código de barras personalizado** para um caso de uso específico, como um rótulo pequeno. + +## Etapa 5: Alterar a altura do código de barras para uma versão maior + +Se o mesmo código de barras precisar aparecer em um rótulo maior, basta modificar a propriedade de altura e reutilizar a mesma instância do gerador. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Por que você pode reutilizar o gerador:** Alterar `BarHeight.Pixels` atualiza o layout interno sem recriar o objeto, o que economiza memória e mantém a string de dados intacta. Essa é a forma recomendada de **alterar a altura do código de barras** dinamicamente. + +## Etapa 6: Verificar a saída + +Abra os dois arquivos PNG em qualquer visualizador de imagens. Você deverá ver dois códigos de barras Databar Omnidirecional que codificam o mesmo GTIN, mas diferem em tamanho vertical: + +* `DatabarBarHeight30Pixels.png` – 30 px de altura, adequado para recibos compactos. +* `DatabarBarHeight60Pixels.png` – 60 px de altura, ideal para rótulos de prateleira maiores. + +Ambas as imagens mantêm a mesma X‑dimension, de modo que a proporção barra‑espaço permanece consistente enquanto a altura total escala. + +## Variações comuns e casos de borda + +| Situação | Como lidar | +|-----------|------------| +| **Simbologia de código de barras diferente** | Substitua `EncodeTypes.DatabarOmniDirectional` por outro valor de enum (por exemplo, `EncodeTypes.Code128`). O restante do código permanece inalterado. | +| **Dimensões não em pixels** | Use `generator.Parameters.Barcode.XDimension.Millimeters` ou `BarHeight.Millimeters` se precisar de medidas físicas para saída pronta para impressão. | +| **Fundo transparente** | Defina `generator.Parameters.ImageBackgroundColor = Color.Transparent;` antes de chamar `Save`. | +| **Saída de alta resolução** | Aumente tanto `XDimension.Pixels` quanto `BarHeight.Pixels` proporcionalmente, ou salve como `BarCodeImageFormat.Tiff` para qualidade sem perdas. | +| **Múltiplos códigos de barras em uma única imagem** | Crie instâncias separadas de `BarcodeGenerator`, renderize cada uma em um `Bitmap` e então componha-as usando `Graphics.DrawImage`. | + +**Dica profissional:** Sempre teste o código de barras gerado com um scanner real antes de colocar em produção. Scanners podem interpretar barras muito finas de forma diferente dependendo da iluminação e da qualidade do sensor. + +## Código-fonte completo para referência + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Copie o código para um novo projeto de console, execute-o e você verá os dois arquivos PNG aparecerem na pasta de saída. + +## Perguntas frequentes + +**P: Posso gerar um código de barras sem instalar uma licença?** +R: A versão de avaliação do Aspose.BarCode funciona sem licença, mas adiciona uma pequena marca d'água. Para uso em produção, aplique uma licença adquirida usando `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**P: Alterar a X‑dimension afeta a legibilidade?** +R: Sim. X‑dimensions muito pequenas podem tornar o código de barras ilegível em impressoras de baixa resolução. Um mínimo de 1 px para renderização em tela é recomendado; para impressão, use ao menos 0,25 mm. + +**P: E se eu precisar gerar um código de barras em formato JPEG?** +R: Substitua `BarCodeImageFormat.Png` por `BarCodeImageFormat.Jpeg`. Você também pode definir `generator.Parameters.ImageQuality` para controlar a compressão. + +## Conclusão + +Agora você sabe como **gerar imagem de código de barras** em C# usando Aspose.BarCode, como **criar um código de barras Databar**, ajustar um **tamanho de código de barras personalizado** e **alterar a altura do código de barras** sob demanda. O exemplo completo demonstra o fluxo de trabalho mais comum, e a tabela de variações prepara você para lidar com casos reais. + +Em seguida, explore tópicos relacionados como **incorporar códigos de barras em documentos PDF**, **gerar lotes de múltiplos códigos de barras** e **usar QR codes para pagamentos móveis**. Cada um desses cenários se baseia nos mesmos princípios abordados aqui, permitindo que você amplie esse conhecimento com confiança. + +Bom desenvolvimento, e que seus códigos de barras sejam lidos perfeitamente! + +## O que você deve aprender a seguir? + +Os tutoriais a seguir cobrem 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. + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/portuguese/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..182827fe6 --- /dev/null +++ b/barcode/portuguese/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Como definir colunas para um código de barras Databar Expanded Stacked + e aprender a gerar imagens de código de barras, definir linhas e salvar o arquivo + de código de barras em C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: pt +lastmod: 2026-08-06 +og_description: Como definir colunas para um código de barras Databar Expanded Stacked + e aprender rapidamente como gerar imagens de código de barras, definir linhas e + salvar o arquivo de código de barras com Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Como definir colunas para um código de barras Databar Expanded Stacked – + guia passo a passo em C# +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Como definir colunas para um código de barras Databar Expanded Stacked – guia + completo em C# +url: /pt/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Como definir colunas para um Databar Expanded Stacked barcode – guia completo em C# + +Se você precisa **definir colunas** para um Databar Expanded Stacked barcode, este tutorial mostra os passos exatos. Seja construindo um sistema de rotulagem de varejo ou uma aplicação logística, controlar colunas e linhas permite ajustar finamente o tamanho do código de barras e a confiabilidade da leitura. Além disso, você verá **como gerar código de barras** imagens, ajustar o número de linhas e salvar corretamente o **arquivo do código de barras** no disco. + +Este guia orienta você através de: + +* Instalar a biblioteca Aspose.Barcode for .NET. +* Criar um gerador de código de barras para o tipo Databar Expanded Stacked. +* Definir a contagem de colunas, contagem de linhas e formato da imagem. +* Salvar os arquivos PNG resultantes em um diretório escolhido. + +Não é necessária experiência prévia com Aspose.Barcode — apenas um ambiente básico de desenvolvimento C#. + +## 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 que suporte .NET). +* Uma referência NuGet ao **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Todos os trechos de código compilam com o modelo padrão de projeto de console. + +## Etapa 1: Criar um gerador de código de barras para Databar Expanded Stacked + +O primeiro passo é instanciar `BarcodeGenerator` com o enum `EncodeTypes.DatabarExpandedStacked`. Isso define o layout padrão (empilhado) e prepara o objeto para configurações adicionais. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Por que isso é importante:** O gerador contém todos os parâmetros de renderização. Ao escolher `DatabarExpandedStacked` você indica à biblioteca para usar o layout empilhado, que é o único que suporta ajustes de colunas e linhas. + +## Como definir colunas para um Databar Expanded Stacked barcode + +Agora que o gerador existe, você pode controlar a contagem de colunas. A propriedade `DataBar.Columns` aceita um inteiro entre 1 e 4. Definir para **4** cria o código de barras mais largo possível, ainda compatível com o layout empilhado. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Dica prática:** Use a contagem máxima de colunas somente quando houver espaço branco suficiente na etiqueta. Muitas colunas em uma etiqueta pequena podem causar problemas de leitura. + +## Como gerar imagens de código de barras e salvá‑las + +Após configurar as colunas, você precisa renderizar o código de barras e gravar a imagem no disco. O método `Save` recebe um caminho de arquivo e um enum de formato de imagem. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +A pasta `output` deve existir ou a chamada lançará uma exceção. Você pode criá‑la programaticamente com `Directory.CreateDirectory("output");` se preferir. + +## Como definir linhas para um Databar Expanded Stacked barcode + +As linhas funcionam de forma semelhante às colunas, mas afetam o empilhamento vertical dos módulos do código de barras. A propriedade `DataBar.Rows` aceita valores de 1 a 5. Neste exemplo usamos **3** linhas. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Por que as linhas são importantes:** Adicionar linhas aumenta a altura do código de barras, o que pode ser útil para etiquetas de alta densidade onde você precisa de mais módulos de dados sem alargar o código de barras. + +## Opções de salvamento de arquivo de código de barras e boas práticas + +O método `Save` suporta vários formatos de imagem (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG é sem perdas e funciona bem na maioria dos dispositivos de leitura. Se precisar de um tamanho de arquivo menor e puder tolerar leves artefatos de compressão, escolha JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Caso extremo:** Ao salvar em JPEG, certifique‑se de que o parâmetro de qualidade está definido adequadamente (o padrão é 90). Qualidade baixa pode desfocar os pequenos módulos, tornando o código de barras ilegível. + +## Exemplo completo e executável + +Juntando tudo, aqui está um único arquivo que você pode copiar para um novo projeto de console e executar imediatamente: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Saída esperada:** Após executar o programa, a pasta `output` contém três arquivos: + +* `DatabarCols4.png` – código de barras com 4 colunas (largo). +* `DatabarRows3.png` – código de barras com 3 linhas (alto). +* `DatabarRows3.jpg` – versão JPEG do código de barras de 3 linhas. + +Abra qualquer um dos arquivos PNG em um visualizador de imagens; você deverá ver um código de barras Databar Expanded Stacked nítido, pronto para leitura. + +## Perguntas comuns e solução de problemas + +| Pergunta | Resposta | +|----------|--------| +| *E se a imagem estiver borrada?* | Verifique se está usando PNG para saída sem perdas. Se precisar de JPEG, aumente a configuração de qualidade (`new JpegOptions { Quality = 95 }`). | +| *Posso mudar o texto do código de barras?* | Sim — substitua o segundo argumento em `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Colunas e linhas funcionam juntas?* | Elas podem ser combinadas; basta definir tanto `DataBar.Columns` quanto `DataBar.Rows` antes de chamar `Save`. | +| *Existe um limite para a profundidade de diretórios?* | O caminho deve ser válido para o sistema operacional. Use `Path.Combine` para segurança multiplataforma. | + +## Conclusão + +Agora você sabe **como definir colunas** para um Databar Expanded Stacked barcode, **como definir linhas** e **como gerar código de barras** imagens que você pode **salvar arquivo de código de barras** em formato PNG ou JPEG. O exemplo completo demonstra cada passo necessário, desde a instalação da biblioteca até a verificação final do arquivo. + +Em seguida, considere explorar: + +* **como gerar código de barras** com níveis de correção de erro para códigos QR. +* opções de **salvar arquivo de código de barras** para formatos vetoriais como SVG ou PDF. +* Integrar os códigos de barras gerados em visualizações ASP.NET Core MVC para impressão dinâmica de etiquetas. + +Sinta‑se à vontade para experimentar diferentes combinações de colunas/linhas, formatos de imagem e conteúdos de código de barras para atender às especificações do seu projeto. Boa codificação! + +## 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. + +- [Como gerar código de barras - Tipos de códigos de barras unidimensionais](/barcode/english/net/one-dimensional-barcode-types/) +- [Como gerar código de barras – Configuração Code 39 com Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/russian/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..c08621d4c --- /dev/null +++ b/barcode/russian/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: Быстро создавайте штрих‑код DataBar Stacked в C#. Узнайте, как задать + размер X, отрегулировать соотношение сторон и экспортировать PNG‑файлы с помощью + генератора DataBar Stacked Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: ru +lastmod: 2026-08-06 +og_description: Создайте штрих‑код Databar Stacked в C# с помощью Aspose.BarCode. + Этот учебник показывает, как настроить размер X, изменить соотношение сторон и сохранить + изображения в формате PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Создание стэкового штрихкода Databar в C# — полное руководство по программированию +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Создание штрих‑кода Databar Stacked в C# – пошаговое руководство +url: /ru/python-java/general/create-databar-stacked-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# – пошаговое руководство + +Если вам нужно **создать датабар-стековый штрихкод** в C#, это руководство покажет, как сделать это с помощью библиотеки Aspose.BarCode. Вы научитесь задавать X‑размер, менять соотношение сторон штрихкода и сохранять результат в виде PNG‑файлов — всё за несколько лаконичных шагов. + +Создание DataBar Stacked штрихкода часто требуется, когда необходимо закодировать данные GS1‑128 для розничного сканирования или отслеживания логистики. В последующих разделах мы рассмотрим всё — от настройки проекта до проверки результата, чтобы вы могли интегрировать решение в любое .NET‑приложение без упущений. + +## Необходимые условия + +* **.NET 6.0** (или новее) установлен — код ориентирован на современный SDK. +* **Лицензированная** копия **Aspose.BarCode for .NET**. Бесплатная оценочная версия подходит для тестирования, но добавляет водяной знак. +* IDE, например **Visual Studio 2022** или **VS Code** с расширением C#. +* Базовое знакомство с синтаксисом **C#** и концепцией идентификаторов приложений GS1. + +> **Совет:** Если вы используете менеджер пакетов NuGet, команда `dotnet add package Aspose.BarCode` автоматически разрешит все зависимости. + +## Шаг 1: Создайте новый консольный проект + +Откройте терминал или консоль диспетчера пакетов и выполните: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +Команда `dotnet new console` создаёт минимальный файл **Program.cs**. Добавление пакета **Aspose.BarCode** делает доступным класс `BarcodeGenerator`. + +## Шаг 2: Инициализируйте генератор DataBar Stacked Omnidirectional + +Откройте **Program.cs** и замените содержимое по умолчанию следующим кодом. Первая строка создаёт **BarcodeGenerator**, настроенный для символьного набора **DataBar Stacked Omnidirectional**, и передаёт полезную нагрузку GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Почему это важно:** Значение перечисления `EncodeTypes.DatabarStackedOmniDirectional` указывает библиотеке генерировать **databar stacked barcode**, который является стековой вариацией семейства omnidirectional DataBar. Эта символьная система может содержать до 14 цифровых символов, что делает её идеальной для кодов GTIN‑14. + +## Шаг 3: Установите X‑размер (ширина модуля) + +X‑размер определяет ширину самого маленького штриха (модуля). Слишком маленькое значение может плохо отображаться на принтерах с низким разрешением, а слишком большое — превысить доступное пространство этикетки. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Подсказка:** Свойство `Pixels` удобно для тестирования на экране. Для сценариев, ориентированных на печать, используйте `generator.Parameters.Barcode.XDimension.Millimeters`. + +## Шаг 4: Настройте соотношение сторон и сохраните первое изображение + +**Соотношение сторон** влияет на соотношение высоты к ширине стекового штрихкода. Тип DataBar Stacked Omnidirectional поддерживает соотношения от 10 до 30. Мы сгенерируем два изображения, чтобы продемонстрировать визуальный эффект. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +Вызов `generator.Save` записывает файл **PNG** в текущий рабочий каталог. Перечисление `BarCodeImageFormat.Png` обеспечивает сжатие без потерь, что идеально подходит для дальнейшей обработки или встраивания в PDF. + +## Шаг 5: Измените соотношение сторон на 30 и сохраните второе изображение + +Теперь мы увеличиваем высоту стековых штрихов, изменив соотношение сторон на **30**. Это делает штрихкод выше, не меняя X‑размер. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Запуск программы теперь создаёт два PNG‑файла: + +* **DatabarAspectRatio15.png** — компактный штрихкод, подходящий для небольших этикеток. +* **DatabarAspectRatio30.png** — более высокий штрихкод, повышающий надёжность сканирования на поверхностях с низким контрастом. + +Вы можете открыть изображения в любом просмотрщике, чтобы убедиться, что штрихи правильно сложены и закодированные данные соответствуют исходной строке GS1. + +## Шаг 6: Проверьте закодированное значение (по желанию) + +Если необходимо убедиться, что штрихкод действительно представляет исходную строку, вы можете декодировать его той же библиотекой: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Декодер должен вывести `(01)12345678901231`, подтверждая, что процесс **создания датабар-стекового штрихкода** сохранил данные. + +## Распространённые подводные камни и как их избежать + +| Проблема | Почему происходит | Решение | +|----------|-------------------|---------| +| Штрихкод выглядит размытым | X‑размер установлен слишком низко для разрешения вывода | Увеличьте `XDimension.Pixels` или используйте `Millimeters` для печати | +| Сканер сообщает «символ не найден» | Соотношение сторон выходит за поддерживаемый диапазон 10‑30 | Держите соотношение в диапазоне от 10 до 30; 15 и 30 — безопасные значения по умолчанию | +| PNG содержит водяной знак | Используется бесплатная оценочная лицензия Aspose.BarCode | Приобретите полную лицензию или используйте пробную версию только для тестирования | +| Декодирование не удаётся на втором изображении | Декодер был настроен на неправильный тип символьной системы | Используйте `DecodeType.DatabarStackedOmniDirectional` при чтении стековых штрихкодов | + +## Следующие шаги + +Теперь, когда вы умеете **создавать датабар-стековые штрихкоды**, вы можете захотеть: + +* **Встраивать PNG‑файлы в PDF‑счета** с помощью PDF‑библиотеки, такой как **Aspose.PDF**. +* **Генерировать штрихкоды «на лету» в веб‑API** — возвращать байты PNG напрямую из контроллера ASP.NET Core. +* **Экспериментировать с другими вариантами DataBar** (например, `DatabarExpanded`, `DatabarLimited`), изменяя перечисление `EncodeTypes`. +* **Настраивать цвета**, задавая `generator.Parameters.Barcode.ForeColor` и `BackColor` для бренд‑специфичных дизайнов. + +Каждая из этих тем опирается на те же базовые концепции, рассмотренные здесь: инициализацию `BarcodeGenerator`, настройку визуальных параметров и сохранение результата с помощью `BarCodeImageFormat`. + +--- + +### Заключение + +В этом руководстве показано, как **создавать датабар-стековые штрихкоды** в C# с помощью Aspose.BarCode. Вы научились задавать **X‑размер**, изменять **соотношение сторон штрихкода** и экспортировать результат в виде **PNG**‑файлов с помощью `BarcodeGenerator`. С помощью дополнительного шага декодирования вы также можете убедиться в точности закодированных данных GS1. Применяйте эти шаблоны в своих системах учёта, доставки или точек продаж и изучайте многочисленные возможности настройки, предоставляемые библиотекой. Приятного кодирования! + +## Что изучить дальше? + +Следующие руководства охватывают тесно связанные темы, опирающиеся на техники, продемонстрированные в этом руководстве. Каждый ресурс содержит полностью работающие примеры кода с пошаговыми объяснениями, помогающими освоить дополнительные возможности API и исследовать альтернативные подходы к реализации в ваших проектах. + +- [Регулировка высоты одноразмерного Databar штрихкода](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Генерация изображения штрихкода – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/russian/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..fcc8a3fea --- /dev/null +++ b/barcode/russian/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: Создайте изображение штрихкода в C# с помощью Aspose.BarCode. Узнайте, + как генерировать Databar, настраивать пользовательский размер штрихкода и изменять + высоту штрихкода простым кодом. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: ru +lastmod: 2026-08-06 +og_description: Создайте изображение штрихкода на C# с помощью Aspose.BarCode. Это + руководство показывает, как создать штрихкод Databar Omnidirectional, настроить + его размер и эффективно изменить высоту штрихкода. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Создание изображения штрихкода в C# – полное руководство Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Создание изображения штрихкода в C# с помощью Aspose.BarCode +url: /ru/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Создание изображения штрих‑кода в C# с помощью Aspose.BarCode + +Если вам нужно **генерировать изображение штрих‑кода** программно, это руководство покажет вам, как это сделать. Независимо от того, создаёте ли вы систему учёта розничных товаров или портал отслеживания логистики, вы увидите полный рабочий процесс создания штрих‑кода Databar Omnidirectional, настройки его размеров и сохранения результата в файл PNG. + +Генерация изображения штрих‑кода — распространённая задача, но разработчики часто задаются вопросом **как сгенерировать Databar** с точными нужными размерами. В этом учебнике вы научитесь создавать штрих‑код Databar, настраивать его ширину и высоту, а также менять высоту штрих‑кода без переписывания всего генератора. + +## Prerequisites + +Перед началом убедитесь, что у вас есть: + +* .NET 6.0 SDK или новее (код работает с .NET Core и .NET Framework) +* Visual Studio 2022 (или любая IDE, поддерживающая C#) +* Действительная лицензия Aspose.BarCode for .NET (бесплатная оценочная версия подходит для тестирования) +* Базовое знакомство с синтаксисом C# + +## Step 1: Install Aspose.BarCode + +Добавьте пакет Aspose.BarCode NuGet в ваш проект: + +```bash +dotnet add package Aspose.BarCode +``` + +Пакет содержит класс `BarcodeGenerator`, используемый на протяжении всего руководства. После установки восстановите проект, чтобы подтянуть зависимости. + +## Step 2: Create a basic barcode generator + +Первая строка кода создаёт **генератор штрих‑кода**, который будет генерировать символ Databar Omnidirectional. Перечисление `EncodeTypes.DatabarOmniDirectional` указывает библиотеке, какую символьную схему использовать, а строка данных следует синтаксису GS1 Application Identifier. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Почему это важно:** Объект `BarcodeGenerator` является точкой входа для любой операции со штрих‑кодом. Выбирая `DatabarOmniDirectional`, вы гарантируете, что вывод соответствует стандарту GS1 для розничного сканирования. + +## Step 3: Set a custom X‑dimension (module width) + +X‑dimension управляет шириной самого узкого штриха. Установка небольшого значения в пикселях даёт компактный штрих‑код, а большие значения увеличивают общую ширину. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Объяснение:** X‑dimension в 2 пикселя — распространённый выбор для экранов с высоким разрешением. При необходимости измените это значение, если вам требуется более плотная или более рыхлая визуальная плотность. + +## Step 4: Generate the first barcode image with a specific height + +Высота штрих‑кода независима от X‑dimension. Здесь мы задаём высоту штриха **30 px**, а затем сохраняем изображение в формате PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Результат:** Теперь у вас есть файл `DatabarBarHeight30Pixels.png`, показывающий штрих‑код Databar высотой 30 px. Это демонстрирует возможность **настройки размера штрих‑кода** для конкретного случая, например, небольшой этикетки. + +## Step 5: Change barcode height for a larger version + +Если тот же штрих‑код должен отображаться на более крупной этикетке, достаточно изменить свойство высоты и переиспользовать тот же экземпляр генератора. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Почему генератор можно переиспользовать:** Изменение `BarHeight.Pixels` обновляет внутреннюю раскладку без создания нового объекта, что экономит память и сохраняет строку данных неизменной. Это рекомендуемый способ **изменения высоты штрих‑кода** «на лету». + +## Step 6: Verify the output + +Откройте оба PNG‑файла в любом просмотрщике изображений. Вы должны увидеть два штрих‑кода Databar Omnidirectional, кодирующих один и тот же GTIN, но различающихся по вертикальному размеру: + +* `DatabarBarHeight30Pixels.png` – 30 px в высоту, подходит для компактных чеков. +* `DatabarBarHeight60Pixels.png` – 60 px в высоту, идеален для более крупных этикеток на полках. + +Оба изображения сохраняют одинаковый X‑dimension, поэтому соотношение штрих‑пробел остаётся постоянным, а общая высота масштабируется. + +## Common variations and edge cases + +| Situation | How to handle it | +|-----------|------------------| +| **Different barcode symbology** | Replace `EncodeTypes.DatabarOmniDirectional` with another enum value (e.g., `EncodeTypes.Code128`). The rest of the code remains unchanged. | +| **Non‑pixel dimensions** | Use `generator.Parameters.Barcode.XDimension.Millimeters` or `BarHeight.Millimeters` if you need physical measurements for print‑ready output. | +| **Transparent background** | Set `generator.Parameters.ImageBackgroundColor = Color.Transparent;` before calling `Save`. | +| **High‑resolution output** | Increase both `XDimension.Pixels` and `BarHeight.Pixels` proportionally, or save as `BarCodeImageFormat.Tiff` for lossless quality. | +| **Multiple barcodes in one image** | Create separate `BarcodeGenerator` instances, render each to a `Bitmap`, then compose them using `Graphics.DrawImage`. | + +**Pro tip:** Always test the generated barcode with a real scanner before deploying to production. Scanners may interpret very thin bars differently depending on lighting and sensor quality. + +## Full source code for reference + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Скопируйте код в новый консольный проект, запустите его, и вы увидите два PNG‑файла в папке вывода. + +## Frequently asked questions + +**Q: Can I generate a barcode without installing a license?** +A: The evaluation version of Aspose.BarCode works without a license but adds a small watermark. For production use, apply a purchased license using `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**Q: Does changing the X‑dimension affect readability?** +A: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution printers. A minimum of 1 px for screen rendering is recommended; for print, use at least 0.25 mm. + +**Q: What if I need to generate a barcode in JPEG format?** +A: Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You may also set `generator.Parameters.ImageQuality` to control compression. + +## Conclusion + +Теперь вы знаете, как **генерировать изображение штрих‑кода** в C# с помощью Aspose.BarCode, как **создавать Databar штрих‑код**, настраивать **пользовательский размер штрих‑кода** и **изменять высоту штрих‑кода** по требованию. Полный пример демонстрирует наиболее распространённый рабочий процесс, а таблица вариантов помогает справиться с реальными краевыми случаями. + +Далее изучайте связанные темы, такие как **встраивание штрих‑кодов в PDF‑документы**, **массовая генерация нескольких штрих‑кодов** и **использование QR‑кодов для мобильных платежей**. Каждый из этих сценариев опирается на те же принципы, изложенные здесь, так что вы сможете уверенно расширять свои знания. + +Happy coding, and may your barcodes scan flawlessly! + +## What Should You Learn Next? + +Следующие учебники охватывают тесно связанные темы, построенные на техниках, продемонстрированных в этом руководстве. Каждый ресурс включает полностью работающие примеры кода с пошаговыми объяснениями, чтобы помочь вам освоить дополнительные возможности API и исследовать альтернативные подходы в собственных проектах. + +- [Создание изображения штрих‑кода – GS1 Coupon UPC‑A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [Как сгенерировать Aztec‑штрих‑код с пользовательским соотношением сторон, используя Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Как сгенерировать штрих‑код – конфигурация Code 39 с Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/russian/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..c21d1c900 --- /dev/null +++ b/barcode/russian/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Как установить столбцы для штрих‑кода Databar Expanded Stacked и узнать, + как генерировать изображения штрих‑кода, задавать строки и сохранять файл штрих‑кода + в C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: ru +lastmod: 2026-08-06 +og_description: Как задать столбцы для штрихкода Databar Expanded Stacked и быстро + узнать, как генерировать изображения штрихкодов, задавать строки и сохранять файл + штрихкода с помощью Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Как задать столбцы для штрих‑кода Databar Expanded Stacked – пошаговое руководство + на C# +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Как задать столбцы для штрих‑кода Databar Expanded Stacked – полное руководство + по C# +url: /ru/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Как установить столбцы для Databar Expanded Stacked штрихкода – полное руководство на C# + +Если вам нужно **как установить столбцы** для Databar Expanded Stacked штрихкода, это руководство покажет точные шаги. Независимо от того, создаёте ли вы систему маркировки розничных товаров или приложение для логистики, управление столбцами и строками позволяет точно настроить размер штрихкода и надёжность сканирования. Кроме того, вы увидите **как генерировать изображения штрихкода**, изменить количество строк и правильно **сохранить файл штрихкода** на диск. + +В этом руководстве рассматривается: + +* Установка библиотеки Aspose.Barcode для .NET. +* Создание генератора штрихкода типа Databar Expanded Stacked. +* Установка количества столбцов, строк и формата изображения. +* Сохранение полученных PNG‑файлов в выбранный каталог. + +Предыдущий опыт работы с Aspose.Barcode не требуется — достаточно базовой среды разработки C#. + +## Требования + +Прежде чем начать, убедитесь, что у вас есть: + +* .NET 6.0 SDK или более поздняя версия. +* Visual Studio 2022 (или любая IDE, поддерживающая .NET). +* Ссылка на NuGet‑пакет **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Все фрагменты кода компилируются с шаблоном проекта консольного приложения по умолчанию. + +## Шаг 1: Создать генератор штрихкода для Databar Expanded Stacked + +Первой операцией является создание экземпляра `BarcodeGenerator` с перечислением `EncodeTypes.DatabarExpandedStacked`. Это задаёт макет по умолчанию (stacked) и подготавливает объект к дальнейшей настройке. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Почему это важно:** Генератор хранит все параметры рендеринга. Выбирая `DatabarExpandedStacked`, вы указываете библиотеке использовать макет stacked, который единственный поддерживает настройку столбцов и строк. + +## Как установить столбцы для Databar Expanded Stacked штрихкода + +Теперь, когда генератор существует, вы можете управлять количеством столбцов. Свойство `DataBar.Columns` принимает целое число от 1 до 4. Установка значения **4** создаёт максимально широкий штрихкод, оставаясь в пределах макета stacked. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Практический совет:** Используйте максимальное количество столбцов только тогда, когда у вас достаточно свободного места на этикетке. Слишком много столбцов на небольшой этикетке могут вызвать проблемы со сканированием. + +## Как генерировать изображения штрихкода и сохранять их + +После настройки столбцов необходимо отрисовать штрихкод и записать изображение на диск. Метод `Save` принимает путь к файлу и перечисление формата изображения. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Папка `output` должна существовать, иначе вызов бросит исключение. При желании её можно создать программно с помощью `Directory.CreateDirectory("output");`. + +## Как установить строки для Databar Expanded Stacked штрихкода + +Строки работают аналогично столбцам, но влияют на вертикальное расположение модулей штрихкода. Свойство `DataBar.Rows` принимает значения от 1 до 5. В этом примере мы используем **3** строки. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Почему строки важны:** Добавление строк увеличивает высоту штрихкода, что может быть полезно для этикеток высокой плотности, где требуется больше модулей данных без увеличения ширины штрихкода. + +## Параметры сохранения файла штрихкода и лучшие практики + +Метод `Save` поддерживает несколько форматов изображений (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG — без потерь и хорошо подходит для большинства сканирующих устройств. Если нужен меньший размер файла и допускаются небольшие артефакты сжатия, выбирайте JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Особый случай:** При сохранении в JPEG убедитесь, что параметр качества установлен корректно (по умолчанию 90). Низкое качество может размыть маленькие модули, делая штрихкод нечитаемым. + +## Полный, готовый к запуску пример + +Объединив всё вместе, получаем один файл, который можно скопировать в новый консольный проект и сразу запустить: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Ожидаемый результат:** После выполнения программы в папке `output` появятся три файла: + +* `DatabarCols4.png` — штрихкод с 4 столбцами (широкий). +* `DatabarRows3.png` — штрихкод с 3 строками (высокий). +* `DatabarRows3.jpg` — версия JPEG штрихкода с 3 строками. + +Откройте любой из PNG‑файлов в просмотрщике изображений; вы увидите чёткий Databar Expanded Stacked штрихкод, готовый к сканированию. + +## Часто задаваемые вопросы и устранение неполадок + +| Вопрос | Ответ | +|----------|--------| +| *Что делать, если изображение размыто?* | Убедитесь, что используете PNG для безпотерьного вывода. Если нужен JPEG, увеличьте параметр качества (`new JpegOptions { Quality = 95 }`). | +| *Можно ли изменить текст штрихкода?* | Да — замените второй аргумент в `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Работают ли столбцы и строки совместно?* | Их можно комбинировать; просто задайте оба свойства `DataBar.Columns` и `DataBar.Rows` перед вызовом `Save`. | +| *Есть ли ограничение на глубину каталогов?* | Путь должен быть корректным для операционной системы. Используйте `Path.Combine` для кроссплатформенной надёжности. | + +## Заключение + +Теперь вы знаете **как установить столбцы** для Databar Expanded Stacked штрихкода, **как установить строки** и **как генерировать изображения штрихкода**, которые можно **сохранить файл штрихкода** в форматах PNG или JPEG. Полный пример демонстрирует каждый необходимый шаг — от установки библиотеки до финальной проверки файлов. + +Далее рассмотрите: + +* **как генерировать штрихкод** с уровнями коррекции ошибок для QR‑кодов. +* **сохранить файл штрихкода** в векторных форматах, таких как SVG или PDF. +* Интеграцию сгенерированных штрихкодов в представления ASP.NET Core MVC для динамической печати этикеток. + +Экспериментируйте с различными комбинациями столбцов/строк, форматами изображений и содержимым штрихкода, чтобы соответствовать требованиям вашего проекта. Приятного кодинга! + +## Что изучать дальше? + +Следующие руководства охватывают тесно связанные темы, расширяющие техники, продемонстрированные в этом руководстве. Каждый ресурс включает полностью работающие примеры кода с пошаговыми объяснениями, помогающими освоить дополнительные возможности API и исследовать альтернативные подходы реализации в ваших проектах. + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/spanish/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..c8e4e5327 --- /dev/null +++ b/barcode/spanish/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,194 @@ +--- +category: general +date: 2026-08-06 +description: Crea rápidamente un código de barras DataBar apilado en C#. Aprende a + establecer la dimensión X, ajustar la relación de aspecto y exportar archivos PNG + usando el generador DataBar Stacked Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: es +lastmod: 2026-08-06 +og_description: Crea códigos de barras Databar apilados en C# con Aspose.BarCode. + Este tutorial muestra cómo configurar la dimensión X, cambiar la relación de aspecto + y guardar imágenes PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Crear código de barras Databar apilado en C# – guía completa de programación +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Crear código de barras Databar apilado en C# – guía paso a paso +url: /es/python-java/general/create-databar-stacked-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 databar stacked barcode en C# – guía paso a paso + +Si necesitas **create databar stacked barcode** imágenes en C#, esta guía te muestra exactamente cómo hacerlo usando la biblioteca Aspose.BarCode. Aprenderás a establecer la dimensión X, cambiar la relación de aspecto del código de barras y guardar el resultado como archivos PNG, todo en unos pocos pasos concisos. + +Generar un DataBar Stacked barcode es común cuando debes codificar datos GS1‑128 para escaneo minorista o seguimiento logístico. En las secciones siguientes cubrimos todo, desde la configuración del proyecto hasta la verificación del resultado, para que puedas integrar la solución en cualquier aplicación .NET sin perder detalle. + +## Requisitos previos + +Antes de comenzar, asegúrate de tener: + +* **.NET 6.0** (o posterior) instalado – el código apunta al SDK moderno. +* Una copia **licenciada** de **Aspose.BarCode for .NET**. La evaluación gratuita funciona para pruebas pero agrega una marca de agua. +* Un IDE como **Visual Studio 2022** o **VS Code** con la extensión C#. +* Familiaridad básica con la sintaxis **C#** y el concepto de Identificadores de Aplicación GS1. + +> **Consejo profesional:** Si usas el administrador de paquetes NuGet, el comando `dotnet add package Aspose.BarCode` resuelve todas las dependencias automáticamente. + +## Paso 1: Crear un nuevo proyecto de consola + +Abre una terminal o la Consola del Administrador de Paquetes y ejecuta: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +El comando `dotnet new console` genera un archivo **Program.cs** mínimo. Añadir el paquete **Aspose.BarCode** hace que la clase `BarcodeGenerator` esté disponible. + +## Paso 2: Inicializar el generador DataBar Stacked Omnidirectional + +Abre **Program.cs** y reemplaza el contenido predeterminado con el siguiente código. La primera línea crea un **BarcodeGenerator** configurado para la simbología **DataBar Stacked Omnidirectional** y suministra una carga útil GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Por qué es importante:** El valor del enum `EncodeTypes.DatabarStackedOmniDirectional` indica a la biblioteca que produzca un **databar stacked barcode**, que es la variante apilada de la familia DataBar omnidireccional. Esta simbología puede contener hasta 14 caracteres numéricos, lo que la hace ideal para códigos GTIN‑14. + +## Paso 3: Establecer la dimensión X (ancho del módulo) + +La dimensión X controla el ancho de la barra más pequeña (el módulo). Un valor demasiado bajo puede renderizarse pobremente en impresoras de baja resolución, mientras que un valor demasiado alto puede exceder el espacio de la etiqueta. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Consejo:** La propiedad `Pixels` es conveniente para pruebas en pantalla. Para escenarios enfocados en impresión, usa `generator.Parameters.Barcode.XDimension.Millimeters` en su lugar. + +## Paso 4: Ajustar la relación de aspecto y guardar la primera imagen + +La **relación de aspecto** influye en la relación altura‑ancho del código de barras apilado. El tipo DataBar Stacked Omnidirectional admite relaciones de 10 a 30. Generaremos dos imágenes para ilustrar el impacto visual. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +La llamada a `generator.Save` escribe un archivo **PNG** en el directorio de trabajo actual. El enum `BarCodeImageFormat.Png` garantiza compresión sin pérdidas, ideal para procesamiento posterior o incrustación en PDFs. + +## Paso 5: Cambiar la relación de aspecto a 30 y guardar la segunda imagen + +Ahora aumentamos la altura de las barras apiladas cambiando la relación de aspecto a **30**. Esto hace que el código de barras sea más alto sin alterar la dimensión X. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Al ejecutar el programa ahora se generan dos archivos PNG: + +* **DatabarAspectRatio15.png** – un código de barras compacto adecuado para etiquetas pequeñas. +* **DatabarAspectRatio30.png** – un código de barras más alto que mejora la fiabilidad del escaneo en superficies de bajo contraste. + +Puedes abrir las imágenes en cualquier visor para verificar que las barras están correctamente apiladas y que los datos codificados coinciden con la cadena GS1 original. + +## Paso 6: Verificar el valor codificado (opcional) + +Si necesitas confirmar que el código de barras representa realmente la cadena de entrada, puedes decodificarlo con la misma biblioteca: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +El decodificador debería devolver `(01)12345678901231`, demostrando que el proceso de **create databar stacked barcode** preservó los datos. + +## Problemas comunes y cómo evitarlos + +| Problema | Por qué ocurre | Solución | +|----------|----------------|----------| +| El código de barras aparece borroso | Dimensión X establecida demasiado baja para la resolución de salida | Incrementa `XDimension.Pixels` o usa `Millimeters` para impresión | +| El escáner informa “símbolo no encontrado” | Relación de aspecto fuera del rango soportado 10‑30 | Mantén la relación entre 10 y 30; 15 y 30 son valores seguros | +| PNG contiene una marca de agua | Uso de la licencia de evaluación gratuita de Aspose.BarCode | Compra una licencia completa o usa la prueba solo para testing | +| La decodificación falla en la segunda imagen | El decodificador se configuró con la simbología incorrecta | Usa `DecodeType.DatabarStackedOmniDirectional` al leer códigos apilados | + +## Próximos pasos + +Ahora que puedes **create databar stacked barcode** imágenes, quizás quieras: + +* **Incrustar los PNG en facturas PDF** usando una biblioteca PDF como **Aspose.PDF**. +* **Generar códigos de barras bajo demanda en una API web** – devuelve los bytes PNG directamente desde un controlador ASP.NET Core. +* **Experimentar con otras variantes DataBar** (p. ej., `DatabarExpanded`, `DatabarLimited`) cambiando el enum `EncodeTypes`. +* **Ajustar colores** estableciendo `generator.Parameters.Barcode.ForeColor` y `BackColor` para diseños específicos de marca. + +Cada uno de estos temas se basa en los conceptos centrales cubiertos aquí: inicializar `BarcodeGenerator`, configurar parámetros visuales y guardar el resultado con `BarCodeImageFormat`. + +--- + +### Conclusión + +Este tutorial demostró cómo **create databar stacked barcode** imágenes en C# usando Aspose.BarCode. Aprendiste a establecer la **dimensión X**, modificar la **relación de aspecto del código de barras** y exportar el resultado como archivos **PNG** con `BarcodeGenerator`. Con el paso opcional de decodificación, también puedes verificar que los datos GS1 codificados son precisos. Aplica estos patrones a tus propias aplicaciones de inventario, envío o punto de venta, y explora las numerosas opciones de personalización que ofrece la biblioteca. ¡Feliz codificación! + +## ¿Qué deberías aprender a continuación? + +Los tutoriales siguientes cubren temas estrechamente relacionados que amplían las técnicas demostradas en esta guía. Cada recurso incluye ejemplos de código completos 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. + +- [One-Dimensional Databar Barcode Height Adjustment](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/spanish/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..e8714e7a4 --- /dev/null +++ b/barcode/spanish/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: Genera una imagen de código de barras en C# usando Aspose.BarCode. Aprende + a generar Databar, ajustar el tamaño personalizado del código de barras y cambiar + la altura del código de barras con un código sencillo. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: es +lastmod: 2026-08-06 +og_description: Genera una imagen de código de barras en C# con Aspose.BarCode. Este + tutorial te muestra cómo crear un código de barras Databar omnidireccional, personalizar + su tamaño y cambiar la altura del código de barras de manera eficiente. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Generar imagen de código de barras en C# – guía completa de Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Generar imagen de código de barras en C# con Aspose.BarCode +url: /es/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generar imagen de código de barras en C# con Aspose.BarCode + +Si necesitas **generar una imagen de código de barras** de forma programática, esta guía te muestra exactamente cómo hacerlo. Ya sea que estés construyendo un sistema de inventario minorista o un portal de seguimiento logístico, verás el flujo completo para crear un código de barras Databar Omnidirectional, ajustar sus dimensiones y guardar el resultado como un archivo PNG. + +Generar una imagen de código de barras es un requisito frecuente, pero los desarrolladores a menudo se preguntan **cómo generar Databar** con el tamaño exacto que necesitan. En este tutorial aprenderás a crear un código de barras Databar, personalizar su ancho y alto, y cambiar la altura del código sin reescribir todo el generador. + +## Requisitos previos + +Antes de comenzar, asegúrate de tener: + +* SDK de .NET 6.0 o posterior (el código funciona con .NET Core y .NET Framework) +* Visual Studio 2022 (o cualquier IDE que soporte C#) +* Una licencia válida de Aspose.BarCode para .NET (la evaluación gratuita funciona para pruebas) +* Familiaridad básica con la sintaxis de C# + +## Paso 1: Instalar Aspose.BarCode + +Agrega el paquete NuGet Aspose.BarCode a tu proyecto: + +```bash +dotnet add package Aspose.BarCode +``` + +El paquete contiene la clase `BarcodeGenerator` que se usa a lo largo de este tutorial. Después de la instalación, restaura el proyecto para descargar las dependencias. + +## Paso 2: Crear un generador de código de barras básico + +La primera línea de código crea un **generador de código de barras** que producirá un símbolo Databar Omnidirectional. El enumerado `EncodeTypes.DatabarOmniDirectional` indica a la biblioteca qué simbología usar, y la cadena de datos sigue la sintaxis del Identificador de Aplicación GS1. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Por qué es importante:** El objeto `BarcodeGenerator` es el punto de entrada para cualquier operación de código de barras. Al seleccionar `DatabarOmniDirectional` garantizas que la salida cumpla con el estándar GS1 para escaneo minorista. + +## Paso 3: Establecer una X‑dimensión personalizada (ancho del módulo) + +La X‑dimensión controla el ancho de la barra más estrecha. Configurarla a un valor pequeño en píxeles te da un código de barras compacto, mientras que valores mayores aumentan el ancho total. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Explicación:** Una X‑dimensión de 2 píxeles es una elección común para pantallas de alta resolución. Ajusta este valor si necesitas una densidad visual más estrecha o más suelta. + +## Paso 4: Generar la primera imagen de código de barras con una altura específica + +La altura del código de barras es independiente de la X‑dimensión. Aquí establecemos la altura de la barra en **30 px**, luego guardamos la imagen como PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Resultado:** Ahora tienes un archivo llamado `DatabarBarHeight30Pixels.png` que muestra un código de barras Databar de 30 px de alto. Esto demuestra la capacidad de **tamaño de código de barras personalizado** para un caso de uso específico, como una etiqueta pequeña. + +## Paso 5: Cambiar la altura del código de barras para una versión más grande + +Si el mismo código de barras debe aparecer en una etiqueta más grande, solo necesitas modificar la propiedad de altura y reutilizar la misma instancia del generador. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Por qué puedes reutilizar el generador:** Cambiar `BarHeight.Pixels` actualiza el diseño interno sin recrear el objeto, lo que ahorra memoria y mantiene intacta la cadena de datos. Esta es la forma recomendada de **cambiar la altura del código de barras** sobre la marcha. + +## Paso 6: Verificar la salida + +Abre los dos archivos PNG en cualquier visor de imágenes. Deberías ver dos códigos de barras Databar Omnidirectional que codifican el mismo GTIN pero difieren en tamaño vertical: + +* `DatabarBarHeight30Pixels.png` – 30 px de alto, adecuado para recibos compactos. +* `DatabarBarHeight60Pixels.png` – 60 px de alto, ideal para etiquetas de estantería más grandes. + +Ambas imágenes conservan la misma X‑dimensión, por lo que la relación barra‑espacio permanece constante mientras la altura total se escala. + +## Variaciones comunes y casos límite + +| Situación | Cómo manejarla | +|-----------|----------------| +| **Diferente simbología de código de barras** | Reemplaza `EncodeTypes.DatabarOmniDirectional` por otro valor del enumerado (p. ej., `EncodeTypes.Code128`). El resto del código permanece sin cambios. | +| **Dimensiones no en píxeles** | Usa `generator.Parameters.Barcode.XDimension.Millimeters` o `BarHeight.Millimeters` si necesitas medidas físicas para una salida lista para imprimir. | +| **Fondo transparente** | Establece `generator.Parameters.ImageBackgroundColor = Color.Transparent;` antes de llamar a `Save`. | +| **Salida de alta resolución** | Incrementa tanto `XDimension.Pixels` como `BarHeight.Pixels` de forma proporcional, o guarda como `BarCodeImageFormat.Tiff` para calidad sin pérdidas. | +| **Múltiples códigos de barras en una sola imagen** | Crea instancias separadas de `BarcodeGenerator`, renderiza cada una a un `Bitmap`, y luego compónlas usando `Graphics.DrawImage`. | + +**Consejo profesional:** Siempre prueba el código de barras generado con un escáner real antes de implementarlo en producción. Los escáneres pueden interpretar barras muy finas de manera diferente según la iluminación y la calidad del sensor. + +## Código fuente completo para referencia + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Copia el código en un nuevo proyecto de consola, ejecútalo y verás los dos archivos PNG aparecer en la carpeta de salida. + +## Preguntas frecuentes + +**P: ¿Puedo generar un código de barras sin instalar una licencia?** +R: La versión de evaluación de Aspose.BarCode funciona sin licencia pero agrega una pequeña marca de agua. Para uso en producción, aplica una licencia comprada con `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**P: ¿Cambiar la X‑dimensión afecta la legibilidad?** +R: Sí. X‑dimensiones muy pequeñas pueden hacer que el código de barras sea ilegible en impresoras de baja resolución. Se recomienda un mínimo de 1 px para renderizado en pantalla; para impresión, utiliza al menos 0.25 mm. + +**P: ¿Qué pasa si necesito generar un código de barras en formato JPEG?** +R: Reemplaza `BarCodeImageFormat.Png` por `BarCodeImageFormat.Jpeg`. También puedes establecer `generator.Parameters.ImageQuality` para controlar la compresión. + +## Conclusión + +Ahora sabes cómo **generar una imagen de código de barras** en C# usando Aspose.BarCode, cómo **crear un código de barras Databar**, ajustar un **tamaño de código de barras personalizado** y **cambiar la altura del código de barras** bajo demanda. El ejemplo completo muestra el flujo de trabajo más común, y la tabla de variaciones te prepara para manejar casos reales. + +A continuación, explora temas relacionados como **incrustar códigos de barras en documentos PDF**, **generar lotes de múltiples códigos de barras**, y **usar códigos QR para pagos móviles**. Cada uno de esos escenarios se basa en los mismos principios cubiertos aquí, por lo que puedes ampliar este conocimiento con confianza. + +¡Feliz codificación y que tus códigos de barras se escaneen sin problemas! + +## ¿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. + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/spanish/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..a51f6405c --- /dev/null +++ b/barcode/spanish/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Cómo establecer columnas para un código de barras Databar Expanded Stacked + y aprender a generar imágenes de códigos de barras, establecer filas y guardar el + archivo de código de barras en C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: es +lastmod: 2026-08-06 +og_description: Cómo establecer columnas para un código de barras Databar Expanded + Stacked y aprender rápidamente a generar imágenes de códigos de barras, establecer + filas y guardar el archivo de código de barras con Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: 'Cómo establecer columnas para un código de barras Databar Expanded Stacked: + guía paso a paso en C#' +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Cómo establecer columnas para un código de barras Databar Expanded Stacked + – guía completa en C# +url: /es/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Cómo establecer columnas para un código de barras Databar Expanded Stacked – guía completa en C# + +Si necesitas **how to set columns** para un código de barras Databar Expanded Stacked, este tutorial te muestra los pasos exactos. Ya sea que estés construyendo un sistema de etiquetado minorista o una aplicación logística, controlar columnas y filas te permite afinar el tamaño del código de barras y la fiabilidad del escaneo. Además, verás **how to generate barcode** imágenes, ajustar el número de filas y guardar correctamente el **barcode save file** en disco. + +Esta guía te lleva a través de: + +* Instalar la biblioteca Aspose.Barcode para .NET. +* Crear un generador de códigos de barras para el tipo Databar Expanded Stacked. +* Establecer el recuento de columnas, el recuento de filas y el formato de imagen. +* Guardar los archivos PNG resultantes en un directorio elegido. + +No se requiere experiencia previa con Aspose.Barcode, solo un entorno básico de desarrollo en C#. + +## Requisitos previos + +Antes de comenzar, asegúrate de tener: + +* SDK .NET 6.0 o posterior instalado. +* Visual Studio 2022 (o cualquier IDE que soporte .NET). +* Una referencia NuGet a **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Todos los fragmentos de código se compilan con la plantilla de proyecto de consola predeterminada. + +## Paso 1: Crear un generador de códigos de barras para Databar Expanded Stacked + +La primera operación es instanciar `BarcodeGenerator` con el enumerado `EncodeTypes.DatabarExpandedStacked`. Esto establece el diseño predeterminado (apilado) y prepara el objeto para una configuración adicional. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Por qué es importante:** El generador contiene todos los parámetros de renderizado. Al elegir `DatabarExpandedStacked` le indicas a la biblioteca que use el diseño apilado, que es el único que admite ajustes de columnas y filas. + +## Cómo establecer columnas para un código de barras Databar Expanded Stacked + +Ahora que el generador existe, puedes controlar el recuento de columnas. La propiedad `DataBar.Columns` acepta un entero entre 1 y 4. Configurarla a **4** crea el código de barras más ancho posible mientras aún se ajusta al diseño apilado. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Consejo práctico:** Usa el recuento máximo de columnas solo cuando tengas suficiente espacio blanco en la etiqueta. Demasiadas columnas en una etiqueta pequeña pueden causar problemas de escaneo. + +## Cómo generar imágenes de códigos de barras y guardarlas + +Después de configurar las columnas, necesitas renderizar el código de barras y escribir la imagen en disco. El método `Save` recibe una ruta de archivo y un enumerado de formato de imagen. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +La carpeta `output` debe existir o la llamada lanzará una excepción. Puedes crearla programáticamente con `Directory.CreateDirectory("output");` si lo prefieres. + +## Cómo establecer filas para un código de barras Databar Expanded Stacked + +Las filas funcionan de manera similar a las columnas, pero afectan el apilamiento vertical de los módulos del código de barras. La propiedad `DataBar.Rows` acepta valores de 1 a 5. En este ejemplo usamos **3** filas. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Por qué las filas son importantes:** Añadir filas incrementa la altura del código de barras, lo que puede ser útil para etiquetas de alta densidad donde necesitas más módulos de datos sin ensanchar el código de barras. + +## Opciones de guardado de archivos de código de barras y mejores prácticas + +El método `Save` admite varios formatos de imagen (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG es sin pérdida y funciona bien para la mayoría de los dispositivos de escaneo. Si necesitas un tamaño de archivo más pequeño y puedes tolerar ligeros artefactos de compresión, elige JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Caso límite:** Al guardar en JPEG, asegúrate de que el parámetro de calidad esté configurado adecuadamente (el valor predeterminado es 90). Una calidad baja puede difuminar los módulos pequeños, haciendo que el código de barras sea ilegible. + +## Ejemplo completo y ejecutable + +Juntando todo, aquí tienes un único archivo que puedes copiar en un nuevo proyecto de consola y ejecutar de inmediato: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Salida esperada:** Después de ejecutar el programa, la carpeta `output` contiene tres archivos: + +* `DatabarCols4.png` – código de barras con 4 columnas (ancho). +* `DatabarRows3.png` – código de barras con 3 filas (alto). +* `DatabarRows3.jpg` – versión JPEG del código de barras de 3 filas. + +Abre cualquiera de los archivos PNG en un visor de imágenes; deberías ver un claro código de barras Databar Expanded Stacked listo para escanear. + +## Preguntas frecuentes y solución de problemas + +| Pregunta | Respuesta | +|----------|-----------| +| *¿Qué pasa si la imagen está borrosa?* | Verifica que estés usando PNG para una salida sin pérdida. Si necesitas JPEG, aumenta el ajuste de calidad (`new JpegOptions { Quality = 95 }`). | +| *¿Puedo cambiar el texto del código de barras?* | Sí—reemplaza el segundo argumento en `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *¿Funcionan juntas las columnas y filas?* | Pueden combinarse; simplemente establece tanto `DataBar.Columns` como `DataBar.Rows` antes de llamar a `Save`. | +| *¿Hay un límite en la profundidad del directorio?* | La ruta debe ser válida para el sistema operativo. Usa `Path.Combine` para seguridad multiplataforma. | + +## Conclusión + +Ahora sabes **how to set columns** para un código de barras Databar Expanded Stacked, **how to set rows**, y **how to generate barcode** imágenes que puedes **barcode save file** en formato PNG o JPEG. El ejemplo completo demuestra cada paso necesario, desde la instalación de la biblioteca hasta la verificación final del archivo. + +A continuación, considera explorar: + +* **how to generate barcode** con niveles de corrección de errores para códigos QR. +* **barcode save file** opciones para formatos vectoriales como SVG o PDF. +* Integrar los códigos de barras generados en vistas ASP.NET Core MVC para impresión dinámica de etiquetas. + +Siéntete libre de experimentar con diferentes combinaciones de columnas/filas, formatos de imagen y contenidos de códigos de barras para que coincidan con las especificaciones de tu proyecto. ¡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 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. + +- [Cómo generar códigos de barras - Tipos de códigos de barras unidimensionales](/barcode/english/net/one-dimensional-barcode-types/) +- [Cómo generar códigos de barras – Configuración Code 39 con Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/swedish/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..3e1a9798f --- /dev/null +++ b/barcode/swedish/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,193 @@ +--- +category: general +date: 2026-08-06 +description: Skapa staplad databar-kod i C# snabbt. Lär dig att ställa in X-dimensionen, + justera bildförhållandet och exportera PNG-filer med DataBar Stacked Omnidirectional‑generatorn. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: sv +lastmod: 2026-08-06 +og_description: Skapa en staplad databar‑streckkod i C# med Aspose.BarCode. Denna + handledning visar hur du konfigurerar X‑dimensionen, ändrar bildförhållandet och + sparar PNG‑bilder. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Skapa staplad databar-streckkod i C# – komplett programmeringsguide +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Skapa staplad databar‑streckkod i C# – steg‑för‑steg‑guide +url: /sv/python-java/general/create-databar-stacked-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 databar staplad streckkod i C# – steg‑för‑steg‑guide + +Om du behöver **create databar stacked barcode** bilder i C#, visar den här guiden exakt hur du gör det med Aspose.BarCode‑biblioteket. Du kommer att lära dig att ställa in X‑dimensionen, ändra streckkodens bildförhållande och spara resultatet som PNG‑filer – allt i några korta steg. + +Att generera en DataBar Stacked streckkod är vanligt när du måste koda GS1‑128‑data för detaljhandelsavläsning eller logistikkontroll. I avsnitten som följer täcker vi allt från projektuppsättning till verifiering av resultatet, så att du kan integrera lösningen i vilken .NET‑applikation som helst utan att missa någon detalj. + +## Förutsättningar + +Innan du börjar, se till att du har: + +* **.NET 6.0** (eller senare) installerat – koden riktar sig mot den moderna SDK:n. +* En **licensierad** kopia av **Aspose.BarCode for .NET**. Den kostnadsfria utvärderingen fungerar för testning men lägger till ett vattenmärke. +* En IDE såsom **Visual Studio 2022** eller **VS Code** med C#‑tillägget. +* Grundläggande kunskap om **C#**‑syntax och konceptet GS1 Application Identifiers. + +> **Proffstips:** Om du använder NuGet‑pakethanteraren löser kommandot `dotnet add package Aspose.BarCode` alla beroenden automatiskt. + +## Steg 1: Skapa ett nytt konsolprojekt + +Öppna en terminal eller Package Manager Console och kör: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +`dotnet new console`‑kommandot skapar en minimal **Program.cs**‑fil. Att lägga till **Aspose.BarCode**‑paketet gör `BarcodeGenerator`‑klassen tillgänglig. + +## Steg 2: Initiera DataBar Stacked Omnidirectional‑generatorn + +Öppna **Program.cs** och ersätt standardinnehållet med följande kod. Den första raden skapar en **BarcodeGenerator** konfigurerad för **DataBar Stacked Omnidirectional**‑symbologi och levererar en GS1‑128‑payload. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Varför detta är viktigt:** Enum‑värdet `EncodeTypes.DatabarStackedOmniDirectional` talar om för biblioteket att producera en **databar stacked barcode**, vilket är den staplade varianten av den omnidirektionella DataBar‑familjen. Denna symbologi kan innehålla upp till 14 numeriska tecken, vilket gör den idealisk för GTIN‑14‑koder. + +## Steg 3: Ställ in X‑dimensionen (modulbredd) + +X‑dimensionen styr bredden på den minsta stapeln (modulen). Ett värde som är för litet kan renderas dåligt på lågupplösta skrivare, medan ett för stort värde kan överskrida etikettutrymmet. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tips:** `Pixels`‑egenskapen är praktisk för skärm‑baserad testning. För utskrifts‑fokuserade scenarier, använd `generator.Parameters.Barcode.XDimension.Millimeters` istället. + +## Steg 4: Justera bildförhållandet och spara den första bilden + +**Bildförhållandet** påverkar förhållandet mellan höjd och bredd för den staplade streckkoden. DataBar Stacked Omnidirectional‑typen stödjer förhållanden från 10 till 30. Vi kommer att generera två bilder för att illustrera den visuella effekten. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +Anropet till `generator.Save` skriver en **PNG**‑fil till den aktuella arbetskatalogen. Enum‑värdet `BarCodeImageFormat.Png` säkerställer förlustfri kompression, vilket är idealiskt för vidare bearbetning eller inbäddning i PDF‑filer. + +## Steg 5: Ändra bildförhållandet till 30 och spara den andra bilden + +Nu ökar vi höjden på de staplade staplarna genom att ändra bildförhållandet till **30**. Detta gör streckkoden högre utan att ändra X‑dimensionen. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Kör programmet nu skapar två PNG‑filer: + +* **DatabarAspectRatio15.png** – en kompakt streckkod lämplig för små etiketter. +* **DatabarAspectRatio30.png** – en högre streckkod som förbättrar skanningspålitlighet på lågkontrastytor. + +Du kan öppna bilderna i vilken visare som helst för att verifiera att staplarna är korrekt staplade och att den kodade datan matchar den ursprungliga GS1‑strängen. + +## Steg 6: Verifiera det kodade värdet (valfritt) + +Om du behöver bekräfta att streckkoden verkligen representerar inmatningssträngen kan du avkoda den med samma bibliotek: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Avkodaren bör skriva ut `(01)12345678901231`, vilket bevisar att **create databar stacked barcode**‑processen bevarade datan. + +## Vanliga fallgropar och hur du undviker dem + +| Problem | Varför det händer | Lösning | +|---------|-------------------|---------| +| Streckkoden blir suddig | X‑dimensionen är för låg för utskriftsupplösningen | Öka `XDimension.Pixels` eller använd `Millimeters` för utskrift | +| Skannern rapporterar “symbol not found” | Bildförhållandet ligger utanför det stödjade intervallet 10‑30 | Håll förhållandet mellan 10 och 30; 15 och 30 är säkra standardvärden | +| PNG‑filen innehåller ett vattenmärke | Användning av den kostnadsfria utvärderingslicensen för Aspose.BarCode | Köp en full licens eller använd provversionen endast för testning | +| Avkodning misslyckas på den andra bilden | Avkodaren var konfigurerad för fel symbologi | Använd `DecodeType.DatabarStackedOmniDirectional` när du läser staplade streckkoder | + +## Nästa steg + +Nu när du kan **create databar stacked barcode** bilder kanske du vill: + +* **Bädda in PNG‑filerna i PDF‑fakturor** med ett PDF‑bibliotek som **Aspose.PDF**. +* **Generera streckkoder i realtid i ett web‑API** – returnera PNG‑bytarna direkt från en ASP.NET Core‑controller. +* **Experimentera med andra DataBar‑varianter** (t.ex. `DatabarExpanded`, `DatabarLimited`) genom att ändra `EncodeTypes`‑enum. +* **Justera färger** genom att sätta `generator.Parameters.Barcode.ForeColor` och `BackColor` för varumärkes‑specifika designer. + +Varje av dessa ämnen bygger på samma grundläggande koncept som behandlats här: initiering av `BarcodeGenerator`, konfiguration av visuella parametrar och sparande av resultatet med `BarCodeImageFormat`. + +--- + +### Slutsats + +Denna handledning demonstrerade hur man **create databar stacked barcode** bilder i C# med Aspose.BarCode. Du lärde dig att ställa in **X‑dimensionen**, ändra **streckkodens bildförhållande** och exportera resultatet som **PNG**‑filer med `BarcodeGenerator`. Med det valfria avkodningssteget kan du även verifiera att den kodade GS1‑datan är korrekt. Använd dessa mönster i dina egna lager-, frakt- eller kassa‑applikationer, och utforska de många anpassningsalternativen som biblioteket erbjuder. 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 implementeringsmetoder i dina egna projekt. + +- [One-Dimensional Databar Barcode Height Adjustment](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/swedish/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..4c5cc2fbb --- /dev/null +++ b/barcode/swedish/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-06 +description: Generera streckkodbild i C# med Aspose.BarCode. Lär dig hur du genererar + Databar, justerar anpassad streckkodsstorlek och ändrar streckkodshöjden med enkel + kod. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: sv +lastmod: 2026-08-06 +og_description: Generera streckkodbild i C# med Aspose.BarCode. Denna handledning + visar hur du skapar en Databar Omnidirectional‑streckkod, anpassar dess storlek + och ändrar streckkodens höjd effektivt. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Generera streckkodbild i C# – fullständig Aspose.BarCode‑guide +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Generera streckkodbild i C# med Aspose.BarCode +url: /sv/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generera streckkodbild i C# med Aspose.BarCode + +Om du behöver **generera streckkodbild** programatiskt visar den här guiden exakt hur. Oavsett om du bygger ett detaljhandelslagerhanteringssystem eller en logistikspårningsportal, kommer du att se hela arbetsflödet för att skapa en Databar Omnidirectional streckkod, justera dess dimensioner och spara resultatet som en PNG‑fil. + +Att generera en streckkodbild är ett vanligt krav, men utvecklare undrar ofta **hur man genererar Databar** med exakt den storlek de behöver. I den här handledningen kommer du att lära dig att skapa en Databar‑streckkod, anpassa dess bredd och höjd, samt ändra streckkodens höjd utan att skriva om hela generatorn. + +## Förutsättningar + +* .NET 6.0 SDK eller senare (koden fungerar med .NET Core och .NET Framework) +* Visual Studio 2022 (eller någon IDE som stödjer C#) +* En giltig Aspose.BarCode för .NET-licens (den kostnadsfria utvärderingen fungerar för testning) +* Grundläggande kunskap om C#‑syntax + +## Steg 1: Installera Aspose.BarCode + +Lägg till Aspose.BarCode NuGet‑paketet i ditt projekt: + +```bash +dotnet add package Aspose.BarCode +``` + +Paketet innehåller klassen `BarcodeGenerator` som används genom hela handledningen. Efter installationen återställ projektet för att hämta beroenden. + +## Steg 2: Skapa en grundläggande streckkodsgenerator + +Den första kodraden skapar en **streckkodsgenerator** som kommer att producera en Databar Omnidirectional‑symbol. Enum‑värdet `EncodeTypes.DatabarOmniDirectional` talar om för biblioteket vilken symbologi som ska användas, och datasträngen följer GS1 Application Identifier‑syntaxen. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Varför detta är viktigt:** `BarcodeGenerator`‑objektet är ingångspunkten för varje streckkodsåtgärd. Genom att välja `DatabarOmniDirectional` säkerställer du att resultatet följer GS1‑standarden för detaljhandelsavläsning. + +## Steg 3: Ställ in en anpassad X‑dimension (modulbredd) + +X‑dimensionen styr bredden på den smalaste stapeln. Att sätta den till ett litet pixelvärde ger en kompakt streckkod, medan större värden ökar den totala bredden. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Förklaring:** En X‑dimension på 2 pixel är ett vanligt val för högupplösta skärmar. Justera detta värde om du behöver en tätare eller lösare visuell densitet. + +## Steg 4: Generera den första streckkodsbilden med en specifik höjd + +Streckkodshöjden är oberoende av X‑dimensionen. Här sätter vi stapelhöjden till **30 px**, och sparar sedan bilden som PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Resultat:** Du har nu en fil med namnet `DatabarBarHeight30Pixels.png` som visar en Databar‑streckkod 30 px hög. Detta demonstrerar möjligheten att **anpassa streckkodsstorlek** för ett specifikt användningsfall, såsom en liten etikett. + +## Steg 5: Ändra streckkodshöjd för en större version + +Om samma streckkod måste visas på en större etikett behöver du bara ändra höjd‑egenskapen och återanvända samma generatorinstans. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Varför du kan återanvända generatorn:** Att ändra `BarHeight.Pixels` uppdaterar den interna layouten utan att återskapa objektet, vilket sparar minne och behåller datasträngen intakt. Detta är det rekommenderade sättet att **ändra streckkodshöjd** dynamiskt. + +## Steg 6: Verifiera resultatet + +Öppna de två PNG‑filerna i någon bildvisare. Du bör se två Databar Omnidirectional‑streckkoder som kodar samma GTIN men skiljer sig i vertikal storlek: + +* `DatabarBarHeight30Pixels.png` – 30 px hög, lämplig för kompakta kvitton. +* `DatabarBarHeight60Pixels.png` – 60 px hög, idealisk för större hyllkantsetiketter. + +Båda bilderna behåller samma X‑dimension, så förhållandet mellan stapel och mellanslag förblir konstant medan den totala höjden skalas. + +## Vanliga variationer och kantfall + +| Situation | Hur man hanterar det | +|-----------|----------------------| +| **Olika streckkodssymbologi** | Byt ut `EncodeTypes.DatabarOmniDirectional` mot ett annat enum‑värde (t.ex. `EncodeTypes.Code128`). Resten av koden förblir oförändrad. | +| **Icke‑pixel dimensioner** | Använd `generator.Parameters.Barcode.XDimension.Millimeters` eller `BarHeight.Millimeters` om du behöver fysiska mått för utskriftsklar output. | +| **Transparent bakgrund** | Sätt `generator.Parameters.ImageBackgroundColor = Color.Transparent;` innan du anropar `Save`. | +| **Högupplöst output** | Öka både `XDimension.Pixels` och `BarHeight.Pixels` proportionellt, eller spara som `BarCodeImageFormat.Tiff` för förlustfri kvalitet. | +| **Flera streckkoder i en bild** | Skapa separata `BarcodeGenerator`‑instanser, rendera var och en till en `Bitmap`, och komponera dem sedan med `Graphics.DrawImage`. | + +**Proffstips:** Testa alltid den genererade streckkoden med en riktig scanner innan du driftsätter i produktion. Scannrar kan tolka mycket tunna staplar olika beroende på belysning och sensors kvalitet. + +## Fullständig källkod för referens + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Kopiera koden till ett nytt konsolprojekt, kör det, så kommer du att se de två PNG‑filerna dyka upp i utskriftsmappen. + +## Vanliga frågor + +**Q: Kan jag generera en streckkod utan att installera en licens?** +A: Utvärderingsversionen av Aspose.BarCode fungerar utan licens men lägger till ett litet vattenmärke. För produktionsbruk, applicera en köpt licens med `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**Q: Påverkar förändring av X‑dimension läsbarheten?** +A: Ja. Mycket små X‑dimensioner kan göra streckkoden oläslig på lågupplösta skrivare. En minimum på 1 px för skärmrendering rekommenderas; för utskrift, använd minst 0,25 mm. + +**Q: Vad händer om jag behöver generera en streckkod i JPEG‑format?** +A: Byt ut `BarCodeImageFormat.Png` mot `BarCodeImageFormat.Jpeg`. Du kan också sätta `generator.Parameters.ImageQuality` för att kontrollera komprimeringen. + +## Slutsats + +Du vet nu hur du **genererar streckkodbild** i C# med Aspose.BarCode, hur du **skapar Databar‑streckkod**, justerar en **anpassad streckkodsstorlek**, och **ändrar streckkodshöjd** på begäran. Det kompletta exemplet demonstrerar det vanligaste arbetsflödet, och variations‑tabellen ger dig verktygen för att hantera verkliga kantfall. + +Nästa steg är att utforska relaterade ämnen såsom **inbäddning av streckkoder i PDF‑dokument**, **batch‑generering av flera streckkoder**, och **användning av QR‑koder för mobila betalningar**. Varje scenario bygger på samma principer som behandlats här, så du kan utöka din kunskap med självförtroende. + +Lycka till med kodningen, och må dina streckkoder skanna felfritt! + +## 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. + +- [Generera streckkodbild – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [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/) +- [Hur man genererar streckkod – Code 39‑konfiguration med Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/swedish/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..101d9b65f --- /dev/null +++ b/barcode/swedish/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,224 @@ +--- +category: general +date: 2026-08-06 +description: Hur man ställer in kolumner för en Databar Expanded Stacked‑streckkod + och lär sig hur man genererar streckkodsbilder, ställer in rader och sparar streckkodsfilen + i C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: sv +lastmod: 2026-08-06 +og_description: Hur man ställer in kolumner för en Databar Expanded Stacked‑streckkod + och snabbt lär sig hur man genererar streckkodsbilder, ställer in rader och sparar + streckkodsfilen med Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Hur man ställer in kolumner för en Databar Expanded Stacked‑streckkod – + steg‑för‑steg C#‑guide +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Hur man ställer in kolumner för en Databar Expanded Stacked‑streckkod – komplett + C#‑guide +url: /sv/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Så ställer du in kolumner för en Databar Expanded Stacked streckkod – komplett C#-guide + +Om du behöver **how to set columns** för en Databar Expanded Stacked streckkod, visar den här handledningen exakt hur du går tillväga. Oavsett om du bygger ett detaljhandels‑etiketteringssystem eller en logistikapplikation, låter kontroll av kolumner och rader dig finjustera streckkodens storlek och skanningspålitlighet. Dessutom kommer du att se **how to generate barcode** bilder, justera antalet rader och korrekt **barcode save file** till disk. + +Denna guide går igenom: + +* Installera Aspose.Barcode för .NET-biblioteket. +* Skapa en streckkodsgenerator för Databar Expanded Stacked‑typen. +* Ställa in antalet kolumner, antalet rader och bildformat. +* Spara de resulterande PNG‑filerna till en vald katalog. + +Ingen tidigare erfarenhet av Aspose.Barcode krävs – bara en grundläggande C#‑utvecklingsmiljö. + +## 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 .NET). +* En NuGet‑referens till **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Alla kodsnuttar kompileras med standardkonsolprojekt‑mallen. + +## Steg 1: Skapa en streckkodsgenerator för Databar Expanded Stacked + +Den första operationen är att instansiera `BarcodeGenerator` med `EncodeTypes.DatabarExpandedStacked`‑enum. Detta ställer in standardlayouten (stacked) och förbereder objektet för vidare konfiguration. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Varför detta är viktigt:** Generatorn innehåller alla renderingsparametrar. Genom att välja `DatabarExpandedStacked` talar du om för biblioteket att använda den staplade layouten, som är den enda layouten som stödjer justering av kolumner och rader. + +## Så ställer du in kolumner för en Databar Expanded Stacked streckkod + +Nu när generatorn finns kan du kontrollera antalet kolumner. `DataBar.Columns`‑egenskapen accepterar ett heltal mellan 1 och 4. Att sätta den till **4** skapar den bredaste möjliga streckkoden samtidigt som den fortfarande passar den staplade layouten. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Praktiskt tips:** Använd det maximala antalet kolumner endast när du har tillräckligt med vitt utrymme på etiketten. För många kolumner på en liten etikett kan orsaka skanningsproblem. + +## Så genererar du streckkodsbilder och sparar dem + +Efter att ha konfigurerat kolumnerna måste du rendera streckkoden och skriva bilden till disk. `Save`‑metoden tar en filsökväg och en bildformat‑enum. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Mappen `output` måste finnas, annars kastas ett undantag. Du kan skapa den programatiskt med `Directory.CreateDirectory("output");` om du föredrar. + +## Så ställer du in rader för en Databar Expanded Stacked streckkod + +Rader fungerar på liknande sätt som kolumner, men de påverkar den vertikala staplingen av streckkodens moduler. `DataBar.Rows`‑egenskapen accepterar värden från 1 till 5. I detta exempel använder vi **3** rader. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Varför rader är viktiga:** Att lägga till rader ökar streckkodens höjd, vilket kan vara användbart för högdensitetsetiketter där du behöver fler datamoduler utan att bredda streckkoden. + +## Alternativ för att spara streckkodsfiler och bästa praxis + +`Save`‑metoden stödjer flera bildformat (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG är förlustfri och fungerar bra för de flesta skanningsenheter. Om du behöver en mindre filstorlek och kan tolerera små komprimeringsartefakter, välj JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Särskilt fall:** När du sparar som JPEG, se till att kvalitetsparametern är korrekt inställd (standard är 90). Låg kvalitet kan sudda ut de små modulerna, vilket gör streckkoden oläslig. + +## Komplett, körbart exempel + +När allt sätts ihop, här är en enda fil som du kan kopiera in i ett nytt konsolprojekt och köra omedelbart: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Förväntad output:** Efter att programmet har körts innehåller mappen `output` tre filer: + +* `DatabarCols4.png` – streckkod med 4 kolumner (bred). +* `DatabarRows3.png` – streckkod med 3 rader (tall). +* `DatabarRows3.jpg` – JPEG‑version av 3‑raders streckkoden. + +Öppna någon av PNG‑filerna i en bildvisare; du bör se en tydlig Databar Expanded Stacked streckkod redo för skanning. + +## Vanliga frågor och felsökning + +| Question | Answer | +|----------|--------| +| *Vad händer om bilden är suddig?* | Verifiera att du använder PNG för förlustfri output. Om du behöver JPEG, öka kvalitetsinställningen (`new JpegOptions { Quality = 95 }`). | +| *Kan jag ändra streckkodstexten?* | Ja – ersätt det andra argumentet i `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Fungerar kolumner och rader tillsammans?* | De kan kombineras; sätt bara både `DataBar.Columns` och `DataBar.Rows` innan du anropar `Save`. | +| *Finns det en gräns för katalogdjup?* | Sökvägen måste vara giltig för operativsystemet. Använd `Path.Combine` för plattformsoberoende säkerhet. | + +## Slutsats + +Du vet nu **how to set columns** för en Databar Expanded Stacked streckkod, **how to set rows**, och **how to generate barcode** bilder som du kan **barcode save file** i PNG‑ eller JPEG‑format. Det kompletta exemplet demonstrerar varje nödvändigt steg, från bibliotekets installation till slutlig filverifiering. + +Nästa, överväg att utforska: + +* **how to generate barcode** med felkorrigeringsnivåer för QR‑koder. +* **barcode save file** alternativ för vektorformat som SVG eller PDF. +* Integrera de genererade streckkoderna i ASP.NET Core MVC‑vyer för dynamisk etikettutskrift. + +Känn dig fri att experimentera med olika kolumn-/radkombinationer, bildformat och streckkodsinnehåll för att matcha ditt projekts specifikationer. 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 implementeringsmetoder i dina egna projekt. + +- [Hur man genererar streckkod – endimensionella streckkodstyper](/barcode/english/net/one-dimensional-barcode-types/) +- [Hur man genererar streckkod – Code 39‑konfiguration med Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/thai/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..701ea262c --- /dev/null +++ b/barcode/thai/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,192 @@ +--- +category: general +date: 2026-08-06 +description: สร้างบาร์โค้ด DataBar แบบซ้อนใน C# อย่างรวดเร็ว เรียนรู้การตั้งค่ามิติ + X ปรับอัตราส่วนภาพ และส่งออกไฟล์ PNG ด้วยเครื่องสร้าง DataBar Stacked Omnidirectional +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: th +lastmod: 2026-08-06 +og_description: สร้างบาร์โค้ด Databar stacked ด้วย C# และ Aspose.BarCode บทเรียนนี้แสดงวิธีกำหนดมิติ + X, ปรับอัตราส่วน, และบันทึกรูปภาพ PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: สร้างบาร์โค้ด Databar แบบซ้อนใน C# – คู่มือการเขียนโปรแกรมครบถ้วน +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: สร้างบาร์โค้ด Databar แบบซ้อนใน C# – คู่มือขั้นตอนโดยละเอียด +url: /th/python-java/general/create-databar-stacked-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 stacked ใน C# – คู่มือขั้นตอนโดยละเอียด + +หากคุณต้องการ **สร้างบาร์โค้ด databar stacked** ใน C# คู่มือนี้จะแสดงวิธีทำโดยใช้ไลบรารี Aspose.BarCode คุณจะได้เรียนรู้การตั้งค่า X dimension, การเปลี่ยนอัตราส่วนของบาร์โค้ด, และการบันทึกผลลัพธ์เป็นไฟล์ PNG – ทั้งหมดในไม่กี่ขั้นตอนสั้น ๆ + +การสร้าง DataBar Stacked barcode เป็นเรื่องทั่วไปเมื่อคุณต้องเข้ารหัสข้อมูล GS1‑128 สำหรับการสแกนในร้านค้าปลีกหรือการติดตามโลจิสติกส์ ในส่วนต่อไปนี้เราจะครอบคลุมตั้งแต่การตั้งค่าโปรเจกต์จนถึงการตรวจสอบผลลัพธ์ เพื่อให้คุณสามารถนำโซลูชันนี้ไปใช้ในแอปพลิเคชัน .NET ใด ๆ ได้โดยไม่พลาดรายละเอียดใด ๆ + +## ข้อกำหนดเบื้องต้น + +ก่อนเริ่มทำตามขั้นตอน ให้ตรวจสอบว่าคุณมี: + +* **.NET 6.0** (หรือใหม่กว่า) ติดตั้งแล้ว – โค้ดนี้ใช้ SDK เวอร์ชันล่าสุด +* สำเนา **Aspose.BarCode for .NET** ที่มี **ลิขสิทธิ์** เวอร์ชันฟรีสำหรับการทดลองใช้จะมีลายน้ำ +* IDE เช่น **Visual Studio 2022** หรือ **VS Code** พร้อมส่วนขยาย C# +* ความคุ้นเคยพื้นฐานกับไวยากรณ์ **C#** และแนวคิดของ GS1 Application Identifiers + +> **เคล็ดลับ:** หากคุณใช้ NuGet package manager คำสั่ง `dotnet add package Aspose.BarCode` จะจัดการ dependencies ทั้งหมดให้โดยอัตโนมัติ + +## ขั้นตอนที่ 1: สร้างโปรเจกต์คอนโซลใหม่ + +เปิดเทอร์มินัลหรือ Package Manager Console แล้วรัน: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +คำสั่ง `dotnet new console` จะสร้างไฟล์ **Program.cs** ขั้นพื้นฐาน การเพิ่มแพคเกจ **Aspose.BarCode** จะทำให้คลาส `BarcodeGenerator` พร้อมใช้งาน + +## ขั้นตอนที่ 2: เริ่มต้นตัวสร้าง DataBar Stacked Omnidirectional + +เปิด **Program.cs** แล้วแทนที่เนื้อหาเริ่มต้นด้วยโค้ดต่อไปนี้ บรรทัดแรกสร้าง **BarcodeGenerator** ที่กำหนดค่าให้ใช้ symbology **DataBar Stacked Omnidirectional** และใส่ payload ของ GS1‑128 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**เหตุผลที่สำคัญ:** ค่า enum `EncodeTypes.DatabarStackedOmniDirectional` บอกไลบรารีให้สร้าง **databar stacked barcode** ซึ่งเป็นรูปแบบ stacked ของตระกูล DataBar omnidirectional symbology symbology นี้สามารถบรรจุตัวเลขได้สูงสุด 14 ตัว ทำให้เหมาะกับรหัส GTIN‑14 + +## ขั้นตอนที่ 3: ตั้งค่า X dimension (ความกว้างโมดูล) + +X dimension ควบคุมความกว้างของบาร์ที่เล็กที่สุด (โมดูล) ค่าที่เล็กเกินไปอาจทำให้ภาพไม่คมบนเครื่องพิมพ์ความละเอียดต่ำ ส่วนค่าที่ใหญ่เกินไปอาจทำให้บาร์โค้ดเกินพื้นที่ของฉลาก + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **คำแนะนำ:** คุณสมบัติ `Pixels` สะดวกสำหรับการทดสอบบนหน้าจอ หากต้องการโฟกัสที่การพิมพ์ ให้ใช้ `generator.Parameters.Barcode.XDimension.Millimeters` แทน + +## ขั้นตอนที่ 4: ปรับอัตราส่วนและบันทึกภาพแรก + +**อัตราส่วน** มีผลต่อความสัมพันธ์ระหว่างความสูงและความกว้างของบาร์โค้ด stacked ประเภท DataBar Stacked Omnidirectional รองรับอัตราส่วนตั้งแต่ 10 ถึง 30 เราจะสร้างสองภาพเพื่อแสดงผลของการเปลี่ยนแปลง + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +การเรียก `generator.Save` จะเขียนไฟล์ **PNG** ไปยังไดเรกทอรีทำงานปัจจุบัน `BarCodeImageFormat.Png` ให้การบีบอัดแบบ lossless ซึ่งเหมาะสำหรับการประมวลผลต่อหรือฝังใน PDF + +## ขั้นตอนที่ 5: เปลี่ยนอัตราส่วนเป็น 30 และบันทึกภาพที่สอง + +ตอนนี้เราจะเพิ่มความสูงของบาร์ stacked โดยตั้งอัตราส่วนเป็น **30** ทำให้บาร์โค้ดสูงขึ้นโดยไม่ต้องเปลี่ยน X dimension + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +เมื่อรันโปรแกรมแล้วจะได้ไฟล์ PNG สองไฟล์: + +* **DatabarAspectRatio15.png** – บาร์โค้ดขนาดกะทัดรัด เหมาะกับฉลากขนาดเล็ก +* **DatabarAspectRatio30.png** – บาร์โค้ดสูงขึ้น ช่วยเพิ่มความน่าเชื่อถือในการสแกนบนพื้นผิวที่มีคอนทราสต์ต่ำ + +คุณสามารถเปิดภาพเหล่านี้ด้วยโปรแกรมดูภาพใดก็ได้เพื่อยืนยันว่าบาร์ถูกจัดเรียงเป็น stacked อย่างถูกต้องและข้อมูลที่เข้ารหัสตรงกับสตริง GS1 ดั้งเดิม + +## ขั้นตอนที่ 6: ตรวจสอบค่าที่เข้ารหัส (ไม่บังคับ) + +หากต้องการยืนยันว่าบาร์โค้ดแท้จริงแสดงสตริงอินพุตที่ใส่เข้าไป คุณสามารถถอดรหัสด้วยไลบรารีเดียวกัน: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +ตัวถอดรหัสควรแสดงผล `(01)12345678901231` ซึ่งพิสูจน์ว่ากระบวนการ **create databar stacked barcode** รักษาข้อมูลไว้ครบถ้วน + +## ข้อผิดพลาดทั่วไปและวิธีหลีกเลี่ยง + +| ปัญหา | สาเหตุ | วิธีแก้ | +|-------|--------|--------| +| บาร์โค้ดดูเบลอ | X dimension ตั้งค่าต่ำเกินความละเอียดของเอาต์พุต | เพิ่มค่า `XDimension.Pixels` หรือใช้ `Millimeters` สำหรับการพิมพ์ | +| สแกนเนอร์แจ้ง “symbol not found” | อัตราส่วนอยู่นอกช่วงที่รองรับ 10‑30 | รักษาอัตราส่วนให้อยู่ระหว่าง 10‑30; ค่า 15 และ 30 เป็นค่าเริ่มต้นที่ปลอดภัย | +| PNG มีลายน้ำ | ใช้ไลเซนส์ทดลองฟรีของ Aspose.BarCode | ซื้อไลเซนส์เต็มหรือใช้รุ่นทดลองเฉพาะการทดสอบ | +| การถอดรหัสล้มเหลวในภาพที่สอง | ตัวถอดรหัสตั้งค่า symbology ผิด | ใช้ `DecodeType.DatabarStackedOmniDirectional` เมื่อต้องอ่านบาร์โค้ด stacked | + +## ขั้นตอนต่อไป + +เมื่อคุณสามารถ **create databar stacked barcode** ได้แล้ว คุณอาจต้องการ: + +* **ฝัง PNG ลงในใบแจ้งหนี้ PDF** ด้วยไลบรารี PDF เช่น **Aspose.PDF** +* **สร้างบาร์โค้ดแบบเรียลไทม์ใน Web API** – ส่งคืนไบต์ PNG โดยตรงจากคอนโทรลเลอร์ ASP.NET Core +* **ทดลองใช้ DataBar รุ่นอื่น** (เช่น `DatabarExpanded`, `DatabarLimited`) โดยเปลี่ยนค่า enum `EncodeTypes` +* **ปรับสี** ด้วยการตั้งค่า `generator.Parameters.Barcode.ForeColor` และ `BackColor` เพื่อให้สอดคล้องกับแบรนด์ + +หัวข้อเหล่านี้ทั้งหมดต่อยอดจากแนวคิดหลักที่อธิบายไว้ในบทนี้: การเริ่มต้น `BarcodeGenerator`, การกำหนดพารามิเตอร์การแสดงผล, และการบันทึกผลลัพธ์ด้วย `BarCodeImageFormat` + +--- + +### สรุป + +บทแนะนำนี้ได้สาธิตวิธี **create databar stacked barcode** ใน C# ด้วย Aspose.BarCode คุณได้เรียนรู้การตั้งค่า **X dimension**, การปรับ **อัตราส่วนของบาร์โค้ด**, และการส่งออกเป็นไฟล์ **PNG** ด้วย `BarcodeGenerator` หากเพิ่มขั้นตอนการถอดรหัส คุณยังสามารถตรวจสอบความถูกต้องของข้อมูล GS1 ได้อีกด้วย นำรูปแบบเหล่านี้ไปใช้ในระบบสินค้าคงคลัง, การจัดส่ง, หรือจุดขายของคุณและสำรวจตัวเลือกการปรับแต่งต่าง ๆ ที่ไลบรารีนี้มีให้ ขอให้สนุกกับการเขียนโค้ด! + +## คุณควรเรียนรู้อะไรต่อไป? + +บทเรียนต่อไปนี้เกี่ยวข้องอย่างใกล้ชิดและต่อยอดจากเทคนิคที่แสดงในคู่มือนี้ แต่ละแหล่งรวมตัวอย่างโค้ดทำงานเต็มรูปแบบพร้อมคำอธิบายขั้นตอนเพื่อให้คุณเชี่ยวชาญฟีเจอร์ API เพิ่มเติมและสำรวจแนวทางการทำงานอื่น ๆ ในโปรเจกต์ของคุณ + +- [One-Dimensional Databar Barcode Height Adjustment](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/thai/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..8d786689f --- /dev/null +++ b/barcode/thai/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-06 +description: สร้างภาพบาร์โค้ดใน C# ด้วย Aspose.BarCode เรียนรู้วิธีสร้าง Databar ปรับขนาดบาร์โค้ดที่กำหนดเอง + และเปลี่ยนความสูงของบาร์โค้ดด้วยโค้ดง่าย ๆ. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: th +lastmod: 2026-08-06 +og_description: สร้างภาพบาร์โค้ดใน C# ด้วย Aspose.BarCode. บทเรียนนี้จะแสดงวิธีสร้างบาร์โค้ด + Databar Omnidirectional ปรับขนาดตามต้องการ และเปลี่ยนความสูงของบาร์โค้ดอย่างมีประสิทธิภาพ. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: สร้างภาพบาร์โค้ดใน C# – คู่มือเต็มของ Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: สร้างภาพบาร์โค้ดใน C# ด้วย Aspose.BarCode +url: /th/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# สร้างภาพบาร์โค้ดใน C# ด้วย Aspose.BarCode + +หากคุณต้องการ **สร้างภาพบาร์โค้ด** อย่างอัตโนมัติ คู่มือนี้จะแสดงวิธีทำอย่างละเอียด ไม่ว่าคุณจะกำลังสร้างระบบจัดการสินค้าปลีกหรือพอร์ทัลติดตามโลจิสติกส์ คุณจะได้เห็นขั้นตอนครบถ้วนสำหรับการสร้างบาร์โค้ด Databar Omnidirectional ปรับขนาดและบันทึกผลลัพธ์เป็นไฟล์ PNG + +การสร้างภาพบาร์โค้ดเป็นความต้องการทั่วไป แต่ผู้พัฒนามักสงสัย **วิธีสร้าง Databar** ด้วยขนาดที่ต้องการอย่างแม่นยำ ในบทเรียนนี้คุณจะได้เรียนรู้การสร้างบาร์โค้ด Databar ปรับความกว้างและความสูงของบาร์โค้ด และเปลี่ยนความสูงของบาร์โค้ดโดยไม่ต้องเขียนโค้ดสร้างใหม่ทั้งหมด + +## ข้อกำหนดเบื้องต้น + +ก่อนเริ่มทำงาน โปรดตรวจสอบว่าคุณมี: + +* .NET 6.0 SDK หรือใหม่กว่า (โค้ดทำงานได้กับ .NET Core และ .NET Framework) +* Visual Studio 2022 (หรือ IDE ใดก็ได้ที่รองรับ C#) +* ใบอนุญาต Aspose.BarCode for .NET ที่ถูกต้อง (รุ่นประเมินฟรีใช้สำหรับการทดสอบ) +* ความคุ้นเคยพื้นฐานกับไวยากรณ์ C# + +## ขั้นตอนที่ 1: ติดตั้ง Aspose.BarCode + +เพิ่มแพ็กเกจ Aspose.BarCode NuGet ลงในโปรเจกต์ของคุณ: + +```bash +dotnet add package Aspose.BarCode +``` + +แพ็กเกจนี้ประกอบด้วยคลาส `BarcodeGenerator` ที่ใช้ตลอดบทเรียน หลังจากติดตั้งเสร็จ ให้ทำการ restore โปรเจกต์เพื่อดึง dependencies + +## ขั้นตอนที่ 2: สร้างตัวสร้างบาร์โค้ดพื้นฐาน + +บรรทัดแรกของโค้ดสร้าง **ตัวสร้างบาร์โค้ด** ที่จะผลิตสัญลักษณ์ Databar Omnidirectional ค่าตัวแปร `EncodeTypes.DatabarOmniDirectional` บอกไลบรารีว่าจะใช้ symbology ใด และสตริงข้อมูลจะตามไวยากรณ์ GS1 Application Identifier + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**ทำไมเรื่องนี้ถึงสำคัญ:** วัตถุ `BarcodeGenerator` เป็นจุดเริ่มต้นของทุกการทำงานกับบาร์โค้ด การเลือก `DatabarOmniDirectional` จะทำให้ผลลัพธ์สอดคล้องกับมาตรฐาน GS1 สำหรับการสแกนในร้านค้า + +## ขั้นตอนที่ 3: ตั้งค่า X‑dimension แบบกำหนดเอง (ความกว้างโมดูล) + +X‑dimension ควบคุมความกว้างของบาร์ที่แคบที่สุด การตั้งค่าเป็นค่าพิกเซลเล็กจะทำให้บาร์โค้ดกระชับ ส่วนค่าที่ใหญ่ขึ้นจะเพิ่มความกว้างโดยรวม + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**คำอธิบาย:** X‑dimension ขนาด 2 พิกเซลเป็นค่าที่นิยมใช้สำหรับหน้าจอความละเอียดสูง หากต้องการความหนาแน่นภาพที่แน่นหรือกระจาย สามารถปรับค่าได้ตามต้องการ + +## ขั้นตอนที่ 4: สร้างภาพบาร์โค้ดแรกด้วยความสูงที่กำหนด + +ความสูงของบาร์โค้ดเป็นอิสระจาก X‑dimension ที่นี่เราตั้งค่าความสูงของบาร์เป็น **30 px** แล้วบันทึกภาพเป็น PNG + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**ผลลัพธ์:** ตอนนี้คุณจะมีไฟล์ชื่อ `DatabarBarHeight30Pixels.png` ที่แสดงบาร์โค้ด Databar สูง 30 px ซึ่งเป็นการสาธิตความสามารถ **กำหนดขนาดบาร์โค้ด** สำหรับกรณีใช้งานเช่นป้ายเล็ก + +## ขั้นตอนที่ 5: เปลี่ยนความสูงของบาร์โค้ดสำหรับเวอร์ชันที่ใหญ่ขึ้น + +หากบาร์โค้ดเดียวกันต้องแสดงบนป้ายที่ใหญ่กว่า เพียงแก้ไขคุณสมบัติความสูงและใช้ตัวสร้างเดียวกันต่อ + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**ทำไมคุณถึงใช้ตัวสร้างซ้ำได้:** การเปลี่ยน `BarHeight.Pixels` จะอัปเดตการจัดวางภายในโดยไม่ต้องสร้างอ็อบเจกต์ใหม่ ซึ่งช่วยประหยัดหน่วยความจำและรักษาสตริงข้อมูลไว้ นี่เป็นวิธีที่แนะนำสำหรับการ **เปลี่ยนความสูงของบาร์โค้ด** แบบไดนามิก + +## ขั้นตอนที่ 6: ตรวจสอบผลลัพธ์ + +เปิดไฟล์ PNG สองไฟล์ในโปรแกรมดูภาพใดก็ได้ คุณควรเห็นบาร์โค้ด Databar Omnidirectional สองแบบที่เข้ารหัส GTIN เดียวกันแต่มีความสูงแนวตั้งต่างกัน: + +* `DatabarBarHeight30Pixels.png` – สูง 30 px เหมาะสำหรับใบเสร็จที่กะทัดรัด +* `DatabarBarHeight60Pixels.png` – สูง 60 px เหมาะสำหรับป้ายชั้นวางที่ใหญ่กว่า + +ทั้งสองภาพใช้ X‑dimension เดียวกัน ทำให้อัตราส่วนบาร์‑ช่องว่างคงที่ในขณะที่ความสูงโดยรวมเพิ่มขึ้น + +## ความแปรผันทั่วไปและกรณีขอบ + +| สถานการณ์ | วิธีจัดการ | +|-----------|------------| +| **สัญลักษณ์บาร์โค้ดที่แตกต่าง** | แทนที่ `EncodeTypes.DatabarOmniDirectional` ด้วยค่า enum อื่น (เช่น `EncodeTypes.Code128`). โค้ดส่วนอื่นคงเดิม | +| **Non‑pixel dimensions** | ใช้ `generator.Parameters.Barcode.XDimension.Millimeters` หรือ `BarHeight.Millimeters` หากต้องการหน่วยวัดจริงสำหรับการพิมพ์ | +| **Transparent background** | ตั้งค่า `generator.Parameters.ImageBackgroundColor = Color.Transparent;` ก่อนเรียก `Save` | +| **High‑resolution output** | เพิ่มค่า `XDimension.Pixels` และ `BarHeight.Pixels` อย่างสัดส่วน หรือบันทึกเป็น `BarCodeImageFormat.Tiff` เพื่อคุณภาพไม่มีการสูญเสีย | +| **Multiple barcodes in one image** | สร้างอินสแตนซ์ `BarcodeGenerator` แยกกัน เรนเดอร์แต่ละอันเป็น `Bitmap` แล้วจัดวางด้วย `Graphics.DrawImage` | + +**เคล็ดลับมืออาชีพ:** ควรทดสอบบาร์โค้ดที่สร้างด้วยเครื่องสแกนจริงก่อนนำไปใช้งานจริง เนื่องจากสแกนอาจตีความบาร์ที่บางมากแตกต่างกันตามแสงและคุณภาพเซ็นเซอร์ + +## โค้ดต้นฉบับเต็มสำหรับอ้างอิง + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +คัดลอกโค้ดไปยังโปรเจกต์คอนโซลใหม่ รันแล้วคุณจะเห็นไฟล์ PNG สองไฟล์ปรากฏในโฟลเดอร์ผลลัพธ์ + +## คำถามที่พบบ่อย + +**Q: สามารถสร้างบาร์โค้ดโดยไม่ติดตั้งใบอนุญาตได้หรือไม่?** +**A:** เวอร์ชันประเมินของ Aspose.BarCode ทำงานได้โดยไม่มีใบอนุญาต แต่จะมีลายน้ำเล็กน้อย สำหรับการใช้งานจริง ควรใช้ใบอนุญาตที่ซื้อแล้วโดยเรียก `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**Q: การเปลี่ยน X‑dimension มีผลต่อการอ่านได้หรือไม่?** +**A:** มีผล. X‑dimension ที่เล็กเกินไปอาจทำให้บาร์โค้ดอ่านไม่ได้บนเครื่องพิมพ์ความละเอียดต่ำ ค่าต่ำสุดที่แนะนำสำหรับการแสดงบนหน้าจอคือ 1 px; สำหรับการพิมพ์ควรใช้อย่างน้อย 0.25 mm + +**Q: หากต้องการสร้างบาร์โค้ดในรูปแบบ JPEG จะทำอย่างไร?** +**A:** แทนที่ `BarCodeImageFormat.Png` ด้วย `BarCodeImageFormat.Jpeg` และสามารถตั้งค่า `generator.Parameters.ImageQuality` เพื่อควบคุมระดับการบีบอัดได้ + +## สรุป + +คุณได้เรียนรู้วิธี **สร้างภาพบาร์โค้ด** ใน C# ด้วย Aspose.BarCode วิธี **สร้างบาร์โค้ด Databar** ปรับ **ขนาดบาร์โค้ดแบบกำหนดเอง** และ **เปลี่ยนความสูงของบาร์โค้ด** ตามต้องการ ตัวอย่างครบถ้วนแสดงขั้นตอนทำงานที่พบบ่อยที่สุด และตารางความแปรผันช่วยให้คุณรับมือกับกรณีจริงได้อย่างมั่นใจ + +ต่อไปให้สำรวจหัวข้อที่เกี่ยวข้อง เช่น **การฝังบาร์โค้ดในเอกสาร PDF**, **การสร้างบาร์โค้ดหลายรายการเป็นชุด**, และ **การใช้ QR Code สำหรับการชำระเงินผ่านมือถือ** ทุกสถานการณ์เหล่านี้ต่อยอดจากหลักการเดียวกันที่อธิบายไว้ที่นี่ ทำให้คุณสามารถขยายความรู้ได้อย่างมั่นใจ + +ขอให้เขียนโค้ดอย่างสนุกและบาร์โค้ดของคุณสแกนได้อย่างไม่มีข้อผิดพลาด! + +## สิ่งที่คุณควรเรียนต่อไป + +บทเรียนต่อไปนี้ครอบคลุมหัวข้อที่เกี่ยวข้องอย่างใกล้ชิดและต่อยอดจากเทคนิคที่แสดงในคู่มือนี้ แต่ละแหล่งรวมตัวอย่างโค้ดทำงานเต็มรูปแบบพร้อมคำอธิบายทีละขั้นตอน เพื่อช่วยให้คุณเชี่ยวชาญฟีเจอร์ API เพิ่มเติมและสำรวจแนวทางการนำไปใช้แบบต่าง ๆ ในโปรเจกต์ของคุณ + +- [สร้างภาพบาร์โค้ด – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [วิธีสร้างบาร์โค้ด Aztec ด้วยอัตราส่วนภาพกำหนดเองโดยใช้ Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [วิธีสร้างบาร์โค้ด – การกำหนดค่า Code 39 ด้วย Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/thai/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..de673223a --- /dev/null +++ b/barcode/thai/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,220 @@ +--- +category: general +date: 2026-08-06 +description: วิธีตั้งค่าคอลัมน์สำหรับบาร์โค้ด Databar Expanded Stacked และเรียนรู้วิธีสร้างภาพบาร์โค้ด + ตั้งค่าแถว และบันทึกไฟล์บาร์โค้ดด้วย C# +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: th +lastmod: 2026-08-06 +og_description: วิธีตั้งค่าคอลัมน์สำหรับบาร์โค้ด Databar Expanded Stacked และเรียนรู้วิธีสร้างภาพบาร์โค้ดอย่างรวดเร็ว + ตั้งค่าแถว และบันทึกไฟล์บาร์โค้ดด้วย Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: วิธีตั้งค่าคอลัมน์สำหรับบาร์โค้ด Databar Expanded Stacked – คู่มือ C# ทีละขั้นตอน +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: วิธีตั้งค่าคอลัมน์สำหรับบาร์โค้ด Databar Expanded Stacked – คู่มือ C# ฉบับสมบูรณ์ +url: /th/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# วิธีตั้งค่าคอลัมน์สำหรับบาร์โค้ด Databar Expanded Stacked – คู่มือ C# ฉบับสมบูรณ์ + +หากคุณต้องการ **วิธีตั้งค่าคอลัมน์** สำหรับบาร์โค้ด Databar Expanded Stacked, บทแนะนำนี้จะแสดงขั้นตอนที่แน่นอน ไม่ว่าคุณจะกำลังสร้างระบบติดฉลากสำหรับร้านค้าปลีกหรือแอปพลิเคชันโลจิสติกส์ การควบคุมคอลัมน์และแถวจะช่วยให้คุณปรับขนาดบาร์โค้ดและความน่าเชื่อถือในการสแกนได้อย่างละเอียด นอกจากนี้คุณยังจะได้เห็น **วิธีสร้างภาพบาร์โค้ด**, ปรับจำนวนแถว, และ **บันทึกไฟล์บาร์โค้ด** ไปยังดิสก์อย่างถูกต้อง + +คู่มือนี้จะพาคุณผ่าน: + +* การติดตั้งไลบรารี Aspose.Barcode สำหรับ .NET +* การสร้างตัวสร้างบาร์โค้ดสำหรับประเภท Databar Expanded Stacked +* การตั้งค่าจำนวนคอลัมน์, จำนวนแถว, และรูปแบบภาพ +* การบันทึกไฟล์ PNG ที่ได้ไปยังไดเรกทอรีที่เลือก + +ไม่จำเป็นต้องมีประสบการณ์กับ Aspose.Barcode มาก่อน—เพียงแค่มีสภาพแวดล้อมการพัฒนา C# พื้นฐาน + +## ข้อกำหนดเบื้องต้น + +ก่อนเริ่มทำงาน, ตรวจสอบให้แน่ใจว่าคุณมี: + +* .NET 6.0 SDK หรือใหม่กว่า +* Visual Studio 2022 (หรือ IDE ใด ๆ ที่รองรับ .NET) +* การอ้างอิง NuGet ไปยัง **Aspose.Barcode** (`dotnet add package Aspose.Barcode`) + +โค้ดทั้งหมดสามารถคอมไพล์ได้ด้วยเทมเพลตโปรเจกต์คอนโซลเริ่มต้น + +## ขั้นตอนที่ 1: สร้างตัวสร้างบาร์โค้ดสำหรับ Databar Expanded Stacked + +การดำเนินการแรกคือการสร้างอินสแตนซ์ของ `BarcodeGenerator` ด้วย enum `EncodeTypes.DatabarExpandedStacked` ซึ่งจะตั้งค่าเลเอาต์เริ่มต้น (stacked) และเตรียมอ็อบเจกต์สำหรับการกำหนดค่าต่อไป + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**ทำไมเรื่องนี้สำคัญ:** ตัวสร้างบาร์โค้ดจะเก็บพารามิเตอร์การเรนเดอร์ทั้งหมด การเลือก `DatabarExpandedStacked` จะบอกไลบรารีให้ใช้เลเอาต์แบบ stacked ซึ่งเป็นเลเอาต์เดียวที่รองรับการปรับคอลัมน์และแถว + +## วิธีตั้งค่าคอลัมน์สำหรับบาร์โค้ด Databar Expanded Stacked + +เมื่อมีตัวสร้างแล้ว, คุณสามารถควบคุมจำนวนคอลัมน์ได้ คุณสมบัติ `DataBar.Columns` รับค่าเต็มระหว่าง 1 ถึง 4 การตั้งค่าเป็น **4** จะสร้างบาร์โค้ดที่กว้างที่สุดที่ยังคงอยู่ในเลเอาต์ stacked + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**เคล็ดลับปฏิบัติ:** ใช้จำนวนคอลัมน์สูงสุดเฉพาะเมื่อคุณมีพื้นที่สีขาวเพียงพอบนฉลาก การมีคอลัมน์มากเกินไปบนฉลากขนาดเล็กอาจทำให้การสแกนล้มเหลว + +## วิธีสร้างภาพบาร์โค้ดและบันทึกลงไฟล์ + +หลังจากกำหนดค่าคอลัมน์แล้ว, คุณต้องเรนเดอร์บาร์โค้ดและเขียนภาพลงดิสก์ วิธี `Save` รับพาธไฟล์และ enum รูปแบบภาพ + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +โฟลเดอร์ `output` ต้องมีอยู่แล้ว มิฉะนั้นคำสั่งจะโยนข้อยกเว้น คุณสามารถสร้างโฟลเดอร์นี้โดยโปรแกรมด้วย `Directory.CreateDirectory("output");` หากต้องการ + +## วิธีตั้งค่าแถวสำหรับบาร์โค้ด Databar Expanded Stacked + +แถวทำงานคล้ายกับคอลัมน์ แต่จะส่งผลต่อการจัดเรียงแนวตั้งของโมดูลบาร์โค้ด คุณสมบัติ `DataBar.Rows` รับค่าตั้งแต่ 1 ถึง 5 ในตัวอย่างนี้เราใช้ **3** แถว + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**ทำไมแถวถึงสำคัญ:** การเพิ่มแถวจะทำให้ความสูงของบาร์โค้ดเพิ่มขึ้น ซึ่งเป็นประโยชน์สำหรับฉลากความหนาแน่นสูงที่ต้องการโมดูลข้อมูลมากขึ้นโดยไม่ต้องทำให้บาร์โค้ดกว้างขึ้น + +## ตัวเลือกการบันทึกไฟล์บาร์โค้ดและแนวทางปฏิบัติที่ดีที่สุด + +วิธี `Save` รองรับหลายรูปแบบภาพ (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`) PNG เป็นแบบ lossless และทำงานได้ดีกับอุปกรณ์สแกนส่วนใหญ่ หากคุณต้องการไฟล์ขนาดเล็กกว่าและยอมรับการบีบอัดเล็กน้อย ให้เลือก JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**กรณีขอบ:** เมื่อบันทึกเป็น JPEG, ตรวจสอบให้แน่ใจว่าพารามิเตอร์คุณภาพตั้งค่าอย่างเหมาะสม (ค่าเริ่มต้นคือ 90) คุณภาพต่ำอาจทำให้โมดูลเล็ก ๆ เบลอและทำให้บาร์โค้ดอ่านไม่ได้ + +## ตัวอย่างสมบูรณ์ที่สามารถรันได้ + +รวมทุกอย่างเข้าด้วยกัน, นี่คือไฟล์เดียวที่คุณสามารถคัดลอกไปยังโปรเจกต์คอนโซลใหม่และรันได้ทันที: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**ผลลัพธ์ที่คาดหวัง:** หลังจากรันโปรแกรม, โฟลเดอร์ `output` จะมีไฟล์สามไฟล์: + +* `DatabarCols4.png` – บาร์โค้ดที่มี 4 คอลัมน์ (กว้าง) +* `DatabarRows3.png` – บาร์โค้ดที่มี 3 แถว (สูง) +* `DatabarRows3.jpg` – เวอร์ชัน JPEG ของบาร์โค้ด 3 แถว + +เปิดไฟล์ PNG ใดไฟล์หนึ่งในโปรแกรมดูภาพ; คุณควรเห็นบาร์โค้ด Databar Expanded Stacked ที่ชัดเจนพร้อมสแกน + +## คำถามที่พบบ่อยและการแก้ไขปัญหา + +| Question | Answer | +|----------|--------| +| *What if the image is blurry?* | Verify you are using PNG for lossless output. If you need JPEG, increase the quality setting (`new JpegOptions { Quality = 95 }`). | +| *Can I change the barcode text?* | Yes—replace the second argument in `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Do columns and rows work together?* | They can be combined; just set both `DataBar.Columns` and `DataBar.Rows` before calling `Save`. | +| *Is there a limit on directory depth?* | The path must be valid for the operating system. Use `Path.Combine` for cross‑platform safety. | + +## สรุป + +คุณได้เรียนรู้ **วิธีตั้งค่าคอลัมน์** สำหรับบาร์โค้ด Databar Expanded Stacked, **วิธีตั้งค่าแถว**, และ **วิธีสร้างภาพบาร์โค้ด** ที่สามารถ **บันทึกไฟล์บาร์โค้ด** ในรูปแบบ PNG หรือ JPEG ตัวอย่างสมบูรณ์แสดงขั้นตอนทั้งหมด ตั้งแต่การติดตั้งไลบรารีจนถึงการตรวจสอบไฟล์สุดท้าย + +ต่อไป, ลองสำรวจ: + +* **how to generate barcode** with error correction levels for QR codes. +* **barcode save file** options for vector formats like SVG or PDF. +* การรวมบาร์โค้ดที่สร้างขึ้นกับมุมมอง ASP.NET Core MVC เพื่อพิมพ์ฉลากแบบไดนามิก + +อย่ากลัวที่จะทดลองผสมคอลัมน์/แถว, รูปแบบภาพ, และเนื้อหาบาร์โค้ดต่าง ๆ เพื่อให้ตรงกับสเปคของโครงการคุณ ขอให้สนุกกับการเขียนโค้ด! + +## คุณควรเรียนรู้อะไรต่อไป? + +บทแนะนำต่อไปนี้ครอบคลุมหัวข้อที่เกี่ยวข้องอย่างใกล้ชิดและต่อยอดจากเทคนิคที่แสดงในคู่มือนี้ แต่ละแหล่งรวมตัวอย่างโค้ดทำงานเต็มรูปแบบพร้อมคำอธิบายทีละขั้นตอน เพื่อช่วยให้คุณเชี่ยวชาญฟีเจอร์ API เพิ่มเติมและสำรวจแนวทางการทำงานทางเลือกในโปรเจกต์ของคุณเอง + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/turkish/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..55d23c7a7 --- /dev/null +++ b/barcode/turkish/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,196 @@ +--- +category: general +date: 2026-08-06 +description: C#'ta hızlıca databar yığılmış barkod oluşturun. X boyutunu ayarlamayı, + en‑boy oranını düzenlemeyi ve DataBar Stacked Omnidirectional jeneratörünü kullanarak + PNG dosyalarını dışa aktarmayı öğrenin. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: tr +lastmod: 2026-08-06 +og_description: Aspose.BarCode ile C#’ta databar yığılmış barkod oluşturun. Bu öğreticide + X boyutunu yapılandırma, en‑boy oranını değiştirme ve PNG görüntülerini kaydetme + gösterilmektedir. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: C#'ta databar yığılmış barkod oluşturma – tam programlama rehberi +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: C#'ta Databar yığılmış barkod oluşturma – adım adım rehber +url: /tr/python-java/general/create-databar-stacked-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 databar stacked barcode oluşturma – adım adım rehber + +Eğer **databar stacked barcode** görüntüleri oluşturmanız gerekiyorsa, bu rehber Aspose.BarCode kütüphanesini kullanarak bunu nasıl yapacağınızı tam olarak gösterir. X boyutunu ayarlamayı, barkod en-boy oranını değiştirmeyi ve sonucu PNG dosyaları olarak kaydetmeyi birkaç kısa adımda öğreneceksiniz. + +DataBar Stacked barkod oluşturma, perakende taraması veya lojistik takibi için GS1‑128 verisini kodlamanız gerektiğinde yaygın bir senaryodur. Aşağıdaki bölümlerde proje kurulumundan çıktıyı doğrulamaya kadar her şeyi ele alacağız, böylece çözümü herhangi bir .NET uygulamasına eksiksiz entegre edebilirsiniz. + +## Önkoşullar + +Başlamadan önce şunların yüklü olduğundan emin olun: + +* **.NET 6.0** (veya daha yeni) – kod modern SDK'yı hedefliyor. +* **Aspose.BarCode for .NET**'in **lisanslı** bir kopyası. Ücretsiz deneme sürümü test için çalışır ancak filigran ekler. +* **Visual Studio 2022** veya **VS Code** + C# uzantısı gibi bir IDE. +* **C#** sözdizimi ve GS1 Application Identifier kavramına temel aşinalık. + +> **Pro ipucu:** NuGet paket yöneticisini kullanıyorsanız, `dotnet add package Aspose.BarCode` komutu tüm bağımlılıkları otomatik olarak çözer. + +## Adım 1: Yeni bir console projesi oluşturun + +Bir terminal ya da Package Manager Console açın ve şu komutu çalıştırın: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +`dotnet new console` komutu minimal bir **Program.cs** dosyası oluşturur. **Aspose.BarCode** paketini eklemek, `BarcodeGenerator` sınıfını kullanılabilir hâle getirir. + +## Adım 2: DataBar Stacked Omnidirectional üreticisini başlatın + +**Program.cs** dosyasını açın ve varsayılan içeriği aşağıdaki kodla değiştirin. İlk satır, **DataBar Stacked Omnidirectional** sembolü için yapılandırılmış bir **BarcodeGenerator** oluşturur ve bir GS1‑128 yükü sağlar. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Neden önemli:** `EncodeTypes.DatabarStackedOmniDirectional` enum değeri, kütüphaneye **databar stacked barcode** üretmesini söyler; bu, omnidirectional DataBar ailesinin yığılmış (stacked) çeşididir. Bu sembol, 14 sayısal karaktere kadar tutabilir ve GTIN‑14 kodları için idealdir. + +## Adım 3: X boyutunu (modül genişliğini) ayarlayın + +X boyutu, en küçük çubuğun (modül) genişliğini kontrol eder. Çok küçük bir değer düşük çözünürlüklü yazıcılarda kötü görünürken, çok büyük bir değer etiket alanını aşabilir. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **İpucu:** `Pixels` özelliği ekran tabanlı testler için pratiktir. Yazdırma odaklı senaryolarda `generator.Parameters.Barcode.XDimension.Millimeters` kullanın. + +## Adım 4: En‑boy oranını ayarlayın ve ilk görüntüyü kaydedin + +**En‑boy oranı**, yığılmış barkodun yükseklik‑genişlik ilişkisini belirler. DataBar Stacked Omnidirectional türü 10 ile 30 arasında oranları destekler. Görsel etkiyi göstermek için iki görüntü oluşturacağız. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +`generator.Save` çağrısı, **PNG** dosyasını geçerli çalışma dizinine yazar. `BarCodeImageFormat.Png` enumu kayıpsız sıkıştırma sağlar; bu da sonraki işleme veya PDF'lere gömmek için idealdir. + +## Adım 5: En‑boy oranını 30’a değiştirin ve ikinci görüntüyü kaydedin + +Şimdi en‑boy oranını **30** yaparak yığılmış çubukların yüksekliğini artırıyoruz. Bu, X boyutunu değiştirmeden barkodu daha uzun hâle getirir. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Programı çalıştırdığınızda iki PNG dosyası oluşur: + +* **DatabarAspectRatio15.png** – küçük etiketler için kompakt bir barkod. +* **DatabarAspectRatio30.png** – düşük kontrastlı yüzeylerde tarama güvenilirliğini artıran daha uzun bir barkod. + +Görüntüleri herhangi bir görüntüleyicide açarak çubukların doğru yığılmış olduğunu ve kodlanan verinin orijinal GS1 dizesiyle eşleştiğini doğrulayabilirsiniz. + +## Adım 6: Kodlanmış değeri doğrulayın (isteğe bağlı) + +Barkodun gerçekten girdi dizesini temsil ettiğinden emin olmak istiyorsanız, aynı kütüphane ile çözümleyebilirsiniz: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Çözücü `(01)12345678901231` çıktısını vermeli; bu da **create databar stacked barcode** sürecinin veriyi koruduğunu gösterir. + +## Yaygın hatalar ve önleme yöntemleri + +| Sorun | Neden oluşur | Çözüm | +|-------|--------------|------| +| Barkod bulanık görünüyor | X boyutu çıktı çözünürlüğü için çok düşük | `XDimension.Pixels` değerini artırın veya yazdırma için `Millimeters` kullanın | +| Tarayıcı “symbol not found” diyor | En‑boy oranı desteklenen 10‑30 aralığının dışında | Oranı 10‑30 arasında tutun; 15 ve 30 güvenli varsayılanlardır | +| PNG filigran içeriyor | Aspose.BarCode ücretsiz değerlendirme lisansı kullanılıyor | Tam lisans satın alın veya sadece test için deneme sürümünü kullanın | +| İkinci görüntüyü çözerken hata alınıyor | Çözücü yanlış sembol türüyle yapılandırılmış | Yığılmış barkodları okurken `DecodeType.DatabarStackedOmniDirectional` kullanın | + +## Sonraki adımlar + +Artık **databar stacked barcode** görüntüleri oluşturabildiğinize göre şunları yapabilirsiniz: + +* **PNG'leri PDF faturalarına gömmek** – **Aspose.PDF** gibi bir PDF kütüphanesi kullanarak. +* **Web API'de barkodları anlık üretmek** – PNG baytlarını doğrudan bir ASP.NET Core denetleyicisinden döndürmek. +* **Diğer DataBar varyantları** (ör. `DatabarExpanded`, `DatabarLimited`) ile `EncodeTypes` enumunu değiştirerek denemeler yapmak. +* **Renkleri ayarlamak** – `generator.Parameters.Barcode.ForeColor` ve `BackColor` ile marka‑özel tasarımlar oluşturmak. + +Bu konuların her biri burada ele alınan temel kavramlara dayanır: `BarcodeGenerator`'ı başlatmak, görsel parametreleri yapılandırmak ve sonucu `BarCodeImageFormat` ile kaydetmek. + +--- + +### Sonuç + +Bu öğreticide, Aspose.BarCode kullanarak C#'ta **databar stacked barcode** görüntüleri nasıl oluşturulacağını gösterdik. **X dimension**'ı ayarlamayı, **barcode aspect ratio**'yu değiştirmeyi ve sonucu **PNG** dosyaları olarak dışa aktarmayı öğrendiniz. İsteğe bağlı çözümleme adımıyla kodlanan GS1 verisinin doğruluğunu da kontrol edebilirsiniz. Bu desenleri envanter, nakliye veya satış‑noktası uygulamalarınıza uygulayın ve kütüphanenin sunduğu çok sayıda özelleştirme seçeneğini keşfedin. İyi kodlamalar! + + +## Bir sonraki öğrenmeniz gerekenler + + +Aşağıdaki öğreticiler, bu rehberde gösterilen tekniklere dayanarak 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. + +- [One-Dimensional Databar Barcode Height Adjustment](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/turkish/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..9d7fc1da5 --- /dev/null +++ b/barcode/turkish/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: Aspose.BarCode kullanarak C#'ta barkod resmi oluşturun. Databar oluşturmayı, + özel barkod boyutunu ayarlamayı ve basit kodla barkod yüksekliğini değiştirmeyi + öğrenin. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: tr +lastmod: 2026-08-06 +og_description: Aspose.BarCode ile C#’ta barkod resmi oluşturun. Bu öğreticide, Databar + Omnidirectional barkodu nasıl oluşturacağınızı, boyutunu nasıl özelleştireceğinizi + ve barkod yüksekliğini verimli bir şekilde nasıl değiştireceğinizi gösteriyoruz. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: C#'de barkod resmi oluşturma – tam Aspose.BarCode rehberi +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Aspose.BarCode ile C#'ta barkod görüntüsü oluşturma +url: /tr/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# ile Aspose.BarCode kullanarak barkod resmi oluşturma + +Programlı olarak **barkod resmi** oluşturmanız gerekiyorsa, bu kılavuz tam olarak nasıl yapılacağını gösterir. Perakende envanter sistemi ya da lojistik takip portalı oluşturuyor olsanız da, Databar Omnidirectional barkodu oluşturma, boyutlarını ayarlama ve sonucu PNG dosyası olarak kaydetme sürecinin tamamını göreceksiniz. + +Barkod resmi oluşturmak yaygın bir gereksinimdir, ancak geliştiriciler genellikle **Databar'ı** tam ihtiyaç duydukları boyutta nasıl oluşturacaklarını merak ederler. Bu öğreticide Databar barkodu oluşturmayı, genişlik ve yüksekliğini özelleştirmeyi ve tüm jeneratörü yeniden yazmadan barkod yüksekliğini değiştirmeyi öğreneceksiniz. + +## Prerequisites + +Başlamadan önce şunların yüklü olduğundan emin olun: + +* .NET 6.0 SDK veya daha yeni bir sürüm (kod .NET Core ve .NET Framework ile çalışır) +* Visual Studio 2022 (veya C# destekleyen herhangi bir IDE) +* Geçerli bir Aspose.BarCode for .NET lisansı (ücretsiz değerlendirme sürümü test için çalışır) +* C# sözdizimine temel aşinalık + +## Step 1: Install Aspose.BarCode + +Aspose.BarCode NuGet paketini projenize ekleyin: + +```bash +dotnet add package Aspose.BarCode +``` + +Paket, bu öğreticide kullanılan `BarcodeGenerator` sınıfını içerir. Kurulumdan sonra bağımlılıkları çekmek için projeyi geri yükleyin. + +## Step 2: Create a basic barcode generator + +Aşağıdaki ilk satır, Databar Omnidirectional sembolü üretecek bir **barkod jeneratörü** oluşturur. `EncodeTypes.DatabarOmniDirectional` enum’u, kütüphaneye hangi sembolojiyi kullanacağını söyler ve veri dizesi GS1 Uygulama Tanımlayıcısı sözdizimini izler. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Neden önemli:** `BarcodeGenerator` nesnesi, her barkod işleminin giriş noktasıdır. `DatabarOmniDirectional` seçerek çıktının perakende taramaları için GS1 standardına uygun olmasını sağlarsınız. + +## Step 3: Set a custom X‑dimension (module width) + +X‑dimension, en dar çubuğun genişliğini kontrol eder. Küçük bir piksel değeri, kompakt bir barkod elde etmenizi sağlarken, daha büyük değerler toplam genişliği artırır. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Açıklama:** 2 piksel X‑dimension, yüksek çözünürlüklü ekranlar için yaygın bir tercihtir. Görsel yoğunluğu daha sıkı ya da daha gevşek olmasını istiyorsanız bu değeri ayarlayın. + +## Step 4: Generate the first barcode image with a specific height + +Barkod yüksekliği, X‑dimension’dan bağımsızdır. Burada çubuk yüksekliğini **30 px** olarak ayarlıyor ve resmi PNG olarak kaydediyoruz. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Sonuç:** `DatabarBarHeight30Pixels.png` adlı bir dosyanız olur ve bu dosya 30 px yüksekliğinde bir Databar barkodu gösterir. Bu, küçük bir etiket gibi belirli bir kullanım senaryosu için **özel barkod boyutu** yeteneğini gösterir. + +## Step 5: Change barcode height for a larger version + +Aynı barkod daha büyük bir etikette kullanılacaksa, sadece yükseklik özelliğini değiştirip aynı jeneratör örneğini yeniden kullanmanız yeterlidir. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Neden jeneratörü yeniden kullanabilirsiniz:** `BarHeight.Pixels` değerini değiştirmek, nesneyi yeniden oluşturmadan iç düzeni günceller; bu da belleği tasarruf eder ve veri dizesini aynı tutar. Bu, **barkod yüksekliğini** dinamik olarak değiştirmenin önerilen yoludur. + +## Step 6: Verify the output + +İki PNG dosyasını herhangi bir görüntüleyicide açın. Aynı GTIN’i kodlayan ancak dikey boyutu farklı olan iki Databar Omnidirectional barkod görmelisiniz: + +* `DatabarBarHeight30Pixels.png` – 30 px yüksek, kompakt makbuzlar için uygun. +* `DatabarBarHeight60Pixels.png` – 60 px yüksek, daha büyük raf‑kenarı etiketleri için ideal. + +Her iki görüntü de aynı X‑dimension’ı korur, böylece çubuk‑boşluk oranı tutarlı kalırken toplam yükseklik ölçeklenir. + +## Common variations and edge cases + +| Durum | Nasıl ele alınır | +|-----------|------------------| +| **Farklı barkod sembolojisi** | `EncodeTypes.DatabarOmniDirectional` yerine başka bir enum değeri (ör. `EncodeTypes.Code128`) kullanın. Kalan kod değişmez. | +| **Piksel dışı boyutlar** | Fiziksel ölçümler (baskı için) gerekiyorsa `generator.Parameters.Barcode.XDimension.Millimeters` veya `BarHeight.Millimeters` kullanın. | +| **Şeffaf arka plan** | `Save` metodunu çağırmadan önce `generator.Parameters.ImageBackgroundColor = Color.Transparent;` ayarlayın. | +| **Yüksek çözünürlüklü çıktı** | `XDimension.Pixels` ve `BarHeight.Pixels` değerlerini orantılı olarak artırın veya kayıpsız kalite için `BarCodeImageFormat.Tiff` olarak kaydedin. | +| **Tek bir görüntüde birden fazla barkod** | Ayrı `BarcodeGenerator` örnekleri oluşturun, her birini bir `Bitmap`e render edin ve ardından `Graphics.DrawImage` ile birleştirin. | + +**Pro ipucu:** Üretimi üretime almadan önce gerçek bir tarayıcıyla oluşturulan barkodu mutlaka test edin. Tarayıcılar, ışık ve sensör kalitesine bağlı olarak çok ince çubukları farklı yorumlayabilir. + +## Full source code for reference + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Kodu yeni bir konsol projesine kopyalayın, çalıştırın ve iki PNG dosyasının çıktı klasöründe göründüğünü göreceksiniz. + +## Frequently asked questions + +**S: Lisans kurmadan barkod oluşturabilir miyim?** +C: Aspose.BarCode’un değerlendirme sürümü lisans olmadan çalışır ancak küçük bir filigran ekler. Üretim için `License license = new License(); license.SetLicense("Aspose.BarCode.lic");` kodu ile satın alınmış lisansı uygulayın. + +**S: X‑dimension’ı değiştirmek okunabilirliği etkiler mi?** +C: Evet. Çok küçük X‑dimension değerleri düşük çözünürlüklü yazıcılarda barkodun okunamamasına yol açabilir. Ekran renderı için en az 1 px, baskı için en az 0.25 mm önerilir. + +**S: Barkodu JPEG formatında üretmem gerekirse ne yapmalıyım?** +C: `BarCodeImageFormat.Png` yerine `BarCodeImageFormat.Jpeg` kullanın. Ayrıca sıkıştırmayı kontrol etmek için `generator.Parameters.ImageQuality` ayarlayabilirsiniz. + +## Conclusion + +Artık C# ile Aspose.BarCode kullanarak **barkod resmi** oluşturmayı, **Databar barkodu** yaratmayı, **özel barkod boyutu** ayarlamayı ve ihtiyaca göre **barkod yüksekliğini** değiştirmeyi biliyorsunuz. Tam örnek, en yaygın iş akışını gösterir ve tablo, gerçek dünya kenar durumlarıyla başa çıkmanız için size yol gösterir. + +Sonraki adımda **PDF belgelerine barkod ekleme**, **birden fazla barkodu toplu oluşturma** ve **mobil ödemeler için QR kodları kullanma** gibi ilgili konuları keşfedin. Bu senaryolar, burada ele alınan aynı prensiplere dayanır; böylece bu bilgiyi güvenle genişletebilirsiniz. + +İyi kodlamalar, barkodlarınız sorunsuz taransın! + +## What Should You Learn Next? + +Aşağıdaki öğreticiler, bu rehberde gösterilen tekniklere dayanarak yakından ilgili konuları kapsar. Her kaynak, ek API özelliklerini ustalaşmanız ve projelerinizde alternatif uygulama yaklaşımlarını keşfetmeniz için adım‑adım açıklamalı tam çalışan kod örnekleri içerir. + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/turkish/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..253c8a508 --- /dev/null +++ b/barcode/turkish/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,225 @@ +--- +category: general +date: 2026-08-06 +description: Databar Expanded Stacked barkod için sütunları nasıl ayarlayacağınızı + ve barkod görüntülerini nasıl oluşturacağınızı, satırları nasıl ayarlayacağınızı + ve C#'ta barkod dosyasını nasıl kaydedeceğinizi öğrenin. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: tr +lastmod: 2026-08-06 +og_description: Databar Expanded Stacked barkod için sütunları nasıl ayarlayacağınızı + ve barkod görüntülerini hızlıca nasıl oluşturacağınızı, satırları nasıl ayarlayacağınızı + ve Aspose.Barcode ile barkod dosyasını nasıl kaydedeceğinizi öğrenin. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Databar Expanded Stacked barkod için sütunları nasıl ayarlarsınız – adım + adım C# rehberi +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Databar Expanded Stacked barkod için sütunları nasıl ayarlarsınız – tam C# + rehberi +url: /tr/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Databar Expanded Stacked barkod için sütunları nasıl ayarlarsınız – tam C# rehberi + +Databar Expanded Stacked barkod için **sütunları nasıl ayarlayacağınızı** öğrenmek istiyorsanız, bu öğretici tam adımları gösterir. Perakende etiketleme sistemi ya da lojistik uygulaması geliştiriyor olun, sütun ve satır kontrolü barkod boyutunu ve tarama güvenilirliğini ince ayar yapmanızı sağlar. Ayrıca **barkod nasıl oluşturulur** ve **barkod kaydet dosyası** konularını da göreceksiniz. + +Bu kılavuz şunları kapsar: + +* Aspose.Barcode for .NET kütüphanesinin kurulumu. +* Databar Expanded Stacked türü için bir barkod üreticisi oluşturma. +* Sütun sayısı, satır sayısı ve görüntü formatını ayarlama. +* Oluşan PNG dosyalarını seçtiğiniz bir dizine kaydetme. + +Aspose.Barcode ile daha önce çalışmış olmanız gerekmez—sadece temel bir C# geliştirme ortamı yeterlidir. + +## Önkoşullar + +Başlamadan önce şunların yüklü olduğundan emin olun: + +* .NET 6.0 SDK veya daha yeni bir sürüm. +* Visual Studio 2022 (veya .NET destekleyen herhangi bir IDE). +* **Aspose.Barcode** NuGet referansı (`dotnet add package Aspose.Barcode`). + +Tüm kod parçacıkları varsayılan console proje şablonu ile derlenebilir. + +## Adım 1: Databar Expanded Stacked için bir barkod üreticisi oluşturma + +İlk işlem, `EncodeTypes.DatabarExpandedStacked` enum’u ile `BarcodeGenerator` örneği oluşturmaktır. Bu, varsayılan düzeni (stacked) ayarlar ve nesneyi sonraki yapılandırmalar için hazırlar. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Neden önemli:** Üretici, tüm render parametrelerini tutar. `DatabarExpandedStacked` seçerek kütüphaneye sütun ve satır ayarlamalarını destekleyen tek düzeni kullanmasını söylersiniz. + +## Databar Expanded Stacked barkod için sütunları nasıl ayarlarsınız + +Üretici artık mevcut olduğuna göre, sütun sayısını kontrol edebilirsiniz. `DataBar.Columns` özelliği 1 ile 4 arasında bir tam sayı alır. **4** olarak ayarlamak, stacked düzen içinde hâlâ sığabilecek en geniş barkodu oluşturur. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Pratik ipucu:** Maksimum sütun sayısını yalnızca etiket üzerinde yeterli beyaz alanınız olduğunda kullanın. Küçük bir etikette çok fazla sütun tarama sorunlarına yol açabilir. + +## Barkod görüntülerini nasıl oluşturur ve kaydedersiniz + +Sütunları yapılandırdıktan sonra barkodu render edip görüntüyü diske yazmanız gerekir. `Save` metodu bir dosya yolu ve bir görüntü formatı enum’u alır. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +`output` klasörü mevcut olmalıdır; aksi takdirde bir istisna fırlatılır. İsterseniz `Directory.CreateDirectory("output");` ile programatik olarak oluşturabilirsiniz. + +## Databar Expanded Stacked barkod için satırları nasıl ayarlarsınız + +Satırlar, sütunlarla benzer şekilde çalışır, ancak barkod modüllerinin dikey yığılmasını etkiler. `DataBar.Rows` özelliği 1 ile 5 arasında değerler alır. Bu örnekte **3** satır kullanıyoruz. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Satırların önemi:** Satır eklemek barkod yüksekliğini artırır; bu, barkodu genişletmeden daha fazla veri modülü gerektiğinde yüksek yoğunluklu etiketlerde faydalıdır. + +## Barkod kaydet dosyası seçenekleri ve en iyi uygulamalar + +`Save` metodu çeşitli görüntü formatlarını destekler (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG kayıpsızdır ve çoğu tarama cihazı için iyidir. Daha küçük dosya boyutu istiyor ve hafif sıkıştırma bozulmalarını tolere edebiliyorsanız JPEG seçin: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Köşe durumu:** JPEG kaydederken kalite parametresinin uygun şekilde ayarlandığından emin olun (varsayılan 90’dır). Düşük kalite, küçük modülleri bulanıklaştırarak barkodun okunamaz hale gelmesine neden olabilir. + +## Tam, çalıştırılabilir örnek + +Her şeyi bir araya getirdiğimizde, yeni bir console projesine kopyalayıp hemen çalıştırabileceğiniz tek dosya şu şekildedir: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Beklenen çıktı:** Program çalıştırıldıktan sonra `output` klasörü üç dosya içerir: + +* `DatabarCols4.png` – 4 sütunlu (geniş) barkod. +* `DatabarRows3.png` – 3 satırlı (yüksek) barkod. +* `DatabarRows3.jpg` – 3 satırlı barkodun JPEG versiyonu. + +PNG dosyalarından birini bir görüntü görüntüleyicide açın; taramaya hazır net bir Databar Expanded Stacked barkod görmelisiniz. + +## Yaygın sorular ve sorun giderme + +| Soru | Cevap | +|----------|--------| +| *Görüntü bulanık olursa ne yapmalı?* | Kayıpsız çıktı için PNG kullandığınızı doğrulayın. JPEG gerekiyorsa kalite ayarını artırın (`new JpegOptions { Quality = 95 }`). | +| *Barkod metnini değiştirebilir miyim?* | Evet—`new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")` ifadesindeki ikinci argümanı değiştirin. | +| *Sütunlar ve satırlar birlikte çalışır mı?* | Evet; `Save` çağrısından önce hem `DataBar.Columns` hem de `DataBar.Rows` ayarlayın. | +| *Dizin derinliğiyle ilgili bir sınırlama var mı?* | Yol işletim sistemi için geçerli olmalıdır. Çapraz platform güvenliği için `Path.Combine` kullanın. | + +## Sonuç + +Artık **Databar Expanded Stacked barkod için sütunları nasıl ayarlayacağınızı**, **satırları nasıl ayarlayacağınızı** ve **barkod nasıl oluşturulur** sorularının yanıtını biliyorsunuz; ayrıca **barkod kaydet dosyası** seçeneklerini PNG veya JPEG formatında nasıl kullanacağınızı da gördünüz. Tam örnek, kütüphane kurulumundan dosya doğrulamasına kadar gereken tüm adımları gösteriyor. + +Sonraki adım olarak şunları keşfedebilirsiniz: + +* QR kodları için hata düzeltme seviyeleriyle **barkod nasıl oluşturulur**. +* SVG veya PDF gibi vektör formatları için **barkod kaydet dosyası** seçenekleri. +* Dinamik etiket baskısı için üretilen barkodları ASP.NET Core MVC görünümlerine entegre etme. + +Farklı sütun/satır kombinasyonları, görüntü formatları ve barkod içerikleriyle denemeler yaparak projenizin gereksinimlerine en uygun çözümü bulun. Kodlamanın tadını çıkarın! + +## Bir Sonraki Öğrenmeniz Gerekenler + + +Aşağıdaki öğreticiler, bu rehberde gösterilen tekniklere dayanarak yakından ilgili konuları kapsar. Her kaynak, ek API özelliklerini ustalaşmanız ve kendi projelerinizde alternatif uygulama yaklaşımlarını keşfetmeniz için adım adım açıklamalar ve tam çalışan kod örnekleri içerir. + +- [How to Generate Barcode - One-Dimensional Barcode Types](/barcode/english/net/one-dimensional-barcode-types/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [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/vietnamese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md b/barcode/vietnamese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..a103ab617 --- /dev/null +++ b/barcode/vietnamese/python-java/general/create-databar-stacked-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,193 @@ +--- +category: general +date: 2026-08-06 +description: Tạo mã vạch databar xếp chồng nhanh chóng trong C#. Học cách đặt kích + thước X, điều chỉnh tỷ lệ khung hình và xuất tệp PNG bằng trình tạo DataBar Stacked + Omnidirectional. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create databar stacked barcode +- DataBar Stacked Omnidirectional +- barcode aspect ratio +- BarcodeGenerator C# +- BarCodeImageFormat PNG +language: vi +lastmod: 2026-08-06 +og_description: Tạo mã vạch databar xếp chồng trong C# với Aspose.BarCode. Hướng dẫn + này chỉ cách cấu hình kích thước X, thay đổi tỷ lệ khung hình và lưu ảnh PNG. +og_image_alt: Screenshot of two PNG files generated from a DataBar Stacked Omnidirectional + barcode with different aspect ratios +og_title: Tạo mã vạch databar xếp chồng trong C# – hướng dẫn lập trình đầy đủ +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Create databar stacked barcode in C# quickly. Learn to set X dimension, + adjust aspect ratio, and export PNG files using the DataBar Stacked Omnidirectional + generator. + headline: Create databar stacked barcode in C# – step‑by‑step guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.BarCode +title: Tạo mã vạch Databar xếp chồng trong C# – hướng dẫn từng bước +url: /vi/python-java/general/create-databar-stacked-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 stacked trong C# – hướng dẫn từng bước + +Nếu bạn cần **tạo mã vạch databar stacked** dưới dạng hình ảnh trong C#, hướng dẫn này sẽ chỉ cho bạn cách thực hiện chính xác bằng cách sử dụng thư viện Aspose.BarCode. Bạn sẽ học cách đặt kích thước X, thay đổi tỷ lệ khung hình của mã vạch và lưu kết quả dưới dạng tệp PNG—tất cả trong một vài bước ngắn gọn. + +Việc tạo mã vạch DataBar Stacked thường gặp khi bạn phải mã hoá dữ liệu GS1‑128 cho việc quét bán lẻ hoặc theo dõi logistics. Trong các phần sau, chúng tôi sẽ bao quát mọi thứ từ thiết lập dự án đến kiểm tra đầu ra, để bạn có thể tích hợp giải pháp này vào bất kỳ ứng dụng .NET nào mà không bỏ sót chi tiết nào. + +## Prerequisites + +Trước khi bắt đầu, hãy chắc chắn rằng bạn có: + +* **.NET 6.0** (hoặc mới hơn) đã được cài đặt – mã nguồn nhắm tới SDK hiện đại. +* Một bản **có giấy phép** của **Aspose.BarCode for .NET**. Bản dùng thử miễn phí chỉ dành cho kiểm tra nhưng sẽ có watermark. +* Một IDE như **Visual Studio 2022** hoặc **VS Code** với phần mở rộng C#. +* Kiến thức cơ bản về cú pháp **C#** và khái niệm GS1 Application Identifiers. + +> **Pro tip:** Nếu bạn sử dụng trình quản lý gói NuGet, lệnh `dotnet add package Aspose.BarCode` sẽ tự động giải quyết tất cả các phụ thuộc. + +## Step 1: Create a new console project + +Mở terminal hoặc Package Manager Console và chạy: + +```bash +dotnet new console -n DatabarStackedDemo +cd DatabarStackedDemo +dotnet add package Aspose.BarCode +``` + +Lệnh `dotnet new console` sẽ tạo một tệp **Program.cs** tối thiểu. Thêm gói **Aspose.BarCode** sẽ làm cho lớp `BarcodeGenerator` khả dụng. + +## Step 2: Initialize the DataBar Stacked Omnidirectional generator + +Mở **Program.cs** và thay thế nội dung mặc định bằng đoạn mã sau. Dòng đầu tiên tạo một **BarcodeGenerator** được cấu hình cho ký hiệu **DataBar Stacked Omnidirectional** và cung cấp payload GS1‑128. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a DataBar Stacked Omnidirectional barcode + // "(01)12345678901231" encodes a GTIN‑14 with Application Identifier (01) + var generator = new BarcodeGenerator( + EncodeTypes.DatabarStackedOmniDirectional, + "(01)12345678901231"); + + // Continue with configuration... +``` + +**Why this matters:** Giá trị enum `EncodeTypes.DatabarStackedOmniDirectional` thông báo cho thư viện tạo ra một **databar stacked barcode**, là biến thể xếp chồng của họ DataBar omnidirectional. Ký hiệu này có thể chứa tới 14 ký tự số, rất thích hợp cho mã GTIN‑14. + +## Step 3: Set the X dimension (module width) + +Kích thước X điều khiển độ rộng của thanh nhỏ nhất (module). Giá trị quá nhỏ có thể hiển thị kém trên máy in độ phân giải thấp, trong khi giá trị quá lớn có thể vượt quá không gian nhãn. + +```csharp + // Step 3: Define the module width – 2 pixels gives a crisp, printable barcode + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +> **Tip:** Thuộc tính `Pixels` tiện lợi cho việc thử nghiệm trên màn hình. Đối với các kịch bản tập trung vào in ấn, hãy sử dụng `generator.Parameters.Barcode.XDimension.Millimeters` thay thế. + +## Step 4: Adjust the aspect ratio and save the first image + +**Aspect ratio** ảnh hưởng đến mối quan hệ chiều cao‑so‑với‑chiều rộng của mã vạch xếp chồng. Kiểu DataBar Stacked Omnidirectional hỗ trợ tỷ lệ từ 10 đến 30. Chúng ta sẽ tạo hai hình ảnh để minh họa ảnh hưởng trực quan. + +```csharp + // Step 4a: Set aspect ratio to 15 (default is 15) and save as PNG + generator.Parameters.Barcode.DataBar.AspectRatio = 15; + generator.Save("DatabarAspectRatio15.png", BarCodeImageFormat.Png); +``` + +Lệnh `generator.Save` ghi một tệp **PNG** vào thư mục làm việc hiện tại. Enum `BarCodeImageFormat.Png` đảm bảo nén không mất dữ liệu, lý tưởng cho việc xử lý tiếp theo hoặc nhúng vào PDF. + +## Step 5: Change the aspect ratio to 30 and save the second image + +Bây giờ chúng ta tăng chiều cao của các thanh xếp chồng bằng cách thay đổi aspect ratio thành **30**. Điều này làm cho mã vạch cao hơn mà không thay đổi kích thước X. + +```csharp + // Step 5a: Increase aspect ratio to 30 for a taller barcode + generator.Parameters.Barcode.DataBar.AspectRatio = 30; + generator.Save("DatabarAspectRatio30.png", BarCodeImageFormat.Png); + + Console.WriteLine("Two barcode images have been generated:"); + Console.WriteLine(" • DatabarAspectRatio15.png"); + Console.WriteLine(" • DatabarAspectRatio30.png"); + } +} +``` + +Chạy chương trình hiện sẽ tạo ra hai tệp PNG: + +* **DatabarAspectRatio15.png** – mã vạch gọn gàng, phù hợp cho nhãn nhỏ. +* **DatabarAspectRatio30.png** – mã vạch cao hơn, cải thiện độ tin cậy khi quét trên bề mặt có độ tương phản thấp. + +Bạn có thể mở các hình ảnh bằng bất kỳ trình xem nào để xác nhận các thanh đã được xếp chồng đúng và dữ liệu đã mã hoá khớp với chuỗi GS1 gốc. + +## Step 6: Verify the encoded value (optional) + +Nếu bạn cần xác nhận rằng mã vạch thực sự đại diện cho chuỗi đầu vào, có thể giải mã nó bằng cùng một thư viện: + +```csharp + // Optional: Decode the generated PNG to ensure correctness + var decoder = new BarCodeReader("DatabarAspectRatio15.png", DecodeType.DatabarStackedOmniDirectional); + foreach (BarCodeResult result in decoder.ReadBarCodes()) + { + Console.WriteLine($"Decoded text: {result.CodeText}"); + } +``` + +Trình giải mã nên xuất ra `(01)12345678901231`, chứng minh rằng quá trình **create databar stacked barcode** đã giữ nguyên dữ liệu. + +## Common pitfalls and how to avoid them + +| Issue | Why it happens | Fix | +|-------|----------------|-----| +| Mã vạch bị mờ | Kích thước X được đặt quá thấp so với độ phân giải đầu ra | Tăng `XDimension.Pixels` hoặc dùng `Millimeters` cho in ấn | +| Máy quét báo “symbol not found” | Aspect ratio nằm ngoài khoảng hỗ trợ 10‑30 | Giữ tỷ lệ trong khoảng 10‑30; 15 và 30 là giá trị mặc định an toàn | +| PNG có watermark | Sử dụng giấy phép dùng thử miễn phí của Aspose.BarCode | Mua giấy phép đầy đủ hoặc chỉ dùng bản trial để thử nghiệm | +| Giải mã thất bại trên hình ảnh thứ hai | Trình giải mã được cấu hình cho ký hiệu sai | Sử dụng `DecodeType.DatabarStackedOmniDirectional` khi đọc mã vạch xếp chồng | + +## Next steps + +Bây giờ bạn đã có thể **tạo mã vạch databar stacked** dưới dạng hình ảnh, có thể muốn: + +* **Nhúng PNG vào hóa đơn PDF** bằng một thư viện PDF như **Aspose.PDF**. +* **Tạo mã vạch động trong một Web API** – trả về byte PNG trực tiếp từ controller ASP.NET Core. +* **Thử nghiệm các biến thể DataBar khác** (ví dụ: `DatabarExpanded`, `DatabarLimited`) bằng cách thay đổi enum `EncodeTypes`. +* **Điều chỉnh màu sắc** bằng cách đặt `generator.Parameters.Barcode.ForeColor` và `BackColor` cho thiết kế thương hiệu. + +Mỗi chủ đề trên dựa trên các khái niệm cốt lõi đã được trình bày ở đây: khởi tạo `BarcodeGenerator`, cấu hình các tham số hiển thị, và lưu kết quả bằng `BarCodeImageFormat`. + +--- + +### Conclusion + +Bài hướng dẫn này đã minh họa cách **tạo mã vạch databar stacked** trong C# bằng Aspose.BarCode. Bạn đã học cách đặt **kích thước X**, thay đổi **aspect ratio** của mã vạch, và xuất kết quả dưới dạng tệp **PNG** bằng `BarcodeGenerator`. Với bước giải mã tùy chọn, bạn cũng có thể xác nhận dữ liệu GS1 đã được mã hoá một cách chính xác. Áp dụng các mẫu này vào hệ thống quản lý tồn kho, vận chuyển hoặc điểm bán lẻ của bạn, và khám phá nhiều tùy chỉnh khác mà thư viện cung cấp. Chúc lập trình vui vẻ! + +## What Should You Learn Next? + +Các hướng dẫn sau đây đề cập đến các chủ đề liên quan chặt chẽ, dựa trên các kỹ thuật đã 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. + +- [One-Dimensional Databar Barcode Height Adjustment](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-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/generate-barcode-image-in-c-with-aspose-barcode/_index.md b/barcode/vietnamese/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md new file mode 100644 index 000000000..207e31793 --- /dev/null +++ b/barcode/vietnamese/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/_index.md @@ -0,0 +1,227 @@ +--- +category: general +date: 2026-08-06 +description: Tạo hình ảnh mã vạch trong C# bằng Aspose.BarCode. Tìm hiểu cách tạo + Databar, điều chỉnh kích thước mã vạch tùy chỉnh và thay đổi chiều cao mã vạch bằng + mã đơn giản. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode image +- how to generate databar +- custom barcode size +- create databar barcode +- change barcode height +language: vi +lastmod: 2026-08-06 +og_description: Tạo hình ảnh mã vạch trong C# với Aspose.BarCode. Hướng dẫn này cho + bạn cách tạo mã vạch Databar Omnidirectional, tùy chỉnh kích thước và thay đổi chiều + cao mã vạch một cách hiệu quả. +og_image_alt: Screenshot of a Databar barcode generated with custom height in C# +og_title: Tạo hình ảnh mã vạch trong C# – hướng dẫn đầy đủ Aspose.BarCode +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: Generate barcode image in C# using Aspose.BarCode. Learn how to generate + Databar, adjust custom barcode size, and change barcode height with simple code. + headline: Generate barcode image in C# with Aspose.BarCode + type: TechArticle +- questions: + - answer: The evaluation version of Aspose.BarCode works without a license but adds + a small watermark. For production use, apply a purchased license using `License + license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + question: Can I generate a barcode without installing a license? + - answer: Yes. Very small X‑dimensions can make the barcode unreadable on low‑resolution + printers. A minimum of 1 px for screen rendering is recommended; for print, + use at least 0.25 mm. + question: Does changing the X‑dimension affect readability? + - answer: 'Replace `BarCodeImageFormat.Png` with `BarCodeImageFormat.Jpeg`. You + may also set `generator.Parameters.ImageQuality` to control compression. ## + Conclusion You now know how to **generate barcode image** in C# using Aspose.BarCode, + how to **create Databar barcode**, adjust a **custom barcode size**, ' + question: What if I need to generate a barcode in JPEG format? + type: FAQPage +tags: +- barcode +- C# +- Aspose.BarCode +title: Tạo hình ảnh mã vạch trong C# với Aspose.BarCode +url: /vi/python-java/general/generate-barcode-image-in-c-with-aspose-barcode/ +--- + +{{< 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# với Aspose.BarCode + +Nếu bạn cần **tạo hình ảnh mã vạch** một cách lập trình, hướng dẫn này sẽ chỉ cho bạn cách thực hiện. Dù bạn đang xây dựng hệ thống quản lý hàng tồn kho bán lẻ hay cổng thông tin theo dõi logistics, bạn sẽ thấy quy trình đầy đủ để tạo mã Databar Omnidirectional, điều chỉnh kích thước và lưu kết quả dưới dạng tệp PNG. + +Việc tạo hình ảnh mã vạch là một yêu cầu phổ biến, nhưng các nhà phát triển thường thắc mắc **cách tạo Databar** với kích thước chính xác mà họ cần. Trong tutorial này, bạn sẽ học cách tạo mã Databar, tùy chỉnh chiều rộng và chiều cao, và thay đổi chiều cao mã vạch mà không phải viết lại toàn bộ trình tạo. + +## Các yêu cầu trước + +Trước khi bắt đầu, hãy chắc chắn rằng bạn có: + +* .NET 6.0 SDK hoặc mới hơn (mã hoạt động với .NET Core và .NET Framework) +* Visual Studio 2022 (hoặc bất kỳ IDE nào hỗ trợ C#) +* Giấy phép Aspose.BarCode for .NET hợp lệ (phiên bản dùng thử miễn phí đủ cho việc thử nghiệm) +* Kiến thức cơ bản về cú pháp C# + +## Bước 1: Cài đặt Aspose.BarCode + +Thêm gói NuGet Aspose.BarCode vào dự án của bạn: + +```bash +dotnet add package Aspose.BarCode +``` + +Gói này chứa lớp `BarcodeGenerator` được sử dụng xuyên suốt tutorial. Sau khi cài đặt, hãy khôi phục dự án để tải các phụ thuộc. + +## Bước 2: Tạo một trình tạo mã vạch cơ bản + +Dòng mã đầu tiên tạo một **trình tạo mã vạch** sẽ sinh ra biểu tượng Databar Omnidirectional. Enum `EncodeTypes.DatabarOmniDirectional` cho thư viện biết sẽ sử dụng loại symbology nào, và chuỗi dữ liệu tuân theo cú pháp GS1 Application Identifier. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +class Program +{ + static void Main() + { + // Step 2: Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // GS1-14 data (example GTIN) +``` + +**Tại sao điều này quan trọng:** Đối tượng `BarcodeGenerator` là điểm vào cho mọi thao tác với mã vạch. Bằng cách chọn `DatabarOmniDirectional` bạn đảm bảo đầu ra tuân thủ tiêu chuẩn GS1 cho việc quét bán lẻ. + +## Bước 3: Đặt X‑dimension tùy chỉnh (độ rộng module) + +X‑dimension kiểm soát độ rộng của thanh mỏng nhất. Đặt giá trị pixel nhỏ sẽ cho bạn một mã vạch gọn, trong khi giá trị lớn hơn sẽ làm tăng tổng chiều rộng. + +```csharp + // Step 3: Define a custom X‑dimension (module width) of 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Giải thích:** X‑dimension 2 pixel là lựa chọn phổ biến cho màn hình độ phân giải cao. Điều chỉnh giá trị này nếu bạn cần mật độ hình ảnh chặt hơn hoặc lỏng hơn. + +## Bước 4: Tạo hình ảnh mã vạch đầu tiên với chiều cao cụ thể + +Chiều cao mã vạch độc lập với X‑dimension. Ở đây chúng ta đặt chiều cao thanh là **30 px**, sau đó lưu hình ảnh dưới dạng PNG. + +```csharp + // Step 4: Set bar height to 30 px and save the image + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); +``` + +**Kết quả:** Bạn sẽ có một tệp tên `DatabarBarHeight30Pixels.png` hiển thị mã Databar cao 30 px. Điều này minh họa khả năng **điều chỉnh kích thước mã vạch** cho trường hợp sử dụng cụ thể như nhãn nhỏ. + +## Bước 5: Thay đổi chiều cao mã vạch cho phiên bản lớn hơn + +Nếu cùng một mã vạch phải xuất hiện trên nhãn lớn hơn, bạn chỉ cần sửa thuộc tính chiều cao và tái sử dụng cùng một instance của trình tạo. + +```csharp + // Step 5: Increase the bar height to 60 px for a larger barcode + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + } +} +``` + +**Tại sao bạn có thể tái sử dụng trình tạo:** Thay đổi `BarHeight.Pixels` cập nhật bố cục nội bộ mà không cần tạo lại đối tượng, giúp tiết kiệm bộ nhớ và giữ nguyên chuỗi dữ liệu. Đây là cách được khuyến nghị để **thay đổi chiều cao mã vạch** một cách linh hoạt. + +## Bước 6: Kiểm tra kết quả + +Mở hai tệp PNG trong bất kỳ trình xem ảnh nào. Bạn sẽ thấy hai mã Databar Omnidirectional mã hoá cùng một GTIN nhưng khác nhau về kích thước dọc: + +* `DatabarBarHeight30Pixels.png` – cao 30 px, phù hợp cho biên lai gọn. +* `DatabarBarHeight60Pixels.png` – cao 60 px, lý tưởng cho nhãn kệ hàng lớn hơn. + +Cả hai hình ảnh đều giữ cùng một X‑dimension, vì vậy tỷ lệ thanh‑khoảng trống vẫn đồng nhất trong khi tổng chiều cao được mở rộng. + +## Các biến thể phổ biến và trường hợp góc cạnh + +| Tình huống | Cách xử lý | +|-----------|------------| +| **Symbology mã vạch khác** | Thay `EncodeTypes.DatabarOmniDirectional` bằng giá trị enum khác (ví dụ: `EncodeTypes.Code128`). Phần còn lại của mã không thay đổi. | +| **Kích thước không phải pixel** | Sử dụng `generator.Parameters.Barcode.XDimension.Millimeters` hoặc `BarHeight.Millimeters` nếu bạn cần đo lường thực tế cho đầu ra sẵn sàng in. | +| **Nền trong suốt** | Đặt `generator.Parameters.ImageBackgroundColor = Color.Transparent;` trước khi gọi `Save`. | +| **Đầu ra độ phân giải cao** | Tăng cả `XDimension.Pixels` và `BarHeight.Pixels` một cách tỷ lệ, hoặc lưu dưới dạng `BarCodeImageFormat.Tiff` để có chất lượng không mất dữ liệu. | +| **Nhiều mã vạch trong một hình ảnh** | Tạo các instance `BarcodeGenerator` riêng biệt, render mỗi cái vào một `Bitmap`, sau đó ghép chúng bằng `Graphics.DrawImage`. | + +**Mẹo chuyên nghiệp:** Luôn kiểm tra mã vạch đã tạo bằng một máy quét thực tế trước khi đưa vào sản xuất. Máy quét có thể diễn giải các thanh quá mỏng khác nhau tùy vào ánh sáng và chất lượng cảm biến. + +## Toàn bộ mã nguồn để tham khảo + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize the generator for a Databar Omnidirectional barcode + BarcodeGenerator generator = new BarcodeGenerator( + EncodeTypes.DatabarOmniDirectional, + "(01)12345678901231"); // Example GTIN + + // Custom X‑dimension (module width) – 2 px + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // First image: 30 px height + generator.Parameters.Barcode.BarHeight.Pixels = 30; + generator.Save("DatabarBarHeight30Pixels.png", BarCodeImageFormat.Png); + + // Second image: 60 px height (larger barcode) + generator.Parameters.Barcode.BarHeight.Pixels = 60; + generator.Save("DatabarBarHeight60Pixels.png", BarCodeImageFormat.Png); + + Console.WriteLine("Barcode images generated successfully."); + } + } +} +``` + +Sao chép đoạn mã vào một dự án console mới, chạy nó, và bạn sẽ thấy hai tệp PNG xuất hiện trong thư mục output. + +## Câu hỏi thường gặp + +**H: Có thể tạo mã vạch mà không cài đặt giấy phép không?** +Đ: Phiên bản dùng thử của Aspose.BarCode hoạt động mà không cần giấy phép nhưng sẽ thêm một watermark nhỏ. Đối với môi trường sản xuất, hãy áp dụng giấy phép đã mua bằng cách sử dụng `License license = new License(); license.SetLicense("Aspose.BarCode.lic");`. + +**H: Thay đổi X‑dimension có ảnh hưởng đến khả năng đọc không?** +Đ: Có. X‑dimension quá nhỏ có thể khiến mã vạch không đọc được trên máy in độ phân giải thấp. Đối với hiển thị trên màn hình, tối thiểu 1 px được khuyến nghị; đối với in, ít nhất 0.25 mm. + +**H: Nếu muốn tạo mã vạch ở định dạng JPEG thì sao?** +Đ: Thay `BarCodeImageFormat.Png` bằng `BarCodeImageFormat.Jpeg`. Bạn cũng có thể đặt `generator.Parameters.ImageQuality` để điều chỉnh mức nén. + +## Kết luận + +Bạn đã biết cách **tạo hình ảnh mã vạch** trong C# bằng Aspose.BarCode, cách **tạo mã Databar**, điều chỉnh **kích thước mã vạch tùy chỉnh**, và **thay đổi chiều cao mã vạch** khi cần. Ví dụ hoàn chỉnh minh họa quy trình phổ biến nhất, và bảng các biến thể giúp bạn xử lý các trường hợp thực tế. + +Tiếp theo, hãy khám phá các chủ đề liên quan như **nhúng mã vạch vào tài liệu PDF**, **tạo hàng loạt nhiều mã vạch**, và **sử dụng QR code cho thanh toán di động**. Mỗi kịch bản này dựa trên các nguyên tắc đã được trình bày ở đây, vì vậy bạn có thể mở rộng kiến thức một cách tự tin. + +Chúc lập trình vui vẻ, và mã vạch của bạn luôn quét được một cách hoàn hảo! + +## 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 từng bước để giúp bạn làm chủ 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. + +- [Generate barcode image – GS1 Coupon UPC-A Databar](/barcode/english/net/gs1-barcode-encoding/gs1-coupon-upc-a-databar-configuration/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [How to Generate Barcode – Code 39 Configuration with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-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/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md b/barcode/vietnamese/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md new file mode 100644 index 000000000..f51918288 --- /dev/null +++ b/barcode/vietnamese/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/_index.md @@ -0,0 +1,222 @@ +--- +category: general +date: 2026-08-06 +description: Cách thiết lập cột cho mã vạch Databar Expanded Stacked và cách tạo hình + ảnh mã vạch, thiết lập hàng, và lưu tệp mã vạch bằng C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- how to set columns +- how to generate barcode +- how to set rows +- barcode save file +language: vi +lastmod: 2026-08-06 +og_description: Cách đặt cột cho mã vạch Databar Expanded Stacked và nhanh chóng học + cách tạo hình ảnh mã vạch, đặt dòng và lưu tệp mã vạch bằng Aspose.Barcode. +og_image_alt: Screenshot showing how to set columns for a Databar Expanded Stacked + barcode in C# +og_title: Cách thiết lập cột cho mã vạch Databar Expanded Stacked – hướng dẫn C# từng + bước +schemas: +- author: Aspose + dateModified: '2026-08-06' + description: How to set columns for a Databar Expanded Stacked barcode and learn + how to generate barcode images, set rows, and save the barcode file in C#. + headline: How to set columns for a Databar Expanded Stacked barcode – complete C# + guide + type: TechArticle +tags: +- barcode +- C# +- Aspose.Barcode +title: Cách thiết lập cột cho mã vạch Databar Expanded Stacked – hướng dẫn C# đầy + đủ +url: /vi/python-java/general/how-to-set-columns-for-a-databar-expanded-stacked-barcode-co/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Cách đặt cột cho mã vạch Databar Expanded Stacked – hướng dẫn C# đầy đủ + +Nếu bạn cần **cách đặt cột** cho một mã vạch Databar Expanded Stacked, hướng dẫn này sẽ chỉ cho bạn các bước chính xác. Cho dù bạn đang xây dựng hệ thống dán nhãn bán lẻ hay một ứng dụng logistics, việc kiểm soát cột và hàng cho phép bạn tinh chỉnh kích thước mã vạch và độ tin cậy khi quét. Ngoài ra, bạn sẽ thấy **cách tạo mã vạch** dưới dạng hình ảnh, điều chỉnh số hàng, và **lưu file mã vạch** đúng cách lên đĩa. + +Hướng dẫn này sẽ đưa bạn qua: + +* Cài đặt thư viện Aspose.Barcode cho .NET. +* Tạo một barcode generator cho loại Databar Expanded Stacked. +* Đặt số cột, số hàng và định dạng ảnh. +* Lưu các tệp PNG kết quả vào thư mục đã chọn. + +Không cần kinh nghiệm trước với Aspose.Barcode—chỉ cần một môi trường phát triển C# cơ bản. + +## Yêu cầu trước + +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 nào hỗ trợ .NET). +* Tham chiếu NuGet tới **Aspose.Barcode** (`dotnet add package Aspose.Barcode`). + +Tất cả các đoạn mã đều biên dịch với mẫu dự án console mặc định. + +## Bước 1: Tạo một barcode generator cho Databar Expanded Stacked + +Hoạt động đầu tiên là khởi tạo `BarcodeGenerator` với enum `EncodeTypes.DatabarExpandedStacked`. Điều này sẽ thiết lập bố cục mặc định (stacked) và chuẩn bị đối tượng cho các cấu hình tiếp theo. + +```csharp +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Create a generator for the Databar Expanded Stacked type. + // The text "Databar Expanded Stacked long" is the data encoded in the barcode. + BarcodeGenerator barcodeGeneratorCols = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); +``` + +**Tại sao điều này quan trọng:** Bộ tạo giữ tất cả các tham số render. Bằng cách chọn `DatabarExpandedStacked` bạn nói với thư viện sử dụng bố cục stacked, đây là bố cục duy nhất hỗ trợ điều chỉnh cột và hàng. + +## Cách đặt cột cho một mã vạch Databar Expanded Stacked + +Bây giờ bộ tạo đã tồn tại, bạn có thể kiểm soát số cột. Thuộc tính `DataBar.Columns` chấp nhận một số nguyên từ 1 đến 4. Đặt nó thành **4** sẽ tạo mã vạch rộng nhất có thể trong khi vẫn phù hợp với bố cục stacked. + +```csharp + // Step 2: Configure the generator to use 4 columns. + barcodeGeneratorCols.Parameters.Barcode.DataBar.Columns = 4; +``` + +**Mẹo thực tế:** Chỉ sử dụng số cột tối đa khi bạn có đủ không gian trắng trên nhãn. Quá nhiều cột trên một nhãn nhỏ có thể gây ra vấn đề khi quét. + +## Cách tạo hình ảnh mã vạch và lưu chúng + +Sau khi cấu hình cột, bạn cần render mã vạch và ghi ảnh ra đĩa. Phương thức `Save` nhận một đường dẫn tệp và một enum định dạng ảnh. + +```csharp + // Step 3: Save the barcode image as PNG. + barcodeGeneratorCols.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); +``` + +Thư mục `output` phải tồn tại, nếu không lời gọi sẽ ném ra ngoại lệ. Bạn có thể tạo nó bằng cách lập trình với `Directory.CreateDirectory("output");` nếu muốn. + +## Cách đặt hàng cho một mã vạch Databar Expanded Stacked + +Hàng hoạt động tương tự như cột, nhưng chúng ảnh hưởng đến việc xếp chồng dọc của các mô-đun mã vạch. Thuộc tính `DataBar.Rows` chấp nhận giá trị từ 1 đến 5. Trong ví dụ này chúng ta sử dụng **3** hàng. + +```csharp + // Step 4: Create a second generator for the same barcode type. + BarcodeGenerator barcodeGeneratorRows = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + + // Step 5: Configure the generator to use 3 rows. + barcodeGeneratorRows.Parameters.Barcode.DataBar.Rows = 3; + + // Step 6: Save the row‑adjusted barcode. + barcodeGeneratorRows.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + } +} +``` + +**Tại sao hàng quan trọng:** Thêm hàng làm tăng chiều cao của mã vạch, hữu ích cho các nhãn mật độ cao nơi bạn cần nhiều mô-đun dữ liệu hơn mà không làm rộng mã vạch. + +## Các tùy chọn lưu file mã vạch và các thực tiễn tốt nhất + +Phương thức `Save` hỗ trợ một số định dạng ảnh (`Png`, `Jpeg`, `Bmp`, `Gif`, `Tiff`). PNG là không mất dữ liệu và hoạt động tốt với hầu hết các thiết bị quét. Nếu bạn cần kích thước tệp nhỏ hơn và có thể chấp nhận một chút nén, hãy chọn JPEG: + +```csharp +barcodeGeneratorCols.Save("output/DatabarCols4.jpg", BarCodeImageFormat.Jpeg); +``` + +**Trường hợp đặc biệt:** Khi lưu dưới dạng JPEG, hãy đảm bảo tham số chất lượng được đặt phù hợp (mặc định là 90). Chất lượng thấp có thể làm mờ các mô-đun nhỏ, khiến mã vạch không đọc được. + +## Ví dụ hoàn chỉnh, có thể chạy ngay + +Kết hợp mọi thứ lại, dưới đây là một tệp duy nhất bạn có thể sao chép vào dự án console mới và chạy ngay: + +```csharp +using System; +using System.IO; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +class Program +{ + static void Main() + { + // Ensure the output directory exists. + Directory.CreateDirectory("output"); + + // ------------------------------ + // How to set columns (4 columns) + // ------------------------------ + BarcodeGenerator colsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + colsGenerator.Parameters.Barcode.DataBar.Columns = 4; + colsGenerator.Save("output/DatabarCols4.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 4 columns to output/DatabarCols4.png"); + + // ------------------------------ + // How to set rows (3 rows) + // ------------------------------ + BarcodeGenerator rowsGenerator = new BarcodeGenerator( + EncodeTypes.DatabarExpandedStacked, "Databar Expanded Stacked long"); + rowsGenerator.Parameters.Barcode.DataBar.Rows = 3; + rowsGenerator.Save("output/DatabarRows3.png", BarCodeImageFormat.Png); + Console.WriteLine("Saved barcode with 3 rows to output/DatabarRows3.png"); + + // ------------------------------ + // How to generate barcode (additional format) + // ------------------------------ + rowsGenerator.Save("output/DatabarRows3.jpg", BarCodeImageFormat.Jpeg); + Console.WriteLine("Saved JPEG version to output/DatabarRows3.jpg"); + } +} +``` + +**Kết quả mong đợi:** Sau khi chạy chương trình, thư mục `output` sẽ chứa ba tệp: + +* `DatabarCols4.png` – mã vạch với 4 cột (rộng). +* `DatabarRows3.png` – mã vạch với 3 hàng (cao). +* `DatabarRows3.jpg` – phiên bản JPEG của mã vạch 3 hàng. + +Mở bất kỳ tệp PNG nào trong trình xem ảnh; bạn sẽ thấy một mã vạch Databar Expanded Stacked rõ ràng, sẵn sàng để quét. + +## Câu hỏi thường gặp và khắc phục sự cố + +| Câu hỏi | Trả lời | +|----------|--------| +| *Nếu ảnh bị mờ thì sao?* | Kiểm tra bạn đang sử dụng PNG cho đầu ra không mất dữ liệu. Nếu cần JPEG, tăng cài đặt chất lượng (`new JpegOptions { Quality = 95 }`). | +| *Tôi có thể thay đổi nội dung mã vạch không?* | Có—thay đối số thứ hai trong `new BarcodeGenerator(EncodeTypes.DatabarExpandedStacked, "Your Text")`. | +| *Cột và hàng có hoạt động cùng nhau không?* | Chúng có thể được kết hợp; chỉ cần đặt cả `DataBar.Columns` và `DataBar.Rows` trước khi gọi `Save`. | +| *Có giới hạn độ sâu thư mục không?* | Đường dẫn phải hợp lệ với hệ điều hành. Sử dụng `Path.Combine` để đảm bảo an toàn đa nền tảng. | + +## Kết luận + +Bạn đã biết **cách đặt cột** cho một mã vạch Databar Expanded Stacked, **cách đặt hàng**, và **cách tạo hình ảnh mã vạch** mà bạn có thể **lưu file mã vạch** ở định dạng PNG hoặc JPEG. Ví dụ hoàn chỉnh minh họa mọi bước cần thiết, từ cài đặt thư viện đến xác minh tệp cuối cùng. + +Tiếp theo, hãy khám phá: + +* **cách tạo mã vạch** với mức sửa lỗi cho QR code. +* Các tùy chọn **lưu file mã vạch** cho định dạng vector như SVG hoặc PDF. +* Tích hợp các mã vạch đã tạo vào các view ASP.NET Core MVC để in nhãn động. + +Hãy tự do thử nghiệm các kết hợp cột/hàng, định dạng ảnh và nội dung mã vạch khác nhau để phù hợp với yêu cầu dự án của bạn. Chúc bạn lập trình vui vẻ! + +## 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ã hoàn chỉnh 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. + +- [Cách tạo mã vạch - Các loại mã vạch một chiều](/barcode/english/net/one-dimensional-barcode-types/) +- [Cách tạo mã vạch – Cấu hình Code 39 với Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-39-configuration/) +- [Cách tạo mã vạch Aztec với tỷ lệ khung tùy chỉnh bằng Aspose.BarCode cho .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