diff --git a/barcode/arabic/net/compact-pdf417-encoding/_index.md b/barcode/arabic/net/compact-pdf417-encoding/_index.md index 6b447ecb2..155ff62fa 100644 --- a/barcode/arabic/net/compact-pdf417-encoding/_index.md +++ b/barcode/arabic/net/compact-pdf417-encoding/_index.md @@ -85,6 +85,9 @@ PDF417 المدمج هو رمز ثنائي الأبعاد عالي السعة ي ### [إنشاء باركودات PDF417 المدمجة](./compact-pdf417-basic-configuration/) تعلم كيفية إنشاء باركودات PDF417 المدمجة باستخدام Aspose.BarCode for .NET. دليل شامل مع تعليمات خطوة بخطوة وأمثلة شفرة. +### [إنشاء باركود Micro PDF417 في C# – دليل خطوة بخطوة](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +تعلم كيفية إنشاء باركود Micro PDF417 باستخدام C# خطوة بخطوة مع Aspose.BarCode. + ## الأسئلة المتكررة **س: ما هو الحد الأقصى للبيانات التي يمكن تخزينها في باركود PDF417 المدمج؟** @@ -113,4 +116,4 @@ PDF417 المدمج هو رمز ثنائي الأبعاد عالي السعة ي {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/arabic/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/arabic/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..5ede1f631 --- /dev/null +++ b/barcode/arabic/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,245 @@ +--- +category: general +date: 2026-08-15 +description: إنشاء رمز شريطي micro PDF417 في C# بسرعة باستخدام Aspose.BarCode. تعلّم + كيفية استخدام مولّد الرموز الشريطية، ضبط بُعد X، اختيار الأعمدة، وتمكين التوافق + مع GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: ar +lastmod: 2026-08-15 +og_description: إنشاء رمز شريطي ميكرو PDF417 في C# باستخدام Aspose.BarCode. اتبع هذا + الدرس لتكوين مولد الرمز الشريطي، وضبط الأبعاد، وإنتاج صورة PNG. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: إنشاء رمز شريطي micro PDF417 باستخدام C# – دليل برمجي شامل +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: إنشاء رمز شريطي micro PDF417 بلغة C# – دليل خطوة بخطوة +url: /ar/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# إنشاء باركود micro PDF417 في C# – دليل خطوة‑بخطوة + +إذا كنت بحاجة إلى **إنشاء باركود micro PDF417** في C#، يوضح لك هذا الدليل الطريقة بالضبط. سنستعرض كيفية تهيئة **مولد الباركود**، ضبط **بعد X**، اختيار عدد الأعمدة، وحفظ النتيجة كملف PNG. + +يُعد توليد باركود Micro PDF417 مفيدًا لتشفير البيانات بشكل مضغوط على الملصقات الصغيرة، التذاكر، أو أجهزة إنترنت الأشياء. في نهاية هذا الشرح ستحصل على مثال كامل قابل للتنفيذ يمكنك إدراجه في أي مشروع .NET. + +## ما ستحتاجه + +قبل أن تبدأ، تأكد من وجود ما يلي: + +- .NET 6.0 (أو أحدث) مُثبت – الكود يعمل أيضًا مع .NET Framework 4.6+. +- مكتبة Aspose.BarCode for .NET (متاحة عبر NuGet `Aspose.BarCode`). +- بيئة تطوير مثل Visual Studio 2022 أو VS Code. + +لا توجد خدمات خارجية إضافية مطلوبة؛ كل شيء يعمل محليًا. + +## كيفية إنشاء باركود micro PDF417 باستخدام Aspose.BarCode + +جوهر العملية هو كائن **مولد الباركود** الذي يعرف كيفية ترميز بيانات Micro PDF417. الأقسام التالية تفصل كل خطوة من خطوات التهيئة. + +### الخطوة 1: تهيئة مولد الباركود + +أولاً، استورد المساحات الاسمية المطلوبة وأنشئ مثيلًا من `BarcodeGenerator` باستخدام تعداد `EncodeTypes.MicroPdf417`. الوسيط الثاني هو النص الذي تريد ترميزه. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**لماذا هذا مهم:** فئة `BarcodeGenerator` تحزم كل منطق الترميز. اختيار `EncodeTypes.MicroPdf417` يخبر المكتبة باستخدام رموز Micro PDF417 المدمجة، والتي تقتصر على 1‑4 أعمدة. + +### الخطوة 2: ضبط بعد X (عرض الوحدة) + +**بعد X** يتحكم في عرض وحدة الباركود الواحدة بالبكسل. القيمة الأصغر تنتج باركودًا أكثر تماسكًا، بينما القيمة الأكبر تحسن القابلية للقراءة على الطابعات منخفضة الدقة. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**نصيحة:** القيم بين 1 و 4 تعمل جيدًا لمعظم شاشات العرض. إذا كنت تخطط للطباعة على طابعة حرارية، جرب 3–4 بكسل لتجنب الضبابية. + +### الخطوة 3: تحديد عدد الأعمدة + +يدعم Micro PDF417 1‑4 أعمدة. المزيد من الأعمدة يجعل الباركود أقصر لكنه يزيد ارتفاعه. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**لماذا تختار 4 أعمدة؟** مع أربعة أعمدة يشغل الباركود أقل مساحة أفقية، وهو مثالي للملصقات الضيقة. إذا كنت تحتاج إلى باركود أطول لكن أضيق، قلل عدد الأعمدة. + +### الخطوة 4: حفظ الباركود كصورة PNG + +أخيرًا، اكتب الباركود إلى ملف. PNG يحافظ على أبعاد البكسل التي قمت بضبطها. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +بعد تشغيل البرنامج، افتح `MicroPdf417.png` لرؤية النتيجة. يجب أن تعرض الصورة باركود Micro PDF417 واضحًا يرمز إلى النص التجريبي. + +#### النتيجة المتوقعة + +![باركود micro PDF417 تم إنشاؤه](/images/micro-pdf417-sample.png "إنشاء باركود micro PDF417 في C# – مخرجات المثال") + +يحتوي ملف PNG على باركود بـ: + +- بعد X قدره 2 px +- 4 أعمدة +- نص مشفر بـ UTF‑8 `"Åspóse.Barcóde©"` + +### اختياري: توليد باركود Micro PDF417 متوافق مع GS1 + +إذا كان تطبيقك يتطلب **باركود متوافق مع GS1** (لمعايير سلاسل الإمداد)، فعّل ترميز GS1 قبل الحفظ: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**شرح:** ضبط `IsGS1` يخبر Aspose.BarCode بإضافة رأس GS1 وتطبيق قواعد التحقق الصحيحة. هذا ضروري عندما يتم مسح الباركود بواسطة قارئات تدعم GS1. + +## مثال كامل قابل للتنفيذ + +فيما يلي تطبيق console كامل يمكنك نسخه، لصقه، وتشغيله. يتضمن جميع بيانات `using` اللازمة، معالجة الأخطاء، وتعليقات. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**تشغيل الكود:** +1. أنشئ مشروع console جديد لـ .NET (`dotnet new console`). +2. أضف حزمة Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. استبدل ملف `Program.cs` المُولد بالكود أعلاه. +4. عدّل مسار الإخراج إذا لزم الأمر وشغّله (`dotnet run`). + +ستظهر لك رسالة في وحدة التحكم تؤكد موقع الملف، وستحتوي صورة PNG على **باركود micro PDF417** الذي أنشأته للتو. + +## المشكلات الشائعة ونصائح الممارسات الأفضل + +- **معالجة Unicode:** Aspose.BarCode يرمز تلقائيًا أحرف UTF‑8، لكن تأكد من حفظ ملف المصدر بترميز UTF‑8 لتجنب تشويه الرموز. +- **حدود الأعمدة:** محاولة ضبط `Columns` إلى قيمة خارج النطاق 1‑4 ستؤدي إلى رمي `ArgumentException`. تحقق من صحة مدخلات المستخدم إذا عرضت هذا الإعداد في واجهة. +- **دقة الصورة:** PNG غير مضغوط، لكن إذا كنت تحتاج إلى تنسيق متجه عالي الدقة، استخدم `BarCodeImageFormat.Svg` بدلاً من ذلك. +- **طول بيانات GS1:** الباركود المتوافق مع GS1 لـ Micro PDF417 له حدود طول أكثر صرامة. تأكد من أن السلسلة المشفرة لا تتجاوز الحد الأقصى المسموح به وفقًا للمعيار (عادةً 90 حرفًا لـ Micro PDF417). + +## الخلاصة + +أصبحت الآن تعرف كيف **تنشئ باركود micro PDF417** في C# باستخدام Aspose.BarCode. غطى الشرح تهيئة **مولد الباركود**، ضبط **بعد X** بالبكسل، اختيار عدد الأعمدة، حفظ الصورة، وتفعيل ميزات **الباركود المتوافق مع GS1** اختياريًا. + +من هنا يمكنك تجربة نصوص مختلفة، تعديل بعد X لتناسب دقة الطباعة المختلفة، أو التحول إلى إخراج SVG للرسومات القابلة للتوسع. إذا احتجت لتوليد رموز ثنائية الأبعاد أخرى، استكشف `EncodeTypes.Pdf417`، `EncodeTypes.DataMatrix`، أو `EncodeTypes.QR`—نفس نمط التهيئة ينطبق. + +برمجة سعيدة! + +## ما الذي يجب أن تتعلمه بعد ذلك؟ + +الدروس التالية تغطي مواضيع ذات صلة وثيقة تبني على التقنيات التي تم توضيحها في هذا الدليل. كل مورد يتضمن أمثلة شفرة كاملة مع شروحات خطوة‑بخطوة لمساعدتك على إتقان ميزات API إضافية واستكشاف أساليب تنفيذ بديلة في مشاريعك. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/arabic/net/one-dimensional-barcode-types/_index.md index 704801638..4120599cf 100644 --- a/barcode/arabic/net/one-dimensional-barcode-types/_index.md +++ b/barcode/arabic/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ url: /ar/net/one-dimensional-barcode-types/ تعرف على كيفية التعامل مع الاستثناءات أثناء إنشاء رموز شريطية أحادية البعد باستخدام Aspose.BarCode لـ .NET. يضمن هذا الدليل التفصيلي حلول الباركود التي تتحمل الأخطاء. نبدأ الآن! ### [تكوين ذو نسبة واسعة وضيقة أحادية البعد](./one-dimensional-wide-narrow-ratio-configuration/) قم بإنشاء رموز شريطية مخصصة بسهولة باستخدام Aspose.BarCode لـ .NET. دليل خطوة بخطوة لتكوين نسبة واسعة وضيقة أحادية البعد. +### [قراءة الباركود من صورة في C# – دليل BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +تعلم كيفية قراءة الباركود من صورة باستخدام Aspose.BarCodeReader في C#. ## خاتمة @@ -89,4 +91,4 @@ url: /ar/net/one-dimensional-barcode-types/ {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/arabic/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/arabic/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..d48753212 --- /dev/null +++ b/barcode/arabic/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,258 @@ +--- +category: general +date: 2026-08-15 +description: قراءة الباركود من صورة في C# باستخدام BarCodeReader. تعلم كيفية قراءة + عدة باركودات في C#، قراءة باركود PDF417، وشاهد مثالًا كاملاً لـ BarCodeReader في + C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: ar +lastmod: 2026-08-15 +og_description: اقرأ الباركود من الصورة في C# مع دليل خطوة بخطوة. اكتشف كيفية قراءة + عدة باركودات في C#، فك تشفير رموز PDF417، وتشغيل مثال كامل لـ C# BarCodeReader. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: قراءة الباركود من صورة في C# – دليل BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: قراءة الباركود من صورة في C# – دليل BarCodeReader +url: /ar/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# قراءة الباركود من صورة في C# – دليل BarCodeReader + +إذا كنت بحاجة إلى **قراءة الباركود من صورة** في تطبيق .NET، يوضح لك هذا الدليل بالضبط كيفية القيام بذلك باستخدام الفئة `BarCodeReader`. ستتعرف أيضًا على كيفية **قراءة عدة باركودات C#**، فك تشفير رمز PDF417، والحصول على مثال كامل **C# BarCodeReader** يمكنك نسخه إلى مشروعك. + +يغطي الدرس كل خطوة—من إضافة حزمة NuGet المطلوبة إلى طباعة حقول PDF417 الموسعة—حتى تحصل على برنامج كونسول قابل للتنفيذ. لا تحتاج إلى وثائق خارجية؛ جميع الشيفرات والشروحات مضمّنة. + +## ما ستحتاجه + +قبل أن تبدأ، تأكد من توفر ما يلي: + +* .NET 6.0 SDK أو أحدث (الشيفرة تعمل مع .NET Core و .NET Framework) +* Visual Studio 2022 أو أي محرر يدعم C# +* حزمة NuGet `Aspose.BarCode` (أو المكتبة المكافئة التي توفر `BarCodeReader`) +* ملف صورة يحتوي على باركود Macro PDF417 (مثال: `ExtPDF417Meta.png`) + +وجود هذه المتطلبات يضمن أن العينة تُجمّع دون إعدادات إضافية. + +## قراءة الباركود من صورة باستخدام BarCodeReader + +الخطوة الأولى هي إنشاء كائن `BarCodeReader` يشير إلى ملف الصورة ويخبر المكتبة بنوع الباركود الذي يجب البحث عنه. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**لماذا يعمل هذا:** +`BarCodeReader` يفتح الصورة، يفحصها للعثور على `DecodeType` المحدد، ويعيد مجموعة من كائنات `BarCodeResult`. يحتوي كل نتيجة على بيانات الباركود العامة (`CodeTypeName`, `CodeText`) ولـ Macro PDF417، كائن `Extended.Pdf417` يُظهر جميع الحقول الإضافية المعرفة في المعيار. + +## قراءة عدة باركودات C# في صورة واحدة + +أحيانًا تحتوي الصورة على أكثر من باركود (مثال: رمز QR بجانب PDF417). للتعامل مع هذا السيناريو، ما عليك سوى حذف `DecodeType` الصريح أو تمرير `DecodeType.AllSupported` ثم التكرار عبر النتائج. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**لماذا تحتاج هذا:** +تحديد `AllSupported` يخبر المحرك بمحاولة كل صيغة باركود يعرفها، مما يضمن التقاط كل رمز في الصورة. هذا هو النهج الموصى به عندما لا يمكنك توقع أنواع الباركود مسبقًا. + +## كيفية قراءة باركود PDF417 باستخدام C# + +إذا كنت تهتم فقط بصيغة PDF417 الكلاسيكية (غير الماكرو)، غيّر `DecodeType` إلى `Pdf417`. يبقى باقي الشيفرة كما هو، باستثناء أن الحقول الموسعة غير متاحة. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**لماذا هذا مهم:** +PDF417 الكلاسيكي لا يُظهر الخصائص الخاصة بالماكرو، لذا لا حاجة لكتلة `Extended.Pdf417`. استخدام `DecodeType` الدقيق يسرّع عملية المسح لأن المكتبة تتخطى الخوارزميات غير المدعومة. + +## مثال كامل لـ C# BarCodeReader يمكنك نسخه + +فيما يلي البرنامج الكامل الذي يجمع السيناريوهات الثلاثة في تطبيق كونسول سهل التشغيل. استبدل `YOUR_DIRECTORY/ExtPDF417Meta.png` بالمسار الفعلي لصورتك. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### النتيجة المتوقعة + +عند احتواء صورة العينة على باركود Macro PDF417، يطبع الكونسول شيئًا مشابهًا لـ: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +إذا كانت الصورة تحتوي فقط على PDF417 عادي، سيكون قسم “Macro PDF417” فارغًا، وسيظهر قسم “Classic PDF417” النص المفكك. + +## الخلاصة + +أنت الآن تعرف كيف **تقرا الباركود من صورة** في C# باستخدام `BarCodeReader`، وكيف **تقرا عدة باركودات C#** في ملف واحد، والخطوات الدقيقة **لقراءة باركود PDF417**—كلا النسختين الماكرو والكلاسيكية. مثال **C# BarCodeReader** الكامل جاهز للنسخ إلى أي مشروع .NET، ويمكنك توسيعه للتعامل مع صيغ أخرى أو دمجه في خط معالجة صور أكبر. + +**الخطوات التالية** + +* استكشف أنماط معالجة الأخطاء مثل `try / catch` حول كتلة القارئ. +* جرّب كائن `ReaderParameters` لضبط سرعة ودقة الكشف. +* اجمع قراءة الباركود مع مكتبات ما قبل معالجة الصور ( + + +## ماذا يجب أن تتعلم بعد ذلك؟ + +الدروس التالية تغطي مواضيع ذات صلة وثيقة تبني على التقنيات الموضحة في هذا الدليل. كل مصدر يتضمن أمثلة شيفرة كاملة مع شروحات خطوة بخطوة لمساعدتك على إتقان ميزات API إضافية واستكشاف أساليب تنفيذ بديلة في مشاريعك. + +- [How to Read DataMatrix Barcodes with Aspose.BarCode for .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Read DataMatrix barcode C# – Generate DataMatrix Mode (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Read Barcode from Image – Mastering Barcode Region Extraction in Java with Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/chinese/net/compact-pdf417-encoding/_index.md index 165dd64a9..3b828580a 100644 --- a/barcode/chinese/net/compact-pdf417-encoding/_index.md +++ b/barcode/chinese/net/compact-pdf417-encoding/_index.md @@ -85,7 +85,7 @@ Aspose.BarCode 允许您设置 `Pdf417ErrorCorrectionLevel` 属性(0‑8)。 ### [创建紧凑 PDF417 条形码](./compact-pdf417-basic-configuration/) -了解如何使用 Aspose.BarCode for .NET 生成紧凑 PDF417 条形码。提供完整的分步指南和代码示例。 +### [在 C# 中创建微型 PDF417 条形码 – 步骤指南](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) ## 常见问题 @@ -115,4 +115,4 @@ Aspose.BarCode 允许您设置 `Pdf417ErrorCorrectionLevel` 属性(0‑8)。 {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/chinese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/chinese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..5be3145c4 --- /dev/null +++ b/barcode/chinese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,244 @@ +--- +category: general +date: 2026-08-15 +description: 使用 Aspose.BarCode 在 C# 中快速创建微型 PDF417 条码。了解如何使用条码生成器、设置 X 维度、选择列数以及启用 + GS1 合规。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: zh +lastmod: 2026-08-15 +og_description: 使用 Aspose.BarCode 在 C# 中创建微型 PDF417 条码。按照本教程配置条码生成器、设置尺寸并生成 PNG 图像。 +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: 在 C# 中创建微型 PDF417 条码 – 完整编程指南 +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: 在 C# 中创建微型 PDF417 条码 – 步骤指南 +url: /zh/net/compact-pdf417-encoding/create-micro-pdf417-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# 中创建微型 PDF417 条码 – 步骤指南 + +如果您需要在 C# 中**创建微型 PDF417 条码**,本指南将手把手教您完成。我们将演示如何初始化**条码生成器**、配置**X 维度**、选择列数,并将结果保存为 PNG 文件。 + +生成微型 PDF417 条码可用于在小标签、票据或物联网设备上进行紧凑的数据编码。阅读完本教程后,您将拥有一个完整、可运行的示例,能够直接放入任何 .NET 项目中。 + +## 所需环境 + +在开始之前,请确保您具备以下条件: + +- 已安装 .NET 6.0(或更高版本)——代码同样适用于 .NET Framework 4.6 及以上。 +- Aspose.BarCode for .NET 库(可通过 NuGet `Aspose.BarCode` 获取)。 +- 开发环境,如 Visual Studio 2022 或 VS Code。 + +无需额外的外部服务;所有操作均在本地完成。 + +## 使用 Aspose.BarCode 创建微型 PDF417 条码 + +整个过程的核心是一个能够编码微型 PDF417 数据的**条码生成器**对象。下面的章节将逐步拆解每一个配置步骤。 + +### 步骤 1:初始化条码生成器 + +首先,引入所需的命名空间,并使用 `EncodeTypes.MicroPdf417` 枚举创建 `BarcodeGenerator` 实例。第二个参数是您想要编码的文本。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**为什么重要:** `BarcodeGenerator` 类封装了所有编码逻辑。选择 `EncodeTypes.MicroPdf417` 会让库使用紧凑的微型 PDF417 符号集,该符号集仅支持 1‑4 列。 + +### 步骤 2:配置 X 维度(模块宽度) + +**X 维度**决定单个条码模块的像素宽度。数值越小,条码越紧凑;数值越大,则在低分辨率打印机上更易读取。 + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**提示:** 对于大多数屏幕显示,1 到 4 之间的值效果良好。如果要在热敏打印机上打印,建议使用 3‑4 像素,以避免模糊。 + +### 步骤 3:设置列数 + +微型 PDF417 支持 1‑4 列。列数越多,条码越短,但高度会增加。 + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**为什么选择 4 列?** 四列时条码占用的水平空间最小,适合窄标签。如果需要更高但更窄的条码,可降低列数。 + +### 步骤 4:将条码保存为 PNG 图像 + +最后,将条码写入文件。PNG 能保留您配置的精确像素尺寸。 + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +运行程序后,打开 `MicroPdf417.png` 即可看到结果。图像应显示一个清晰的微型 PDF417 条码,编码了示例文本。 + +#### 预期输出 + +![已创建的微型 PDF417 条码](/images/micro-pdf417-sample.png "在 C# 中创建微型 PDF417 条码 – 示例输出") + +该 PNG 文件包含的条码特性: + +- X 维度为 2 像素 +- 4 列 +- UTF‑8 编码文本 `"Åspóse.Barcóde©"` + +### 可选:生成符合 GS1 标准的微型 PDF417 + +如果您的应用需要**符合 GS1 标准的条码**(用于供应链),请在保存前启用 GS1 编码: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**说明:** 设置 `IsGS1` 会让 Aspose.BarCode 在前面添加 GS1 标头并应用正确的校验规则。这在条码将被支持 GS1 的读取器扫描时至关重要。 + +## 完整、可运行的示例 + +下面是一段完整的控制台应用程序代码,您可以直接复制、粘贴并运行。代码已包含所有必要的 `using` 语句、错误处理以及注释。 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**运行代码步骤:** +1. 创建一个新的 .NET 控制台项目(`dotnet new console`)。 +2. 添加 Aspose.BarCode 包(`dotnet add package Aspose.BarCode`)。 +3. 用上述代码替换生成的 `Program.cs`。 +4. 如有需要,调整输出路径,然后运行(`dotnet run`)。 + +您将看到控制台输出确认文件位置,PNG 文件中即包含您刚创建的**微型 PDF417 条码**。 + +## 常见问题与最佳实践提示 + +- **Unicode 处理:** Aspose.BarCode 会自动对 UTF‑8 字符进行编码,但请确保源文件保存为 UTF‑8 编码,以免出现字符损坏。 +- **列数限制:** 将 `Columns` 设置为 1‑4 之外的值会抛出 `ArgumentException`。如果在 UI 中暴露此设置,请对用户输入进行校验。 +- **图像分辨率:** PNG 为无损格式,但若需要更高分辨率的矢量图,请使用 `BarCodeImageFormat.Svg`。 +- **GS1 数据长度:** 符合 GS1 标准的微型 PDF417 对长度限制更严格。请确认编码字符串未超过标准允许的最大长度(通常为 90 个字符)。 + +## 结论 + +现在,您已经掌握了在 C# 中使用 Aspose.BarCode **创建微型 PDF417 条码**的全部步骤。教程涵盖了初始化**条码生成器**、设置**X 维度像素**、选择列数、保存图像,以及可选的**GS1 合规**功能。 + +接下来,您可以尝试不同的文本输入、为不同的打印分辨率调整 X 维度,或改用 SVG 输出以获得可伸缩的图形。如果需要生成其他二维条码,请探索 `EncodeTypes.Pdf417`、`EncodeTypes.DataMatrix` 或 `EncodeTypes.QR`——配置模式相同。 + +祝编码愉快! + + +## 接下来您可以学习什么? + +以下教程涵盖了与本指南技术紧密相关的主题,帮助您进一步掌握 API 功能并在项目中尝试不同的实现方式。 + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/chinese/net/one-dimensional-barcode-types/_index.md index 78607b4f1..4f27414b0 100644 --- a/barcode/chinese/net/one-dimensional-barcode-types/_index.md +++ b/barcode/chinese/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ url: /zh/net/one-dimensional-barcode-types/ 了解如何使用 Aspose.BarCode for .NET 生成一维条形码时处理异常。本分步指南可确保条码解决方案具有容错性。现在就开始! ### [一维宽窄比配置](./one-dimensional-wide-narrow-ratio-configuration/) 使用 Aspose.BarCode for .NET 轻松生成自定义条形码。一维宽窄比配置的分步指南。 +### [在 C# 中从图像读取条形码 – BarCodeReader 教程](./read-barcode-from-image-in-c-barcodereader-tutorial/) +了解如何使用 Aspose.BarCode 在 C# 中从图像读取条形码。分步指南帮助您快速实现读取功能。 ## 结论 @@ -89,4 +91,4 @@ url: /zh/net/one-dimensional-barcode-types/ {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/chinese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/chinese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..f0381ee58 --- /dev/null +++ b/barcode/chinese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,257 @@ +--- +category: general +date: 2026-08-15 +description: 使用 BarCodeReader 在 C# 中读取图像中的条形码。了解如何在 C# 中读取多个条形码、读取 PDF417 条形码,并查看完整的 + C# BarCodeReader 示例。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: zh +lastmod: 2026-08-15 +og_description: 使用分步指南在 C# 中从图像读取条形码。了解如何在 C# 中读取多个条形码、解码 PDF417 符号,并运行完整的 C# BarCodeReader + 示例。 +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: 在 C# 中从图像读取条形码 – BarCodeReader 教程 +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: 在 C# 中从图像读取条形码 – BarCodeReader 教程 +url: /zh/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 在 C# 中从图像读取条码 – BarCodeReader 教程 + +如果您需要在 .NET 应用程序中 **从图像读取条码**,本指南将向您展示如何使用 `BarCodeReader` 类完成此操作。您还将了解如何 **在 C# 中读取多个条码**、解码 PDF417 符号,以及获取一个完整的 **C# BarCodeReader 示例**,可以直接复制到您的项目中。 + +本教程涵盖每一步——从添加所需的 NuGet 包到打印扩展的 PDF417 字段——让您最终得到一个可运行的控制台程序。无需查阅外部文档,所有代码和说明均已包含。 + +## 您需要的准备 + +在开始之前,请确保您具备以下条件: + +* .NET 6.0 SDK 或更高版本(代码同样适用于 .NET Core 和 .NET Framework) +* Visual Studio 2022 或任意支持 C# 的编辑器 +* `Aspose.BarCode` NuGet 包(或提供 `BarCodeReader` 的等效库) +* 包含 Macro PDF417 条码的图像文件(例如 `ExtPDF417Meta.png`) + +拥有这些前置条件可确保示例能够在无需额外配置的情况下编译通过。 + +## 使用 BarCodeReader 从图像读取条码 + +第一步是创建一个指向图像文件的 `BarCodeReader` 实例,并告知库要查找的条码类型。 + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**工作原理说明:** +`BarCodeReader` 会打开图像,扫描指定的 `DecodeType`,并返回一个 `BarCodeResult` 对象集合。每个结果都包含通用的条码数据(`CodeTypeName`、`CodeText`),对于 Macro PDF417,还会提供一个 `Extended.Pdf417` 对象,公开标准定义的所有额外字段。 + +## 在单张图像中读取多个条码(C#) + +有时图像中会包含多个条码(例如 QR 码旁边还有 PDF417)。要处理这种情况,只需省略显式的 `DecodeType`,或传入 `DecodeType.AllSupported`,然后遍历结果即可。 + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**为何需要这样做:** +指定 `AllSupported` 会让引擎尝试它已知的所有条码格式,从而保证捕获图像中的每一个符号。这是在无法预先确定条码类型时的推荐做法。 + +## 使用 C# 读取 PDF417 条码 + +如果您只关心经典的 PDF417(非宏)格式,只需将 `DecodeType` 改为 `Pdf417`。其余代码保持不变,只是没有扩展字段可用。 + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**意义所在:** +经典 PDF417 不会暴露宏特有的属性,因此 `Extended.Pdf417` 块是多余的。使用精确的 `DecodeType` 还能加快扫描速度,因为库会跳过不支持的算法。 + +## 完整的 C# BarCodeReader 示例(可直接复制) + +下面是将上述三种场景合并到一个易于运行的控制台应用程序中的完整代码。请将 `YOUR_DIRECTORY/ExtPDF417Meta.png` 替换为实际的图像路径。 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### 预期输出 + +当示例图像包含 Macro PDF417 条码时,控制台会打印类似以下内容: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +如果图像仅包含普通 PDF417,则 “Macro PDF417” 部分将为空,而 “Classic PDF417” 部分会显示解码后的文本。 + +## 结论 + +现在您已经掌握了如何在 C# 中使用 `BarCodeReader` **从图像读取条码**,以及如何在单个文件中 **读取多个条码 C#**,并了解了 **读取 PDF417 条码** 的完整步骤——包括宏和经典两种变体。完整的 **C# BarCodeReader 示例** 已准备好粘贴到任何 .NET 项目中,您还可以进一步扩展以支持其他格式或将其集成到更大的图像处理流水线中。 + +**后续步骤** + +* 探索在读取器代码块周围使用 `try / catch` 的错误处理模式。 +* 尝试使用 `ReaderParameters` 对象来调节检测速度和准确度。 +* 将条码读取与图像预处理库结合使用( + + +## 接下来您应该学习什么? + +以下教程涵盖与本指南技术紧密相关的主题,帮助您在已有技巧的基础上进一步提升。每篇资源都提供完整的可运行代码示例,并配有逐步解释,帮助您掌握更多 API 功能并在自己的项目中探索替代实现方案。 + +- [How to Read DataMatrix Barcodes with Aspose.BarCode for .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Read DataMatrix barcode C# – Generate DataMatrix Mode (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Read Barcode from Image – Mastering Barcode Region Extraction in Java with Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/czech/net/compact-pdf417-encoding/_index.md index 29de108a1..a79f78196 100644 --- a/barcode/czech/net/compact-pdf417-encoding/_index.md +++ b/barcode/czech/net/compact-pdf417-encoding/_index.md @@ -86,6 +86,9 @@ Mimo základy, zde jsou některé praktické tipy pro zefektivnění vašeho pra ### [Vytváření Compact PDF417 čárových kódů](./compact-pdf417-basic-configuration/) Naučte se generovat Compact PDF417 čárové kódy pomocí Aspose.BarCode pro .NET. Kompletní průvodce s krok‑za‑krokem instrukcemi a ukázkami kódu. +### [Vytvoření mikro PDF417 čárového kódu v C# – krok‑za‑krokem](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Naučte se vytvořit mikro PDF417 čárový kód v C# pomocí Aspose.BarCode s podrobným návodem. + ## Často kladené otázky **Q:** Jaké je maximální množství dat, která mohu uložit do Compact PDF417 čárového kódu? @@ -114,4 +117,4 @@ Naučte se generovat Compact PDF417 čárové kódy pomocí Aspose.BarCode pro . {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/czech/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/czech/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..708aa0947 --- /dev/null +++ b/barcode/czech/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,244 @@ +--- +category: general +date: 2026-08-15 +description: Vytvořte mikro PDF417 čárový kód v C# rychle pomocí Aspose.BarCode. Naučte + se, jak používat generátor čárových kódů, nastavit X‑dimenzi, vybrat sloupce a povolit + soulad s GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: cs +lastmod: 2026-08-15 +og_description: Vytvořte mikro PDF417 čárový kód v C# pomocí Aspose.BarCode. Postupujte + podle tohoto tutoriálu, abyste nakonfigurovali generátor čárových kódů, nastavili + rozměry a vytvořili PNG obrázek. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Vytvořte mikro PDF417 čárový kód v C# – kompletní programovací průvodce +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Vytvořte mikro PDF417 čárový kód v C# – průvodce krok po kroku +url: /cs/net/compact-pdf417-encoding/create-micro-pdf417-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řte mikro PDF417 čárový kód v C# – krok za krokem + +Pokud potřebujete **vytvořit mikro PDF417 čárový kód** v C#, tento návod vám přesně ukáže, jak na to. Provedeme vás inicializací **generátoru čárových kódů**, nastavením **X‑dimenze**, výběrem počtu sloupců a uložením výsledku jako PNG souboru. + +Generování mikro PDF417 čárového kódu je užitečné pro kompaktní kódování dat na malých štítcích, vstupenkách nebo IoT zařízeních. Na konci tohoto tutoriálu budete mít kompletní, spustitelný příklad, který můžete vložit do libovolného .NET projektu. + +## Co budete potřebovat + +- .NET 6.0 (nebo novější) nainstalovaný – kód funguje také s .NET Framework 4.6+. +- Knihovna Aspose.BarCode pro .NET (k dispozici přes NuGet `Aspose.BarCode`). +- Vývojové prostředí jako Visual Studio 2022 nebo VS Code. + +Žádné další externí služby nejsou vyžadovány; vše běží lokálně. + +## Jak vytvořit mikro PDF417 čárový kód pomocí Aspose.BarCode + +Jádrem procesu je objekt **barcode generator**, který umí kódovat data Micro PDF417. Následující sekce rozebírají každý konfigurační krok. + +### Krok 1: Inicializace generátoru čárových kódů + +Nejprve importujte požadované jmenné prostory a vytvořte instanci `BarcodeGenerator` s výčtem `EncodeTypes.MicroPdf417`. Druhý argument je text, který chcete zakódovat. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Proč je to důležité:** Třída `BarcodeGenerator` zapouzdřuje veškerou logiku kódování. Výběrem `EncodeTypes.MicroPdf417` řeknete knihovně, aby použila kompaktní symbologii Micro PDF417, která je omezena na 1‑4 sloupce. + +### Krok 2: Nastavení X‑dimenze (šířka modulu) + +**X‑dimenze** určuje šířku jednoho modulu čárového kódu v pixelech. Menší hodnota vytváří kompaktnější kód, zatímco větší hodnota zlepšuje čitelnost na tiskárnách s nízkým rozlišením. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Tip:** Hodnoty mezi 1 a 4 fungují dobře pro většinu displejů. Pokud plánujete tisk na termální tiskárně, vyzkoušejte 3–4 pixely, abyste předešli rozmazání. + +### Krok 3: Nastavení počtu sloupců + +Micro PDF417 podporuje 1‑4 sloupce. Více sloupců zkracuje čárový kód, ale zvyšuje jeho výšku. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Proč zvolit 4 sloupce?** Se čtyřmi sloupci zabírá čárový kód nejmenší vodorovný prostor, což je ideální pro úzké štítky. Pokud potřebujete vyšší, ale užší čárový kód, snižte počet sloupců. + +### Krok 4: Uložení čárového kódu jako PNG obrázek + +Nakonec zapište čárový kód do souboru. PNG zachovává přesné pixelové rozměry, které jste nastavili. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Po spuštění programu otevřete `MicroPdf417.png`, abyste viděli výsledek. Obrázek by měl zobrazovat ostrý Micro PDF417 čárový kód, který kóduje ukázkový text. + +#### Očekávaný výstup + +![Created micro PDF417 barcode](/images/micro-pdf417-sample.png "Create micro PDF417 barcode in C# – example output") + +PNG soubor obsahuje čárový kód s: + +- X‑dimenzí 2 px +- 4 sloupci +- UTF‑8 kódovaným textem `"Åspóse.Barcóde©"` + +### Volitelné: generování GS1‑kompatibilního Micro PDF417 + +Pokud vaše aplikace vyžaduje data **GS1‑kompatibilního čárového kódu** (pro standardy dodavatelského řetězce), povolte GS1 kódování před uložením: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Vysvětlení:** Nastavení `IsGS1` říká Aspose.BarCode, aby předřadilo GS1 hlavičku a použilo správná pravidla kontrolního součtu. To je nezbytné, když bude váš čárový kód skenován čtečkami podporujícími GS1. + +## Kompletní, spustitelný příklad + +Níže je kompletní konzolová aplikace, kterou můžete zkopírovat, vložit a spustit. Obsahuje všechny potřebné `using` příkazy, ošetření chyb a komentáře. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Spuštění kódu:** +1. Vytvořte nový .NET konzolový projekt (`dotnet new console`). +2. Přidejte balíček Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. Nahraďte vygenerovaný soubor `Program.cs` výše uvedeným kódem. +4. Upravte výstupní cestu podle potřeby a spusťte (`dotnet run`). + +Měli byste vidět zprávu v konzoli potvrzující umístění souboru a PNG bude obsahovat **mikro PDF417 čárový kód**, který jste právě vytvořili. + +## Časté úskalí a tipy pro nejlepší postupy + +- **Zpracování Unicode:** Aspose.BarCode automaticky kóduje UTF‑8 znaky, ale ujistěte se, že váš zdrojový soubor je uložen v kódování UTF‑8, aby nedošlo k poškození symbolů. +- **Limity sloupců:** Pokus o nastavení `Columns` na hodnotu mimo 1‑4 vyvolá `ArgumentException`. Ověřte vstup uživatele, pokud tuto volbu zpřístupníte v UI. +- **Rozlišení obrázku:** PNG je bezztrátový, ale pokud potřebujete vyšší rozlišení ve vektorovém formátu, použijte místo toho `BarCodeImageFormat.Svg`. +- **Délka GS1 dat:** GS1‑kompatibilní Micro PDF417 má přísnější limity délky. Ověřte, že kódovaný řetězec nepřekračuje maximální povolenou délku podle standardu (typicky 90 znaků pro Micro PDF417). + +## Závěr + +Nyní víte, jak **vytvořit mikro PDF417 čárový kód** v C# pomocí Aspose.BarCode. Tutoriál pokryl inicializaci **generátoru čárových kódů**, nastavení **pixelů X‑dimenze**, výběr počtu sloupců, uložení obrázku a volitelné povolení funkcí **GS1‑kompatibilního čárového kódu**. + +Odtud můžete experimentovat s různými vstupními texty, upravit X‑dimenzi pro různé rozlišení tisku nebo přejít na SVG výstup pro škálovatelnou grafiku. Pokud potřebujete generovat jiné 2‑D symbologie, prozkoumejte `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` nebo `EncodeTypes.QR` – stejný konfigurační vzor platí. + +Šťastné kódová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 návodu. Každý zdroj obsahuje kompletní funkční příklady kódu s podrobnými vysvětleními, které vám pomohou zvládnout další funkce API a prozkoumat alternativní přístupy k implementaci ve vašich projektech. + +- [Jak vytvořit čárový kód – Kompaktní PDF417 s Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Vytvořit obrázek DotCode čárového kódu – řádky a sloupce (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Jak vytvořit tichou zónu čárového kódu pro ITF-14 pomocí Aspose.BarCode pro .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/czech/net/one-dimensional-barcode-types/_index.md index 7d07268a4..3405d51f5 100644 --- a/barcode/czech/net/one-dimensional-barcode-types/_index.md +++ b/barcode/czech/net/one-dimensional-barcode-types/_index.md @@ -78,10 +78,12 @@ vydělávejte, jak generovat čárové kódy v .NET s Aspose.BarCode pro .NET. T Naučte se, jak zacházet s výjimkami při generování jednorozměrných čárových kódů pomocí Aspose.BarCode for .NET. Tento průvodce krok za krokem zajišťuje řešení čárových kódů odolné proti chybám. Začněte hned! ### [Konfigurace jednorozměrného širokoúhlého poměru](./one-dimensional-wide-narrow-ratio-configuration/) Snadno generujte přizpůsobené čárové kódy pomocí Aspose.BarCode pro .NET. Průvodce krok za krokem pro jednorozměrnou konfiguraci širokého a úzkého poměru. +### [Čtení čárového kódu z obrázku v C# – tutoriál BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Naučte se, jak pomocí Aspose.BarCode v .NET načíst čárový kód z obrázku pomocí třídy BarCodeReader. ## Závěr -V této sérii výukových programů jsme se ponořili do světa jednorozměrných typů čárových kódů a zaměřili jsme se na jejich konfiguraci a přizpůsobení. S Aspose.BarCode for .NET je tento proces jednoduchý a zajišťuje, že můžete vytvářet čárové kódy přizpůsobené vašim potřebám. Takže, ať už jste zkušený vývojář nebo teprve začínáte, tyto výukové programy vám umožní využít sílu jednorozměrných čárových kódů ve vašich projektech .NET. Začněte hned a uvolněte potenciál technologie čárových kódů! +V této sérii výukových programů jsme se ponořili do světa jednorozměrných typů čárových kódů a zaměřili se na jejich konfiguraci a přizpůsobení. S Aspose.BarCode for .NET je tento proces jednoduchý a zajišťuje, že můžete vytvářet čárové kódy přizpůsobené vašim potřebám. Takže, ať už jste zkušený vývojář nebo teprve začínáte, tyto výukové programy vám umožní využít sílu jednorozměrných čárových kódů ve vašich projektech .NET. Začněte hned a uvolněte potenciál technologie čárových kódů! tímto článkem získáte nejen znalosti o různých typech jednorozměrných čárových kódů, ale také sebevědomí je implementovat do svých projektů. Šťastné kódování! {{< /blocks/products/pf/tutorial-page-section >}} @@ -89,4 +91,4 @@ tímto článkem získáte nejen znalosti o různých typech jednorozměrných {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/czech/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/czech/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..b3d6cfe50 --- /dev/null +++ b/barcode/czech/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,258 @@ +--- +category: general +date: 2026-08-15 +description: Čtěte čárový kód z obrázku v C# pomocí BarCodeReader. Naučte se, jak + číst více čárových kódů v C#, číst čárový kód PDF417 a podívejte se na kompletní + příklad BarCodeReader v C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: cs +lastmod: 2026-08-15 +og_description: Čtěte čárový kód z obrázku v C# pomocí krok‑za‑krokem průvodce. Objevte, + jak číst více čárových kódů v C#, dekódovat symboly PDF417 a spustit kompletní příklad + C# BarCodeReader. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Načíst čárový kód z obrázku v C# – BarCodeReader tutoriál +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Čtení čárového kódu z obrázku v C# – tutoriál BarCodeReader +url: /cs/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Načíst čárový kód z obrázku v C# – BarCodeReader tutoriál + +Pokud potřebujete **číst čárový kód z obrázku** v .NET aplikaci, tento průvodce vám přesně ukáže, jak to provést pomocí třídy `BarCodeReader`. Také uvidíte, jak **číst více čárových kódů v C#**, dekódovat symbol PDF417 a získat kompletní **C# BarCodeReader příklad**, který můžete zkopírovat do svého projektu. + +Tutoriál pokrývá každý krok — od přidání požadovaného NuGet balíčku až po výpis rozšířených PDF417 polí — takže skončíte s funkční konzolovou aplikací. Není potřeba žádná externí dokumentace; veškerý kód a vysvětlení jsou zahrnuty. + +## Co budete potřebovat + +Než začnete, ujistěte se, že máte: + +* .NET 6.0 SDK nebo novější (kód funguje s .NET Core i .NET Framework) +* Visual Studio 2022 nebo jakýkoli editor kompatibilní s C# +* Balíček NuGet `Aspose.BarCode` (nebo ekvivalentní knihovna, která poskytuje `BarCodeReader`) +* Obrázkový soubor, který obsahuje čárový kód Macro PDF417 (např. `ExtPDF417Meta.png`) + +Mít tyto předpoklady zajišťuje, že ukázka se zkompiluje bez další konfigurace. + +## Načíst čárový kód z obrázku pomocí BarCodeReader + +Prvním krokem je vytvořit instanci `BarCodeReader`, která ukazuje na soubor s obrázkem a říká knihovně, jaký typ čárového kódu má hledat. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Proč to funguje:** +`BarCodeReader` otevře obrázek, prohledá jej podle zadaného `DecodeType` a vrátí kolekci objektů `BarCodeResult`. Každý výsledek obsahuje obecná data čárového kódu (`CodeTypeName`, `CodeText`) a pro Macro PDF417 objekt `Extended.Pdf417`, který vystavuje všechna dodatečná pole definovaná standardem. + +## Číst více čárových kódů v C# na jednom obrázku + +Někdy obrázek obsahuje více než jeden čárový kód (např. QR kód vedle PDF417). Pro tento scénář stačí vynechat explicitní `DecodeType` nebo předat `DecodeType.AllSupported` a projít výsledky ve smyčce. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Proč to potřebujete:** +Zadání `AllSupported` říká enginu, aby vyzkoušel každý formát čárového kódu, který zná, což zaručuje zachycení všech symbolů na obrázku. Toto je doporučený přístup, když předem nevíte, jaké typy čárových kódů se mohou objevit. + +## Jak číst PDF417 čárový kód pomocí C# + +Pokud vás zajímá jen klasický PDF417 (ne‑macro) formát, změňte `DecodeType` na `Pdf417`. Zbytek kódu zůstane stejný, jen rozšířená pole nebudou k dispozici. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Proč na tom záleží:** +Klasický PDF417 neexponuje makro‑specifické vlastnosti, takže blok `Extended.Pdf417` není potřeba. Použití přesného `DecodeType` také urychluje skenování, protože knihovna přeskočí nepodporované algoritmy. + +## Kompletní C# BarCodeReader příklad, který můžete zkopírovat + +Níže je kompletní program, který spojuje všechny tři scénáře do jedné snadno spustitelné konzolové aplikace. Nahraďte `YOUR_DIRECTORY/ExtPDF417Meta.png` skutečnou cestou k vašemu obrázku. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Očekávaný výstup + +Když ukázkový obrázek obsahuje Macro PDF417 čárový kód, konzole vypíše něco podobného: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Pokud obrázek obsahuje jen běžný PDF417, sekce „Macro PDF417“ bude prázdná a sekce „Classic PDF417“ zobrazí dekódovaný text. + +## Závěr + +Nyní už víte, jak **číst čárový kód z obrázku** v C# pomocí `BarCodeReader`, jak **číst více čárových kódů v C#** v jednom souboru a jaké jsou přesné kroky k **čtení PDF417 čárového kódu** — včetně makro i klasické varianty. Kompletní **C# BarCodeReader příklad** je připraven k vložení do jakéhokoli .NET projektu a můžete jej rozšířit o další formáty nebo integrovat do většího pipeline pro zpracování obrázků. + +**Další kroky** + +* Prozkoumejte vzory pro zpracování chyb, jako je `try / catch` kolem bloku čtečky. +* Experimentujte s objektem `ReaderParameters` pro ladění rychlosti a přesnosti detekce. +* Kombinujte čtení čárových kódů s knihovnami pro předzpracování obrázků ( + +## 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 k implementaci ve vlastních projektech. + +- [Jak číst DataMatrix čárové kódy pomocí Aspose.BarCode pro .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Číst DataMatrix čárový kód v C# – Generovat DataMatrix režim (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Číst čárový kód z obrázku – Mistrovství extrakce oblasti čárového kódu v Javě s Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/dutch/net/compact-pdf417-encoding/_index.md index 64f0fba6f..f7064bcd4 100644 --- a/barcode/dutch/net/compact-pdf417-encoding/_index.md +++ b/barcode/dutch/net/compact-pdf417-encoding/_index.md @@ -84,6 +84,10 @@ Voorbij de basis, hier zijn enkele praktische tips om je workflow te stroomlijne Leer hoe je Compact PDF417 barcodes genereert met Aspose.BarCode voor .NET. Uitgebreide gids met stap‑voor‑stap instructies en code‑voorbeelden. +### [Micro PDF417 barcode maken in C# – stapsgewijze handleiding](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) + +Leer hoe je een micro PDF417 barcode genereert in C# met Aspose.BarCode, inclusief configuratie en voorbeeldcode. + ## Veelgestelde Vragen **V: Wat is de maximale hoeveelheid data die ik kan opslaan in een Compact PDF417 barcode?** @@ -112,4 +116,4 @@ A: Geen externe lettertypen zijn nodig; de bibliotheek verwerkt alle rendering i {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/dutch/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/dutch/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..738327ce0 --- /dev/null +++ b/barcode/dutch/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,246 @@ +--- +category: general +date: 2026-08-15 +description: Maak snel een micro‑PDF417‑barcode in C# met Aspose.BarCode. Leer hoe + u de barcodegenerator gebruikt, de X‑dimensie instelt, kolommen kiest en GS1‑conformiteit + inschakelt. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: nl +lastmod: 2026-08-15 +og_description: Maak een micro PDF417-barcode in C# met Aspose.BarCode. Volg deze + tutorial om de barcodegenerator te configureren, afmetingen in te stellen en een + PNG-afbeelding te maken. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Maak een micro PDF417-barcode in C# – volledige programmeergids +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Micro‑PDF417‑barcode maken in C# – stapsgewijze handleiding +url: /nl/net/compact-pdf417-encoding/create-micro-pdf417-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 micro PDF417 barcode in C# – stapsgewijze handleiding + +Als je een **micro PDF417 barcode** wilt **maken** in C#, laat deze gids je precies zien hoe. We lopen door het initialiseren van een **barcode‑generator**, het configureren van de **X‑dimensie**, het kiezen van het aantal kolommen en het opslaan van het resultaat als een PNG‑bestand. + +Het genereren van een Micro PDF417 barcode is handig voor compacte gegevenscodering op kleine etiketten, tickets of IoT‑apparaten. Aan het einde van deze tutorial heb je een volledig, uitvoerbaar voorbeeld dat je in elk .NET‑project kunt gebruiken. + +## Wat je nodig hebt + +Voordat je begint, zorg dat je het volgende hebt: + +- .NET 6.0 (of later) geïnstalleerd – de code werkt ook met .NET Framework 4.6+. +- De Aspose.BarCode for .NET‑bibliotheek (beschikbaar via NuGet `Aspose.BarCode`). +- Een ontwikkelomgeving zoals Visual Studio 2022 of VS Code. + +Er zijn geen extra externe services nodig; alles draait lokaal. + +## Hoe maak je een micro PDF417 barcode met Aspose.BarCode + +De kern van het proces is een **barcode‑generator**‑object dat Micro PDF417‑gegevens kan coderen. De volgende secties splitsen elke configuratiestap uit. + +### Stap 1: Initialise­er de barcode‑generator + +Importeer eerst de benodigde namespaces en maak een instantie van `BarcodeGenerator` met de enum `EncodeTypes.MicroPdf417`. Het tweede argument is de tekst die je wilt coderen. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Waarom dit belangrijk is:** De `BarcodeGenerator`‑klasse omvat alle coderingslogica. Door `EncodeTypes.MicroPdf417` te selecteren, vertel je de bibliotheek de compacte Micro PDF417‑symbologie te gebruiken, die beperkt is tot 1‑4 kolommen. + +### Stap 2: Configureer de X‑dimensie (module‑breedte) + +De **X‑dimensie** bepaalt de breedte van één barcode‑module in pixels. Een kleinere waarde levert een compactere barcode op, terwijl een grotere waarde de leesbaarheid op laag‑resolutieprinters verbetert. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Tip:** Waarden tussen 1 en 4 werken goed voor de meeste schermen. Als je op een thermische printer wilt afdrukken, test dan met 3‑4 pixels om vervaging te voorkomen. + +### Stap 3: Stel het aantal kolommen in + +Micro PDF417 ondersteunt 1‑4 kolommen. Meer kolommen maken de barcode korter, maar verhogen de hoogte. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Waarom kiezen voor 4 kolommen?** Met vier kolommen neemt de barcode de minste horizontale ruimte in, wat ideaal is voor smalle etiketten. Als je een hogere maar smallere barcode nodig hebt, verlaag dan het aantal kolommen. + +### Stap 4: Sla de barcode op als PNG‑afbeelding + +Schrijf tenslotte de barcode naar een bestand. PNG behoudt de exacte pixelafmetingen die je hebt ingesteld. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Na het uitvoeren van het programma, open `MicroPdf417.png` om het resultaat te bekijken. De afbeelding moet een scherpe Micro PDF417 barcode tonen die de voorbeeldtekst codeert. + +#### Verwachte output + +![Aangemaakt micro PDF417 barcode](/images/micro-pdf417-sample.png "Maak micro PDF417 barcode in C# – voorbeeldoutput") + +Het PNG‑bestand bevat een barcode met: + +- X‑dimensie van 2 px +- 4 kolommen +- UTF‑8‑gecodeerde tekst `"Åspóse.Barcóde©"` + +### Optioneel: genereer een GS1‑compatibele Micro PDF417 + +Als je applicatie **GS1‑compatibele barcode**‑gegevens vereist (voor supply‑chain‑normen), schakel dan GS1‑codering in vóór het opslaan: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Uitleg:** Het instellen van `IsGS1` vertelt Aspose.BarCode om de GS1‑header toe te voegen en de juiste controle‑somregels toe te passen. Dit is essentieel wanneer je barcode wordt gescand door GS1‑bewuste lezers. + +## Volledig, uitvoerbaar voorbeeld + +Hieronder vind je een complete console‑applicatie die je kunt kopiëren, plakken en uitvoeren. Het bevat alle benodigde `using`‑statements, foutafhandeling en commentaar. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Het uitvoeren van de code:** +1. Maak een nieuw .NET‑consoleproject (`dotnet new console`). +2. Voeg het Aspose.BarCode‑pakket toe (`dotnet add package Aspose.BarCode`). +3. Vervang de gegenereerde `Program.cs` door de bovenstaande code. +4. Pas het uitvoerpad aan indien nodig en voer uit (`dotnet run`). + +Je ziet een console‑bericht dat de bestandslocatie bevestigt, en de PNG bevat de **micro PDF417 barcode** die je zojuist hebt gemaakt. + +## Veelvoorkomende valkuilen en best‑practice tips + +- **Unicode‑verwerking:** Aspose.BarCode codeert automatisch UTF‑8‑tekens, maar zorg ervoor dat je bronbestand is opgeslagen met UTF‑8‑codering om corrupte symbolen te voorkomen. +- **Kolomlimieten:** Het instellen van `Columns` op een waarde buiten 1‑4 veroorzaakt een `ArgumentException`. Valideer gebruikersinvoer als je deze instelling in een UI blootstelt. +- **Afbeeldingsresolutie:** PNG is verliesloos, maar als je een hogere‑resolutie vectorformaat nodig hebt, gebruik dan `BarCodeImageFormat.Svg` in plaats daarvan. +- **GS1‑datumlengte:** GS1‑compatibele Micro PDF417 heeft strengere lengtelimieten. Controleer of de gecodeerde string de maximale lengte volgens de standaard niet overschrijdt (meestal 90 tekens voor Micro PDF417). + +## Conclusie + +Je weet nu hoe je een **micro PDF417 barcode** kunt **maken** in C# met Aspose.BarCode. De tutorial behandelde het initialiseren van een **barcode‑generator**, het instellen van de **X‑dimensie‑pixels**, het kiezen van het aantal kolommen, het opslaan van de afbeelding en optioneel het inschakelen van **GS1‑compatibele barcode**‑functies. + +Vanaf hier kun je experimenteren met verschillende tekstinvoeren, de X‑dimensie aanpassen voor diverse afdrukresoluties, of overschakelen naar SVG‑output voor schaalbare graphics. Als je andere 2‑D‑symbologieën wilt genereren, verken dan `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` of `EncodeTypes.QR` — hetzelfde configuratie‑patroon is van toepassing. + +Veel programmeerplezier! + +## Wat moet je hierna leren? + +De volgende tutorials behandelen nauw verwante onderwerpen die voortbouwen op de technieken die in deze gids zijn 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. + +- [Hoe een barcode te maken – Compact PDF417 met Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Maak DotCode barcode‑afbeelding – rijen & kolommen (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Hoe een barcode‑quiet‑zone te maken voor ITF-14 met Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/dutch/net/one-dimensional-barcode-types/_index.md index cd103f02d..117b14f47 100644 --- a/barcode/dutch/net/one-dimensional-barcode-types/_index.md +++ b/barcode/dutch/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ leer hoe u streepjescodes kunt genereren in .NET met Aspose.BarCode voor .NET. D Leer hoe u met uitzonderingen omgaat terwijl u eendimensionale streepjescodes genereert met Aspose.BarCode voor .NET. Deze stapsgewijze handleiding zorgt voor fouttolerante barcodeoplossingen. Begin nu! ### [Eendimensionale configuratie met brede en smalle verhoudingen](./one-dimensional-wide-narrow-ratio-configuration/) Genereer eenvoudig aangepaste barcodes met Aspose.BarCode voor .NET. Stapsgewijze handleiding voor eendimensionale configuratie van breed-nauw verhoudingen. +### [Barcode lezen vanuit afbeelding in C# – BarCodeReader-tutorial](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Leer hoe u barcodes uit afbeeldingen kunt lezen in C# met de BarCodeReader van Aspose.BarCode. ## Conclusie @@ -89,4 +91,4 @@ Met dit artikel verkrijgt u niet alleen kennis over verschillende eendimensional {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/dutch/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/dutch/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..ff47cebc2 --- /dev/null +++ b/barcode/dutch/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,256 @@ +--- +category: general +date: 2026-08-15 +description: Lees een barcode van een afbeelding in C# met BarCodeReader. Leer hoe + je meerdere barcodes in C# kunt lezen, een PDF417‑barcode kunt lezen, en bekijk + een volledig C# BarCodeReader‑voorbeeld. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: nl +lastmod: 2026-08-15 +og_description: Lees een barcode van een afbeelding in C# met een stapsgewijze handleiding. + Ontdek hoe je meerdere barcodes in C# kunt lezen, PDF417‑symbolen kunt decoderen + en een volledig C# BarCodeReader‑voorbeeld kunt uitvoeren. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Barcode lezen van afbeelding in C# – BarCodeReader tutorial +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Barcode lezen uit afbeelding in C# – BarCodeReader‑tutorial +url: /nl/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Barcode lezen van afbeelding in C# – BarCodeReader tutorial + +Als je een **barcode van afbeelding** moet lezen in een .NET‑applicatie, laat deze gids je precies zien hoe je dat doet met de `BarCodeReader`‑klasse. Je ziet ook hoe je **meerdere barcodes C#** kunt lezen, een PDF417‑symbool decodeert, en een volledige **C# BarCodeReader‑voorbeeld** krijgt die je in je project kunt kopiëren. + +De tutorial behandelt elke stap — van het toevoegen van het vereiste NuGet‑pakket tot het afdrukken van uitgebreide PDF417‑velden — zodat je eindigt met een uitvoerbaar console‑programma. Er is geen externe documentatie nodig; alle code en uitleg zijn inbegrepen. + +## Wat je nodig hebt + +* .NET 6.0 SDK of later (de code werkt met .NET Core en .NET Framework) +* Visual Studio 2022 of een C#‑compatible editor +* Het `Aspose.BarCode` NuGet‑pakket (of de equivalente bibliotheek die `BarCodeReader` levert) +* Een afbeeldingsbestand dat een Macro PDF417‑barcode bevat (bijv. `ExtPDF417Meta.png`) + +Het hebben van deze vereisten zorgt ervoor dat het voorbeeld compileert zonder extra configuratie. + +## Barcode lezen van afbeelding met BarCodeReader + +De eerste stap is het aanmaken van een `BarCodeReader`‑instantie die naar het afbeeldingsbestand wijst en de bibliotheek vertelt naar welk barcode‑type gezocht moet worden. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Waarom dit werkt:** +`BarCodeReader` opent de afbeelding, scant naar het opgegeven `DecodeType` en retourneert een collectie van `BarCodeResult`‑objecten. Elk resultaat bevat de generieke barcode‑gegevens (`CodeTypeName`, `CodeText`) en, voor Macro PDF417, een `Extended.Pdf417`‑object dat alle extra velden die door de standaard zijn gedefinieerd, blootlegt. + +## Meerdere barcodes C# lezen in één afbeelding + +Soms bevat een afbeelding meer dan één barcode (bijv. een QR‑code naast een PDF417). Om dat scenario te behandelen, laat je eenvoudigweg de expliciete `DecodeType` weg of geef je `DecodeType.AllSupported` door en loop je door de resultaten. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Waarom je dit nodig hebt:** +Het specificeren van `AllSupported` vertelt de engine om elk barcode‑formaat dat hij kent te proberen, wat garandeert dat je elk symbool in de afbeelding vastlegt. Dit is de aanbevolen aanpak wanneer je de barcode‑types van tevoren niet kunt voorspellen. + +## Hoe PDF417‑barcode te lezen met C# + +Als je alleen geïnteresseerd bent in het klassieke PDF417 (niet‑macro) formaat, wijzig je de `DecodeType` naar `Pdf417`. De rest van de code blijft identiek, behalve dat de uitgebreide velden niet beschikbaar zijn. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Waarom dit belangrijk is:** +Klassiek PDF417 exposeert de macro‑specifieke eigenschappen niet, dus het `Extended.Pdf417`‑blok is overbodig. Het gebruik van de precieze `DecodeType` versnelt ook het scannen omdat de bibliotheek niet‑ondersteunde algoritmen overslaat. + +## Volledig C# BarCodeReader‑voorbeeld dat je kunt kopiëren + +Hieronder staat het volledige programma dat de drie scenario's combineert in één gemakkelijk uit te voeren console‑applicatie. Vervang `YOUR_DIRECTORY/ExtPDF417Meta.png` door het daadwerkelijke pad naar je afbeelding. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Verwachte output + +Wanneer de voorbeeldafbeelding een Macro PDF417‑barcode bevat, print de console iets vergelijkbaars met: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Als de afbeelding alleen een reguliere PDF417 bevat, zal de “Macro PDF417” sectie leeg zijn, en zal de “Classic PDF417” sectie de gedecodeerde tekst weergeven. + +## Conclusie + +Je weet nu hoe je **barcode van afbeelding** kunt lezen in C# met `BarCodeReader`, hoe je **meerdere barcodes C#** kunt lezen in één bestand, en de exacte stappen om **PDF417‑barcode** te lezen — zowel macro‑ als klassieke varianten. Het volledige **C# BarCodeReader‑voorbeeld** is klaar om in elk .NET‑project te plakken, en je kunt het uitbreiden om andere formaten te verwerken of te integreren in een grotere beeld‑verwerkings‑pipeline. + +**Volgende stappen** + +* Verken foutafhandelings‑patronen zoals `try / catch` rond het reader‑blok. +* Experimenteer met het `ReaderParameters`‑object om detectiesnelheid en nauwkeurigheid af te stemmen. +* Combineer barcode‑lezen met beeld‑preprocessing‑bibliotheken ( + +## 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 DataMatrix‑barcodes te lezen met Aspose.BarCode voor .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [DataMatrix‑barcode lezen C# – DataMatrix‑modus genereren (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Barcode lezen van afbeelding – Barcode‑regio‑extractie beheersen in Java met Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/english/net/compact-pdf417-encoding/_index.md index 1762ea2a8..a46957fef 100644 --- a/barcode/english/net/compact-pdf417-encoding/_index.md +++ b/barcode/english/net/compact-pdf417-encoding/_index.md @@ -41,7 +41,7 @@ Before we dive into code, let’s cover the fundamentals: - **Data Structure:** Information is divided into codewords, then arranged into rows and columns. - **Error Correction:** PDF417 uses Reed‑Solomon error correction; you can choose the level that balances redundancy and size. -- **Compact Mode:** Removes unnecessary padding, resulting in a smaller barcode without sacrificing readability. +- **Compact Mode:** Removes unnecessary padding, resulting a smaller barcode without sacrificing readability. ### PDF417 Error Correction Options Aspose.BarCode lets you set the `Pdf417ErrorCorrectionLevel` property (0‑8). Higher levels increase redundancy, which is useful for harsh environments like industrial scanning. Choose a level based on your risk tolerance and space constraints. @@ -84,6 +84,9 @@ Beyond the basics, here are some practical tips to streamline your workflow: ### [Creating Compact PDF417 Barcodes](./compact-pdf417-basic-configuration/) Learn how to generate Compact PDF417 barcodes using Aspose.BarCode for .NET. Comprehensive guide with step-by-step instructions and code examples. +### [Create micro PDF417 barcode in C# – step‑by‑step guide](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Step-by-step guide to creating micro PDF417 barcodes in C# with Aspose.BarCode for .NET. + ## Frequently Asked Questions **Q: What is the maximum amount of data I can store in a Compact PDF417 barcode?** @@ -112,4 +115,4 @@ A: No external fonts are required; the library handles all rendering internally. {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/english/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/english/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..e14c7e6fc --- /dev/null +++ b/barcode/english/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,247 @@ +--- +category: general +date: 2026-08-15 +description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable GS1 + compliance. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: en +lastmod: 2026-08-15 +og_description: Create micro PDF417 barcode in C# with Aspose.BarCode. Follow this + tutorial to configure the barcode generator, set dimensions, and produce a PNG image. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Create micro PDF417 barcode in C# – complete programming guide +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Create micro PDF417 barcode in C# – step‑by‑step guide +url: /net/compact-pdf417-encoding/create-micro-pdf417-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 micro PDF417 barcode in C# – step‑by‑step guide + +If you need to **create micro PDF417 barcode** in C#, this guide shows you exactly how. We'll walk through initializing a **barcode generator**, configuring the **X‑dimension**, choosing the column count, and saving the result as a PNG file. + +Generating a Micro PDF417 barcode is useful for compact data encoding on small labels, tickets, or IoT devices. By the end of this tutorial you will have a complete, runnable example that you can drop into any .NET project. + +## What you’ll need + +Before you start, make sure you have: + +- .NET 6.0 (or later) installed – the code works with .NET Framework 4.6+ as well. +- The Aspose.BarCode for .NET library (available via NuGet `Aspose.BarCode`). +- A development environment such as Visual Studio 2022 or VS Code. + +No additional external services are required; everything runs locally. + +## How to create micro PDF417 barcode with Aspose.BarCode + +The core of the process is a **barcode generator** object that knows how to encode Micro PDF417 data. The following sections break down each configuration step. + +### Step 1: Initialize the barcode generator + +First, import the required namespaces and create an instance of `BarcodeGenerator` with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you want to encode. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Why this matters:** The `BarcodeGenerator` class encapsulates all encoding logic. Selecting `EncodeTypes.MicroPdf417` tells the library to use the compact Micro PDF417 symbology, which is limited to 1‑4 columns. + +### Step 2: Configure the X‑dimension (module width) + +The **X‑dimension** controls the width of a single barcode module in pixels. A smaller value produces a tighter barcode, while a larger value improves readability on low‑resolution printers. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Tip:** Values between 1 and 4 work well for most screen displays. If you plan to print on a thermal printer, test with 3–4 pixels to avoid blurring. + +### Step 3: Set the number of columns + +Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter but increase its height. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Why choose 4 columns?** With four columns the barcode occupies the least horizontal space, which is ideal for narrow labels. If you need a taller but narrower barcode, lower the column count. + +### Step 4: Save the barcode as a PNG image + +Finally, write the barcode to a file. PNG preserves the exact pixel dimensions you configured. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +After running the program, open `MicroPdf417.png` to see the result. The image should display a crisp Micro PDF417 barcode that encodes the sample text. + +#### Expected output + +![Created micro PDF417 barcode](/images/micro-pdf417-sample.png "Create micro PDF417 barcode in C# – example output") + +The PNG file contains a barcode with: + +- X‑dimension of 2 px +- 4 columns +- UTF‑8 encoded text `"Åspóse.Barcóde©"` + +### Optional: generate a GS1‑compliant Micro PDF417 + +If your application requires **GS1‑compliant barcode** data (for supply‑chain standards), enable GS1 encoding before saving: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Explanation:** Setting `IsGS1` tells Aspose.BarCode to prepend the GS1 header and apply the correct checksum rules. This is essential when your barcode will be scanned by GS1‑aware readers. + +## Full, runnable example + +Below is a complete console application you can copy, paste, and run. It includes all necessary `using` statements, error handling, and comments. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Running the code:** +1. Create a new .NET console project (`dotnet new console`). +2. Add the Aspose.BarCode package (`dotnet add package Aspose.BarCode`). +3. Replace the generated `Program.cs` with the code above. +4. Adjust the output path if needed and run (`dotnet run`). + +You should see a console message confirming the file location, and the PNG will contain the **micro PDF417 barcode** you just created. + +## Common pitfalls and best‑practice tips + +- **Unicode handling:** Aspose.BarCode automatically encodes UTF‑8 characters, but ensure your source file is saved with UTF‑8 encoding to avoid corrupted symbols. +- **Column limits:** Trying to set `Columns` to a value outside 1‑4 throws an `ArgumentException`. Validate user input if you expose this setting in a UI. +- **Image resolution:** PNG is lossless, but if you need a higher‑resolution vector format, use `BarCodeImageFormat.Svg` instead. +- **GS1 data length:** GS1‑compliant Micro PDF417 has stricter length limits. Verify the encoded string does not exceed the maximum allowed by the standard (typically 90 characters for Micro PDF417). + +## Conclusion + +You now know how to **create micro PDF417 barcode** in C# using Aspose.BarCode. The tutorial covered initializing a **barcode generator**, setting the **X‑dimension pixels**, choosing the column count, saving the image, and optionally enabling **GS1‑compliant barcode** features. + +From here you can experiment with different text inputs, adjust the X‑dimension for various printing resolutions, or switch to SVG output for scalable graphics. If you need to generate other 2‑D symbologies, explore `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix`, or `EncodeTypes.QR`—the same configuration pattern applies. + +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 Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/og-image.png b/barcode/english/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/og-image.png new file mode 100644 index 000000000..3038f9c15 Binary files /dev/null and b/barcode/english/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/og-image.png differ diff --git a/barcode/english/net/one-dimensional-barcode-types/_index.md b/barcode/english/net/one-dimensional-barcode-types/_index.md index 6c53014d9..f62c4e881 100644 --- a/barcode/english/net/one-dimensional-barcode-types/_index.md +++ b/barcode/english/net/one-dimensional-barcode-types/_index.md @@ -98,6 +98,8 @@ earn how to generate barcodes in .NET with Aspose.BarCode for .NET. This compreh Learn how to handle exceptions while generating one-dimensional barcodes using Aspose.BarCode for .NET. This step-by-step guide ensures error-tolerant barcode solutions. Get started now! ### [One-Dimensional Wide-Narrow Ratio Configuration](./one-dimensional-wide-narrow-ratio-configuration/) Generate customized barcodes easily with Aspose.BarCode for .NET. Step-by-step guide for one-dimensional wide-narrow ratio configuration. +### [Read barcode from image in C# – BarCodeReader tutorial](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Learn how to read barcodes from images in C# using Aspose.BarCodeReader. Follow our step‑by‑step guide for easy implementation. ## Frequently Asked Questions @@ -133,4 +135,4 @@ With this article, you'll not only gain knowledge about various one‑dimensiona {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/english/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/english/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..e9f2dbe19 --- /dev/null +++ b/barcode/english/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,259 @@ +--- +category: general +date: 2026-08-15 +description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: en +lastmod: 2026-08-15 +og_description: Read barcode from image in C# with a step‑by‑step guide. Discover + how to read multiple barcodes C#, decode PDF417 symbols, and run a complete C# BarCodeReader + example. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Read barcode from image in C# – BarCodeReader tutorial +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Read barcode from image in C# – BarCodeReader tutorial +url: /net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Read barcode from image in C# – BarCodeReader tutorial + +If you need to **read barcode from image** in a .NET application, this guide shows you exactly how to do it with the `BarCodeReader` class. You’ll also see how to **read multiple barcodes C#**, decode a PDF417 symbol, and get a complete **C# BarCodeReader example** you can copy into your project. + +The tutorial covers every step—from adding the required NuGet package to printing extended PDF417 fields—so you finish with a runnable console program. No external documentation is needed; all code and explanations are included. + +## What you’ll need + +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 C#‑compatible editor +* The `Aspose.BarCode` NuGet package (or the equivalent library that provides `BarCodeReader`) +* An image file that contains a Macro PDF417 barcode (e.g., `ExtPDF417Meta.png`) + +Having these prerequisites ensures the sample compiles without additional configuration. + +## Read barcode from image with BarCodeReader + +The first step is to create a `BarCodeReader` instance that points at the image file and tells the library which barcode type to look for. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Why this works:** +`BarCodeReader` opens the image, scans for the specified `DecodeType`, and returns a collection of `BarCodeResult` objects. Each result contains the generic barcode data (`CodeTypeName`, `CodeText`) and, for Macro PDF417, an `Extended.Pdf417` object that exposes all additional fields defined by the standard. + +## Read multiple barcodes C# in a single image + +Sometimes an image contains more than one barcode (e.g., QR code beside a PDF417). To handle that scenario, simply omit the explicit `DecodeType` or pass `DecodeType.AllSupported` and loop through the results. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Why you need this:** +Specifying `AllSupported` tells the engine to try every barcode format it knows, which guarantees that you capture every symbol in the image. This is the recommended approach when you cannot predict the barcode types ahead of time. + +## How to read PDF417 barcode using C# + +If you only care about the classic PDF417 (non‑macro) format, change the `DecodeType` to `Pdf417`. The rest of the code stays identical, except the extended fields are not available. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Why this matters:** +Classic PDF417 does not expose the macro‑specific properties, so the `Extended.Pdf417` block is unnecessary. Using the precise `DecodeType` also speeds up scanning because the library skips unsupported algorithms. + +## Full C# BarCodeReader example you can copy + +Below is the complete program that combines the three scenarios into a single, easy‑to‑run console application. Replace `YOUR_DIRECTORY/ExtPDF417Meta.png` with the actual path to your image. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Expected output + +When the sample image contains a Macro PDF417 barcode, the console prints something similar to: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +If the image contains only a regular PDF417, the “Macro PDF417” section will be empty, and the “Classic PDF417” section will display the decoded text. + +## Conclusion + +You now know how to **read barcode from image** in C# using `BarCodeReader`, how to **read multiple barcodes C#** in a single file, and the exact steps to **read PDF417 barcode**—both macro and classic variants. The full **C# BarCodeReader example** is ready to paste into any .NET project, and you can extend it to handle other formats or integrate it into a larger image‑processing pipeline. + +**Next steps** + +* Explore error‑handling patterns such as `try / catch` around the reader block. +* Experiment with the `ReaderParameters` object to tune detection speed and accuracy. +* Combine barcode reading with image preprocessing libraries ( + + +## 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 Read DataMatrix Barcodes with Aspose.BarCode for .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Read DataMatrix barcode C# – Generate DataMatrix Mode (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Read Barcode from Image – Mastering Barcode Region Extraction in Java with Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/og-image.png b/barcode/english/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/og-image.png new file mode 100644 index 000000000..db74f783f Binary files /dev/null and b/barcode/english/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/og-image.png differ diff --git a/barcode/french/net/compact-pdf417-encoding/_index.md b/barcode/french/net/compact-pdf417-encoding/_index.md index 13df3a6a5..e2d784270 100644 --- a/barcode/french/net/compact-pdf417-encoding/_index.md +++ b/barcode/french/net/compact-pdf417-encoding/_index.md @@ -87,6 +87,9 @@ Au‑delà des bases, voici quelques astuces pratiques pour optimiser votre flux ### [Créer des codes-barres Compact PDF417](./compact-pdf417-basic-configuration/) Apprenez à générer des codes-barres Compact PDF417 en utilisant Aspose.BarCode pour .NET. Guide complet avec des instructions étape par étape et des exemples de code. +### [Créer un code-barres micro PDF417 en C# – guide étape par étape](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Apprenez à créer un code-barres micro PDF417 en C# avec Aspose.BarCode, incluant configuration, paramètres et exemples de code. + ## Questions fréquentes **Q : Quelle est la quantité maximale de données que je peux stocker dans un code‑barcode Compact PDF417 ?** @@ -115,4 +118,4 @@ R : Aucune police externe n'est requise ; la bibliothèque gère tout le ren {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/french/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/french/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..2f15a2750 --- /dev/null +++ b/barcode/french/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,246 @@ +--- +category: general +date: 2026-08-15 +description: Créez rapidement un code‑barres micro PDF417 en C# avec Aspose.BarCode. + Apprenez à utiliser le générateur de code‑barres, à définir la dimension X, à choisir + les colonnes et à activer la conformité GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: fr +lastmod: 2026-08-15 +og_description: Créer un code‑barres micro PDF417 en C# avec Aspose.BarCode. Suivez + ce tutoriel pour configurer le générateur de code‑barres, définir les dimensions + et générer une image PNG. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Créer un code‑barres micro PDF417 en C# – guide complet de programmation +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Créer un code‑barres micro PDF417 en C# – guide étape par étape +url: /fr/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Créer un code‑barres micro PDF417 en C# – guide étape par étape + +Si vous devez **créer un code‑barres micro PDF417** en C#, ce guide vous montre exactement comment faire. Nous parcourrons l’initialisation d’un **générateur de code‑barres**, la configuration de la **dimension X**, le choix du nombre de colonnes et l’enregistrement du résultat sous forme de fichier PNG. + +Générer un code‑barres Micro PDF417 est utile pour encoder des données compactes sur de petites étiquettes, des tickets ou des appareils IoT. À la fin de ce tutoriel, vous disposerez d’un exemple complet et exécutable que vous pourrez intégrer à n’importe quel projet .NET. + +## Ce dont vous aurez besoin + +Avant de commencer, assurez‑vous d’avoir : + +- .NET 6.0 (ou supérieur) installé – le code fonctionne également avec .NET Framework 4.6+. +- La bibliothèque Aspose.BarCode for .NET (disponible via NuGet `Aspose.BarCode`). +- Un environnement de développement tel que Visual Studio 2022 ou VS Code. + +Aucun service externe supplémentaire n’est requis ; tout s’exécute localement. + +## Comment créer un code‑barres micro PDF417 avec Aspose.BarCode + +Le cœur du processus est un objet **barcode generator** qui sait encoder les données Micro PDF417. Les sections suivantes détaillent chaque étape de configuration. + +### Étape 1 : Initialiser le générateur de code‑barres + +Tout d’abord, importez les espaces de noms requis et créez une instance de `BarcodeGenerator` avec l’énumération `EncodeTypes.MicroPdf417`. Le deuxième argument correspond au texte que vous souhaitez encoder. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Pourquoi c’est important :** La classe `BarcodeGenerator` encapsule toute la logique d’encodage. Sélectionner `EncodeTypes.MicroPdf417` indique à la bibliothèque d’utiliser la symbologie compacte Micro PDF417, qui est limitée à 1‑4 colonnes. + +### Étape 2 : Configurer la dimension X (largeur du module) + +La **dimension X** contrôle la largeur d’un seul module du code‑barres en pixels. Une valeur plus petite produit un code‑barres plus serré, tandis qu’une valeur plus grande améliore la lisibilité sur des imprimantes à basse résolution. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Astuce :** Des valeurs comprises entre 1 et 4 fonctionnent bien pour la plupart des écrans. Si vous prévoyez d’imprimer sur une imprimante thermique, testez avec 3–4 pixels pour éviter le flou. + +### Étape 3 : Définir le nombre de colonnes + +Micro PDF417 prend en charge 1‑4 colonnes. Plus de colonnes raccourcissent le code‑barres mais augmentent sa hauteur. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Pourquoi choisir 4 colonnes ?** Avec quatre colonnes, le code‑barres occupe le moins d’espace horizontal, ce qui est idéal pour les étiquettes étroites. Si vous avez besoin d’un code‑barres plus haut mais plus étroit, réduisez le nombre de colonnes. + +### Étape 4 : Enregistrer le code‑barres sous forme d’image PNG + +Enfin, écrivez le code‑barres dans un fichier. Le PNG conserve exactement les dimensions de pixel que vous avez configurées. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Après l’exécution du programme, ouvrez `MicroPdf417.png` pour voir le résultat. L’image doit afficher un code‑barres Micro PDF417 net qui encode le texte d’exemple. + +#### Résultat attendu + +![Code‑barres micro PDF417 créé](/images/micro-pdf417-sample.png "Create micro PDF417 barcode in C# – example output") + +Le fichier PNG contient un code‑barres avec : + +- Dimension X de 2 px +- 4 colonnes +- Texte encodé en UTF‑8 `"Åspóse.Barcóde©"` + +### Optionnel : générer un Micro PDF417 conforme GS1 + +Si votre application nécessite des données **code‑barres conforme GS1** (pour les normes de chaîne d’approvisionnement), activez l’encodage GS1 avant l’enregistrement : + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Explication :** Le paramètre `IsGS1` indique à Aspose.BarCode de préfixer l’en‑tête GS1 et d’appliquer les règles de checksum appropriées. C’est essentiel lorsque votre code‑barres sera lu par des lecteurs compatibles GS1. + +## Exemple complet et exécutable + +Voici une application console complète que vous pouvez copier, coller et exécuter. Elle inclut toutes les instructions `using` nécessaires, la gestion des erreurs et des commentaires. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Exécution du code :** +1. Créez un nouveau projet console .NET (`dotnet new console`). +2. Ajoutez le package Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. Remplacez le `Program.cs` généré par le code ci‑dessus. +4. Ajustez le chemin de sortie si besoin et lancez (`dotnet run`). + +Vous devriez voir un message dans la console confirmant l’emplacement du fichier, et le PNG contiendra le **code‑barres micro PDF417** que vous venez de créer. + +## Pièges courants et bonnes pratiques + +- **Gestion Unicode :** Aspose.BarCode encode automatiquement les caractères UTF‑8, mais assurez‑vous que votre fichier source est enregistré en UTF‑8 pour éviter les symboles corrompus. +- **Limites de colonnes :** Tenter de définir `Columns` à une valeur hors 1‑4 déclenche une `ArgumentException`. Validez les entrées utilisateur si vous exposez ce paramètre dans une interface. +- **Résolution d’image :** Le PNG est sans perte, mais si vous avez besoin d’un format vectoriel à plus haute résolution, utilisez `BarCodeImageFormat.Svg` à la place. +- **Longueur des données GS1 :** Le Micro PDF417 conforme GS1 impose des limites de longueur plus strictes. Vérifiez que la chaîne encodée ne dépasse pas le maximum autorisé par la norme (généralement 90 caractères pour le Micro PDF417). + +## Conclusion + +Vous savez maintenant comment **créer un code‑barres micro PDF417** en C# avec Aspose.BarCode. Le tutoriel a couvert l’initialisation d’un **générateur de code‑barres**, la définition des **pixels de dimension X**, le choix du nombre de colonnes, l’enregistrement de l’image, et, en option, l’activation des fonctionnalités **code‑barres conforme GS1**. + +À partir d’ici, vous pouvez expérimenter avec différents textes d’entrée, ajuster la dimension X pour diverses résolutions d’impression, ou passer à la sortie SVG pour des graphiques évolutifs. Si vous devez générer d’autres symbologies 2‑D, explorez `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` ou `EncodeTypes.QR` — le même schéma de configuration s’applique. + +Bon codage ! + +## Que devez‑vous apprendre ensuite ? + +Les tutoriels suivants abordent 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 d’autres fonctionnalités de l’API et à explorer des approches d’implémentation alternatives dans vos projets. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/french/net/one-dimensional-barcode-types/_index.md index 9f7bfd64d..9defab439 100644 --- a/barcode/french/net/one-dimensional-barcode-types/_index.md +++ b/barcode/french/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ Découvrez comment générer des codes-barres dans .NET avec Aspose.BarCode pour Découvrez comment gérer les exceptions lors de la génération de codes-barres unidimensionnels à l'aide d'Aspose.BarCode for .NET. Ce guide étape par étape garantit des solutions de codes-barres tolérantes aux erreurs. Commencez maintenant! ### [Configuration unidimensionnelle à rapport large-étroit](./one-dimensional-wide-narrow-ratio-configuration/) Générez facilement des codes-barres personnalisés avec Aspose.BarCode pour .NET. Guide étape par étape pour la configuration unidimensionnelle du rapport large-étroit. +### [Lire un code-barres à partir d'une image en C# – Tutoriel BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Apprenez à lire des codes-barres à partir d'images en C# avec BarCodeReader d'Aspose.BarCode. ## Conclusion @@ -89,4 +91,4 @@ Avec cet article, vous acquerrez non seulement des connaissances sur les différ {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/french/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/french/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..d7cc7bbc5 --- /dev/null +++ b/barcode/french/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,260 @@ +--- +category: general +date: 2026-08-15 +description: Lire un code‑barres à partir d’une image en C# avec BarCodeReader. Apprenez + à lire plusieurs codes‑barres en C#, à lire le code‑barres PDF417 et à consulter + un exemple complet de BarCodeReader en C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: fr +lastmod: 2026-08-15 +og_description: Lire un code‑barres à partir d’une image en C# avec un guide étape + par étape. Découvrez comment lire plusieurs codes‑barres en C#, décoder les symboles + PDF417 et exécuter un exemple complet de BarCodeReader en C#. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Lire un code‑barres à partir d’une image en C# – Tutoriel BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Lire le code‑barres à partir d’une image en C# – Tutoriel BarCodeReader +url: /fr/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Lire un code‑barres à partir d’une image en C# – Tutoriel BarCodeReader + +Si vous devez **lire un code‑barres à partir d’une image** dans une application .NET, ce guide vous montre exactement comment le faire avec la classe `BarCodeReader`. Vous verrez également comment **lire plusieurs codes‑barres C#**, décoder un symbole PDF417, et obtenir un **exemple complet C# BarCodeReader** que vous pouvez copier dans votre projet. + +Le tutoriel couvre chaque étape — de l’ajout du package NuGet requis à l’affichage des champs PDF417 étendus— afin que vous terminiez avec un programme console exécutable. Aucune documentation externe n’est nécessaire ; tout le code et les explications sont inclus. + +## Ce dont vous aurez besoin + +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 éditeur compatible C# +* Le package NuGet `Aspose.BarCode` (ou la bibliothèque équivalente qui fournit `BarCodeReader`) +* Un fichier image contenant un code‑barres Macro PDF417 (par ex. `ExtPDF417Meta.png`) + +Disposer de ces prérequis garantit que l’exemple se compile sans configuration supplémentaire. + +## Lire un code‑barres à partir d’une image avec BarCodeReader + +La première étape consiste à créer une instance de `BarCodeReader` qui pointe vers le fichier image et indique à la bibliothèque quel type de code‑barres rechercher. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Pourquoi cela fonctionne :** +`BarCodeReader` ouvre l’image, scanne le `DecodeType` spécifié et renvoie une collection d’objets `BarCodeResult`. Chaque résultat contient les données génériques du code‑barres (`CodeTypeName`, `CodeText`) et, pour Macro PDF417, un objet `Extended.Pdf417` qui expose tous les champs supplémentaires définis par la norme. + +## Lire plusieurs codes‑barres C# dans une même image + +Parfois, une image contient plus d’un code‑barres (par ex. un QR code à côté d’un PDF417). Pour gérer ce scénario, il suffit d’omettre le `DecodeType` explicite ou de passer `DecodeType.AllSupported` et de parcourir les résultats. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Pourquoi vous avez besoin de cela :** +Spécifier `AllSupported` indique au moteur d’essayer tous les formats de code‑barres qu’il connaît, ce qui garantit que vous capturez chaque symbole présent dans l’image. C’est l’approche recommandée lorsque vous ne pouvez pas prédire à l’avance les types de code‑barres. + +## Comment lire un code‑barres PDF417 avec C# + +Si vous ne vous intéressez qu’au format PDF417 classique (non‑macro), changez le `DecodeType` en `Pdf417`. Le reste du code reste identique, à l’exception du fait que les champs étendus ne sont pas disponibles. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Pourquoi c’est important :** +Le PDF417 classique n’expose pas les propriétés spécifiques au macro, donc le bloc `Extended.Pdf417` est inutile. Utiliser le `DecodeType` précis accélère également le scan car la bibliothèque ignore les algorithmes non pris en charge. + +## Exemple complet C# BarCodeReader que vous pouvez copier + +Voici le programme complet qui combine les trois scénarios en une seule application console facile à exécuter. Remplacez `YOUR_DIRECTORY/ExtPDF417Meta.png` par le chemin réel de votre image. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Résultat attendu + +Lorsque l’image d’exemple contient un code‑barres Macro PDF417, la console affiche quelque chose de similaire à : + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Si l’image ne contient qu’un PDF417 ordinaire, la section « Macro PDF417 » sera vide et la section « Classic PDF417 » affichera le texte décodé. + +## Conclusion + +Vous savez maintenant comment **lire un code‑barres à partir d’une image** en C# avec `BarCodeReader`, comment **lire plusieurs codes‑barres C#** dans un même fichier, et les étapes exactes pour **lire un code‑barres PDF417**—tant la variante macro que la variante classique. L’**exemple complet C# BarCodeReader** est prêt à être collé dans n’importe quel projet .NET, et vous pouvez l’étendre pour gérer d’autres formats ou l’intégrer à une chaîne de traitement d’images plus large. + +**Prochaines étapes** + +* Explorez les modèles de gestion des erreurs tels que `try / catch` autour du bloc lecteur. +* Expérimentez avec l’objet `ReaderParameters` pour ajuster la vitesse et la précision de la détection. +* Combinez la lecture de code‑barres avec des bibliothèques de prétraitement d’image ( + + +## 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 fonctionnels complets avec des explications pas à pas pour vous aider à maîtriser d’autres fonctionnalités de l’API et à explorer des approches d’implémentation alternatives dans vos propres projets. + +- [Comment lire les codes‑barres DataMatrix avec Aspose.BarCode pour .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Lire un code‑barres DataMatrix C# – Générer le mode DataMatrix (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Lire un code‑barres à partir d’une image – Maîtriser l’extraction de région de code‑barres en Java avec Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/german/net/compact-pdf417-encoding/_index.md index 201fcffef..24fad74e6 100644 --- a/barcode/german/net/compact-pdf417-encoding/_index.md +++ b/barcode/german/net/compact-pdf417-encoding/_index.md @@ -84,6 +84,8 @@ Nachfolgend eine knappe Beschreibung eines typischen Barcode‑Erstellungsszenar ## Compact PDF417 Codierungs‑Tutorials ### [Creating Compact PDF417 Barcodes](./compact-pdf417-basic-configuration/) Erfahren Sie, wie Sie Compact PDF417 Barcodes mit Aspose.BarCode für .NET erzeugen. Umfassender Leitfaden mit Schritt‑für‑Schritt‑Anweisungen und Code‑Beispielen. +### [Erstellen Sie einen Micro PDF417 Barcode in C# – Schritt‑für‑Schritt‑Anleitung](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Erfahren Sie, wie Sie einen Micro PDF417 Barcode in C# erzeugen – detaillierte Anleitung mit Code‑Beispielen. ## Häufig gestellte Fragen @@ -113,4 +115,4 @@ A: Nein, es werden keine externen Schriftarten benötigt; die Bibliothek überni {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/german/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/german/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..4d5daf1c7 --- /dev/null +++ b/barcode/german/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,246 @@ +--- +category: general +date: 2026-08-15 +description: Erstellen Sie schnell einen Micro‑PDF417‑Barcode in C# mit Aspose.BarCode. + Erfahren Sie, wie Sie den Barcode‑Generator verwenden, die X‑Dimension einstellen, + Spalten auswählen und die GS1‑Konformität aktivieren. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: de +lastmod: 2026-08-15 +og_description: Erstellen Sie einen Micro‑PDF417‑Barcode in C# mit Aspose.BarCode. + Folgen Sie diesem Tutorial, um den Barcode‑Generator zu konfigurieren, die Abmessungen + festzulegen und ein PNG‑Bild zu erzeugen. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Micro-PDF417-Barcode in C# erstellen – vollständiger Programmierleitfaden +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Erstellen eines Micro‑PDF417‑Barcodes in C# – Schritt‑für‑Schritt‑Anleitung +url: /de/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Micro PDF417‑Barcode in C# erstellen – Schritt‑für‑Schritt‑Anleitung + +Wenn Sie **einen Micro PDF417‑Barcode** in C# **erstellen** müssen, zeigt Ihnen diese Anleitung genau, wie es geht. Wir gehen durch die Initialisierung eines **Barcode‑Generators**, die Konfiguration der **X‑Dimension**, die Auswahl der Spaltenanzahl und das Speichern des Ergebnisses als PNG‑Datei. + +Das Erzeugen eines Micro PDF417‑Barcodes ist nützlich für die kompakte Datenkodierung auf kleinen Etiketten, Tickets oder IoT‑Geräten. Am Ende dieses Tutorials haben Sie ein vollständiges, ausführbares Beispiel, das Sie in jedes .NET‑Projekt einbinden können. + +## Was Sie benötigen + +Bevor Sie beginnen, stellen Sie sicher, dass Sie Folgendes haben: + +- .NET 6.0 (oder höher) installiert – der Code funktioniert auch mit .NET Framework 4.6+. +- Die Aspose.BarCode für .NET‑Bibliothek (verfügbar über NuGet `Aspose.BarCode`). +- Eine Entwicklungsumgebung wie Visual Studio 2022 oder VS Code. + +Es werden keine zusätzlichen externen Dienste benötigt; alles läuft lokal. + +## Wie man einen Micro PDF417‑Barcode mit Aspose.BarCode erstellt + +Der Kern des Prozesses ist ein **Barcode‑Generator**‑Objekt, das weiß, wie Micro PDF417‑Daten zu kodieren sind. Die folgenden Abschnitte zerlegen jeden Konfigurationsschritt. + +### Schritt 1: Initialisieren des Barcode‑Generators + +Zuerst importieren Sie die erforderlichen Namespaces und erstellen eine Instanz von `BarcodeGenerator` mit dem Enum `EncodeTypes.MicroPdf417`. Das zweite Argument ist der Text, den Sie kodieren möchten. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Warum das wichtig ist:** Die Klasse `BarcodeGenerator` kapselt die gesamte Kodierungslogik. Durch die Auswahl von `EncodeTypes.MicroPdf417` wird der Bibliothek mitgeteilt, die kompakte Micro PDF417‑Symbolik zu verwenden, die auf 1‑4 Spalten beschränkt ist. + +### Schritt 2: Konfigurieren der X‑Dimension (Modulbreite) + +Die **X‑Dimension** steuert die Breite eines einzelnen Barcode‑Moduls in Pixeln. Ein kleinerer Wert erzeugt einen dichteren Barcode, während ein größerer Wert die Lesbarkeit auf Niedrigauflösungs‑Druckern verbessert. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Tipp:** Werte zwischen 1 und 4 funktionieren für die meisten Bildschirme gut. Wenn Sie auf einem Thermodrucker drucken wollen, testen Sie 3–4 Pixel, um Unschärfen zu vermeiden. + +### Schritt 3: Festlegen der Spaltenanzahl + +Micro PDF417 unterstützt 1‑4 Spalten. Mehr Spalten machen den Barcode kürzer, erhöhen aber seine Höhe. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Warum 4 Spalten wählen?** Mit vier Spalten nimmt der Barcode den wenigsten horizontalen Raum ein, was ideal für schmale Etiketten ist. Wenn Sie einen höheren, aber schmaleren Barcode benötigen, reduzieren Sie die Spaltenanzahl. + +### Schritt 4: Barcode als PNG‑Bild speichern + +Zum Schluss schreiben Sie den Barcode in eine Datei. PNG bewahrt die exakt konfigurierten Pixelmaße. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Nach dem Ausführen des Programms öffnen Sie `MicroPdf417.png`, um das Ergebnis zu sehen. Das Bild sollte einen klaren Micro PDF417‑Barcode zeigen, der den Beispieltext kodiert. + +#### Erwartete Ausgabe + +![Erstellter Micro PDF417‑Barcode](/images/micro-pdf417-sample.png "Micro PDF417‑Barcode in C# erstellen – Beispielausgabe") + +Die PNG‑Datei enthält einen Barcode mit: + +- X‑Dimension von 2 px +- 4 Spalten +- UTF‑8‑kodiertem Text `"Åspóse.Barcóde©"` + +### Optional: GS1‑konformen Micro PDF417 erzeugen + +Falls Ihre Anwendung **GS1‑konforme Barcode**‑Daten** benötigt (für Lieferketten‑Standards), aktivieren Sie die GS1‑Kodierung vor dem Speichern: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Erklärung:** Das Setzen von `IsGS1` weist Aspose.BarCode an, den GS1‑Header vorzupendeln und die korrekten Prüfsummenregeln anzuwenden. Das ist essenziell, wenn Ihr Barcode von GS1‑fähigen Lesegeräten gescannt wird. + +## Vollständiges, ausführbares Beispiel + +Unten finden Sie eine komplette Konsolenanwendung, die Sie kopieren, einfügen und ausführen können. Sie enthält alle notwendigen `using`‑Anweisungen, Fehlerbehandlung und Kommentare. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Ausführen des Codes:** +1. Erstellen Sie ein neues .NET‑Konsolenprojekt (`dotnet new console`). +2. Fügen Sie das Aspose.BarCode‑Paket hinzu (`dotnet add package Aspose.BarCode`). +3. Ersetzen Sie die erzeugte `Program.cs` durch den obigen Code. +4. Passen Sie bei Bedarf den Ausgabepfad an und führen Sie das Projekt aus (`dotnet run`). + +Sie sollten eine Konsolennachricht sehen, die den Speicherort der Datei bestätigt, und das PNG enthält den **Micro PDF417‑Barcode**, den Sie gerade erstellt haben. + +## Häufige Stolperfallen und bewährte Tipps + +- **Unicode‑Verarbeitung:** Aspose.BarCode kodiert UTF‑8‑Zeichen automatisch, stellen Sie jedoch sicher, dass Ihre Quelldatei mit UTF‑8 gespeichert ist, um beschädigte Symbole zu vermeiden. +- **Spaltenbeschränkungen:** Das Setzen von `Columns` auf einen Wert außerhalb von 1‑4 löst eine `ArgumentException` aus. Validieren Sie Benutzereingaben, wenn Sie diese Einstellung in einer UI anbieten. +- **Bildauflösung:** PNG ist verlustfrei, aber wenn Sie ein hochauflösendes Vektorformat benötigen, verwenden Sie stattdessen `BarCodeImageFormat.Svg`. +- **GS1‑Datenlänge:** GS1‑konforme Micro PDF417 haben strengere Längenbeschränkungen. Vergewissern Sie sich, dass die kodierte Zeichenkette die maximal zulässige Länge des Standards nicht überschreitet (typischerweise 90 Zeichen für Micro PDF417). + +## Fazit + +Sie wissen jetzt, wie Sie **einen Micro PDF417‑Barcode** in C# mit Aspose.BarCode **erstellen**. Das Tutorial behandelte die Initialisierung eines **Barcode‑Generators**, das Setzen der **X‑Dimension‑Pixel**, die Auswahl der Spaltenanzahl, das Speichern des Bildes und optional das Aktivieren von **GS1‑konformen Barcode**‑Funktionen. + +Ab hier können Sie mit verschiedenen Texteingaben experimentieren, die X‑Dimension für unterschiedliche Druckauflösungen anpassen oder auf SVG‑Ausgabe umstellen, um skalierbare Grafiken zu erhalten. Wenn Sie andere 2‑D‑Symboliken erzeugen möchten, schauen Sie sich `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` oder `EncodeTypes.QR` an – das gleiche Konfigurationsmuster gilt. + +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 Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/german/net/one-dimensional-barcode-types/_index.md index b2fd5ba30..5ab576a16 100644 --- a/barcode/german/net/one-dimensional-barcode-types/_index.md +++ b/barcode/german/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ Erfahren Sie, wie Sie mit Aspose.BarCode für .NET Barcodes in .NET generieren. Erfahren Sie, wie Sie Ausnahmen beim Generieren eindimensionaler Barcodes mit Aspose.BarCode für .NET behandeln. Diese Schritt-für-Schritt-Anleitung sorgt für fehlertolerante Barcode-Lösungen. Jetzt loslegen! ### [Eindimensionale Breit-Schmal-Verhältnis-Konfiguration](./one-dimensional-wide-narrow-ratio-configuration/) Generieren Sie ganz einfach individuelle Barcodes mit Aspose.BarCode für .NET. Schritt-für-Schritt-Anleitung für die eindimensionale Breit-Schmal-Verhältniskonfiguration. +### [Barcode aus Bild in C# lesen – BarCodeReader‑Tutorial](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Erfahren Sie, wie Sie mit Aspose.BarCode Barcodes aus Bildern in C# auslesen. ## Abschluss @@ -89,4 +91,4 @@ Mit diesem Artikel erwerben Sie nicht nur Kenntnisse über verschiedene eindimen {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/german/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/german/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..07c75d825 --- /dev/null +++ b/barcode/german/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,259 @@ +--- +category: general +date: 2026-08-15 +description: Barcode aus Bild in C# mit BarCodeReader lesen. Erfahren Sie, wie man + mehrere Barcodes in C# liest, den PDF417‑Barcode ausliest und ein vollständiges + C#‑BarCodeReader‑Beispiel sieht. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: de +lastmod: 2026-08-15 +og_description: Lesen Sie Barcodes aus einem Bild in C# mit einer Schritt‑für‑Schritt‑Anleitung. + Erfahren Sie, wie Sie mehrere Barcodes in C# lesen, PDF417‑Symbole dekodieren und + ein komplettes C# BarCodeReader‑Beispiel ausführen. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Barcode aus Bild in C# auslesen – BarCodeReader‑Tutorial +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Barcode aus Bild in C# auslesen – BarCodeReader‑Tutorial +url: /de/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Barcode aus Bild in C# lesen – BarCodeReader‑Tutorial + +Wenn Sie **einen Barcode aus einem Bild** in einer .NET‑Anwendung lesen müssen, zeigt Ihnen diese Anleitung genau, wie Sie das mit der Klasse `BarCodeReader` erledigen. Sie erfahren außerdem, wie Sie **mehrere Barcodes in C# lesen**, ein PDF417‑Symbol dekodieren und ein vollständiges **C# BarCodeReader‑Beispiel** erhalten, das Sie in Ihr Projekt übernehmen können. + +Das Tutorial behandelt jeden Schritt – vom Hinzufügen des erforderlichen NuGet‑Pakets bis zum Ausgeben erweiterter PDF417‑Felder – sodass Sie am Ende ein lauffähiges Konsolenprogramm besitzen. Keine externe Dokumentation ist nötig; sämtlicher Code und alle Erklärungen sind enthalten. + +## Was Sie benötigen + +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 ein beliebiger C#‑kompatibler Editor +* Das NuGet‑Paket `Aspose.BarCode` (oder die entsprechende Bibliothek, die `BarCodeReader` bereitstellt) +* Eine Bilddatei, die einen Macro PDF417‑Barcode enthält (z. B. `ExtPDF417Meta.png`) + +Diese Voraussetzungen gewährleisten, dass das Beispiel ohne zusätzliche Konfiguration kompiliert. + +## Barcode aus Bild mit BarCodeReader lesen + +Der erste Schritt besteht darin, eine `BarCodeReader`‑Instanz zu erstellen, die auf die Bilddatei zeigt und der Bibliothek mitteilt, welchen Barcode‑Typ sie suchen soll. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Warum das funktioniert:** +`BarCodeReader` öffnet das Bild, scannt nach dem angegebenen `DecodeType` und liefert eine Sammlung von `BarCodeResult`‑Objekten. Jeder Treffer enthält die generischen Barcode‑Daten (`CodeTypeName`, `CodeText`) und bei Macro PDF417 ein `Extended.Pdf417`‑Objekt, das alle zusätzlichen Felder des Standards bereitstellt. + +## Mehrere Barcodes in C# aus einem Bild lesen + +Manchmal enthält ein Bild mehr als einen Barcode (z. B. einen QR‑Code neben einem PDF417). Um dieses Szenario zu behandeln, lassen Sie einfach den expliziten `DecodeType` weg oder übergeben `DecodeType.AllSupported` und iterieren über die Ergebnisse. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Warum Sie das benötigen:** +Die Angabe von `AllSupported` veranlasst die Engine, jedes ihr bekannte Barcode‑Format zu prüfen, sodass Sie jedes Symbol im Bild erfassen. Dies ist der empfohlene Ansatz, wenn Sie die Barcode‑Typen im Voraus nicht kennen. + +## PDF417‑Barcode in C# lesen + +Falls Sie nur das klassische PDF417 (ohne Macro) benötigen, ändern Sie den `DecodeType` zu `Pdf417`. Der restliche Code bleibt identisch, jedoch stehen die erweiterten Felder nicht zur Verfügung. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Warum das wichtig ist:** +Das klassische PDF417 stellt keine macro‑spezifischen Eigenschaften bereit, sodass der `Extended.Pdf417`‑Block überflüssig ist. Die präzise Angabe des `DecodeType` beschleunigt zudem das Scannen, weil die Bibliothek nicht unterstützte Algorithmen überspringt. + +## Vollständiges C# BarCodeReader‑Beispiel zum Kopieren + +Unten finden Sie das komplette Programm, das die drei Szenarien zu einer leicht ausführbaren Konsolenanwendung kombiniert. Ersetzen Sie `YOUR_DIRECTORY/ExtPDF417Meta.png` durch den tatsächlichen Pfad zu Ihrem Bild. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Erwartete Ausgabe + +Enthält das Beispielbild einen Macro PDF417‑Barcode, gibt die Konsole etwa Folgendes aus: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Enthält das Bild nur ein reguläres PDF417, bleibt der Abschnitt „Macro PDF417“ leer und der Abschnitt „Classic PDF417“ zeigt den dekodierten Text an. + +## Fazit + +Sie wissen jetzt, wie Sie **einen Barcode aus einem Bild** in C# mit `BarCodeReader` lesen, wie Sie **mehrere Barcodes in C#** aus einer einzigen Datei auslesen und welche Schritte nötig sind, um **PDF417‑Barcodes** – sowohl Macro‑ als auch klassische Varianten – zu lesen. Das vollständige **C# BarCodeReader‑Beispiel** kann in jedes .NET‑Projekt eingefügt werden; Sie können es erweitern, um weitere Formate zu unterstützen oder in eine größere Bildverarbeitungspipeline zu integrieren. + +**Nächste Schritte** + +* Erkunden Sie Fehlerbehandlungsmuster wie `try / catch` rund um den Reader‑Block. +* Experimentieren Sie mit dem Objekt `ReaderParameters`, um Erkennungs‑Geschwindigkeit und Genauigkeit zu optimieren. +* Kombinieren Sie das Barcode‑Lesen mit Bild‑Preprocessing‑Bibliotheken ( + +## 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 Implementierungsansätze in Ihren eigenen Projekten erkunden können. + +- [Wie man DataMatrix‑Barcodes mit Aspose.BarCode für .NET liest](/barcode/english/net/datamatrix-barcode-reading/) +- [DataMatrix‑Barcode in C# lesen – DataMatrix‑Modus (Auto) generieren](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Barcode aus Bild lesen – Barcode‑Regionsextraktion in Java mit Aspose.BarCode meistern](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/greek/net/compact-pdf417-encoding/_index.md index 06b8d9294..937710cc3 100644 --- a/barcode/greek/net/compact-pdf417-encoding/_index.md +++ b/barcode/greek/net/compact-pdf417-encoding/_index.md @@ -46,7 +46,7 @@ weight: 29 - **Λειτουργία Συμπαγούς:** Αφαιρεί περιττές προσθήκες, δημιουργώντας έναν μικρότερο κώδικα χωρίς να θυσιάζει την αναγνωσιμότητα. ### Επιλογές Διόρθωσης Σφαλμάτων PDF417 -Το Aspose.BarCode σας επιτρέπει να ορίσετε την ιδιότητα `Pdf417ErrorCorrectionLevel` (0‑8). Τα υψηλότερα επίπεδα αυξάνουν τον πλεονασμό, κάτι χρήσιμο σε σκληρά περιβάλλοντα όπως η βιομηχανική σάρωση. Επιλέξτε επίπεδο βάσει της ανοχή σας στον κίνδυνο και των περιορισμών χώρου. +Το Aspose.BarCode σας επιτρέπει να ορίσετε την ιδιότητα `Pdf417ErrorCorrectionLevel` (0‑8). Τα υψηλότερα επίπεδα αυξάνουν τον πλεονασμό, κάτι χρήσιμο σε σκληρά περιβάλλοντα όπως η βιομηχανική σάρωση. Επιλέξτε επίπεδο βάσει της ανοχής σας στον κίνδυνο και των περιορισμών χώρου. ## Δημιουργία Συμπαγών PDF417 Κωδικών με το Aspose.BarCode for .NET @@ -84,7 +84,7 @@ weight: 29 ## Συμμετοχικά Σεμινάρια Συμπαγούς PDF417 ### [Δημιουργία Συμπαγών PDF417 Κωδικών](./compact-pdf417-basic-configuration/) -Μάθετε πώς να δημιουργείτε Συμπαγείς PDF417 κωδικούς χρησιμοποιώντας το Aspose.BarCode for .NET. Αναλυτικός οδηγός με βήμα‑βήμα οδηγίες και παραδείγματα κώδικα. +### [Δημιουργία μικρού κώδικα PDF417 σε C# – βήμα‑βήμα οδηγός](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) ## Συχνές Ερωτήσεις @@ -114,4 +114,4 @@ weight: 29 {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/greek/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/greek/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..609daeb75 --- /dev/null +++ b/barcode/greek/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,246 @@ +--- +category: general +date: 2026-08-15 +description: Δημιουργήστε μικρο‑PDF417 barcode σε C# γρήγορα με το Aspose.BarCode. + Μάθετε πώς να χρησιμοποιείτε τη γεννήτρια barcode, να ορίζετε τη διάσταση X, να + επιλέγετε στήλες και να ενεργοποιείτε τη συμμόρφωση με το GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: el +lastmod: 2026-08-15 +og_description: Δημιουργήστε μικρο‑PDF417 barcode σε C# με το Aspose.BarCode. Ακολουθήστε + αυτό το σεμινάριο για να ρυθμίσετε τον δημιουργό κωδικών, να ορίσετε τις διαστάσεις + και να παραγάγετε μια εικόνα PNG. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Δημιουργία μικρο‑PDF417 barcode σε C# – πλήρης οδηγός προγραμματισμού +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Δημιουργία μικρο‑κώδικα PDF417 σε C# – οδηγός βήμα‑προς‑βήμα +url: /el/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Δημιουργία μικρο‑PDF417 barcode σε C# – βήμα‑βήμα οδηγός + +Αν χρειάζεστε **δημιουργία μικρο‑PDF417 barcode** σε C#, αυτός ο οδηγός σας δείχνει ακριβώς πώς. Θα περάσουμε από την αρχικοποίηση ενός **barcode generator**, τη ρύθμιση της **X‑διάστασης**, την επιλογή του αριθμού στηλών και την αποθήκευση του αποτελέσματος ως αρχείο PNG. + +Η δημιουργία ενός Micro PDF417 barcode είναι χρήσιμη για συμπαγή κωδικοποίηση δεδομένων σε μικρές ετικέτες, εισιτήρια ή συσκευές IoT. Στο τέλος αυτού του tutorial θα έχετε ένα πλήρες, εκτελέσιμο παράδειγμα που μπορείτε να ενσωματώσετε σε οποιοδήποτε .NET project. + +## What you’ll need + +Πριν ξεκινήσετε, βεβαιωθείτε ότι έχετε: + +- .NET 6.0 (ή νεότερο) εγκατεστημένο – ο κώδικας λειτουργεί επίσης με .NET Framework 4.6+. +- Τη βιβλιοθήκη Aspose.BarCode for .NET (διαθέσιμη μέσω NuGet `Aspose.BarCode`). +- Ένα περιβάλλον ανάπτυξης όπως το Visual Studio 2022 ή το VS Code. + +Δεν απαιτούνται πρόσθετες εξωτερικές υπηρεσίες· όλα εκτελούνται τοπικά. + +## How to create micro PDF417 barcode with Aspose.BarCode + +Ο πυρήνας της διαδικασίας είναι ένα αντικείμενο **barcode generator** που γνωρίζει πώς να κωδικοποιήσει δεδομένα Micro PDF417. Οι παρακάτω ενότητες εξηγούν βήμα‑βήμα κάθε ρύθμιση. + +### Step 1: Initialize the barcode generator + +Πρώτα, εισάγετε τα απαιτούμενα namespaces και δημιουργήστε μια παρουσία του `BarcodeGenerator` με το enum `EncodeTypes.MicroPdf417`. Το δεύτερο όρισμα είναι το κείμενο που θέλετε να κωδικοποιήσετε. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Why this matters:** Η κλάση `BarcodeGenerator` περιλαμβάνει όλη τη λογική κωδικοποίησης. Η επιλογή `EncodeTypes.MicroPdf417` λέει στη βιβλιοθήκη να χρησιμοποιήσει τη συμπαγή συμβολική Micro PDF417, η οποία περιορίζεται σε 1‑4 στήλες. + +### Step 2: Configure the X‑dimension (module width) + +Η **X‑διάσταση** ελέγχει το πλάτος ενός μονάδα barcode σε pixel. Μικρότερη τιμή παράγει πιο πυκνό barcode, ενώ μεγαλύτερη τιμή βελτιώνει την αναγνωσιμότητα σε εκτυπωτές χαμηλής ανάλυσης. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Tip:** Τιμές μεταξύ 1 και 4 λειτουργούν καλά για τις περισσότερες οθόνες. Αν σκοπεύετε να εκτυπώσετε σε θερμικό εκτυπωτή, δοκιμάστε 3–4 pixel για να αποφύγετε το θόλωμα. + +### Step 3: Set the number of columns + +Το Micro PDF417 υποστηρίζει 1‑4 στήλες. Περισσότερες στήλες κάνουν το barcode πιο σύντομο αλλά αυξάνουν το ύψος του. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Why choose 4 columns?** Με τέσσερις στήλες το barcode καταλαμβάνει τον ελάχιστο οριζόντιο χώρο, κάτι ιδανικό για στενές ετικέτες. Αν χρειάζεστε ένα ψηλότερο αλλά πιο στενό barcode, μειώστε τον αριθμό των στηλών. + +### Step 4: Save the barcode as a PNG image + +Τέλος, γράψτε το barcode σε αρχείο. Το PNG διατηρεί τις ακριβείς διαστάσεις pixel που ρυθμίσατε. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Αφού εκτελέσετε το πρόγραμμα, ανοίξτε το `MicroPdf417.png` για να δείτε το αποτέλεσμα. Η εικόνα πρέπει να εμφανίζει ένα καθαρό Micro PDF417 barcode που κωδικοποιεί το δείγμα κειμένου. + +#### Expected output + +![Δημιουργημένο μικρο‑PDF417 barcode](/images/micro-pdf417-sample.png "Δημιουργία μικρο‑PDF417 barcode σε C# – παράδειγμα εξόδου") + +Το αρχείο PNG περιέχει barcode με: + +- X‑διάσταση 2 px +- 4 στήλες +- Κείμενο κωδικοποιημένο σε UTF‑8 `"Åspóse.Barcóde©"` + +### Optional: generate a GS1‑compliant Micro PDF417 + +Αν η εφαρμογή σας απαιτεί **GS1‑συμβατό barcode** (για πρότυπα εφοδιαστικής αλυσίδας), ενεργοποιήστε την κωδικοποίηση GS1 πριν την αποθήκευση: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Explanation:** Η ρύθμιση `IsGS1` λέει στο Aspose.BarCode να προσθέσει το GS1 header και να εφαρμόσει τους σωστούς κανόνες ελέγχου. Αυτό είναι απαραίτητο όταν το barcode θα διαβαστεί από αναγνώστες που υποστηρίζουν GS1. + +## Full, runnable example + +Παρακάτω υπάρχει μια πλήρης εφαρμογή console που μπορείτε να αντιγράψετε, επικολλήσετε και να τρέξετε. Περιλαμβάνει όλες τις απαραίτητες δηλώσεις `using`, διαχείριση σφαλμάτων και σχόλια. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Running the code:** +1. Δημιουργήστε ένα νέο .NET console project (`dotnet new console`). +2. Προσθέστε το πακέτο Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. Αντικαταστήστε το παραγόμενο `Program.cs` με τον κώδικα παραπάνω. +4. Προσαρμόστε το μονοπάτι εξόδου αν χρειάζεται και τρέξτε (`dotnet run`). + +Θα πρέπει να δείτε ένα μήνυμα στην κονσόλα που επιβεβαιώνει τη θέση του αρχείου, και το PNG θα περιέχει το **micro PDF417 barcode** που μόλις δημιουργήσατε. + +## Common pitfalls and best‑practice tips + +- **Unicode handling:** Το Aspose.BarCode κωδικοποιεί αυτόματα χαρακτήρες UTF‑8, αλλά βεβαιωθείτε ότι το αρχείο πηγής σας είναι αποθηκευμένο σε κωδικοποίηση UTF‑8 για να αποφύγετε κατεστραμμένα σύμβολα. +- **Column limits:** Η προσπάθεια να ορίσετε `Columns` σε τιμή εκτός 1‑4 προκαλεί `ArgumentException`. Επικυρώστε την είσοδο του χρήστη αν εκθέτετε αυτή τη ρύθμιση σε UI. +- **Image resolution:** Το PNG είναι lossless, αλλά αν χρειάζεστε υψηλότερη ανάλυση σε διανυσματική μορφή, χρησιμοποιήστε `BarCodeImageFormat.Svg`. +- **GS1 data length:** Τα GS1‑συμβατά Micro PDF417 έχουν πιο αυστηρούς περιορισμούς μήκους. Επαληθεύστε ότι η κωδικοποιημένη συμβολοσειρά δεν υπερβαίνει το μέγιστο επιτρεπτό από το πρότυπο (συνήθως 90 χαρακτήρες για Micro PDF417). + +## Conclusion + +Τώρα ξέρετε πώς να **δημιουργήσετε micro PDF417 barcode** σε C# χρησιμοποιώντας το Aspose.BarCode. Το tutorial κάλυψε την αρχικοποίηση ενός **barcode generator**, τη ρύθμιση της **X‑διάστασης σε pixel**, την επιλογή του αριθμού στηλών, την αποθήκευση της εικόνας και προαιρετικά την ενεργοποίηση **GS1‑συμβατών χαρακτηριστικών**. + +Από εδώ μπορείτε να πειραματιστείτε με διαφορετικά κείμενα, να προσαρμόσετε την X‑διάσταση για διάφορες αναλύσεις εκτύπωσης ή να μεταβείτε σε έξοδο SVG για κλιμακώσιμα γραφικά. Αν χρειάζεστε δημιουργία άλλων 2‑Δ συμβολών, εξερευνήστε `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` ή `EncodeTypes.QR`—το ίδιο πρότυπο ρύθμισης ισχύει. + +Καλή προγραμματιστική! + +## What Should You Learn Next? + +Τα παρακάτω tutorials καλύπτουν στενά σχετικά θέματα που επεκτείνουν τις τεχνικές που παρουσιάστηκαν σε αυτόν τον οδηγό. Κάθε πόρος περιλαμβάνει πλήρη λειτουργικό κώδικα με βήμα‑βήμα εξηγήσεις για να σας βοηθήσει να κυριαρχήσετε επιπλέον δυνατότητες του API και να εξερευνήσετε εναλλακτικές προσεγγίσεις στα δικά σας έργα. + +- [Πώς να δημιουργήσετε Barcode – Compact PDF417 με Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Δημιουργία εικόνας DotCode barcode – γραμμές & στήλες (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Πώς να δημιουργήσετε Quiet Zone για ITF-14 χρησιμοποιώντας Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/greek/net/one-dimensional-barcode-types/_index.md index 42905c3b2..255a5f9e5 100644 --- a/barcode/greek/net/one-dimensional-barcode-types/_index.md +++ b/barcode/greek/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ url: /el/net/one-dimensional-barcode-types/ Μάθετε πώς να χειρίζεστε τις εξαιρέσεις κατά τη δημιουργία μονοδιάστατων γραμμωτών κωδίκων χρησιμοποιώντας το Aspose.BarCode για .NET. Αυτός ο οδηγός βήμα προς βήμα διασφαλίζει λύσεις γραμμωτού κώδικα ανεκτικές σε σφάλματα. Ξεκινήστε τώρα! ### [Μονοδιάστατη διαμόρφωση ευρείας-στενής αναλογίας](./one-dimensional-wide-narrow-ratio-configuration/) Δημιουργήστε εύκολα προσαρμοσμένους γραμμικούς κώδικες με το Aspose.BarCode για .NET. Οδηγός βήμα προς βήμα για μονοδιάστατη διαμόρφωση ευρείας-στενής αναλογίας. +### [Ανάγνωση barcode από εικόνα σε C# – BarCodeReader tutorial](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Μάθετε πώς να διαβάζετε barcode από εικόνα σε C# χρησιμοποιώντας το BarCodeReader του Aspose.BarCode. ## συμπέρασμα @@ -89,4 +91,4 @@ url: /el/net/one-dimensional-barcode-types/ {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/greek/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/greek/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..5fca173bd --- /dev/null +++ b/barcode/greek/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,258 @@ +--- +category: general +date: 2026-08-15 +description: Διαβάστε γραμμωτό κώδικα από εικόνα σε C# χρησιμοποιώντας το BarCodeReader. + Μάθετε πώς να διαβάζετε πολλαπλούς γραμμωτούς κώδικες σε C#, πώς να διαβάζετε τον + κώδικα PDF417 και δείτε ένα πλήρες παράδειγμα BarCodeReader σε C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: el +lastmod: 2026-08-15 +og_description: Διαβάστε γραμμωτό κώδικα από εικόνα σε C# με έναν οδηγό βήμα‑βήμα. + Ανακαλύψτε πώς να διαβάζετε πολλαπλούς γραμμωτούς κώδικες σε C#, να αποκωδικοποιείτε + σύμβολα PDF417 και να εκτελείτε ένα πλήρες παράδειγμα C# BarCodeReader. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Ανάγνωση γραμμωτού κώδικα από εικόνα σε C# – Εγχειρίδιο BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Ανάγνωση barcode από εικόνα σε C# – Οδηγός BarCodeReader +url: /el/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Ανάγνωση barcode από εικόνα σε C# – tutorial BarCodeReader + +Αν χρειάζεστε **ανάγνωση barcode από εικόνα** σε μια εφαρμογή .NET, αυτός ο οδηγός σας δείχνει ακριβώς πώς να το κάνετε με την κλάση `BarCodeReader`. Θα δείτε επίσης πώς να **διαβάσετε πολλαπλά barcodes C#**, να αποκωδικοποιήσετε ένα σύμβολο PDF417 και να αποκτήσετε ένα πλήρες **παράδειγμα C# BarCodeReader** που μπορείτε να αντιγράψετε στο έργο σας. + +Το tutorial καλύπτει κάθε βήμα—από την προσθήκη του απαιτούμενου πακέτου NuGet μέχρι την εκτύπωση εκτεταμένων πεδίων PDF417—ώστε να ολοκληρώσετε με ένα εκτελέσιμο πρόγραμμα κονσόλας. Δεν απαιτείται εξωτερική τεκμηρίωση· όλος ο κώδικας και οι εξηγήσεις περιλαμβάνονται. + +## Τι θα χρειαστείτε + +Πριν ξεκινήσετε, βεβαιωθείτε ότι έχετε: + +* .NET 6.0 SDK ή νεότερο (ο κώδικας λειτουργεί με .NET Core και .NET Framework) +* Visual Studio 2022 ή οποιονδήποτε επεξεργαστή συμβατό με C# +* Το πακέτο NuGet `Aspose.BarCode` (ή την ισοδύναμη βιβλιοθήκη που παρέχει το `BarCodeReader`) +* Ένα αρχείο εικόνας που περιέχει ένα Macro PDF417 barcode (π.χ., `ExtPDF417Meta.png`) + +Η ύπαρξη αυτών των προαπαιτούμενων διασφαλίζει ότι το δείγμα θα μεταγλωττιστεί χωρίς πρόσθετη ρύθμιση. + +## Ανάγνωση barcode από εικόνα με BarCodeReader + +Το πρώτο βήμα είναι η δημιουργία μιας στιγμής `BarCodeReader` που δείχνει στο αρχείο εικόνας και λέει στη βιβλιοθήκη ποιος τύπος barcode πρέπει να αναζητηθεί. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Γιατί λειτουργεί αυτό:** +`BarCodeReader` ανοίγει την εικόνα, σαρώει για το καθορισμένο `DecodeType` και επιστρέφει μια συλλογή αντικειμένων `BarCodeResult`. Κάθε αποτέλεσμα περιέχει τα γενικά δεδομένα barcode (`CodeTypeName`, `CodeText`) και, για Macro PDF417, ένα αντικείμενο `Extended.Pdf417` που εκθέτει όλα τα πρόσθετα πεδία που ορίζονται από το πρότυπο. + +## Ανάγνωση πολλαπλών barcodes C# σε μία εικόνα + +Μερικές φορές μια εικόνα περιέχει περισσότερα από ένα barcode (π.χ., QR code δίπλα σε PDF417). Για να διαχειριστείτε αυτήν την περίπτωση, απλώς παραλείψτε το ρητό `DecodeType` ή περάστε `DecodeType.AllSupported` και κάντε βρόχο στα αποτελέσματα. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Γιατί το χρειάζεστε:** +Η καθορισμένη τιμή `AllSupported` λέει στη μηχανή να δοκιμάσει κάθε μορφή barcode που γνωρίζει, εξασφαλίζοντας ότι θα συλλάβετε κάθε σύμβολο στην εικόνα. Αυτή είναι η προτεινόμενη προσέγγιση όταν δεν μπορείτε να προβλέψετε εκ των προτέρων τους τύπους barcode. + +## Πώς να διαβάσετε barcode PDF417 χρησιμοποιώντας C# + +Αν σας ενδιαφέρει μόνο η κλασική μορφή PDF417 (μη‑macro), αλλάξτε το `DecodeType` σε `Pdf417`. Το υπόλοιπο του κώδικα παραμένει ίδιο, εκτός από το ότι τα εκτεταμένα πεδία δεν είναι διαθέσιμα. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Γιατί έχει σημασία:** +Η κλασική PDF417 δεν εκθέτει τις ιδιότητες που αφορούν το macro, επομένως το τμήμα `Extended.Pdf417` είναι περιττό. Η χρήση του ακριβούς `DecodeType` επίσης επιταχύνει τη σάρωση επειδή η βιβλιοθήκη παραλείπει αλγόριθμους που δεν υποστηρίζονται. + +## Πλήρες παράδειγμα C# BarCodeReader που μπορείτε να αντιγράψετε + +Παρακάτω βρίσκεται το πλήρες πρόγραμμα που συνδυάζει τα τρία σενάρια σε μια ενιαία, εύκολη στην εκτέλεση εφαρμογή κονσόλας. Αντικαταστήστε το `YOUR_DIRECTORY/ExtPDF417Meta.png` με την πραγματική διαδρομή της εικόνας σας. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Αναμενόμενη έξοδος + +Όταν η δείγμα εικόνας περιέχει ένα Macro PDF417 barcode, η κονσόλα εκτυπώνει κάτι παρόμοιο με: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Αν η εικόνα περιέχει μόνο ένα κανονικό PDF417, η ενότητα “Macro PDF417” θα είναι κενή, και η ενότητα “Classic PDF417” θα εμφανίσει το αποκωδικοποιημένο κείμενο. + +## Συμπέρασμα + +Τώρα ξέρετε πώς να **διαβάζετε barcode από εικόνα** σε C# χρησιμοποιώντας το `BarCodeReader`, πώς να **διαβάζετε πολλαπλά barcodes C#** σε ένα αρχείο, και τα ακριβή βήματα για **ανάγνωση barcode PDF417**—και στις macro και στις κλασικές εκδοχές. Το πλήρες **παράδειγμα C# BarCodeReader** είναι έτοιμο να επικολληθεί σε οποιοδήποτε έργο .NET, και μπορείτε να το επεκτείνετε για να υποστηρίξετε άλλες μορφές ή να το ενσωματώσετε σε μια μεγαλύτερη αλυσίδα επεξεργασίας εικόνας. + +**Επόμενα βήματα** + +* Εξερευνήστε μοτίβα διαχείρισης σφαλμάτων όπως `try / catch` γύρω από το μπλοκ του αναγνώστη. +* Πειραματιστείτε με το αντικείμενο `ReaderParameters` για να ρυθμίσετε την ταχύτητα και την ακρίβεια ανίχνευσης. +* Συνδυάστε την ανάγνωση barcode με βιβλιοθήκες προεπεξεργασίας εικόνας ( + +## Τι πρέπει να μάθετε στη συνέχεια; + +Τα παρακάτω tutorials καλύπτουν στενά σχετιζόμενα θέματα που επεκτείνουν τις τεχνικές που παρουσιάστηκαν σε αυτόν τον οδηγό. Κάθε πόρος περιλαμβάνει πλήρη λειτουργικά παραδείγματα κώδικα με βήμα‑βήμα εξηγήσεις για να σας βοηθήσουν να κυριαρχήσετε επιπλέον δυνατότητες API και να εξερευνήσετε εναλλακτικές προσεγγίσεις υλοποίησης στα δικά σας έργα. + +- [How to Read DataMatrix Barcodes with Aspose.BarCode for .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Read DataMatrix barcode C# – Generate DataMatrix Mode (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Read Barcode from Image – Mastering Barcode Region Extraction in Java with Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/hindi/net/compact-pdf417-encoding/_index.md index 7df391155..2eed07131 100644 --- a/barcode/hindi/net/compact-pdf417-encoding/_index.md +++ b/barcode/hindi/net/compact-pdf417-encoding/_index.md @@ -86,6 +86,10 @@ Aspose.BarCode आपको `Pdf417ErrorCorrectionLevel` प्रॉपर् Aspose.BarCode for .NET का उपयोग करके Compact PDF417 बारकोड कैसे जनरेट करें सीखें। चरण‑दर‑चरण निर्देशों और कोड उदाहरणों के साथ व्यापक गाइड। +### [C# में माइक्रो PDF417 बारकोड बनाना – चरण‑दर‑चरण गाइड](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) + +Aspose.BarCode for .NET का उपयोग करके C# में माइक्रो PDF417 बारकोड कैसे बनाएं, चरण‑दर‑चरण सीखें। + ## अक्सर पूछे जाने वाले प्रश्न **Q: Compact PDF417 बारकोड में मैं अधिकतम कितना डेटा स्टोर कर सकता हूँ?** @@ -114,4 +118,4 @@ A: कोई बाहरी फ़ॉन्ट आवश्यक नहीं {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hindi/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/hindi/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..1da53fba4 --- /dev/null +++ b/barcode/hindi/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,245 @@ +--- +category: general +date: 2026-08-15 +description: Aspose.BarCode के साथ C# में माइक्रो PDF417 बारकोड जल्दी बनाएं। बारकोड + जेनरेटर का उपयोग करना, X‑डायमेंशन सेट करना, कॉलम चुनना और GS1 अनुपालन सक्षम करना + सीखें। +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: hi +lastmod: 2026-08-15 +og_description: Aspose.BarCode के साथ C# में माइक्रो PDF417 बारकोड बनाएं। इस ट्यूटोरियल + का पालन करके बारकोड जेनरेटर को कॉन्फ़िगर करें, आयाम सेट करें, और PNG इमेज बनाएं। +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: C# में माइक्रो PDF417 बारकोड बनाएं – पूर्ण प्रोग्रामिंग गाइड +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: C# में माइक्रो PDF417 बारकोड बनाएं – चरण‑दर‑चरण मार्गदर्शिका +url: /hi/net/compact-pdf417-encoding/create-micro-pdf417-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# में माइक्रो PDF417 बारकोड बनाएं – चरण‑दर‑चरण गाइड + +यदि आपको C# में **माइक्रो PDF417 बारकोड** बनाना है, तो यह गाइड आपको ठीक‑ठीक दिखाता है। हम **बारकोड जेनरेटर** को इनिशियलाइज़ करने, **X‑डायमेंशन** को कॉन्फ़िगर करने, कॉलम काउंट चुनने, और परिणाम को PNG फ़ाइल के रूप में सेव करने की प्रक्रिया को चरण‑दर‑चरण समझेंगे। + +माइक्रो PDF417 बारकोड बनाना छोटे लेबल, टिकट या IoT डिवाइसों पर कॉम्पैक्ट डेटा एन्कोडिंग के लिए उपयोगी है। इस ट्यूटोरियल के अंत तक आपके पास एक पूर्ण, चलाने योग्य उदाहरण होगा जिसे आप किसी भी .NET प्रोजेक्ट में डाल सकते हैं। + +## आपको क्या चाहिए + +शुरू करने से पहले सुनिश्चित करें कि आपके पास है: + +- .NET 6.0 (या बाद का) इंस्टॉल हो – कोड .NET Framework 4.6+ के साथ भी काम करता है। +- Aspose.BarCode for .NET लाइब्रेरी (NuGet `Aspose.BarCode` के माध्यम से उपलब्ध)। +- Visual Studio 2022 या VS Code जैसा डेवलपमेंट एनवायरनमेंट। + +कोई अतिरिक्त बाहरी सर्विसेज़ आवश्यक नहीं हैं; सब कुछ लोकली चलता है। + +## Aspose.BarCode के साथ माइक्रो PDF417 बारकोड कैसे बनाएं + +इस प्रक्रिया का मूल भाग एक **बारकोड जेनरेटर** ऑब्जेक्ट है जो माइक्रो PDF417 डेटा को एन्कोड करना जानता है। नीचे प्रत्येक कॉन्फ़िगरेशन स्टेप को विस्तार से बताया गया है। + +### चरण 1: बारकोड जेनरेटर को इनिशियलाइज़ करें + +पहले आवश्यक नेमस्पेस इम्पोर्ट करें और `EncodeTypes.MicroPdf417` एनेम के साथ `BarcodeGenerator` का एक इंस्टेंस बनाएं। दूसरा आर्ग्यूमेंट वह टेक्स्ट है जिसे आप एन्कोड करना चाहते हैं। + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**यह क्यों महत्वपूर्ण है:** `BarcodeGenerator` क्लास सभी एन्कोडिंग लॉजिक को एन्कैप्सुलेट करती है। `EncodeTypes.MicroPdf417` चुनने से लाइब्रेरी कॉम्पैक्ट माइक्रो PDF417 सिम्बोलॉजी का उपयोग करती है, जो 1‑4 कॉलम तक सीमित है। + +### चरण 2: X‑डायमेंशन (मॉड्यूल चौड़ाई) कॉन्फ़िगर करें + +**X‑डायमेंशन** एक सिंगल बारकोड मॉड्यूल की चौड़ाई को पिक्सेल में नियंत्रित करता है। छोटा वैल्यू बारकोड को अधिक टाइट बनाता है, जबकि बड़ा वैल्यू लो‑रिज़ॉल्यूशन प्रिंटर पर रीडेबिलिटी बढ़ाता है। + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**टिप:** अधिकांश स्क्रीन डिस्प्ले के लिए 1 से 4 के बीच वैल्यू अच्छे काम करते हैं। यदि आप थर्मल प्रिंटर पर प्रिंट करने की योजना बना रहे हैं, तो ब्लरिंग से बचने के लिए 3–4 पिक्सेल पर टेस्ट करें। + +### चरण 3: कॉलम की संख्या सेट करें + +माइक्रो PDF417 1‑4 कॉलम का समर्थन करता है। अधिक कॉलम होने से बारकोड की ऊँचाई बढ़ती है लेकिन क्षैतिज लंबाई कम होती है। + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**4 कॉलम क्यों चुनें?** चार कॉलम होने पर बारकोड सबसे कम क्षैतिज स्पेस लेता है, जो संकरी लेबल के लिए आदर्श है। यदि आपको ऊँचा लेकिन संकरी बारकोड चाहिए, तो कॉलम काउंट कम करें। + +### चरण 4: बारकोड को PNG इमेज के रूप में सेव करें + +अंत में, बारकोड को फ़ाइल में लिखें। PNG आपके द्वारा कॉन्फ़िगर किए गए सटीक पिक्सेल डायमेंशन को संरक्षित रखता है। + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +प्रोग्राम चलाने के बाद, `MicroPdf417.png` खोलें और परिणाम देखें। इमेज में एक स्पष्ट माइक्रो PDF417 बारकोड दिखना चाहिए जो सैंपल टेक्स्ट को एन्कोड करता है। + +#### अपेक्षित आउटपुट + +![माइक्रो PDF417 बारकोड बनाया गया](/images/micro-pdf417-sample.png "C# में माइक्रो PDF417 बारकोड बनाएं – उदाहरण आउटपुट") + +PNG फ़ाइल में बारकोड में शामिल हैं: + +- 2 px की X‑डायमेंशन +- 4 कॉलम +- UTF‑8 एन्कोडेड टेक्स्ट `"Åspóse.Barcóde©"` + +### वैकल्पिक: GS1‑अनुपालन वाला माइक्रो PDF417 जेनरेट करें + +यदि आपके एप्लिकेशन को **GS1‑अनुपालन बारकोड** डेटा चाहिए (सप्लाई‑चेन मानकों के लिए), तो सेव करने से पहले GS1 एन्कोडिंग सक्षम करें: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**व्याख्या:** `IsGS1` सेट करने से Aspose.BarCode GS1 हेडर प्रीपेंड करता है और सही चेकसम नियम लागू करता है। यह तब आवश्यक है जब आपका बारकोड GS1‑अवेयर रीडर्स द्वारा स्कैन किया जाएगा। + +## पूर्ण, चलाने योग्य उदाहरण + +नीचे एक पूरा कंसोल एप्लिकेशन दिया गया है जिसे आप कॉपी, पेस्ट और रन कर सकते हैं। इसमें सभी आवश्यक `using` स्टेटमेंट्स, एरर हैंडलिंग, और कमेंट्स शामिल हैं। + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**कोड चलाने के चरण:** +1. नया .NET कंसोल प्रोजेक्ट बनाएं (`dotnet new console`)। +2. Aspose.BarCode पैकेज जोड़ें (`dotnet add package Aspose.BarCode`)। +3. जेनरेटेड `Program.cs` को ऊपर दिए गए कोड से रिप्लेस करें। +4. आउटपुट पाथ आवश्यकतानुसार एडजस्ट करें और रन करें (`dotnet run`)। + +आपको कंसोल में फ़ाइल लोकेशन की पुष्टि वाला मैसेज दिखेगा, और PNG में वह **माइक्रो PDF417 बारकोड** होगा जो आपने अभी बनाया है। + +## सामान्य समस्याएँ और बेस्ट‑प्रैक्टिस टिप्स + +- **Unicode हैंडलिंग:** Aspose.BarCode स्वचालित रूप से UTF‑8 कैरेक्टर्स एन्कोड करता है, लेकिन स्रोत फ़ाइल को UTF‑8 एन्कोडिंग के साथ सेव करना सुनिश्चित करें ताकि करैक्टर करप्शन न हो। +- **कॉलम लिमिट्स:** `Columns` को 1‑4 के बाहर सेट करने पर `ArgumentException` फेंका जाता है। यदि आप इस सेटिंग को UI में एक्सपोज़ कर रहे हैं तो यूज़र इनपुट को वैलिडेट करें। +- **इमेज रिज़ॉल्यूशन:** PNG लॉसलेस है, लेकिन यदि आपको हाई‑रेज़ोल्यूशन वेक्टर फ़ॉर्मेट चाहिए, तो `BarCodeImageFormat.Svg` उपयोग करें। +- **GS1 डेटा लंबाई:** GS1‑अनुपालन माइक्रो PDF417 में स्ट्रिक्टर लंबाई लिमिट्स होते हैं। एन्कोडेड स्ट्रिंग को मानक द्वारा अनुमत अधिकतम (आमतौर पर माइक्रो PDF417 के लिए 90 कैरेक्टर) से अधिक न होने की जाँच करें। + +## निष्कर्ष + +आप अब जानते हैं कि C# में Aspose.BarCode का उपयोग करके **माइक्रो PDF417 बारकोड** कैसे बनाते हैं। ट्यूटोरियल ने **बारकोड जेनरेटर** को इनिशियलाइज़ करना, **X‑डायमेंशन पिक्सेल** सेट करना, कॉलम काउंट चुनना, इमेज सेव करना, और वैकल्पिक रूप से **GS1‑अनुपालन** फीचर सक्षम करना कवर किया। + +अब आप विभिन्न टेक्स्ट इनपुट्स के साथ प्रयोग कर सकते हैं, विभिन्न प्रिंटिंग रिज़ॉल्यूशन के लिए X‑डायमेंशन एडजस्ट कर सकते हैं, या स्केलेबल ग्राफ़िक्स के लिए SVG आउटपुट पर स्विच कर सकते हैं। यदि आपको अन्य 2‑D सिम्बोलॉजीज जेनरेट करनी हैं, तो `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix`, या `EncodeTypes.QR` को एक्सप्लोर करें—एक ही कॉन्फ़िगरेशन पैटर्न लागू होता है। + +कोडिंग का आनंद लें! + +## अगला आप क्या सीखेंगे? + +निम्नलिखित ट्यूटोरियल्स उन विषयों को कवर करते हैं जो इस गाइड में दिखाए गए तकनीकों पर आधारित हैं। प्रत्येक संसाधन में पूर्ण कार्यशील कोड उदाहरण और चरण‑दर‑चरण व्याख्याएँ शामिल हैं, जिससे आप अतिरिक्त API फीचर्स में महारत हासिल कर सकें और अपने प्रोजेक्ट्स में वैकल्पिक इम्प्लीमेंटेशन एप्रोचेज़ को एक्सप्लोर कर सकें। + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/hindi/net/one-dimensional-barcode-types/_index.md index c02a2e3d8..0af74f30e 100644 --- a/barcode/hindi/net/one-dimensional-barcode-types/_index.md +++ b/barcode/hindi/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,7 @@ Aspose.BarCode का उपयोग करके .NET में डेटा .NET के लिए Aspose.BarCode का उपयोग करके एक-आयामी बारकोड उत्पन्न करते समय अपवादों को संभालना सीखें। यह चरण-दर-चरण मार्गदर्शिका त्रुटि-सहिष्णु बारकोड समाधान सुनिश्चित करती है। अब शुरू हो जाओ! ### [एक-आयामी चौड़ा-संकीर्ण अनुपात विन्यास](./one-dimensional-wide-narrow-ratio-configuration/) .NET के लिए Aspose.BarCode के साथ आसानी से अनुकूलित बारकोड जेनरेट करें। एक-आयामी चौड़े-संकीर्ण अनुपात कॉन्फ़िगरेशन के लिए चरण-दर-चरण मार्गदर्शिका। +### [C# में इमेज से बारकोड पढ़ें – BarCodeReader ट्यूटोरियल](./read-barcode-from-image-in-c-barcodereader-tutorial/) ## निष्कर्ष @@ -89,4 +90,4 @@ Aspose.BarCode का उपयोग करके .NET में डेटा {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hindi/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/hindi/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..4733e8b82 --- /dev/null +++ b/barcode/hindi/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,256 @@ +--- +category: general +date: 2026-08-15 +description: BarCodeReader का उपयोग करके C# में छवि से बारकोड पढ़ें। जानें कि C# में + कई बारकोड कैसे पढ़ें, PDF417 बारकोड कैसे पढ़ें, और एक पूर्ण C# BarCodeReader उदाहरण + देखें। +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: hi +lastmod: 2026-08-15 +og_description: C# में इमेज से बारकोड पढ़ें, चरण‑दर‑चरण गाइड के साथ। जानें कैसे कई + बारकोड C# में पढ़ें, PDF417 प्रतीकों को डिकोड करें, और एक पूर्ण C# BarCodeReader + उदाहरण चलाएँ। +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: C# में छवि से बारकोड पढ़ें – BarCodeReader ट्यूटोरियल +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: C# में छवि से बारकोड पढ़ें – BarCodeReader ट्यूटोरियल +url: /hi/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# में इमेज से बारकोड पढ़ें – BarCodeReader ट्यूटोरियल + +यदि आपको .NET एप्लिकेशन में **इमेज से बारकोड पढ़ना** है, तो यह गाइड आपको `BarCodeReader` क्लास के साथ यह कैसे करना है, बिल्कुल दिखाएगा। आप यह भी देखेंगे कि **C# में कई बारकोड कैसे पढ़ें**, PDF417 सिंबल को डिकोड करें, और एक पूरा **C# BarCodeReader उदाहरण** प्राप्त करें जिसे आप अपने प्रोजेक्ट में कॉपी कर सकते हैं। + +ट्यूटोरियल हर कदम को कवर करता है—आवश्यक NuGet पैकेज जोड़ने से लेकर विस्तारित PDF417 फ़ील्ड प्रिंट करने तक—ताकि आप एक चलाने योग्य कंसोल प्रोग्राम के साथ समाप्त हो सकें। कोई बाहरी दस्तावेज़ीकरण आवश्यक नहीं है; सभी कोड और व्याख्याएँ शामिल हैं। + +## आपको क्या चाहिए + +* .NET 6.0 SDK या बाद का (कोड .NET Core और .NET Framework के साथ काम करता है) +* Visual Studio 2022 या कोई भी C#‑compatible एडिटर +* `Aspose.BarCode` NuGet पैकेज (या समकक्ष लाइब्रेरी जो `BarCodeReader` प्रदान करती है) +* एक इमेज फ़ाइल जिसमें Macro PDF417 बारकोड हो (उदाहरण के लिए `ExtPDF417Meta.png`) + +इन आवश्यकताओं को पूरा करने से यह सुनिश्चित होता है कि सैंपल अतिरिक्त कॉन्फ़िगरेशन के बिना कंपाइल हो जाता है। + +## BarCodeReader के साथ इमेज से बारकोड पढ़ें + +पहला कदम एक `BarCodeReader` इंस्टेंस बनाना है जो इमेज फ़ाइल की ओर इशारा करता है और लाइब्रेरी को बताता है कि किस बारकोड प्रकार को देखना है। + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**यह क्यों काम करता है:** +`BarCodeReader` इमेज को खोलता है, निर्दिष्ट `DecodeType` के लिए स्कैन करता है, और `BarCodeResult` ऑब्जेक्ट्स का एक संग्रह लौटाता है। प्रत्येक परिणाम में सामान्य बारकोड डेटा (`CodeTypeName`, `CodeText`) और Macro PDF417 के लिए एक `Extended.Pdf417` ऑब्जेक्ट होता है जो मानक द्वारा परिभाषित सभी अतिरिक्त फ़ील्ड को उजागर करता है। + +## एक इमेज में कई बारकोड C# में पढ़ें + +कभी-कभी एक इमेज में एक से अधिक बारकोड होते हैं (उदाहरण के लिए, PDF417 के बगल में QR कोड)। इस स्थिति को संभालने के लिए, बस स्पष्ट `DecodeType` को छोड़ दें या `DecodeType.AllSupported` पास करें और परिणामों पर लूप करें। + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**आपको यह क्यों चाहिए:** +`AllSupported` निर्दिष्ट करने से इंजन को वह सभी बारकोड फ़ॉर्मेट आज़माने को कहा जाता है जो उसे पता है, जिससे यह सुनिश्चित होता है कि आप इमेज में हर सिम्बल को कैप्चर कर लें। यह अनुशंसित तरीका है जब आप पहले से बारकोड प्रकारों की भविष्यवाणी नहीं कर सकते। + +## C# का उपयोग करके PDF417 बारकोड कैसे पढ़ें + +यदि आपको केवल क्लासिक PDF417 (नॉन‑मैक्रो) फ़ॉर्मेट की परवाह है, तो `DecodeType` को `Pdf417` में बदल दें। बाकी कोड समान रहता है, सिवाय इसके कि विस्तारित फ़ील्ड उपलब्ध नहीं होते। + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**यह क्यों महत्वपूर्ण है:** +क्लासिक PDF417 मैक्रो‑विशिष्ट प्रॉपर्टीज़ को उजागर नहीं करता, इसलिए `Extended.Pdf417` ब्लॉक की आवश्यकता नहीं है। सटीक `DecodeType` का उपयोग करने से स्कैनिंग तेज़ हो जाती है क्योंकि लाइब्रेरी असमर्थित एल्गोरिदम को छोड़ देती है। + +## पूर्ण C# BarCodeReader उदाहरण जिसे आप कॉपी कर सकते हैं + +नीचे पूर्ण प्रोग्राम दिया गया है जो तीनों परिदृश्यों को एक ही, चलाने में आसान कंसोल एप्लिकेशन में जोड़ता है। `YOUR_DIRECTORY/ExtPDF417Meta.png` को अपनी इमेज के वास्तविक पथ से बदलें। + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### अपेक्षित आउटपुट + +जब सैंपल इमेज में Macro PDF417 बारकोड होता है, तो कंसोल कुछ इस तरह प्रिंट करता है: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +यदि इमेज में केवल सामान्य PDF417 है, तो “Macro PDF417” सेक्शन खाली रहेगा, और “Classic PDF417” सेक्शन डिकोड किया हुआ टेक्स्ट दिखाएगा। + +## निष्कर्ष + +अब आप जानते हैं कि C# में `BarCodeReader` का उपयोग करके **इमेज से बारकोड कैसे पढ़ें**, एक फ़ाइल में **C# में कई बारकोड कैसे पढ़ें**, और **PDF417 बारकोड कैसे पढ़ें**—मैक्रो और क्लासिक दोनों वेरिएंट। पूर्ण **C# BarCodeReader उदाहरण** किसी भी .NET प्रोजेक्ट में पेस्ट करने के लिए तैयार है, और आप इसे अन्य फ़ॉर्मेट को संभालने या बड़े इमेज‑प्रोसेसिंग पाइपलाइन में एकीकृत करने के लिए विस्तारित कर सकते हैं। + +**अगले कदम** + +* `try / catch` जैसे error‑handling पैटर्न को रीडर ब्लॉक के आसपास एक्सप्लोर करें। +* `ReaderParameters` ऑब्जेक्ट के साथ प्रयोग करके डिटेक्शन स्पीड और एक्यूरेसी को ट्यून करें। +* बारकोड रीडिंग को इमेज प्री‑प्रोसेसिंग लाइब्रेरीज़ के साथ संयोजित करें ( + +## अगला आप क्या सीखें? + +निम्नलिखित ट्यूटोरियल्स उन निकट संबंधित विषयों को कवर करते हैं जो इस गाइड में प्रदर्शित तकनीकों पर आधारित हैं। प्रत्येक संसाधन में पूर्ण कार्यशील कोड उदाहरण और चरण‑दर‑चरण व्याख्याएँ शामिल हैं जो आपको अतिरिक्त API फीचर्स में महारत हासिल करने और अपने प्रोजेक्ट्स में वैकल्पिक इम्प्लीमेंटेशन अप्रोच को एक्सप्लोर करने में मदद करती हैं। + +- [Aspose.BarCode for .NET के साथ DataMatrix बारकोड कैसे पढ़ें](/barcode/english/net/datamatrix-barcode-reading/) +- [DataMatrix बारकोड C# पढ़ें – DataMatrix मोड (ऑटो) जेनरेट करें](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [इमेज से बारकोड पढ़ें – Java में Aspose.BarCode के साथ बारकोड रीजन एक्सट्रैक्शन में महारत हासिल करें](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/hongkong/net/compact-pdf417-encoding/_index.md index 9254eb3ec..3b888a6f0 100644 --- a/barcode/hongkong/net/compact-pdf417-encoding/_index.md +++ b/barcode/hongkong/net/compact-pdf417-encoding/_index.md @@ -84,6 +84,9 @@ Aspose.BarCode 讓你設定 `Pdf417ErrorCorrectionLevel` 屬性 (0‑8)。較高 ### [建立緊湊式 PDF417 條碼](./compact-pdf417-basic-configuration/) 了解如何使用 Aspose.BarCode for .NET 產生緊湊式 PDF417 條碼。完整指南包含一步一步說明與程式碼範例。 +### [在 C# 中建立微型 PDF417 條碼 – 步驟指南](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +一步一步說明如何在 C# 使用 Aspose.BarCode 產生微型 PDF417 條碼。 + ## 常見問題 **Q: 緊湊式 PDF417 條碼最多能儲存多少資料?** @@ -112,4 +115,4 @@ A: 不需要外部字型;函式庫會在內部處理所有渲染。 {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hongkong/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/hongkong/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..4055828ac --- /dev/null +++ b/barcode/hongkong/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,242 @@ +--- +category: general +date: 2026-08-15 +description: 使用 Aspose.BarCode 在 C# 中快速建立微型 PDF417 條碼。了解如何使用條碼產生器、設定 X 尺寸、選擇列數,並啟用 + GS1 相容性。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: zh-hant +lastmod: 2026-08-15 +og_description: 使用 Aspose.BarCode 在 C# 中建立微型 PDF417 條碼。請依照本教學設定條碼產生器、調整尺寸,並產生 PNG + 圖片。 +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: 在 C# 中建立微型 PDF417 條碼 – 完整程式設計指南 +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: 於 C# 中建立微型 PDF417 條碼 – 逐步指南 +url: /zh-hant/net/compact-pdf417-encoding/create-micro-pdf417-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# 中建立微型 PDF417 條碼 – 步驟指南 + +如果您需要在 C# 中**建立微型 PDF417 條碼**,本指南將會一步步說明。 我們會逐步說明如何初始化**條碼產生器**、設定**X‑dimension**、選擇欄位數量,並將結果儲存為 PNG 檔案。 + +產生微型 PDF417 條碼可用於在小型標籤、票券或物聯網裝置上進行緊湊的資料編碼。 完成本教學後,您將擁有一個完整、可執行的範例,能直接放入任何 .NET 專案中使用。 + +## 您需要的環境 + +- .NET 6.0(或更新版本)已安裝 – 此程式碼亦相容 .NET Framework 4.6 以上。 +- Aspose.BarCode for .NET 函式庫(可透過 NuGet `Aspose.BarCode` 取得)。 +- 開發環境,例如 Visual Studio 2022 或 VS Code。 + +不需要額外的外部服務;所有操作皆在本機執行。 + +## 使用 Aspose.BarCode 建立微型 PDF417 條碼 + +此流程的核心是一個能夠編碼 Micro PDF417 資料的**條碼產生器**物件。以下各節將逐一說明每個設定步驟。 + +### 步驟 1:初始化條碼產生器 + +首先,匯入必要的命名空間,並以 `EncodeTypes.MicroPdf417` 列舉建立 `BarcodeGenerator` 的實例。第二個參數為您欲編碼的文字。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**為什麼重要:** `BarcodeGenerator` 類別封裝了所有編碼邏輯。選取 `EncodeTypes.MicroPdf417` 會指示函式庫使用緊湊的 Micro PDF417 符號,該符號僅支援 1‑4 欄。 + +### 步驟 2:設定 X‑dimension(模組寬度) + +**X‑dimension** 控制單一條碼模組的像素寬度。較小的數值會產生更緊密的條碼,而較大的數值則可提升低解析度印表機上的可讀性。 + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**小技巧:** 1 到 4 之間的值在大多數螢幕顯示上表現良好。若您打算使用熱感印表機列印,建議以 3–4 像素測試,以避免模糊。 + +### 步驟 3:設定欄位數量 + +Micro PDF417 支援 1‑4 欄。欄位數量越多,條碼在水平方向上越短,但高度會相對增加。 + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**為什麼選擇 4 欄?** 使用四欄時,條碼佔用最少的水平空間,適合窄標籤。若您需要較高但較窄的條碼,可減少欄位數量。 + +### 步驟 4:將條碼儲存為 PNG 圖片 + +最後,將條碼寫入檔案。PNG 會保留您設定的精確像素尺寸。 + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +執行程式後,開啟 `MicroPdf417.png` 以檢視結果。圖像應顯示一個清晰的 Micro PDF417 條碼,且已編碼範例文字。 + +#### 預期輸出 + +![已建立的微型 PDF417 條碼](/images/micro-pdf417-sample.png "在 C# 中建立微型 PDF417 條碼 – 範例輸出") + +此 PNG 檔案的條碼具備: + +- X‑dimension 為 2 px +- 4 欄 +- UTF‑8 編碼文字 `"Åspóse.Barcóde©"` + +### 可選:產生符合 GS1 標準的 Micro PDF417 + +若您的應用程式需要**符合 GS1 標準的條碼**資料(供應鏈標準),請在儲存前啟用 GS1 編碼: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**說明:** 設定 `IsGS1` 會讓 Aspose.BarCode 在條碼前加上 GS1 標頭,並套用正確的檢查碼規則。當條碼將被支援 GS1 的讀取器掃描時,這是必要的步驟。 + +## 完整、可執行的範例 + +以下是一個完整的主控台應用程式範例,您可以直接複製、貼上並執行。它包含所有必要的 `using` 陳述式、錯誤處理與註解。 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**執行程式碼:** +1. 建立新的 .NET 主控台專案(`dotnet new console`)。 +2. 新增 Aspose.BarCode 套件(`dotnet add package Aspose.BarCode`)。 +3. 用上述程式碼取代產生的 `Program.cs`。 +4. 如有需要調整輸出路徑,然後執行(`dotnet run`)。 + +您應會在主控台看到確認檔案位置的訊息,且 PNG 檔案將包含您剛剛建立的**微型 PDF417 條碼**。 + +## 常見陷阱與最佳實踐技巧 + +- **Unicode 處理:** Aspose.BarCode 會自動以 UTF‑8 編碼字元,但請確保您的原始檔案以 UTF‑8 儲存,以免符號損壞。 +- **欄位限制:** 若將 `Columns` 設為 1‑4 以外的值,會拋出 `ArgumentException`。若在 UI 中提供此設定,請先驗證使用者輸入。 +- **影像解析度:** PNG 為無損格式,但若需要更高解析度的向量格式,請改用 `BarCodeImageFormat.Svg`。 +- **GS1 資料長度:** 符合 GS1 標準的 Micro PDF417 對長度限制更嚴格。請確認編碼字串未超過標準允許的最大長度(Micro PDF417 通常為 90 個字元)。 + +## 結論 + +現在您已了解如何使用 Aspose.BarCode 在 C# 中**建立微型 PDF417 條碼**。本教學涵蓋了初始化**條碼產生器**、設定**X‑dimension 像素**、選擇欄位數量、儲存影像,以及可選的**GS1 相容條碼**功能。 + +接下來您可以嘗試不同的文字輸入、調整 X‑dimension 以因應各種列印解析度,或改用 SVG 輸出以取得可縮放的圖形。若需產生其他 2‑D 符號,請探索 `EncodeTypes.Pdf417`、`EncodeTypes.DataMatrix` 或 `EncodeTypes.QR`——設定模式相同。 + +祝開發順利! + +## 接下來您可以學習什麼? + +以下教學涵蓋與本指南緊密相關的主題,並以此為基礎。每個資源皆提供完整可執行的程式碼範例與逐步說明,協助您精通其他 API 功能,並在自己的專案中探索不同的實作方式。 + +- [如何使用 Aspose.BarCode 建立條碼 – 緊湊 PDF417](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [建立 DotCode 條碼影像 – 行與欄設定(Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [如何使用 Aspose.BarCode for .NET 為 ITF-14 建立條碼安靜區](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/hongkong/net/one-dimensional-barcode-types/_index.md index 5802bdbba..81c203c41 100644 --- a/barcode/hongkong/net/one-dimensional-barcode-types/_index.md +++ b/barcode/hongkong/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ url: /zh-hant/net/one-dimensional-barcode-types/ 了解如何使用 Aspose.BarCode for .NET 產生一維條碼時處理例外狀況。本逐步指南可確保條碼解決方案具有容錯性。現在就開始吧! ### [一維寬窄比配置](./one-dimensional-wide-narrow-ratio-configuration/) 使用 Aspose.BarCode for .NET 輕鬆產生自訂條碼。一維寬窄比配置的分步指南。 +### [在 C# 中從圖像讀取條碼 – BarCodeReader 教學](./read-barcode-from-image-in-c-barcodereader-tutorial/) +了解如何使用 Aspose.BarCode 的 BarCodeReader 在 .NET 中從圖像讀取條碼的步驟指南。 ## 結論 @@ -89,4 +91,4 @@ url: /zh-hant/net/one-dimensional-barcode-types/ {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hongkong/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/hongkong/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..2b14536bc --- /dev/null +++ b/barcode/hongkong/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,256 @@ +--- +category: general +date: 2026-08-15 +description: 使用 BarCodeReader 在 C# 中從圖像讀取條碼。了解如何在 C# 中讀取多個條碼、讀取 PDF417 條碼,並查看完整的 C# + BarCodeReader 範例。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: zh-hant +lastmod: 2026-08-15 +og_description: 在 C# 中從圖片讀取條碼,提供逐步指南。了解如何在 C# 中讀取多條碼、解碼 PDF417 符號,並執行完整的 C# BarCodeReader + 範例。 +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: 在 C# 中從圖像讀取條碼 – BarCodeReader 教學 +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: 在 C# 中從圖像讀取條碼 – BarCodeReader 教學 +url: /zh-hant/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 從圖像讀取條碼(C#) – BarCodeReader 教程 + +如果您需要在 .NET 應用程式中 **從圖像讀取條碼**,本指南將向您展示如何使用 `BarCodeReader` 類別完成此操作。您還會看到如何 **在 C# 中讀取多個條碼**、解碼 PDF417 符號,以及取得一個完整的 **C# BarCodeReader 範例**,可直接複製到您的專案中。 + +本教程涵蓋每一步——從加入必要的 NuGet 套件到列印擴充的 PDF417 欄位——讓您最終得到可執行的主控台程式。無需外部文件說明;所有程式碼與說明均已包含在內。 + +## 您需要的條件 + +在開始之前,請確保您具備: + +* .NET 6.0 SDK 或更新版本(此程式碼可於 .NET Core 與 .NET Framework 執行) +* Visual Studio 2022 或任何相容 C# 的編輯器 +* `Aspose.BarCode` NuGet 套件(或提供 `BarCodeReader` 的等效函式庫) +* 包含 Macro PDF417 條碼的圖像檔(例如 `ExtPDF417Meta.png`) + +具備上述前置條件即可確保範例能順利編譯,無需額外設定。 + +## 使用 BarCodeReader 從圖像讀取條碼 + +第一步是建立一個指向圖像檔案的 `BarCodeReader` 實例,並告訴函式庫要搜尋哪種類型的條碼。 + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**為什麼這樣可行:** +`BarCodeReader` 會開啟圖像,掃描指定的 `DecodeType`,並回傳 `BarCodeResult` 物件的集合。每個結果都包含一般條碼資料(`CodeTypeName`、`CodeText`),而對於 Macro PDF417,則會有 `Extended.Pdf417` 物件,提供標準定義的所有額外欄位。 + +## 在單一圖像中以 C# 讀取多個條碼 + +有時圖像中會包含多個條碼(例如 QR code 與 PDF417 並列)。若要處理此情況,只需省略明確的 `DecodeType`,或傳入 `DecodeType.AllSupported`,然後遍歷結果即可。 + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**為什麼需要這樣做:** +指定 `AllSupported` 會讓引擎嘗試所有已知的條碼格式,確保能捕捉圖像中的每個符號。當您無法事先預測條碼類型時,這是建議的做法。 + +## 使用 C# 讀取 PDF417 條碼的方法 + +如果您只關心傳統的 PDF417(非 macro)格式,只需將 `DecodeType` 改為 `Pdf417`。其餘程式碼保持相同,只是無法取得擴充欄位。 + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**為什麼這很重要:** +傳統 PDF417 不會顯示 macro 專屬屬性,因此 `Extended.Pdf417` 區塊不是必需的。使用精確的 `DecodeType` 也能加快掃描速度,因為函式庫會跳過不支援的演算法。 + +## 完整的 C# BarCodeReader 範例,您可以直接複製 + +以下是結合上述三種情境的完整程式,為單一易於執行的主控台應用程式。請將 `YOUR_DIRECTORY/ExtPDF417Meta.png` 替換為您圖像的實際路徑。 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### 預期輸出 + +當範例圖像包含 Macro PDF417 條碼時,主控台會印出類似以下內容: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +如果圖像僅包含普通的 PDF417,則 “Macro PDF417” 部分會為空,而 “Classic PDF417” 部分會顯示解碼後的文字。 + +## 結論 + +現在您已了解如何在 C# 中使用 `BarCodeReader` **從圖像讀取條碼**、如何在單一檔案中 **讀取多個條碼 C#**,以及 **讀取 PDF417 條碼** 的完整步驟——包括 macro 與 classic 兩種變體。完整的 **C# BarCodeReader 範例** 已可直接貼入任何 .NET 專案,您亦可擴充以支援其他格式或整合至更大的影像處理流程中。 + +**下一步** + +* 探索錯誤處理模式,例如在讀取器區塊周圍使用 `try / catch`。 +* 嘗試使用 `ReaderParameters` 物件調整偵測速度與精確度。 +* 將條碼讀取與影像前處理函式庫結合( + +## 接下來您應該學習什麼? + +以下教學涵蓋與本指南緊密相關的主題,並以此為基礎。每個資源皆提供完整可執行的程式碼範例與逐步說明,協助您精通更多 API 功能,並在自己的專案中探索其他實作方式。 + +- [如何使用 Aspose.BarCode for .NET 讀取 DataMatrix 條碼](/barcode/english/net/datamatrix-barcode-reading/) +- [讀取 DataMatrix 條碼 C# – 產生 DataMatrix 模式(自動)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [從圖像讀取條碼 – 精通 Java 中的條碼區域提取(使用 Aspose.BarCode)](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/hungarian/net/compact-pdf417-encoding/_index.md index 17598f023..d19f1c1a8 100644 --- a/barcode/hungarian/net/compact-pdf417-encoding/_index.md +++ b/barcode/hungarian/net/compact-pdf417-encoding/_index.md @@ -83,6 +83,8 @@ Az alapok mellett itt van néhány gyakorlati tipp a munkafolyamat egyszerűsít ## Compact PDF417 kódolási útmutatók ### [Compact PDF417 vonalkódok létrehozása](./compact-pdf417-basic-configuration/) Ismerje meg, hogyan generáljon Compact PDF417 vonalkódokat az Aspose.BarCode for .NET használatával. Átfogó útmutató lépésről‑lépésre utasításokkal és kódrészletekkel. +### [Micro PDF417 vonalkód létrehozása C#‑ban – lépésről‑lépésre útmutató](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Ismerje meg, hogyan hozhat létre micro PDF417 vonalkódot C#‑ban az Aspose.BarCode for .NET segítségével, részletes példákkal. ## Gyakran Ismételt Kérdések @@ -112,4 +114,4 @@ A: Nem szükséges külső betűtípus; a könyvtár minden megjelenítést bels {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hungarian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/hungarian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..038a93265 --- /dev/null +++ b/barcode/hungarian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,244 @@ +--- +category: general +date: 2026-08-15 +description: Készítsen micro PDF417 vonalkódot C#‑ban gyorsan az Aspose.BarCode segítségével. + Tanulja meg, hogyan használja a vonalkód-generátort, állítsa be az X‑dimenziót, + válasszon oszlopokat, és engedélyezze a GS1 megfelelőséget. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: hu +lastmod: 2026-08-15 +og_description: Készíts micro PDF417 vonalkódot C#-ban az Aspose.BarCode segítségével. + Kövesd ezt az útmutatót a vonalkód-generátor beállításához, a méretek megadásához, + és egy PNG kép előállításához. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Micro PDF417 vonalkód létrehozása C#‑ban – teljes programozási útmutató +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Micro PDF417 vonalkód létrehozása C#‑ban – lépésről‑lépésre útmutató +url: /hu/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Micro PDF417 vonalkód létrehozása C#‑ban – lépésről‑lépésre útmutató + +Ha **micro PDF417 vonalkódot** kell létrehoznod C#‑ban, ez az útmutató pontosan megmutatja, hogyan. Végigvezetünk a **vonalkód generátor** inicializálásán, az **X‑dimenzió** beállításán, az oszlopszám kiválasztásán, és az eredmény PNG fájlba mentésén. + +Micro PDF417 vonalkód generálása hasznos a kompakt adatkódoláshoz kis címkéken, jegyeken vagy IoT eszközökön. A tutorial végére egy teljes, futtatható példát kapsz, amelyet bármely .NET projektbe beilleszthetsz. + +## Amire szükséged lesz + +- .NET 6.0 (vagy újabb) telepítve – a kód a .NET Framework 4.6+‑vel is működik. +- Az Aspose.BarCode for .NET könyvtár (elérhető a NuGet‑en keresztül `Aspose.BarCode`). +- Fejlesztői környezet, például Visual Studio 2022 vagy VS Code. + +Nem szükséges további külső szolgáltatás; minden helyben fut. + +## Micro PDF417 vonalkód létrehozása Aspose.BarCode‑dal + +A folyamat központja egy **vonalkód generátor** objektum, amely tudja, hogyan kell Micro PDF417 adatot kódolni. A következő szakaszok részletezik az egyes konfigurációs lépéseket. + +### 1. lépés: A vonalkód generátor inicializálása + +Először importáld a szükséges névtereket, és hozz létre egy `BarcodeGenerator` példányt a `EncodeTypes.MicroPdf417` enumerációval. A második argumentum a kódolni kívánt szöveg. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Miért fontos:** A `BarcodeGenerator` osztály tartalmazza az összes kódolási logikát. A `EncodeTypes.MicroPdf417` kiválasztása azt mondja a könyvtárnak, hogy a kompakt Micro PDF417 szimbólumot használja, amely 1‑4 oszlopra korlátozódik. + +### 2. lépés: Az X‑dimenzió (modul szélesség) beállítása + +Az **X‑dimenzió** szabályozza egyetlen vonalkód modul szélességét pixelben. A kisebb érték szorosabb vonalkódot eredményez, míg a nagyobb érték javítja az olvashatóságot alacsony felbontású nyomtatókon. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Tipp:** Az 1 és 4 közötti értékek a legtöbb képernyőn jól működnek. Ha hőnyomtatóra tervezel nyomtatni, tesztelj 3–4 pixellel, hogy elkerüld a elmosódást. + +### 3. lépés: Az oszlopok számának beállítása + +A Micro PDF417 1‑4 oszlopot támogat. Több oszlop rövidebb vonalkódot eredményez, de növeli a magasságát. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Miért válassz 4 oszlopot?** Négy oszloppal a vonalkód a legkevesebb vízszintes helyet foglalja, ami ideális keskeny címkékhez. Ha magasabb, de keskenyebb vonalkódra van szükséged, csökkentsd az oszlopszámot. + +### 4. lépés: A vonalkód mentése PNG képként + +Végül írd a vonalkódot egy fájlba. A PNG megőrzi a beállított pixelméreteket. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +A program futtatása után nyisd meg a `MicroPdf417.png` fájlt, hogy lásd az eredményt. A képnek egy éles Micro PDF417 vonalkódot kell mutatnia, amely a mintaszöveget kódolja. + +#### Várt kimenet + +![Létrehozott micro PDF417 vonalkód](/images/micro-pdf417-sample.png "Micro PDF417 vonalkód létrehozása C#‑ban – példa kimenet") + +A PNG fájl egy vonalkódot tartalmaz: + +- 2 px X‑dimenzió +- 4 oszlop +- UTF‑8 kódolt szöveg `"Åspóse.Barcóde©"` + +### Opcionális: GS1‑kompatibilis Micro PDF417 generálása + +Ha az alkalmazásod **GS1‑kompatibilis vonalkód** adatot igényel (ellátási lánc szabványokhoz), a mentés előtt engedélyezd a GS1 kódolást: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Magyarázat:** Az `IsGS1` beállítása azt mondja az Aspose.BarCode‑nak, hogy előállítsa a GS1 fejléct, és alkalmazza a megfelelő ellenőrzőösszeg szabályokat. Ez elengedhetetlen, ha a vonalkódot GS1‑tudatos olvasók fogják beolvasni. + +## Teljes, futtatható példa + +Az alábbiakban egy teljes konzolalkalmazás található, amelyet másolhatsz, beilleszthetsz és futtathatsz. Tartalmazza az összes szükséges `using` utasítást, hibakezelést és megjegyzéseket. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**A kód futtatása:** +1. Hozz létre egy új .NET konzolprojektet (`dotnet new console`). +2. Add the Aspose.BarCode csomagot (`dotnet add package Aspose.BarCode`). +3. Cseréld le a generált `Program.cs`-t a fenti kóddal. +4. Szükség esetén állítsd be a kimeneti útvonalat, majd futtasd (`dotnet run`). + +A konzolban egy üzenetet kell látnod, amely megerősíti a fájl helyét, és a PNG tartalmazni fogja a **micro PDF417 vonalkódot**, amelyet most létrehoztál. + +## Gyakori hibák és legjobb gyakorlatok + +- **Unicode kezelés:** Az Aspose.BarCode automatikusan UTF‑8 karaktereket kódol, de győződj meg arról, hogy a forrásfájl UTF‑8 kódolású legyen a hibás szimbólumok elkerülése érdekében. +- **Oszlopkorlátok:** Ha a `Columns` értékét 1‑4-en kívülre állítod, `ArgumentException`-t dob. Érvényesítsd a felhasználói bemenetet, ha ezt a beállítást UI‑ban teszed elérhetővé. +- **Képfelbontás:** A PNG veszteségmentes, de ha nagyobb felbontású vektorgrafikára van szükséged, használd a `BarCodeImageFormat.Svg`-t. +- **GS1 adat hossza:** A GS1‑kompatibilis Micro PDF417 szigorúbb hosszkorlátokkal rendelkezik. Ellenőrizd, hogy a kódolt karakterlánc nem haladja-e meg a szabvány által megengedett maximális hosszúságot (általában 90 karakter a Micro PDF417 esetén). + +## Következtetés + +Most már tudod, hogyan **hozz létre micro PDF417 vonalkódot** C#‑ban az Aspose.BarCode használatával. A tutorial bemutatta a **vonalkód generátor** inicializálását, az **X‑dimenzió pixel** beállítását, az oszlopszám kiválasztását, a kép mentését, valamint opcionálisan a **GS1‑kompatibilis vonalkód** funkciók engedélyezését. + +Innen tovább kísérletezhetsz különböző szövegbevitelekkel, állíthatod az X‑dimenziót különböző nyomtatási felbontásokhoz, vagy válthatsz SVG kimenetre a méretezhető grafikákhoz. Ha más 2‑D szimbólumokat kell generálnod, nézd meg a `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` vagy `EncodeTypes.QR` értékeket – ugyanaz a konfigurációs minta érvényes. + +Jó kódolást! + +## Mit érdemes még megtanulni? + +Az alábbi tutorialok szorosan kapcsolódó témákat fednek le, amelyek a jelen útmutatóban bemutatott technikákra épülnek. Minden forrás teljes, működő kódrészleteket tartalmaz lépésről‑lépésre magyarázatokkal, hogy segítsenek elsajátítani további API funkciókat és alternatív megvalósítási megközelítéseket a saját projektjeidben. + +- [Hogyan hozz létre vonalkódot – kompakt PDF417 Aspose.BarCode‑dal](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [DotCode vonalkód kép létrehozása – sorok és oszlopok (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Hogyan hozz létre vonalkód csendes zónát ITF-14‑hez az Aspose.BarCode for .NET használatával](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/hungarian/net/one-dimensional-barcode-types/_index.md index 5717cda04..3c71d802d 100644 --- a/barcode/hungarian/net/one-dimensional-barcode-types/_index.md +++ b/barcode/hungarian/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ megtudhatja, hogyan hozhat létre vonalkódokat .NET-ben az Aspose.BarCode for . Ismerje meg, hogyan kezelheti a kivételeket, miközben egydimenziós vonalkódokat állít elő az Aspose.BarCode for .NET használatával. Ez a lépésenkénti útmutató hibatűrő vonalkód-megoldásokat biztosít. Kezd el most! ### [Egydimenziós széles-keskeny arány konfiguráció](./one-dimensional-wide-narrow-ratio-configuration/) Az Aspose.BarCode for .NET segítségével egyszerűen hozhat létre testreszabott vonalkódokat. Lépésről lépésre útmutató az egydimenziós széles-keskeny arány konfigurációhoz. +### [Vonalkód olvasása képből C#-ban – BarCodeReader oktatóanyag](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Ismerje meg, hogyan olvashat vonalkódot képfájlokból C#-ban az Aspose.BarCode BarCodeReader használatával. ## Következtetés @@ -89,4 +91,4 @@ Ezzel a cikkel nemcsak ismereteket szerezhet a különféle egydimenziós vonalk {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hungarian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/hungarian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..ff02e74c2 --- /dev/null +++ b/barcode/hungarian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,256 @@ +--- +category: general +date: 2026-08-15 +description: Olvass be vonalkódot képről C#-ban a BarCodeReader használatával. Tanulja + meg, hogyan olvasson több vonalkódot C#-ban, hogyan olvasson PDF417 vonalkódot, + és tekintse meg a teljes C# BarCodeReader példát. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: hu +lastmod: 2026-08-15 +og_description: Olvassa be a vonalkódot képről C#‑ban egy lépésről‑lépésre útmutatóval. + Fedezze fel, hogyan olvashat több vonalkódot C#‑ban, dekódolhatja a PDF417 szimbólumokat, + és futtathat egy teljes C# BarCodeReader példát. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Vonalkód olvasása képből C#‑ban – BarCodeReader oktató +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Vonalkód olvasása képből C#-ban – BarCodeReader oktató +url: /hu/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Olvasd be a vonalkódot képről C#‑ban – BarCodeReader bemutató + +Ha **vonalkódot szeretnél beolvasni képről** egy .NET alkalmazásban, ez az útmutató pontosan megmutatja, hogyan teheted ezt a `BarCodeReader` osztállyal. Emellett láthatod, hogyan **olvashatsz több vonalkódot C#‑ban**, hogyan dekódolhatsz egy PDF417 szimbólumot, és megkapod a teljes **C# BarCodeReader példát**, amelyet beilleszthetsz a projektedbe. + +A bemutató minden lépést lefed – a szükséges NuGet csomag hozzáadásától az kiterjesztett PDF417 mezők kiírásáig – így egy futtatható konzolprogrammal zársz. Külső dokumentációra nincs szükség; minden kód és magyarázat benne van. + +## Amire szükséged lesz + +* .NET 6.0 SDK vagy újabb (a kód működik .NET Core és .NET Framework alatt is) +* Visual Studio 2022 vagy bármely C#‑kompatibilis szerkesztő +* A `Aspose.BarCode` NuGet csomag (vagy a megfelelő könyvtár, amely biztosítja a `BarCodeReader`‑t) +* Egy képfájl, amely Macro PDF417 vonalkódot tartalmaz (például `ExtPDF417Meta.png`) + +Ezeknek a feltételeknek a megléte biztosítja, hogy a példa további konfiguráció nélkül leforduljon. + +## Vonalkód beolvasása képről a BarCodeReader-rel + +Az első lépés egy `BarCodeReader` példány létrehozása, amely a képfájlra mutat, és megadja a könyvtárnak, hogy melyik vonalkódtípust keresse. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Miért működik ez:** +A `BarCodeReader` megnyitja a képet, a megadott `DecodeType` típusra keres, és egy `BarCodeResult` objektumok gyűjteményét adja vissza. Minden eredmény tartalmazza az általános vonalkód adatokat (`CodeTypeName`, `CodeText`), és a Macro PDF417 esetén egy `Extended.Pdf417` objektumot, amely a szabvány által definiált összes további mezőt mutatja. + +## Több vonalkód beolvasása C#‑ban egyetlen képen + +Néha egy kép több vonalkódot is tartalmaz (például QR‑kód a PDF417 mellett). Ennek kezeléséhez egyszerűen hagyd ki a kifejezett `DecodeType` megadását, vagy add meg a `DecodeType.AllSupported` értéket, és iterálj a találatokon. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Miért van erre szükség:** +Az `AllSupported` megadása azt mondja a motornak, hogy minden ismert vonalkódformátumot próbáljon ki, ami garantálja, hogy minden szimbólumot felderíts a képen. Ez a javasolt megközelítés, ha előre nem tudod, milyen vonalkódok lesznek jelen. + +## PDF417 vonalkód beolvasása C#‑ban + +Ha csak a klasszikus PDF417 (nem‑macro) formátum érdekel, állítsd a `DecodeType`‑ot `Pdf417`‑ra. A kód többi része változatlan marad, csak a kiterjesztett mezők nem lesznek elérhetők. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Miért fontos ez:** +A klasszikus PDF417 nem teszi elérhetővé a macro‑specifikus tulajdonságokat, így az `Extended.Pdf417` blokk felesleges. A pontos `DecodeType` használata tovább gyorsítja a beolvasást, mivel a könyvtár kihagyja a nem támogatott algoritmusokat. + +## Teljes C# BarCodeReader példa, amelyet másolhatsz + +Az alábbiakban a teljes program látható, amely a három szcenáriót egyetlen, könnyen futtatható konzolalkalmazásba egyesíti. Cseréld le a `YOUR_DIRECTORY/ExtPDF417Meta.png` értéket a képed tényleges elérési útjára. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Várható kimenet + +Ha a mintakép Macro PDF417 vonalkódot tartalmaz, a konzol valami hasonlót ír ki: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Ha a kép csak egy szabályos PDF417-et tartalmaz, a „Macro PDF417” szakasz üres lesz, és a „Classic PDF417” szakasz megjeleníti a dekódolt szöveget. + +## Következtetés + +Most már tudod, hogyan **olvass be vonalkódot képről** C#‑ban a `BarCodeReader` segítségével, hogyan **olvass be több vonalkódot C#‑ban** egyetlen fájlban, és a pontos lépéseket a **PDF417 vonalkód beolvasásához** – mind macro, mind klasszikus változatban. A teljes **C# BarCodeReader példa** készen áll, hogy beilleszd bármely .NET projektbe, és kiterjesztheted más formátumok kezelésére vagy egy nagyobb képfeldolgozó csővezetékbe való integrálásra. + +**Következő lépések** + +* Fedezd fel a hibakezelési mintákat, például a `try / catch`‑et a reader blokk körül. +* Kísérletezz a `ReaderParameters` objektummal a felismerés sebességének és pontosságának finomhangolásához. +* Kombináld a vonalkódolvasást képelőfeldolgozó könyvtárakkal ( + +## Mit érdemes még megtanulnod? + +A következő bemutatók szorosan kapcsolódó témákat fednek le, amelyek a jelen útmutatóban bemutatott technikákra épülnek. Minden forrás tartalmaz teljes, működő kódrészleteket 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. + +- [Hogyan olvassunk DataMatrix vonalkódokat az Aspose.BarCode for .NET segítségével](/barcode/english/net/datamatrix-barcode-reading/) +- [DataMatrix vonalkód beolvasása C# – DataMatrix mód generálása (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Vonalkód beolvasása képről – A vonalkód régió kinyerésének elsajátítása Java‑ban az Aspose.BarCode segítségével](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/indonesian/net/compact-pdf417-encoding/_index.md index e49f3f784..1bdabf150 100644 --- a/barcode/indonesian/net/compact-pdf417-encoding/_index.md +++ b/barcode/indonesian/net/compact-pdf417-encoding/_index.md @@ -78,6 +78,9 @@ Aspose.BarCode memungkinkan Anda mengatur properti `Pdf417ErrorCorrectionLevel` ### [Creating Compact PDF417 Barcodes](./compact-pdf417-basic-configuration/) Pelajari cara menghasilkan barcode Compact PDF417 menggunakan Aspose.BarCode untuk .NET. Panduan komprehensif dengan instruksi langkah‑demi‑langkah dan contoh kode. +### [Buat barcode micro PDF417 dalam C# – panduan langkah demi langkah](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Panduan lengkap untuk membuat barcode micro PDF417 menggunakan C# dengan Aspose.BarCode, termasuk contoh kode dan konfigurasi. + ## Frequently Asked Questions **Q: Apa jumlah maksimum data yang dapat saya simpan dalam barcode Compact PDF417?** @@ -106,4 +109,4 @@ A: Tidak diperlukan font eksternal; pustaka menangani semua rendering secara int {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/indonesian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/indonesian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..835f75238 --- /dev/null +++ b/barcode/indonesian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,246 @@ +--- +category: general +date: 2026-08-15 +description: Buat barcode micro PDF417 dalam C# dengan cepat menggunakan Aspose.BarCode. + Pelajari cara menggunakan generator barcode, mengatur dimensi X, memilih kolom, + dan mengaktifkan kepatuhan GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: id +lastmod: 2026-08-15 +og_description: Buat kode batang micro PDF417 di C# dengan Aspose.BarCode. Ikuti tutorial + ini untuk mengonfigurasi generator kode batang, mengatur dimensi, dan menghasilkan + gambar PNG. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Buat kode batang micro PDF417 di C# – panduan pemrograman lengkap +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Buat barcode micro PDF417 di C# – panduan langkah demi langkah +url: /id/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Membuat barcode micro PDF417 di C# – panduan langkah‑demi‑langkah + +Jika Anda perlu **membuat barcode micro PDF417** di C#, panduan ini menunjukkan cara melakukannya secara tepat. Kami akan membahas cara menginisialisasi **generator barcode**, mengatur **dimensi X**, memilih jumlah kolom, dan menyimpan hasilnya sebagai file PNG. + +Membuat barcode Micro PDF417 berguna untuk pengkodean data yang kompak pada label kecil, tiket, atau perangkat IoT. Pada akhir tutorial ini Anda akan memiliki contoh lengkap yang dapat dijalankan dan dapat dimasukkan ke dalam proyek .NET apa pun. + +## Apa yang Anda perlukan + +Sebelum memulai, pastikan Anda memiliki: + +- .NET 6.0 (atau lebih baru) terpasang – kode ini juga bekerja dengan .NET Framework 4.6+. +- Library Aspose.BarCode untuk .NET (tersedia via NuGet `Aspose.BarCode`). +- Lingkungan pengembangan seperti Visual Studio 2022 atau VS Code. + +Tidak ada layanan eksternal tambahan yang diperlukan; semuanya berjalan secara lokal. + +## Cara membuat barcode micro PDF417 dengan Aspose.BarCode + +Inti proses adalah objek **barcode generator** yang mengetahui cara mengkodekan data Micro PDF417. Bagian‑bagian berikut menjelaskan setiap langkah konfigurasi. + +### Langkah 1: Inisialisasi generator barcode + +Pertama, impor namespace yang diperlukan dan buat instance `BarcodeGenerator` dengan enum `EncodeTypes.MicroPdf417`. Argumen kedua adalah teks yang ingin Anda enkode. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Mengapa ini penting:** Kelas `BarcodeGenerator` mengenkapsulasi semua logika enkoding. Memilih `EncodeTypes.MicroPdf417` memberi tahu library untuk menggunakan simbolik Micro PDF417 yang kompak, yang terbatas pada 1‑4 kolom. + +### Langkah 2: Konfigurasi dimensi X (lebar modul) + +**Dimensi X** mengontrol lebar satu modul barcode dalam piksel. Nilai yang lebih kecil menghasilkan barcode yang lebih rapat, sementara nilai yang lebih besar meningkatkan keterbacaan pada printer beresolusi rendah. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Tip:** Nilai antara 1 dan 4 bekerja baik untuk kebanyakan tampilan layar. Jika Anda berencana mencetak pada printer termal, uji dengan 3–4 piksel untuk menghindari blur. + +### Langkah 3: Atur jumlah kolom + +Micro PDF417 mendukung 1‑4 kolom. Lebih banyak kolom membuat barcode lebih pendek tetapi meningkatkan tinggi barcode. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Mengapa memilih 4 kolom?** Dengan empat kolom barcode menempati ruang horizontal paling sedikit, ideal untuk label sempit. Jika Anda membutuhkan barcode yang lebih tinggi tetapi lebih sempit, kurangi jumlah kolom. + +### Langkah 4: Simpan barcode sebagai gambar PNG + +Terakhir, tulis barcode ke file. PNG mempertahankan dimensi piksel persis yang Anda konfigurasikan. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Setelah menjalankan program, buka `MicroPdf417.png` untuk melihat hasilnya. Gambar tersebut harus menampilkan barcode Micro PDF417 yang tajam dan mengenkode teks contoh. + +#### Output yang diharapkan + +![Barcode micro PDF417 yang dibuat](/images/micro-pdf417-sample.png "Membuat barcode micro PDF417 di C# – contoh output") + +File PNG berisi barcode dengan: + +- Dimensi X sebesar 2 px +- 4 kolom +- Teks berenkode UTF‑8 `"Åspóse.Barcóde©"` + +### Opsional: menghasilkan Micro PDF417 yang sesuai GS1 + +Jika aplikasi Anda memerlukan data **barcode yang sesuai GS1** (untuk standar rantai pasokan), aktifkan enkoding GS1 sebelum menyimpan: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Penjelasan:** Menetapkan `IsGS1` memberi tahu Aspose.BarCode untuk menambahkan header GS1 dan menerapkan aturan checksum yang tepat. Ini penting ketika barcode Anda akan dipindai oleh pembaca yang mendukung GS1. + +## Contoh lengkap yang dapat dijalankan + +Berikut adalah aplikasi konsol lengkap yang dapat Anda salin, tempel, dan jalankan. Termasuk semua pernyataan `using` yang diperlukan, penanganan error, dan komentar. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Menjalankan kode:** +1. Buat proyek konsol .NET baru (`dotnet new console`). +2. Tambahkan paket Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. Ganti `Program.cs` yang dihasilkan dengan kode di atas. +4. Sesuaikan jalur output bila diperlukan dan jalankan (`dotnet run`). + +Anda akan melihat pesan konsol yang mengonfirmasi lokasi file, dan PNG akan berisi **barcode micro PDF417** yang baru saja Anda buat. + +## Kesalahan umum dan tips praktik terbaik + +- **Penanganan Unicode:** Aspose.BarCode secara otomatis mengenkode karakter UTF‑8, tetapi pastikan file sumber Anda disimpan dengan enkoding UTF‑8 agar tidak terjadi simbol yang rusak. +- **Batas kolom:** Mencoba mengatur `Columns` ke nilai di luar 1‑4 akan memicu `ArgumentException`. Validasi input pengguna jika Anda menampilkan pengaturan ini di UI. +- **Resolusi gambar:** PNG bersifat lossless, tetapi jika Anda memerlukan format vektor dengan resolusi lebih tinggi, gunakan `BarCodeImageFormat.Svg` sebagai gantinya. +- **Panjang data GS1:** Micro PDF417 yang sesuai GS1 memiliki batas panjang yang lebih ketat. Pastikan string yang dienkode tidak melebihi maksimum yang diizinkan oleh standar (biasanya 90 karakter untuk Micro PDF417). + +## Kesimpulan + +Anda kini tahu cara **membuat barcode micro PDF417** di C# menggunakan Aspose.BarCode. Tutorial ini mencakup inisialisasi **generator barcode**, pengaturan **dimensi X dalam piksel**, pemilihan jumlah kolom, penyimpanan gambar, dan opsional mengaktifkan fitur **barcode yang sesuai GS1**. + +Selanjutnya Anda dapat bereksperimen dengan input teks yang berbeda, menyesuaikan dimensi X untuk berbagai resolusi pencetakan, atau beralih ke output SVG untuk grafik yang dapat diskalakan. Jika Anda perlu menghasilkan simbolik 2‑D lainnya, jelajahi `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix`, atau `EncodeTypes.QR`—pola konfigurasi yang sama dapat diterapkan. + +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 dengan penjelasan langkah‑demi‑langkah untuk membantu Anda menguasai fitur API tambahan dan mengeksplorasi pendekatan implementasi alternatif dalam proyek Anda. + +- [Cara Membuat Barcode – Compact PDF417 dengan Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Buat gambar barcode DotCode – baris & kolom (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Cara Membuat Zona Tenang Barcode untuk ITF-14 Menggunakan Aspose.BarCode untuk .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/indonesian/net/one-dimensional-barcode-types/_index.md index 7f12b70c9..042ca280a 100644 --- a/barcode/indonesian/net/one-dimensional-barcode-types/_index.md +++ b/barcode/indonesian/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ dapatkan cara membuat kode batang di .NET dengan Aspose.BarCode untuk .NET. Tuto Pelajari cara menangani pengecualian saat membuat kode batang satu dimensi menggunakan Aspose.BarCode untuk .NET. Panduan langkah demi langkah ini memastikan solusi kode batang yang toleran terhadap kesalahan. Mulai sekarang! ### [Konfigurasi Rasio Lebar-Sempit Satu Dimensi](./one-dimensional-wide-narrow-ratio-configuration/) Hasilkan kode batang khusus dengan mudah menggunakan Aspose.BarCode untuk .NET. Panduan langkah demi langkah untuk konfigurasi rasio lebar-sempit satu dimensi. +### [Membaca barcode dari gambar di C# – tutorial BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Pelajari cara membaca barcode dari gambar menggunakan BarCodeReader di C#. Ikuti panduan langkah demi langkah kami. ## Kesimpulan @@ -89,4 +91,4 @@ Dengan artikel ini, Anda tidak hanya akan memperoleh pengetahuan tentang berbaga {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/indonesian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/indonesian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..208f620a0 --- /dev/null +++ b/barcode/indonesian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,258 @@ +--- +category: general +date: 2026-08-15 +description: Baca kode batang dari gambar dalam C# menggunakan BarCodeReader. Pelajari + cara membaca beberapa kode batang di C#, membaca kode batang PDF417, dan lihat contoh + lengkap BarCodeReader C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: id +lastmod: 2026-08-15 +og_description: Baca kode batang dari gambar di C# dengan panduan langkah demi langkah. + Temukan cara membaca beberapa kode batang di C#, mendekode simbol PDF417, dan menjalankan + contoh lengkap BarCodeReader C#. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Baca kode batang dari gambar di C# – Tutorial BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Baca kode batang dari gambar di C# – Tutorial BarCodeReader +url: /id/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Membaca barcode dari gambar di C# – Tutorial BarCodeReader + +Jika Anda perlu **membaca barcode dari gambar** dalam aplikasi .NET, panduan ini menunjukkan secara tepat cara melakukannya dengan kelas `BarCodeReader`. Anda juga akan melihat cara **membaca beberapa barcode C#**, mendekode simbol PDF417, dan mendapatkan contoh lengkap **C# BarCodeReader** yang dapat Anda salin ke proyek Anda. + +Tutorial ini mencakup setiap langkah—dari menambahkan paket NuGet yang diperlukan hingga mencetak bidang PDF417 yang diperluas—sehingga Anda selesai dengan program konsol yang dapat dijalankan. Tidak diperlukan dokumentasi eksternal; semua kode dan penjelasan disertakan. + +## Apa yang Anda perlukan + +Sebelum memulai, pastikan Anda memiliki: + +* .NET 6.0 SDK atau yang lebih baru (kode berfungsi dengan .NET Core dan .NET Framework) +* Visual Studio 2022 atau editor yang kompatibel dengan C# +* Paket NuGet `Aspose.BarCode` (atau perpustakaan setara yang menyediakan `BarCodeReader`) +* File gambar yang berisi barcode Macro PDF417 (misalnya `ExtPDF417Meta.png`) + +Memiliki prasyarat ini memastikan contoh dapat dikompilasi tanpa konfigurasi tambahan. + +## Membaca barcode dari gambar dengan BarCodeReader + +Langkah pertama adalah membuat instance `BarCodeReader` yang menunjuk ke file gambar dan memberi tahu perpustakaan jenis barcode apa yang harus dicari. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Mengapa ini berhasil:** +`BarCodeReader` membuka gambar, memindai untuk `DecodeType` yang ditentukan, dan mengembalikan koleksi objek `BarCodeResult`. Setiap hasil berisi data barcode umum (`CodeTypeName`, `CodeText`) dan, untuk Macro PDF417, objek `Extended.Pdf417` yang menampilkan semua bidang tambahan yang didefinisikan oleh standar. + +## Membaca beberapa barcode C# dalam satu gambar + +Kadang-kadang sebuah gambar berisi lebih dari satu barcode (misalnya, QR code di samping PDF417). Untuk menangani skenario ini, cukup hilangkan `DecodeType` yang eksplisit atau gunakan `DecodeType.AllSupported` dan iterasi melalui hasilnya. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Mengapa Anda memerlukan ini:** +Menentukan `AllSupported` memberi tahu mesin untuk mencoba setiap format barcode yang diketahui, yang menjamin Anda menangkap setiap simbol dalam gambar. Ini adalah pendekatan yang disarankan ketika Anda tidak dapat memprediksi jenis barcode sebelumnya. + +## Cara membaca barcode PDF417 menggunakan C# + +Jika Anda hanya peduli pada format PDF417 klasik (non‑macro), ubah `DecodeType` menjadi `Pdf417`. Sisanya tetap sama, kecuali bidang yang diperluas tidak tersedia. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Mengapa ini penting:** +PDF417 klasik tidak menampilkan properti khusus macro, sehingga blok `Extended.Pdf417` tidak diperlukan. Menggunakan `DecodeType` yang tepat juga mempercepat pemindaian karena perpustakaan melewatkan algoritma yang tidak didukung. + +## Contoh lengkap C# BarCodeReader yang dapat Anda salin + +Berikut adalah program lengkap yang menggabungkan tiga skenario menjadi satu aplikasi konsol yang mudah dijalankan. Ganti `YOUR_DIRECTORY/ExtPDF417Meta.png` dengan jalur sebenarnya ke gambar Anda. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Output yang diharapkan + +Ketika gambar contoh berisi barcode Macro PDF417, konsol akan mencetak sesuatu yang mirip dengan: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Jika gambar hanya berisi PDF417 biasa, bagian “Macro PDF417” akan kosong, dan bagian “Classic PDF417” akan menampilkan teks yang terdekripsi. + +## Kesimpulan + +Anda kini tahu cara **membaca barcode dari gambar** di C# menggunakan `BarCodeReader`, cara **membaca beberapa barcode C#** dalam satu file, dan langkah‑langkah tepat untuk **membaca barcode PDF417**—baik varian macro maupun klasik. Contoh lengkap **C# BarCodeReader** siap ditempelkan ke proyek .NET apa pun, dan Anda dapat memperluasnya untuk menangani format lain atau mengintegrasikannya ke dalam pipeline pemrosesan gambar yang lebih besar. + +**Langkah selanjutnya** + +* Jelajahi pola penanganan error seperti `try / catch` di sekitar blok pembaca. +* Eksperimen dengan objek `ReaderParameters` untuk menyesuaikan kecepatan dan akurasi deteksi. +* Gabungkan pembacaan barcode dengan perpustakaan pra‑pemrosesan gambar ( + +## Apa yang Harus Anda Pelajari Selanjutnya? + +Tutorial berikut mencakup topik yang sangat terkait dan membangun di atas teknik yang ditunjukkan dalam panduan ini. Setiap sumber menyertakan contoh kode yang lengkap dan berfungsi dengan penjelasan langkah‑demi‑langkah untuk membantu Anda menguasai fitur API tambahan dan mengeksplorasi pendekatan implementasi alternatif dalam proyek Anda sendiri. + +- [Cara Membaca Barcode DataMatrix dengan Aspose.BarCode untuk .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Baca barcode DataMatrix C# – Hasilkan Mode DataMatrix (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Baca Barcode dari Gambar – Menguasai Ekstraksi Region Barcode di Java dengan Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/italian/net/compact-pdf417-encoding/_index.md index 9fd32044d..6f6dc4d3d 100644 --- a/barcode/italian/net/compact-pdf417-encoding/_index.md +++ b/barcode/italian/net/compact-pdf417-encoding/_index.md @@ -84,7 +84,9 @@ Oltre alle basi, ecco alcuni consigli pratici per ottimizzare il tuo flusso di l ## Tutorial di codifica Compact PDF417 ### [Creating Compact PDF417 Barcodes](./compact-pdf417-basic-configuration/) -Scopri come generare codici a barre Compact PDF417 usando Aspose.BarCode per .NET. Guida completa con istruzioni passo‑per‑passo ed esempi di codice. +Scopri come generare codici a barre Compact PDF417 usando Aspose.BarCode per .NET. Guida completa con istruzioni passo‑per‑step ed esempi di codice. +### [Crea codice a barre micro PDF417 in C# – guida passo‑per‑passo](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Scopri come generare un codice a barre micro PDF417 in C# con esempi pratici e configurazioni dettagliate. ## Domande frequenti @@ -114,4 +116,4 @@ R: No, non sono richiesti font esterni; la libreria gestisce tutto il rendering {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/italian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/italian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..54f7bdfbd --- /dev/null +++ b/barcode/italian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,246 @@ +--- +category: general +date: 2026-08-15 +description: Crea rapidamente un codice a barre micro PDF417 in C# con Aspose.BarCode. + Scopri come utilizzare il generatore di codici a barre, impostare la dimensione + X, scegliere le colonne e abilitare la conformità GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: it +lastmod: 2026-08-15 +og_description: Crea un codice a barre micro PDF417 in C# con Aspose.BarCode. Segui + questo tutorial per configurare il generatore di codici a barre, impostare le dimensioni + e produrre un'immagine PNG. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Crea codice a barre micro PDF417 in C# – guida completa di programmazione +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Crea codice a barre micro PDF417 in C# – guida passo‑passo +url: /it/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Crea codice a barre micro PDF417 in C# – guida passo‑passo + +Se hai bisogno di **creare un codice a barre micro PDF417** in C#, questa guida ti mostra esattamente come fare. Ti accompagneremo nell’inizializzare un **generatore di codici a barre**, configurare la **X‑dimension**, scegliere il numero di colonne e salvare il risultato come file PNG. + +Generare un codice a barre Micro PDF417 è utile per codificare dati compatti su etichette piccole, biglietti o dispositivi IoT. Alla fine di questo tutorial avrai un esempio completo e funzionante da inserire in qualsiasi progetto .NET. + +## Di cosa avrai bisogno + +Prima di iniziare, assicurati di avere: + +- .NET 6.0 (o successivo) installato – il codice funziona anche con .NET Framework 4.6+. +- La libreria Aspose.BarCode per .NET (disponibile via NuGet `Aspose.BarCode`). +- Un ambiente di sviluppo come Visual Studio 2022 o VS Code. + +Non sono richiesti servizi esterni aggiuntivi; tutto viene eseguito localmente. + +## Come creare un codice a barre micro PDF417 con Aspose.BarCode + +Il cuore del processo è un oggetto **barcode generator** che sa come codificare i dati Micro PDF417. Le sezioni seguenti scompongono ogni passaggio di configurazione. + +### Passo 1: Inizializzare il generatore di codici a barre + +Per prima cosa, importa gli spazi dei nomi necessari e crea un’istanza di `BarcodeGenerator` con l’enumerazione `EncodeTypes.MicroPdf417`. Il secondo argomento è il testo che desideri codificare. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Perché è importante:** La classe `BarcodeGenerator` incapsula tutta la logica di codifica. Selezionare `EncodeTypes.MicroPdf417` indica alla libreria di utilizzare la simbologia compatta Micro PDF417, limitata a 1‑4 colonne. + +### Passo 2: Configurare la X‑dimension (larghezza del modulo) + +La **X‑dimension** controlla la larghezza di un singolo modulo del codice a barre in pixel. Un valore più piccolo produce un codice più compatto, mentre un valore più grande migliora la leggibilità su stampanti a bassa risoluzione. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Suggerimento:** Valori compresi tra 1 e 4 funzionano bene per la maggior parte dei display. Se prevedi di stampare su una stampante termica, prova con 3–4 pixel per evitare sfocature. + +### Passo 3: Impostare il numero di colonne + +Micro PDF417 supporta da 1 a 4 colonne. Più colonne rendono il codice più corto ma ne aumentano l’altezza. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Perché scegliere 4 colonne?** Con quattro colonne il codice occupa il minor spazio orizzontale, ideale per etichette strette. Se ti serve un codice più alto ma più stretto, riduci il numero di colonne. + +### Passo 4: Salvare il codice a barre come immagine PNG + +Infine, scrivi il codice a barre su file. PNG conserva esattamente le dimensioni in pixel che hai configurato. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Dopo aver eseguito il programma, apri `MicroPdf417.png` per vedere il risultato. L’immagine dovrebbe mostrare un nitido codice a barre Micro PDF417 che codifica il testo di esempio. + +#### Output previsto + +![Codice a barre micro PDF417 creato](/images/micro-pdf417-sample.png "Crea codice a barre micro PDF417 in C# – output di esempio") + +Il file PNG contiene un codice a barre con: + +- X‑dimension di 2 px +- 4 colonne +- Testo codificato UTF‑8 `"Åspóse.Barcóde©"` + +### Opzionale: generare un Micro PDF417 conforme a GS1 + +Se la tua applicazione richiede dati **conformi a GS1** (per standard della catena di fornitura), abilita la codifica GS1 prima di salvare: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Spiegazione:** Impostare `IsGS1` indica ad Aspose.BarCode di anteporre l’intestazione GS1 e di applicare le regole di checksum corrette. Questo è essenziale quando il codice verrà letto da scanner compatibili GS1. + +## Esempio completo, eseguibile + +Di seguito trovi un’applicazione console completa che puoi copiare, incollare ed eseguire. Include tutti i `using` necessari, la gestione degli errori e i commenti. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Eseguire il codice:** +1. Crea un nuovo progetto console .NET (`dotnet new console`). +2. Aggiungi il pacchetto Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. Sostituisci il `Program.cs` generato con il codice sopra. +4. Regola il percorso di output se necessario e avvia (`dotnet run`). + +Dovresti vedere un messaggio nella console che conferma la posizione del file, e il PNG conterrà il **codice a barre micro PDF417** appena creato. + +## Problemi comuni e consigli di best‑practice + +- **Gestione Unicode:** Aspose.BarCode codifica automaticamente i caratteri UTF‑8, ma assicurati che il file sorgente sia salvato con codifica UTF‑8 per evitare simboli corrotti. +- **Limiti di colonne:** Impostare `Columns` a un valore al di fuori di 1‑4 genera un `ArgumentException`. Convalida l’input dell’utente se esponi questa impostazione in un’interfaccia. +- **Risoluzione immagine:** PNG è lossless, ma se ti serve un formato vettoriale ad alta risoluzione, usa `BarCodeImageFormat.Svg`. +- **Lunghezza dati GS1:** Il Micro PDF417 conforme a GS1 ha limiti di lunghezza più restrittivi. Verifica che la stringa codificata non superi il massimo consentito dallo standard (tipicamente 90 caratteri per Micro PDF417). + +## Conclusione + +Ora sai come **creare un codice a barre micro PDF417** in C# usando Aspose.BarCode. Il tutorial ha coperto l’inizializzazione di un **generatore di codici a barre**, l’impostazione dei **pixel della X‑dimension**, la scelta del numero di colonne, il salvataggio dell’immagine e, facoltativamente, l’attivazione delle funzionalità **conformi a GS1**. + +Da qui puoi sperimentare con diversi input di testo, regolare la X‑dimension per varie risoluzioni di stampa o passare all’output SVG per grafica scalabile. Se devi generare altre simbologie 2‑D, esplora `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` o `EncodeTypes.QR` — lo stesso schema di configurazione si applica. + +Buon lavoro! + +## Cosa dovresti imparare dopo? + +I tutorial seguenti trattano argomenti strettamente correlati che approfondiscono le tecniche illustrate in questa guida. Ogni risorsa include esempi di codice completi con spiegazioni passo‑passo per aiutarti a padroneggiare ulteriori funzionalità dell’API e a esplorare approcci alternativi nei tuoi progetti. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/italian/net/one-dimensional-barcode-types/_index.md index dc08df975..81be0cc01 100644 --- a/barcode/italian/net/one-dimensional-barcode-types/_index.md +++ b/barcode/italian/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ guadagna come generare codici a barre in .NET con Aspose.BarCode per .NET. Quest Scopri come gestire le eccezioni durante la generazione di codici a barre unidimensionali utilizzando Aspose.BarCode per .NET. Questa guida passo passo garantisce soluzioni per codici a barre tolleranti agli errori. Inizia ora! ### [Configurazione unidimensionale del rapporto largo-stretto](./one-dimensional-wide-narrow-ratio-configuration/) Genera facilmente codici a barre personalizzati con Aspose.BarCode per .NET. Guida passo passo per la configurazione unidimensionale del rapporto largo-stretto. +### [Leggi il codice a barre da immagine in C# – tutorial BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Scopri come leggere codici a barre da immagini in C# usando BarCodeReader di Aspose.BarCode. ## Conclusione @@ -89,4 +91,4 @@ Con questo articolo non solo acquisirai conoscenze sui vari tipi di codici a bar {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/italian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/italian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..788b6e0fe --- /dev/null +++ b/barcode/italian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,259 @@ +--- +category: general +date: 2026-08-15 +description: Leggi il codice a barre da un'immagine in C# usando BarCodeReader. Scopri + come leggere più codici a barre in C#, leggere il codice a barre PDF417 e vedere + un esempio completo di BarCodeReader in C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: it +lastmod: 2026-08-15 +og_description: Leggi il codice a barre da un'immagine in C# con una guida passo passo. + Scopri come leggere più codici a barre in C#, decodificare i simboli PDF417 e eseguire + un esempio completo di BarCodeReader in C#. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Leggi il codice a barre da un'immagine in C# – tutorial BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Leggi il codice a barre da un'immagine in C# – tutorial BarCodeReader +url: /it/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Leggi il codice a barre da un'immagine in C# – tutorial BarCodeReader + +Se devi **leggere un codice a barre da un'immagine** in un'applicazione .NET, questa guida ti mostra esattamente come farlo con la classe `BarCodeReader`. Vedrai anche come **leggere più codici a barre C#**, decodificare un simbolo PDF417 e ottenere un **esempio completo di C# BarCodeReader** da copiare nel tuo progetto. + +Il tutorial copre ogni passaggio—dall'aggiunta del pacchetto NuGet necessario alla stampa dei campi PDF417 estesi—così terminerai con un programma console eseguibile. Non è necessaria alcuna documentazione esterna; tutto il codice e le spiegazioni sono inclusi. + +## Cosa ti servirà + +Prima di iniziare, assicurati di avere: + +* .NET 6.0 SDK o successivo (il codice funziona con .NET Core e .NET Framework) +* Visual Studio 2022 o qualsiasi editor compatibile con C# +* Il pacchetto NuGet `Aspose.BarCode` (o la libreria equivalente che fornisce `BarCodeReader`) +* Un file immagine che contenga un codice a barre Macro PDF417 (ad es., `ExtPDF417Meta.png`) + +Avere questi prerequisiti garantisce che il campione si compili senza configurazioni aggiuntive. + +## Leggi il codice a barre da un'immagine con BarCodeReader + +Il primo passo è creare un'istanza di `BarCodeReader` che punti al file immagine e indichi alla libreria quale tipo di codice a barre cercare. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Perché funziona:** +`BarCodeReader` apre l'immagine, esegue la scansione per il `DecodeType` specificato e restituisce una collezione di oggetti `BarCodeResult`. Ogni risultato contiene i dati generici del codice a barre (`CodeTypeName`, `CodeText`) e, per Macro PDF417, un oggetto `Extended.Pdf417` che espone tutti i campi aggiuntivi definiti dallo standard. + +## Leggi più codici a barre C# in una singola immagine + +A volte un'immagine contiene più di un codice a barre (ad es., un QR code accanto a un PDF417). Per gestire questo scenario, basta omettere il `DecodeType` esplicito o passare `DecodeType.AllSupported` e iterare sui risultati. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Perché ti serve:** +Specificare `AllSupported` indica al motore di provare tutti i formati di codice a barre noti, garantendo che tu catturi ogni simbolo presente nell'immagine. Questo è l'approccio consigliato quando non è possibile prevedere in anticipo i tipi di codice a barre. + +## Come leggere un codice a barre PDF417 usando C# + +Se ti interessa solo il formato PDF417 classico (non macro), cambia il `DecodeType` in `Pdf417`. Il resto del codice rimane identico, tranne per il fatto che i campi estesi non sono disponibili. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Perché è importante:** +Il PDF417 classico non espone le proprietà specifiche del macro, quindi il blocco `Extended.Pdf417` è superfluo. Utilizzare il `DecodeType` preciso velocizza anche la scansione perché la libreria salta gli algoritmi non supportati. + +## Esempio completo di C# BarCodeReader che puoi copiare + +Di seguito trovi il programma completo che combina i tre scenari in una singola applicazione console facile da eseguire. Sostituisci `YOUR_DIRECTORY/ExtPDF417Meta.png` con il percorso reale della tua immagine. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Output previsto + +Quando l'immagine di esempio contiene un codice a barre Macro PDF417, la console stampa qualcosa di simile a: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Se l'immagine contiene solo un PDF417 normale, la sezione “Macro PDF417” sarà vuota e la sezione “Classic PDF417” mostrerà il testo decodificato. + +## Conclusione + +Ora sai come **leggere un codice a barre da un'immagine** in C# usando `BarCodeReader`, come **leggere più codici a barre C#** in un unico file, e i passaggi esatti per **leggere un codice a barre PDF417**—sia nella variante macro che classica. L'intero **esempio C# BarCodeReader** è pronto per essere incollato in qualsiasi progetto .NET, e puoi estenderlo per gestire altri formati o integrarlo in una pipeline di elaborazione immagini più ampia. + +**Passi successivi** + +* Esplora i pattern di gestione degli errori come `try / catch` attorno al blocco reader. +* Sperimenta con l'oggetto `ReaderParameters` per ottimizzare velocità e precisione di rilevamento. +* Combina la lettura dei codici a barre con librerie di pre‑elaborazione immagini ( + +## Cosa dovresti imparare dopo? + + +I tutorial seguenti trattano argomenti strettamente correlati che si basano sulle tecniche dimostrate in questa guida. Ogni risorsa include esempi di codice completi e funzionanti con spiegazioni passo‑passo per aiutarti a padroneggiare funzionalità aggiuntive dell'API e a esplorare approcci di implementazione alternativi nei tuoi progetti. + +- [How to Read DataMatrix Barcodes with Aspose.BarCode for .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Read DataMatrix barcode C# – Generate DataMatrix Mode (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Read Barcode from Image – Mastering Barcode Region Extraction in Java with Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/japanese/net/compact-pdf417-encoding/_index.md index a3cc7ebe8..bf63eb872 100644 --- a/barcode/japanese/net/compact-pdf417-encoding/_index.md +++ b/barcode/japanese/net/compact-pdf417-encoding/_index.md @@ -84,7 +84,7 @@ Aspose.BarCode では `Pdf417ErrorCorrectionLevel` プロパティ(0‑8)を ### [Compact PDF417 バーコードの作成](./compact-pdf417-basic-configuration/) -Aspose.BarCode for .NET を使用して Compact PDF417 バーコードを生成する方法を学びます。ステップバイステップの手順とコード例を含む包括的なガイドです。 +### [C#でマイクロPDF417バーコードを作成する – ステップバイステップガイド](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) ## よくある質問 @@ -114,4 +114,4 @@ A: 外部フォントは不要です。ライブラリが内部で全てのレ {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/japanese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/japanese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..4600274fe --- /dev/null +++ b/barcode/japanese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,242 @@ +--- +category: general +date: 2026-08-15 +description: Aspose.BarCode を使用して C# でマイクロ PDF417 バーコードをすばやく作成します。バーコードジェネレータの使い方、X + ディメンションの設定、列数の選択、GS1 準拠の有効化について学びましょう。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: ja +lastmod: 2026-08-15 +og_description: Aspose.BarCode を使用して C# でマイクロ PDF417 バーコードを作成します。このチュートリアルに従ってバーコードジェネレーターを設定し、サイズを指定し、PNG + 画像を生成します。 +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: C#でマイクロPDF417バーコードを作成する – 完全プログラミングガイド +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: C#でマイクロPDF417バーコードを作成する – ステップバイステップガイド +url: /ja/net/compact-pdf417-encoding/create-micro-pdf417-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# でマイクロ PDF417 バーコードを作成する – ステップバイステップ ガイド + +C# で **マイクロ PDF417 バーコード** を作成する必要がある場合、このガイドで正確な手順を示します。**barcode generator** の初期化、**X‑dimension** の設定、列数の選択、そして結果を PNG ファイルとして保存する方法を順に解説します。 + +マイクロ PDF417 バーコードの生成は、小さなラベル、チケット、または IoT デバイス上でコンパクトにデータをエンコードするのに便利です。このチュートリアルの最後までに、任意の .NET プロジェクトに組み込める完全な実行可能サンプルが手に入ります。 + +## 必要なもの + +- .NET 6.0(またはそれ以降)をインストール済み – コードは .NET Framework 4.6+ でも動作します。 +- Aspose.BarCode for .NET ライブラリ(NuGet の `Aspose.BarCode` で入手可能)。 +- Visual Studio 2022 や VS Code などの開発環境。 + +追加の外部サービスは不要です。すべてローカルで実行できます。 + +## Aspose.BarCode を使用してマイクロ PDF417 バーコードを作成する方法 + +このプロセスの中心は、Micro PDF417 データをエンコードできる **barcode generator** オブジェクトです。以下のセクションで各設定手順を分解して説明します。 + +### 手順 1: barcode generator の初期化 + +まず、必要な名前空間をインポートし、`EncodeTypes.MicroPdf417` 列挙体を指定して `BarcodeGenerator` のインスタンスを作成します。第2引数にはエンコードしたいテキストを渡します。 + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Why this matters:** `BarcodeGenerator` クラスはすべてのエンコードロジックをカプセル化します。`EncodeTypes.MicroPdf417` を選択すると、ライブラリはコンパクトな Micro PDF417 シンボロジーを使用するよう指示され、列数は 1‑4 に制限されます。 + +### 手順 2: X‑dimension(モジュール幅)の設定 + +**X‑dimension** は、バーコードの単一モジュールの幅(ピクセル)を制御します。値が小さいほどバーコードは密になり、値が大きいほど低解像度プリンターでの可読性が向上します。 + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Tip:** 1 から 4 の範囲の値は、ほとんどの画面表示でうまく機能します。サーマルプリンターで印刷する場合は、ぼやけを防ぐために 3〜4 ピクセルでテストしてください。 + +### 手順 3: 列数の設定 + +Micro PDF417 は 1‑4 列をサポートします。列数が多いほどバーコードは短くなりますが、高さが増加します。 + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Why choose 4 columns?** 四列にすると、バーコードは最小の横幅を占めるため、狭いラベルに最適です。高さは必要だが横幅を狭くしたい場合は、列数を減らしてください。 + +### 手順 4: バーコードを PNG 画像として保存する + +最後に、バーコードをファイルに書き出します。PNG は設定したピクセル寸法を正確に保持します。 + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +プログラムを実行したら、`MicroPdf417.png` を開いて結果を確認してください。画像には、サンプルテキストをエンコードした鮮明な Micro PDF417 バーコードが表示されます。 + +#### 期待される出力 + +![作成されたマイクロ PDF417 バーコード](/images/micro-pdf417-sample.png "C# でマイクロ PDF417 バーコードを作成 – 出力例") + +PNG ファイルには次のようなバーコードが含まれます: + +- X‑dimension が 2 px +- 4 列 +- UTF‑8 エンコードされたテキスト `"Åspóse.Barcóde©"` + +### オプション: GS1 準拠のマイクロ PDF417 を生成する + +アプリケーションでサプライチェーン標準向けの **GS1‑compliant barcode** データが必要な場合は、保存前に GS1 エンコーディングを有効にします: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Explanation:** `IsGS1` を設定すると、Aspose.BarCode は GS1 ヘッダーを前置し、正しいチェックサム規則を適用します。GS1 対応リーダーでスキャンされるバーコードの場合、これは必須です。 + +## 完全な実行可能サンプル + +以下は、コピーして貼り付け、実行できる完全なコンソールアプリケーションです。必要な `using` 文、エラーハンドリング、コメントがすべて含まれています。 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**コードの実行:** +1. 新しい .NET コンソールプロジェクトを作成します(`dotnet new console`)。 +2. Aspose.BarCode パッケージを追加します(`dotnet add package Aspose.BarCode`)。 +3. 生成された `Program.cs` を上記のコードに置き換えます。 +4. 必要に応じて出力パスを調整し、実行します(`dotnet run`)。 + +コンソールにファイルの場所を示すメッセージが表示され、PNG には作成した **micro PDF417 barcode** が含まれます。 + +## よくある落とし穴とベストプラクティスのヒント + +- **Unicode handling:** Aspose.BarCode は UTF‑8 文字を自動的にエンコードしますが、ソースファイルが UTF‑8 エンコードで保存されていることを確認し、文字化けを防いでください。 +- **Column limits:** `Columns` に 1‑4 以外の値を設定しようとすると `ArgumentException` がスローされます。UI でこの設定を公開する場合は、ユーザー入力を検証してください。 +- **Image resolution:** PNG はロスレスですが、より高解像度のベクタ形式が必要な場合は `BarCodeImageFormat.Svg` を使用してください。 +- **GS1 data length:** GS1 準拠の Micro PDF417 にはより厳しい長さ制限があります。エンコードされた文字列が標準で許容される最大長(通常は Micro PDF417 で 90 文字)を超えていないか確認してください。 + +## 結論 + +これで、Aspose.BarCode を使用して C# で **micro PDF417 barcode** を **作成する** 方法が分かりました。このチュートリアルでは、**barcode generator** の初期化、**X‑dimension ピクセル** の設定、列数の選択、画像の保存、そしてオプションで **GS1‑compliant barcode** 機能を有効にする手順をカバーしました。 + +ここからは、さまざまなテキスト入力で実験したり、印刷解像度に合わせて X‑dimension を調整したり、スケーラブルなグラフィックのために SVG 出力に切り替えたりできます。他の 2‑D シンボロジーを生成する必要がある場合は、`EncodeTypes.Pdf417`、`EncodeTypes.DataMatrix`、`EncodeTypes.QR` を調べてみてください。設定パターンは同じです。 + +コーディングを楽しんでください! + +## 次に学ぶべきことは? + +以下のチュートリアルは、本ガイドで示した手法を基にした密接に関連するトピックを取り上げています。各リソースには、ステップバイステップの解説と完全な動作コード例が含まれており、追加の API 機能を習得し、プロジェクトでの代替実装アプローチを探求するのに役立ちます。 + +- [バーコードの作成方法 – Aspose.BarCode を使用したコンパクト PDF417](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [DotCode バーコード画像の作成 – 行と列 (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [ITF-14 のバーコードクワイエットゾーンの作成方法 – Aspose.BarCode for .NET を使用](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/japanese/net/one-dimensional-barcode-types/_index.md index 5127ab85a..4ecb60d21 100644 --- a/barcode/japanese/net/one-dimensional-barcode-types/_index.md +++ b/barcode/japanese/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ Aspose.BarCode for .NET を使用して .NET でバーコードを生成する Aspose.BarCode for .NET を使用して 1 次元バーコードを生成する際に例外を処理する方法を学びます。このステップバイステップのガイドは、エラー耐性のあるバーコード ソリューションを保証します。今すぐ始めましょう! ### [1 次元のワイド/ナロー比構成](./one-dimensional-wide-narrow-ratio-configuration/) Aspose.BarCode for .NET を使用して、カスタマイズされたバーコードを簡単に生成します。 1 次元のワイド/ナロー比構成のステップバイステップ ガイド。 +### [画像からバーコードを読み取る(C#) – BarCodeReader チュートリアル](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Aspose.BarCode を使用して C# で画像からバーコードを読み取る方法を学びます。ステップバイステップのガイドです。 ## 結論 @@ -89,4 +91,4 @@ Aspose.BarCode for .NET を使用して、カスタマイズされたバーコ {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/japanese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/japanese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..7cbaf5a5e --- /dev/null +++ b/barcode/japanese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,256 @@ +--- +category: general +date: 2026-08-15 +description: C# の BarCodeReader を使用して画像からバーコードを読み取ります。C# で複数のバーコードを読み取る方法、PDF417 バーコードの読み取り方法、そして完全な + C# BarCodeReader のサンプルをご覧ください。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: ja +lastmod: 2026-08-15 +og_description: ステップバイステップのガイドでC#を使って画像からバーコードを読み取ります。C#で複数のバーコードを読み取る方法、PDF417シンボルをデコードする方法、そして完全なC# + BarCodeReader のサンプルを実行する方法をご紹介します。 +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: C#で画像からバーコードを読み取る – BarCodeReaderチュートリアル +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: C#で画像からバーコードを読み取る – BarCodeReaderチュートリアル +url: /ja/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 画像からバーコードを読み取る(C#) – BarCodeReader チュートリアル + +.NET アプリケーションで **画像からバーコードを読み取る** 必要がある場合、このガイドでは `BarCodeReader` クラスを使った具体的な手順を示します。**C# で複数のバーコードを読み取る** 方法や PDF417 シンボルのデコード、プロジェクトにそのまま貼り付けられる **C# BarCodeReader の完全サンプル** も紹介します。 + +チュートリアルは、必要な NuGet パッケージの追加から拡張 PDF417 フィールドの出力まで、すべての手順を網羅しています。外部ドキュメントは不要で、コードと解説がすべて含まれています。 + +## 必要な環境 + +開始する前に、以下を用意してください。 + +* .NET 6.0 SDK 以降(コードは .NET Core と .NET Framework でも動作します) +* Visual Studio 2022 または任意の C# 対応エディタ +* `Aspose.BarCode` NuGet パッケージ(または `BarCodeReader` を提供する同等のライブラリ) +* Macro PDF417 バーコードを含む画像ファイル(例: `ExtPDF417Meta.png`) + +これらの前提条件が揃っていれば、追加設定なしでサンプルをコンパイルできます。 + +## BarCodeReader で画像からバーコードを読み取る + +最初のステップは、画像ファイルを指し示し、対象のバーコードタイプを指定した `BarCodeReader` インスタンスを作成することです。 + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**このコードが機能する理由:** +`BarCodeReader` は画像を開き、指定した `DecodeType` をスキャンし、`BarCodeResult` オブジェクトのコレクションを返します。各結果には汎用バーコードデータ(`CodeTypeName`、`CodeText`)が含まれ、Macro PDF417 の場合は標準で定義されたすべての追加フィールドを公開する `Extended.Pdf417` オブジェクトが取得できます。 + +## 1 つの画像から複数のバーコードを C# で読み取る + +画像に複数のバーコードが含まれることがあります(例: QR コードと PDF417 が隣り合っている場合)。そのようなシナリオでは、明示的な `DecodeType` を省略するか `DecodeType.AllSupported` を渡して結果をループ処理します。 + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**この手法が必要な理由:** +`AllSupported` を指定すると、エンジンはサポートしているすべてのバーコード形式を試行します。これにより、画像内のすべてのシンボルを確実に取得でき、事前にバーコードタイプを予測できない場合に推奨されます。 + +## C# で PDF417 バーコードを読み取る方法 + +クラシックな PDF417(マクロなし)だけが必要な場合は、`DecodeType` を `Pdf417` に変更します。残りのコードは同一ですが、拡張フィールドは利用できません。 + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**この違いが重要な理由:** +クラシック PDF417 ではマクロ固有のプロパティが公開されないため、`Extended.Pdf417` ブロックは不要です。正確な `DecodeType` を指定することで、未対応アルゴリズムをスキップし、スキャン速度が向上します。 + +## コピー可能な完全 C# BarCodeReader サンプル + +以下は、上記 3 つのシナリオを 1 つの実行可能なコンソール アプリケーションに統合した完全プログラムです。`YOUR_DIRECTORY/ExtPDF417Meta.png` を実際の画像パスに置き換えてください。 + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### 期待される出力 + +サンプル画像に Macro PDF417 バーコードが含まれている場合、コンソールには次のような内容が表示されます。 + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +画像が通常の PDF417 のみの場合は、「Macro PDF417」セクションは空になり、「Classic PDF417」セクションにデコードされたテキストが表示されます。 + +## 結論 + +これで、`BarCodeReader` を使用した **C# で画像からバーコードを読み取る** 方法、**1 つのファイルで複数のバーコードを読み取る** 方法、そして **PDF417 バーコード(マクロ版・クラシック版)を読み取る** 正確な手順が分かりました。完全な **C# BarCodeReader サンプル** は任意の .NET プロジェクトに貼り付けてすぐに使用でき、他のフォーマットへの拡張や画像処理パイプラインへの統合も容易です。 + +**次のステップ** + +* `try / catch` を使用したエラーハンドリング パターンをリーダー ブロック周辺に実装してみましょう。 +* `ReaderParameters` オブジェクトで検出速度と精度を調整してみてください。 +* バーコード読み取りと画像前処理ライブラリを組み合わせて( + +## 次に学ぶべきことは? + +以下のチュートリアルは、本ガイドで示したテクニックを基にした関連トピックを扱っています。各リソースには、ステップバイステップの解説と完全な動作コード例が含まれており、API の追加機能を習得したり、独自の実装アプローチを探求したりするのに役立ちます。 + +- [Aspose.BarCode for .NET で DataMatrix バーコードを読む方法](/barcode/english/net/datamatrix-barcode-reading/) +- [DataMatrix バーコード C# で読み取る – DataMatrix モード(自動)を生成](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [画像からバーコードを読み取る – Java で Aspose.BarCode を使用したバーコード領域抽出のマスター](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/korean/net/compact-pdf417-encoding/_index.md index 0ecfa04d3..7fb86de6f 100644 --- a/barcode/korean/net/compact-pdf417-encoding/_index.md +++ b/barcode/korean/net/compact-pdf417-encoding/_index.md @@ -86,6 +86,8 @@ Aspose.BarCode는 `Pdf417ErrorCorrectionLevel` 속성(0‑8)을 설정할 수 ### [Compact PDF417 바코드 만들기](./compact-pdf417-basic-configuration/) Aspose.BarCode for .NET를 사용해 Compact PDF417 바코드를 생성하는 방법을 배웁니다. 단계별 지침과 코드 예제가 포함된 포괄적인 가이드입니다. +### [C#에서 마이크로 PDF417 바코드 만들기 – 단계별 가이드](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) + ## 자주 묻는 질문 **Q: Compact PDF417 바코드에 저장할 수 있는 최대 데이터 양은?** @@ -114,4 +116,4 @@ A: 외부 폰트가 필요하지 않으며, 라이브러리가 내부적으로 {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/korean/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/korean/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..8edc3a1eb --- /dev/null +++ b/barcode/korean/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,244 @@ +--- +category: general +date: 2026-08-15 +description: Aspose.BarCode를 사용하여 C#에서 마이크로 PDF417 바코드를 빠르게 생성하세요. 바코드 생성기 사용 방법, + X‑디멘션 설정, 열 선택 및 GS1 준수 활성화 방법을 배워보세요. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: ko +lastmod: 2026-08-15 +og_description: Aspose.BarCode를 사용하여 C#에서 마이크로 PDF417 바코드를 생성합니다. 이 튜토리얼을 따라 바코드 생성기를 + 구성하고, 크기를 설정하며, PNG 이미지를 생성하세요. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: C#에서 마이크로 PDF417 바코드 생성 – 완전 프로그래밍 가이드 +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: C#에서 마이크로 PDF417 바코드 만들기 – 단계별 가이드 +url: /ko/net/compact-pdf417-encoding/create-micro-pdf417-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#에서 마이크로 PDF417 바코드 생성 – 단계별 가이드 + +C#에서 **마이크로 PDF417 바코드**를 **생성**해야 할 경우, 이 가이드는 정확한 방법을 보여줍니다. 바코드 생성기 초기화, **X‑dimension** 설정, 열 개수 선택, PNG 파일로 저장하는 과정을 단계별로 안내합니다. + +마이크로 PDF417 바코드 생성은 작은 라벨, 티켓 또는 IoT 디바이스와 같이 제한된 공간에 데이터를 압축해서 인코딩할 때 유용합니다. 이 튜토리얼을 마치면 .NET 프로젝트에 바로 삽입할 수 있는 완전한 실행 예제를 얻을 수 있습니다. + +## 준비 사항 + +시작하기 전에 다음이 설치되어 있는지 확인하세요. + +- .NET 6.0(또는 그 이상) – 코드는 .NET Framework 4.6+에서도 동작합니다. +- Aspose.BarCode for .NET 라이브러리(NuGet `Aspose.BarCode`를 통해 제공). +- Visual Studio 2022 또는 VS Code와 같은 개발 환경. + +추가 외부 서비스는 필요 없으며, 모든 작업이 로컬에서 수행됩니다. + +## Aspose.BarCode를 사용해 마이크로 PDF417 바코드 생성하기 + +핵심은 **바코드 생성기** 객체이며, 이 객체가 마이크로 PDF417 데이터를 인코딩합니다. 아래 섹션에서는 각 설정 단계를 자세히 설명합니다. + +### 단계 1: 바코드 생성기 초기화 + +먼저 필요한 네임스페이스를 가져오고 `EncodeTypes.MicroPdf417` 열거형을 사용해 `BarcodeGenerator` 인스턴스를 생성합니다. 두 번째 인자는 인코딩할 텍스트입니다. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**왜 중요한가:** `BarcodeGenerator` 클래스는 모든 인코딩 로직을 캡슐화합니다. `EncodeTypes.MicroPdf417`를 선택하면 라이브러리가 1‑4열로 제한되는 컴팩트 마이크로 PDF417 심볼을 사용하도록 지정합니다. + +### 단계 2: X‑dimension(모듈 폭) 설정 + +**X‑dimension**은 단일 바코드 모듈의 픽셀 너비를 제어합니다. 값이 작을수록 바코드가 더 촘촘해지고, 값이 클수록 저해상도 프린터에서 가독성이 향상됩니다. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**팁:** 대부분의 화면에서는 1~4 사이의 값이 잘 작동합니다. 열전사 프린터에 인쇄할 경우 흐림을 방지하기 위해 3–4픽셀로 테스트해 보세요. + +### 단계 3: 열 개수 설정 + +마이크로 PDF417은 1‑4열을 지원합니다. 열이 많을수록 바코드가 짧아지지만 높이가 증가합니다. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**왜 4열을 선택하나요?** 4열을 사용하면 가로 공간을 최소화할 수 있어 좁은 라벨에 적합합니다. 더 높지만 좁은 바코드가 필요하면 열 개수를 낮추세요. + +### 단계 4: 바코드를 PNG 이미지로 저장 + +마지막으로 바코드를 파일에 기록합니다. PNG는 설정한 정확한 픽셀 크기를 유지합니다. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +프로그램을 실행한 뒤 `MicroPdf417.png`를 열어 결과를 확인하세요. 이미지에는 샘플 텍스트가 인코딩된 선명한 마이크로 PDF417 바코드가 표시됩니다. + +#### 예상 출력 + +![생성된 마이크로 PDF417 바코드](/images/micro-pdf417-sample.png "C#에서 마이크로 PDF417 바코드 생성 – 예시 출력") + +PNG 파일에는 다음과 같은 바코드가 포함됩니다. + +- X‑dimension: 2 px +- 4열 +- UTF‑8 인코딩 텍스트 `"Åspóse.Barcóde©"` + +### 선택 사항: GS1‑호환 마이크로 PDF417 생성 + +애플리케이션에서 **GS1‑호환 바코드** 데이터(공급망 표준)를 필요로 하는 경우, 저장하기 전에 GS1 인코딩을 활성화합니다. + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**설명:** `IsGS1`을 설정하면 Aspose.BarCode가 GS1 헤더를 앞에 붙이고 올바른 체크섬 규칙을 적용합니다. 이는 GS1‑인식 리더기로 스캔될 때 필수입니다. + +## 전체 실행 예제 + +아래는 복사·붙여넣기만으로 바로 실행할 수 있는 완전한 콘솔 애플리케이션 예제입니다. 모든 `using` 구문, 오류 처리 및 주석이 포함되어 있습니다. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**코드 실행 방법:** +1. 새 .NET 콘솔 프로젝트를 생성합니다(`dotnet new console`). +2. Aspose.BarCode 패키지를 추가합니다(`dotnet add package Aspose.BarCode`). +3. 생성된 `Program.cs`를 위 코드로 교체합니다. +4. 필요에 따라 출력 경로를 조정하고 실행합니다(`dotnet run`). + +콘솔에 파일 위치가 출력되고, PNG 파일에 **마이크로 PDF417 바코드**가 생성된 것을 확인할 수 있습니다. + +## 흔히 발생하는 문제와 모범 사례 + +- **유니코드 처리:** Aspose.BarCode는 UTF‑8 문자를 자동으로 인코딩하지만, 소스 파일을 UTF‑8 인코딩으로 저장해 문자 손상을 방지하세요. +- **열 제한:** `Columns` 값을 1‑4 범위 밖으로 설정하면 `ArgumentException`이 발생합니다. UI에서 이 설정을 노출한다면 사용자 입력을 검증하세요. +- **이미지 해상도:** PNG는 무손실이지만 더 높은 해상도의 벡터 형식이 필요하면 `BarCodeImageFormat.Svg`를 사용하세요. +- **GS1 데이터 길이:** GS1‑호환 마이크로 PDF417은 길이 제한이 더 엄격합니다. 인코딩 문자열이 표준에서 허용하는 최대 길이(보통 90자)를 초과하지 않는지 확인하세요. + +## 결론 + +이제 Aspose.BarCode를 사용해 C#에서 **마이크로 PDF417 바코드**를 **생성**하는 방법을 알게 되었습니다. 튜토리얼에서는 **바코드 생성기** 초기화, **X‑dimension** 픽셀 설정, 열 개수 선택, 이미지 저장, 그리고 **GS1‑호환** 옵션 활성화까지 다루었습니다. + +앞으로는 다양한 텍스트 입력을 실험해 보거나, 인쇄 해상도에 맞게 X‑dimension을 조정하거나, SVG 출력으로 전환해 확장 가능한 그래픽을 만들 수 있습니다. 다른 2‑D 심볼을 생성하려면 `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix`, `EncodeTypes.QR` 등을 살펴보세요—동일한 구성 패턴이 적용됩니다. + +즐거운 코딩 되세요! + +## 다음에 배울 내용은? + +다음 튜토리얼은 이 가이드에서 배운 기술을 확장하는 데 도움이 되는 관련 주제를 다룹니다. 각 자료에는 완전한 코드 예제와 단계별 설명이 포함되어 있어 API 기능을 마스터하고 프로젝트에 다양한 구현 방식을 적용할 수 있습니다. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/korean/net/one-dimensional-barcode-types/_index.md index 5196c2e2a..091a83994 100644 --- a/barcode/korean/net/one-dimensional-barcode-types/_index.md +++ b/barcode/korean/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ Aspose.BarCode를 사용하여 .NET에서 Databar GS1 인코딩 바코드를 만 .NET용 Aspose.BarCode를 사용하여 1차원 바코드를 생성하는 동안 예외를 처리하는 방법을 알아보세요. 이 단계별 가이드는 오류 방지 바코드 솔루션을 보장합니다. 지금 시작하세요! ### [1차원 광폭-협폭 구성](./one-dimensional-wide-narrow-ratio-configuration/) .NET용 Aspose.BarCode를 사용하여 맞춤형 바코드를 쉽게 생성하세요. 1차원 광폭-협폭 비율 구성을 위한 단계별 가이드입니다. +### [C#에서 이미지로부터 바코드 읽기 – BarCodeReader 튜토리얼](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Aspose.BarCode의 BarCodeReader를 사용하여 C#에서 이미지 파일의 바코드를 읽는 방법을 단계별로 안내합니다. ## 결론 @@ -89,4 +91,4 @@ Aspose.BarCode를 사용하여 .NET에서 Databar GS1 인코딩 바코드를 만 {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/korean/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/korean/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..7f00dfdf7 --- /dev/null +++ b/barcode/korean/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,256 @@ +--- +category: general +date: 2026-08-15 +description: BarCodeReader를 사용하여 C#에서 이미지의 바코드를 읽습니다. C#에서 여러 바코드를 읽는 방법, PDF417 바코드 + 읽기, 그리고 전체 C# BarCodeReader 예제를 확인하세요. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: ko +lastmod: 2026-08-15 +og_description: C#에서 이미지의 바코드를 단계별 가이드와 함께 읽어보세요. C#으로 여러 바코드를 읽는 방법, PDF417 심볼을 디코딩하는 + 방법, 그리고 완전한 C# BarCodeReader 예제를 실행하는 방법을 확인하세요. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: C#에서 이미지의 바코드 읽기 – BarCodeReader 튜토리얼 +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: C#에서 이미지의 바코드 읽기 – BarCodeReader 튜토리얼 +url: /ko/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 이미지에서 바코드 읽기 (C#) – BarCodeReader 튜토리얼 + +.NET 애플리케이션에서 **이미지에서 바코드 읽기**가 필요하다면, 이 가이드는 `BarCodeReader` 클래스를 사용하여 정확히 수행하는 방법을 보여줍니다. 또한 **C#에서 다중 바코드 읽기**, PDF417 심볼 디코딩, 그리고 프로젝트에 복사할 수 있는 완전한 **C# BarCodeReader 예제**를 확인할 수 있습니다. + +이 튜토리얼은 NuGet 패키지 추가부터 확장된 PDF417 필드 출력까지 모든 단계를 다루므로, 실행 가능한 콘솔 프로그램을 완성할 수 있습니다. 외부 문서는 필요 없으며, 모든 코드와 설명이 포함되어 있습니다. + +## 필요 사항 + +시작하기 전에 다음을 확인하십시오: + +* .NET 6.0 SDK 또는 그 이후 버전 (코드는 .NET Core 및 .NET Framework에서도 작동합니다) +* Visual Studio 2022 또는 C# 호환 편집기 +* `Aspose.BarCode` NuGet 패키지 (또는 `BarCodeReader`를 제공하는 동등한 라이브러리) +* Macro PDF417 바코드가 포함된 이미지 파일 (예: `ExtPDF417Meta.png`) + +이러한 사전 요구 사항을 갖추면 추가 설정 없이 샘플을 컴파일할 수 있습니다. + +## BarCodeReader를 사용하여 이미지에서 바코드 읽기 + +첫 번째 단계는 이미지 파일을 가리키고 라이브러리에 검색할 바코드 유형을 알려주는 `BarCodeReader` 인스턴스를 만드는 것입니다. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**왜 작동하나요:** +`BarCodeReader`는 이미지를 열고 지정된 `DecodeType`을 스캔하여 `BarCodeResult` 객체 컬렉션을 반환합니다. 각 결과는 일반 바코드 데이터(`CodeTypeName`, `CodeText`)와 Macro PDF417의 경우 표준에 정의된 모든 추가 필드를 노출하는 `Extended.Pdf417` 객체를 포함합니다. + +## 단일 이미지에서 C#으로 다중 바코드 읽기 + +이미지에 하나 이상의 바코드가 포함된 경우가 있습니다(예: PDF417 옆에 QR 코드). 이러한 상황을 처리하려면 명시적인 `DecodeType`을 생략하거나 `DecodeType.AllSupported`를 전달하고 결과를 반복하면 됩니다. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**왜 필요한가요:** +`AllSupported`를 지정하면 엔진이 알고 있는 모든 바코드 형식을 시도하도록 하여 이미지 내 모든 심볼을 포착할 수 있습니다. 바코드 유형을 사전에 예측할 수 없을 때 권장되는 접근 방식입니다. + +## C#을 사용하여 PDF417 바코드 읽는 방법 + +클래식 PDF417(비매크로) 형식만 필요하다면 `DecodeType`을 `Pdf417`로 변경하십시오. 나머지 코드는 동일하지만 확장 필드는 사용할 수 없습니다. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**왜 중요한가요:** +클래식 PDF417은 매크로 전용 속성을 노출하지 않으므로 `Extended.Pdf417` 블록이 필요 없습니다. 정확한 `DecodeType`을 사용하면 라이브러리가 지원되지 않는 알고리즘을 건너뛰어 스캔 속도가 빨라집니다. + +## 복사해서 사용할 수 있는 전체 C# BarCodeReader 예제 + +아래는 세 가지 시나리오를 하나의 실행하기 쉬운 콘솔 애플리케이션으로 결합한 전체 프로그램입니다. `YOUR_DIRECTORY/ExtPDF417Meta.png`를 이미지의 실제 경로로 교체하십시오. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### 예상 출력 + +샘플 이미지에 Macro PDF417 바코드가 포함된 경우 콘솔에 다음과 유사한 내용이 출력됩니다: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +이미지에 일반 PDF417만 포함된 경우 “Macro PDF417” 섹션은 비어 있고, “Classic PDF417” 섹션에 디코딩된 텍스트가 표시됩니다. + +## 결론 + +이제 `BarCodeReader`를 사용하여 C#에서 **이미지에서 바코드 읽기**, 단일 파일에서 **C#으로 다중 바코드 읽기**, 그리고 **PDF417 바코드 읽기**(매크로 및 클래식 변형 모두)의 정확한 단계를 알게 되었습니다. 전체 **C# BarCodeReader 예제**는 모든 .NET 프로젝트에 붙여넣을 준비가 되었으며, 다른 형식을 처리하거나 더 큰 이미지 처리 파이프라인에 통합하도록 확장할 수 있습니다. + +**다음 단계** + +* `reader` 블록 주변에 `try / catch`와 같은 오류 처리 패턴을 탐색하십시오. +* 감지 속도와 정확성을 조정하기 위해 `ReaderParameters` 객체를 실험해 보십시오. +* 바코드 읽기를 이미지 전처리 라이브러리와 결합하십시오 ( + +## 다음에 배워야 할 내용은? + +다음 튜토리얼은 이 가이드에서 시연한 기술을 기반으로 하는 밀접한 관련 주제를 다룹니다. 각 리소스에는 단계별 설명과 함께 완전한 작동 코드 예제가 포함되어 있어 추가 API 기능을 마스터하고 자체 프로젝트에서 대체 구현 방법을 탐색하는 데 도움이 됩니다. + +- [Aspose.BarCode for .NET을 사용하여 DataMatrix 바코드 읽는 방법](/barcode/english/net/datamatrix-barcode-reading/) +- [DataMatrix 바코드 C# 읽기 – DataMatrix 모드 자동 생성](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [이미지에서 바코드 읽기 – Aspose.BarCode와 함께 Java에서 바코드 영역 추출 마스터하기](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/polish/net/compact-pdf417-encoding/_index.md index 90d161b27..8bccbf108 100644 --- a/barcode/polish/net/compact-pdf417-encoding/_index.md +++ b/barcode/polish/net/compact-pdf417-encoding/_index.md @@ -86,7 +86,7 @@ Poza podstawami, oto kilka praktycznych wskazówek, które usprawnią Twój prze ### [Tworzenie kodów Compact PDF417](./compact-pdf417-basic-configuration/) -Dowiedz się, jak generować kody Compact PDF417 przy użyciu Aspose.BarCode dla .NET. Kompleksowy przewodnik z instrukcjami krok po kroku i przykładami kodu. +### [Utwórz mikro kod PDF417 w C# – przewodnik krok po kroku](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) ## Najczęściej zadawane pytania @@ -116,4 +116,4 @@ Dowiedz się, jak generować kody Compact PDF417 przy użyciu Aspose.BarCode dla {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/polish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/polish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..d39ac0011 --- /dev/null +++ b/barcode/polish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,246 @@ +--- +category: general +date: 2026-08-15 +description: Szybko utwórz mikro‑kod PDF417 w C# przy użyciu Aspose.BarCode. Dowiedz + się, jak korzystać z generatora kodów kreskowych, ustawiać wymiar X, wybierać kolumny + i włączać zgodność z GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: pl +lastmod: 2026-08-15 +og_description: Utwórz mikrokod PDF417 w C# przy użyciu Aspose.BarCode. Skorzystaj + z tego samouczka, aby skonfigurować generator kodów kreskowych, ustawić wymiary + i wygenerować obraz PNG. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Utwórz mikro kod kreskowy PDF417 w C# – kompletny przewodnik programistyczny +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Tworzenie mikro‑kodów PDF417 w C# – przewodnik krok po kroku +url: /pl/net/compact-pdf417-encoding/create-micro-pdf417-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 mikro kod PDF417 w C# – przewodnik krok po kroku + +Jeśli potrzebujesz **utworzyć mikro kod PDF417** w C#, ten przewodnik pokaże Ci dokładnie, jak to zrobić. Przejdziemy przez inicjalizację **generatora kodów kreskowych**, konfigurację **wymiaru X**, wybór liczby kolumn oraz zapis wyniku jako plik PNG. + +Generowanie mikro kodu PDF417 jest przydatne do kompaktowego kodowania danych na małych etykietach, biletach lub urządzeniach IoT. Po zakończeniu tego samouczka będziesz mieć kompletny, działający przykład, który możesz wstawić do dowolnego projektu .NET. + +## Czego będziesz potrzebować + +Zanim zaczniesz, upewnij się, że masz: + +- .NET 6.0 (lub nowszy) zainstalowany – kod działa również z .NET Framework 4.6+. +- Bibliotekę Aspose.BarCode for .NET (dostępną przez NuGet `Aspose.BarCode`). +- Środowisko programistyczne, takie jak Visual Studio 2022 lub VS Code. + +Nie są wymagane żadne dodatkowe usługi zewnętrzne; wszystko działa lokalnie. + +## Jak utworzyć mikro kod PDF417 przy użyciu Aspose.BarCode + +Sednem procesu jest obiekt **generatora kodów kreskowych**, który potrafi zakodować dane mikro PDF417. Poniższe sekcje rozkładają każdy krok konfiguracji. + +### Krok 1: Zainicjuj generator kodów kreskowych + +Najpierw zaimportuj wymagane przestrzenie nazw i utwórz instancję `BarcodeGenerator` z wyliczeniem `EncodeTypes.MicroPdf417`. Drugi argument to tekst, który chcesz zakodować. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Dlaczego to ważne:** Klasa `BarcodeGenerator` enkapsuluje całą logikę kodowania. Wybranie `EncodeTypes.MicroPdf417` informuje bibliotekę, że ma użyć kompaktowej symbologii Micro PDF417, ograniczonej do 1‑4 kolumn. + +### Krok 2: Skonfiguruj wymiar X (szerokość modułu) + +**Wymiar X** kontroluje szerokość pojedynczego modułu kodu kreskowego w pikselach. Mniejsza wartość daje bardziej zwarty kod, większa zwiększa czytelność na drukarkach o niskiej rozdzielczości. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Wskazówka:** Wartości od 1 do 4 działają dobrze na większości wyświetlaczy. Jeśli planujesz druk na drukarce termicznej, przetestuj 3–4 piksele, aby uniknąć rozmycia. + +### Krok 3: Ustaw liczbę kolumn + +Micro PDF417 obsługuje 1‑4 kolumny. Więcej kolumn skraca kod w poziomie, ale zwiększa jego wysokość. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Dlaczego wybrać 4 kolumny?** Przy czterech kolumnach kod zajmuje najmniej miejsca w poziomie, co jest idealne dla wąskich etykiet. Jeśli potrzebujesz wyższego, ale węższego kodu, zmniejsz liczbę kolumn. + +### Krok 4: Zapisz kod kreskowy jako obraz PNG + +Na koniec zapisz kod kreskowy do pliku. PNG zachowuje dokładne wymiary pikseli, które skonfigurowałeś. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Po uruchomieniu programu otwórz `MicroPdf417.png`, aby zobaczyć wynik. Obraz powinien wyświetlać wyraźny mikro kod PDF417, który koduje przykładowy tekst. + +#### Oczekiwany wynik + +![Utworzony mikro kod PDF417](/images/micro-pdf417-sample.png "Utwórz mikro kod PDF417 w C# – przykład wyjścia") + +Plik PNG zawiera kod z: + +- Wymiarem X równym 2 px +- 4 kolumnami +- Tekstem zakodowanym w UTF‑8 `"Åspóse.Barcóde©"` + +### Opcjonalnie: wygeneruj mikro PDF417 zgodny z GS1 + +Jeśli Twoja aplikacja wymaga **danych kodu kreskowego zgodnych z GS1** (standardy łańcucha dostaw), włącz kodowanie GS1 przed zapisem: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Wyjaśnienie:** Ustawienie `IsGS1` informuje Aspose.BarCode, aby dodał nagłówek GS1 i zastosował odpowiednie reguły sumy kontrolnej. Jest to niezbędne, gdy kod będzie skanowany przez czytniki obsługujące GS1. + +## Pełny, gotowy do uruchomienia przykład + +Poniżej znajduje się kompletny program konsolowy, który możesz skopiować, wkleić i uruchomić. Zawiera wszystkie niezbędne dyrektywy `using`, obsługę błędów i komentarze. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Uruchamianie kodu:** +1. Utwórz nowy projekt konsolowy .NET (`dotnet new console`). +2. Dodaj pakiet Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. Zamień wygenerowany plik `Program.cs` na powyższy kod. +4. Dostosuj ścieżkę wyjściową w razie potrzeby i uruchom (`dotnet run`). + +Powinieneś zobaczyć komunikat w konsoli potwierdzający lokalizację pliku, a PNG będzie zawierał **mikro kod PDF417**, który właśnie utworzyłeś. + +## Częste pułapki i wskazówki najlepszych praktyk + +- **Obsługa Unicode:** Aspose.BarCode automatycznie koduje znaki UTF‑8, ale upewnij się, że Twój plik źródłowy jest zapisany w kodowaniu UTF‑8, aby uniknąć uszkodzonych symboli. +- **Limity kolumn:** Próba ustawienia `Columns` na wartość spoza zakresu 1‑4 spowoduje `ArgumentException`. Waliduj dane wejściowe, jeśli udostępniasz to ustawienie w interfejsie użytkownika. +- **Rozdzielczość obrazu:** PNG jest bezstratny, ale jeśli potrzebujesz formatu wektorowego o wyższej rozdzielczości, użyj `BarCodeImageFormat.Svg`. +- **Długość danych GS1:** Mikro PDF417 zgodny z GS1 ma bardziej restrykcyjne limity długości. Zweryfikuj, czy zakodowany ciąg nie przekracza maksymalnej dopuszczalnej długości (zwykle 90 znaków dla Micro PDF417). + +## Zakończenie + +Teraz wiesz, jak **utworzyć mikro kod PDF417** w C# przy użyciu Aspose.BarCode. Samouczek obejmował inicjalizację **generatora kodów kreskowych**, ustawienie **pikseli wymiaru X**, wybór liczby kolumn, zapis obrazu oraz opcjonalne włączenie funkcji **kodów zgodnych z GS1**. + +Od tego momentu możesz eksperymentować z różnymi tekstami wejściowymi, dostosowywać wymiar X do różnych rozdzielczości druku lub przejść na wyjście SVG dla grafiki skalowalnej. Jeśli potrzebujesz generować inne symbologie 2‑D, zapoznaj się z `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` lub `EncodeTypes.QR` — ten sam wzorzec konfiguracji ma zastosowanie. + +Miłego kodowania! + +## Co powinieneś nauczyć się dalej? + +Poniższe samouczki obejmują tematy ściśle powiązane, które rozwijają techniki przedstawione w tym przewodniku. Każdy zasób zawiera kompletne działające przykłady kodu oraz wyjaśnienia krok po kroku, aby pomóc Ci opanować dodatkowe funkcje API i odkrywać alternatywne podejścia w własnych projektach. + +- [Jak utworzyć kod kreskowy – kompaktowy PDF417 z Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Utwórz obraz kodu DotCode – wiersze i kolumny (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Jak utworzyć strefę ciszy kodu kreskowego dla ITF-14 przy użyciu Aspose.BarCode dla .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/polish/net/one-dimensional-barcode-types/_index.md index 8fef375f6..8687f7322 100644 --- a/barcode/polish/net/one-dimensional-barcode-types/_index.md +++ b/barcode/polish/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ zarabiaj, jak generować kody kreskowe w .NET za pomocą Aspose.BarCode dla .NET Dowiedz się, jak obsługiwać wyjątki podczas generowania jednowymiarowych kodów kreskowych przy użyciu Aspose.BarCode dla .NET. Ten przewodnik krok po kroku zapewnia rozwiązania odporne na błędy w zakresie kodów kreskowych. Zacznij teraz! ### [Konfiguracja jednowymiarowego szerokiego i wąskiego współczynnika](./one-dimensional-wide-narrow-ratio-configuration/) Z łatwością generuj niestandardowe kody kreskowe za pomocą Aspose.BarCode dla .NET. Przewodnik krok po kroku dotyczący konfiguracji jednowymiarowego współczynnika szerokiego i wąskiego. +### [Odczyt kodu kreskowego z obrazu w C# – samouczek BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Dowiedz się, jak odczytać kod kreskowy z obrazu w C# przy użyciu klasy BarCodeReader w Aspose.BarCode. ## Wniosek @@ -89,4 +91,4 @@ Dzięki temu artykułowi nie tylko zdobędziesz wiedzę na temat różnych typó {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/polish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/polish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..6cfe49be0 --- /dev/null +++ b/barcode/polish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,256 @@ +--- +category: general +date: 2026-08-15 +description: Odczytaj kod kreskowy z obrazu w C# przy użyciu BarCodeReader. Dowiedz + się, jak odczytywać wiele kodów kreskowych w C#, odczytywać kod PDF417 oraz zobacz + pełny przykład BarCodeReader w C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: pl +lastmod: 2026-08-15 +og_description: Odczytaj kod kreskowy z obrazu w C# dzięki przewodnikowi krok po kroku. + Dowiedz się, jak odczytywać wiele kodów kreskowych w C#, dekodować symbole PDF417 + i uruchomić kompletny przykład C# BarCodeReader. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Odczytaj kod kreskowy z obrazu w C# – samouczek BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Odczyt kodu kreskowego z obrazu w C# – samouczek BarCodeReader +url: /pl/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Odczyt kodu kreskowego z obrazu w C# – samouczek BarCodeReader + +Jeśli potrzebujesz **odczytać kod kreskowy z obrazu** w aplikacji .NET, ten przewodnik pokaże Ci dokładnie, jak to zrobić przy użyciu klasy `BarCodeReader`. Zobaczysz także, jak **odczytać wiele kodów kreskowych w C#**, zdekodować symbol PDF417 oraz uzyskać kompletny **przykład C# BarCodeReader**, który możesz skopiować do swojego projektu. + +Samouczek obejmuje każdy krok — od dodania wymaganego pakietu NuGet po wypisanie rozszerzonych pól PDF417 — tak abyś zakończył z działającym programem konsolowym. Nie potrzebna jest żadna zewnętrzna dokumentacja; cały kod i wyjaśnienia są zawarte. + +## Czego będziesz potrzebować + +* .NET 6.0 SDK lub nowszy (kod działa z .NET Core i .NET Framework) +* Visual Studio 2022 lub dowolny edytor kompatybilny z C# +* Pakiet NuGet `Aspose.BarCode` (lub równoważna biblioteka udostępniająca `BarCodeReader`) +* Plik obrazu zawierający kod kreskowy Macro PDF417 (np. `ExtPDF417Meta.png`) + +Posiadanie tych wymagań zapewnia, że przykładowy kod skompiluje się bez dodatkowej konfiguracji. + +## Odczyt kodu kreskowego z obrazu przy użyciu BarCodeReader + +Pierwszym krokiem jest utworzenie instancji `BarCodeReader`, która wskazuje plik obrazu i informuje bibliotekę, jakiego typu kodu kreskowego szukać. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Dlaczego to działa:** +`BarCodeReader` otwiera obraz, skanuje pod kątem określonego `DecodeType` i zwraca kolekcję obiektów `BarCodeResult`. Każdy wynik zawiera ogólne dane kodu kreskowego (`CodeTypeName`, `CodeText`) oraz, w przypadku Macro PDF417, obiekt `Extended.Pdf417`, który udostępnia wszystkie dodatkowe pola zdefiniowane w standardzie. + +## Odczyt wielu kodów kreskowych w C# na jednym obrazie + +Czasami obraz zawiera więcej niż jeden kod kreskowy (np. kod QR obok PDF417). Aby obsłużyć taką sytuację, po prostu pomiń explicite `DecodeType` lub przekaż `DecodeType.AllSupported` i iteruj po wynikach. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Dlaczego tego potrzebujesz:** +Określenie `AllSupported` instruuje silnik, aby wypróbował każdy znany format kodu kreskowego, co gwarantuje przechwycenie każdego symbolu na obrazie. Jest to zalecane podejście, gdy nie możesz wcześniej przewidzieć typów kodów kreskowych. + +## Jak odczytać kod PDF417 przy użyciu C# + +Jeśli interesuje Cię tylko klasyczny format PDF417 (bez makra), zmień `DecodeType` na `Pdf417`. Reszta kodu pozostaje identyczna, z wyjątkiem braku dostępnych pól rozszerzonych. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Dlaczego to ma znaczenie:** +Klasyczny PDF417 nie udostępnia właściwości specyficznych dla makra, więc blok `Extended.Pdf417` jest niepotrzebny. Użycie precyzyjnego `DecodeType` przyspiesza skanowanie, ponieważ biblioteka pomija nieobsługiwane algorytmy. + +## Pełny przykład C# BarCodeReader, który możesz skopiować + +Poniżej znajduje się kompletny program, który łączy trzy scenariusze w jedną, łatwą do uruchomienia aplikację konsolową. Zamień `YOUR_DIRECTORY/ExtPDF417Meta.png` na rzeczywistą ścieżkę do swojego obrazu. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Oczekiwany wynik + +Gdy przykładowy obraz zawiera kod Macro PDF417, konsola wypisuje coś podobnego do: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Jeśli obraz zawiera tylko zwykły PDF417, sekcja „Macro PDF417” będzie pusta, a sekcja „Classic PDF417” wyświetli zdekodowany tekst. + +## Podsumowanie + +Teraz wiesz, jak **odczytać kod kreskowy z obrazu** w C# przy użyciu `BarCodeReader`, jak **odczytać wiele kodów kreskowych w C#** w jednym pliku oraz jakie są dokładne kroki, aby **odczytać kod PDF417** — zarówno w wersji makro, jak i klasycznej. Pełny **przykład C# BarCodeReader** jest gotowy do wklejenia w dowolnym projekcie .NET i możesz go rozbudować, aby obsługiwał inne formaty lub zintegrować z większym potokiem przetwarzania obrazu. + +**Kolejne kroki** + +* Zbadaj wzorce obsługi błędów, takie jak `try / catch` wokół bloku czytnika. +* Eksperymentuj z obiektem `ReaderParameters`, aby dostroić szybkość i dokładność wykrywania. +* Połącz odczyt kodów kreskowych z bibliotekami przetwarzania obrazu ( + +## 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. + +- [Jak odczytać kody DataMatrix przy użyciu Aspose.BarCode dla .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Odczyt kodu DataMatrix w C# – Generowanie trybu DataMatrix (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Odczyt kodu kreskowego z obrazu – Opanowanie wyodrębniania regionu kodu kreskowego w Javie z Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/portuguese/net/compact-pdf417-encoding/_index.md index 9b00326c0..fab8b728c 100644 --- a/barcode/portuguese/net/compact-pdf417-encoding/_index.md +++ b/barcode/portuguese/net/compact-pdf417-encoding/_index.md @@ -85,6 +85,9 @@ Beyond the basics, here are some practical tips to streamline your workflow: ### [Criando Códigos de Barras Compact PDF417](./compact-pdf417-basic-configuration/) Learn how to generate Compact PDF417 barcodes using Aspose.BarCode for .NET. Comprehensive guide with step-by-step instructions and code examples. +### [Criar código de barras micro PDF417 em C# – guia passo a passo](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Aprenda a gerar códigos de barras micro PDF417 em C# com instruções detalhadas passo a passo. + ## Perguntas Frequentes **Q: Qual é a quantidade máxima de dados que posso armazenar em um código de barras Compact PDF417?** @@ -113,4 +116,4 @@ A: Não são necessárias fontes externas; a biblioteca lida com toda a renderiz {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/portuguese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/portuguese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..e6c6dc61c --- /dev/null +++ b/barcode/portuguese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,244 @@ +--- +category: general +date: 2026-08-15 +description: Crie código de barras micro PDF417 em C# rapidamente com Aspose.BarCode. + Aprenda como usar o gerador de códigos de barras, definir a dimensão X, escolher + colunas e habilitar a conformidade GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: pt +lastmod: 2026-08-15 +og_description: Crie código de barras micro PDF417 em C# com Aspose.BarCode. Siga + este tutorial para configurar o gerador de código de barras, definir dimensões e + gerar uma imagem PNG. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Crie código de barras micro PDF417 em C# – guia completo de programação +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Criar código de barras micro PDF417 em C# – guia passo a passo +url: /pt/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Criar código de barras micro PDF417 em C# – guia passo a passo + +Se você precisa **criar código de barras micro PDF417** em C#, este guia mostra exatamente como fazer. Vamos percorrer a inicialização de um **gerador de código de barras**, a configuração da **X‑dimension**, a escolha do número de colunas e a gravação do resultado como um arquivo PNG. + +Gerar um código de barras Micro PDF417 é útil para codificação compacta de dados em etiquetas pequenas, ingressos ou dispositivos IoT. Ao final deste tutorial você terá um exemplo completo e executável que pode ser inserido em qualquer projeto .NET. + +## O que você precisará + +- .NET 6.0 (ou posterior) instalado – o código também funciona com .NET Framework 4.6+. +- A biblioteca Aspose.BarCode for .NET (disponível via NuGet `Aspose.BarCode`). +- Um ambiente de desenvolvimento como Visual Studio 2022 ou VS Code. + +Nenhum serviço externo adicional é necessário; tudo roda localmente. + +## Como criar código de barras micro PDF417 com Aspose.BarCode + +O núcleo do processo é um objeto **barcode generator** que sabe como codificar dados Micro PDF417. As seções a seguir detalham cada passo de configuração. + +### Etapa 1: Inicializar o gerador de código de barras + +Primeiro, importe os namespaces necessários e crie uma instância de `BarcodeGenerator` com o enum `EncodeTypes.MicroPdf417`. O segundo argumento é o texto que você deseja codificar. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Por que isso importa:** A classe `BarcodeGenerator` encapsula toda a lógica de codificação. Selecionar `EncodeTypes.MicroPdf417` indica à biblioteca que deve usar a simbologia compacta Micro PDF417, que é limitada a 1‑4 colunas. + +### Etapa 2: Configurar a X‑dimension (largura do módulo) + +A **X‑dimension** controla a largura de um único módulo do código de barras em pixels. Um valor menor produz um código de barras mais compacto, enquanto um valor maior melhora a legibilidade em impressoras de baixa resolução. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Dica:** Valores entre 1 e 4 funcionam bem na maioria das telas. Se você pretende imprimir em uma impressora térmica, teste com 3–4 pixels para evitar borrões. + +### Etapa 3: Definir o número de colunas + +Micro PDF417 suporta de 1‑4 colunas. Mais colunas tornam o código de barras mais curto, mas aumentam sua altura. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Por que escolher 4 colunas?** Com quatro colunas o código de barras ocupa o menor espaço horizontal, o que é ideal para etiquetas estreitas. Se você precisar de um código de barras mais alto porém mais estreito, diminua o número de colunas. + +### Etapa 4: Salvar o código de barras como imagem PNG + +Finalmente, grave o código de barras em um arquivo. PNG preserva as dimensões exatas em pixels que você configurou. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Depois de executar o programa, abra `MicroPdf417.png` para ver o resultado. A imagem deve exibir um código de barras Micro PDF417 nítido que codifica o texto de exemplo. + +#### Saída esperada + +![Código de barras micro PDF417 criado](/images/micro-pdf417-sample.png "Criar código de barras micro PDF417 em C# – saída de exemplo") + +O arquivo PNG contém um código de barras com: + +- X‑dimension de 2 px +- 4 colunas +- Texto codificado em UTF‑8 `"Åspóse.Barcóde©"` + +### Opcional: gerar um Micro PDF417 compatível com GS1 + +Se sua aplicação requer dados de **código de barras compatível com GS1** (para padrões de cadeia de suprimentos), habilite a codificação GS1 antes de salvar: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Explicação:** Definir `IsGS1` informa ao Aspose.BarCode para prefixar o cabeçalho GS1 e aplicar as regras corretas de checksum. Isso é essencial quando seu código de barras será lido por leitores compatíveis com GS1. + +## Exemplo completo e executável + +Abaixo está uma aplicação console completa que você pode copiar, colar e executar. Ela inclui todas as declarações `using` necessárias, tratamento de erros e comentários. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Executando o código:** +1. Crie um novo projeto console .NET (`dotnet new console`). +2. Adicione o pacote Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. Substitua o `Program.cs` gerado pelo código acima. +4. Ajuste o caminho de saída se necessário e execute (`dotnet run`). + +Você deverá ver uma mensagem no console confirmando a localização do arquivo, e o PNG conterá o **código de barras micro PDF417** que você acabou de criar. + +## Armadilhas comuns e dicas de boas práticas + +- **Manipulação de Unicode:** Aspose.BarCode codifica automaticamente caracteres UTF‑8, mas certifique-se de que seu arquivo fonte esteja salvo com codificação UTF‑8 para evitar símbolos corrompidos. +- **Limites de colunas:** Tentar definir `Columns` com um valor fora de 1‑4 lança uma `ArgumentException`. Valide a entrada do usuário se você expuser essa configuração em uma interface. +- **Resolução da imagem:** PNG é sem perdas, mas se precisar de um formato vetorial de alta resolução, use `BarCodeImageFormat.Svg`. +- **Comprimento dos dados GS1:** O Micro PDF417 compatível com GS1 tem limites de comprimento mais restritos. Verifique se a string codificada não excede o máximo permitido pelo padrão (geralmente 90 caracteres para Micro PDF417). + +## Conclusão + +Agora você sabe como **criar código de barras micro PDF417** em C# usando Aspose.BarCode. O tutorial abordou a inicialização de um **barcode generator**, a definição dos **pixels da X‑dimension**, a escolha do número de colunas, a gravação da imagem e, opcionalmente, a habilitação de recursos de **código de barras compatível com GS1**. + +A partir daqui você pode experimentar diferentes entradas de texto, ajustar a X‑dimension para várias resoluções de impressão ou mudar para saída SVG para gráficos escaláveis. Se precisar gerar outras simbologias 2‑D, explore `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` ou `EncodeTypes.QR` — o mesmo padrão de configuração se aplica. + +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 criar código de barras – PDF417 compacto com Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Criar imagem de código de barras DotCode – linhas e colunas (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Como criar zona silenciosa de código de barras para ITF-14 usando Aspose.BarCode para .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/portuguese/net/one-dimensional-barcode-types/_index.md index 5c81ef2a1..436d8be39 100644 --- a/barcode/portuguese/net/one-dimensional-barcode-types/_index.md +++ b/barcode/portuguese/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ aprenda como gerar códigos de barras em .NET com Aspose.BarCode for .NET. Este Aprenda como lidar com exceções ao gerar códigos de barras unidimensionais usando Aspose.BarCode for .NET. Este guia passo a passo garante soluções de código de barras tolerantes a erros. Comece agora! ### [Configuração de relação ampla-estreita unidimensional](./one-dimensional-wide-narrow-ratio-configuration/) Gere códigos de barras personalizados facilmente com Aspose.BarCode for .NET. Guia passo a passo para configuração unidimensional de proporção larga-estreita. +### [Leitura de código de barras a partir de imagem em C# – tutorial BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Aprenda a ler códigos de barras de imagens em C# usando BarCodeReader da Aspose.BarCode. Guia passo a passo. ## Conclusão @@ -89,4 +91,4 @@ Com este artigo, você não apenas obterá conhecimento sobre vários tipos de c {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/portuguese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/portuguese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..3ee9d99a5 --- /dev/null +++ b/barcode/portuguese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,258 @@ +--- +category: general +date: 2026-08-15 +description: Leia código de barras a partir de imagem em C# usando BarCodeReader. + Aprenda como ler vários códigos de barras em C#, ler código de barras PDF417 e veja + um exemplo completo de BarCodeReader em C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: pt +lastmod: 2026-08-15 +og_description: Leia códigos de barras a partir de imagem em C# com um guia passo + a passo. Descubra como ler múltiplos códigos de barras em C#, decodificar símbolos + PDF417 e executar um exemplo completo do BarCodeReader em C#. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Ler código de barras de imagem em C# – tutorial BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Ler código de barras de imagem em C# – tutorial BarCodeReader +url: /pt/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Ler código de barras a partir de imagem em C# – tutorial BarCodeReader + +Se você precisa **ler código de barras a partir de imagem** em uma aplicação .NET, este guia mostra exatamente como fazer isso com a classe `BarCodeReader`. Você também verá como **ler vários códigos de barras C#**, decodificar um símbolo PDF417 e obter um **exemplo completo de C# BarCodeReader** que pode ser copiado para o seu projeto. + +O tutorial cobre cada passo — desde a adição do pacote NuGet necessário até a impressão dos campos estendidos do PDF417 — para que você termine com um programa de console executável. Nenhuma documentação externa é necessária; todo o código e explicações estão incluídos. + +## O que você precisará + +Antes de começar, certifique‑se de que tem: + +* .NET 6.0 SDK ou posterior (o código funciona com .NET Core e .NET Framework) +* Visual Studio 2022 ou qualquer editor compatível com C# +* O pacote NuGet `Aspose.BarCode` (ou a biblioteca equivalente que fornece `BarCodeReader`) +* Um arquivo de imagem que contenha um código de barras Macro PDF417 (por exemplo, `ExtPDF417Meta.png`) + +Ter esses pré‑requisitos garante que o exemplo compile sem configuração adicional. + +## Ler código de barras a partir de imagem com BarCodeReader + +O primeiro passo é criar uma instância de `BarCodeReader` que aponte para o arquivo de imagem e indique à biblioteca qual tipo de código de barras procurar. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Por que isso funciona:** +`BarCodeReader` abre a imagem, escaneia o `DecodeType` especificado e devolve uma coleção de objetos `BarCodeResult`. Cada resultado contém os dados genéricos do código de barras (`CodeTypeName`, `CodeText`) e, para Macro PDF417, um objeto `Extended.Pdf417` que expõe todos os campos adicionais definidos pelo padrão. + +## Ler vários códigos de barras C# em uma única imagem + +Às vezes, uma imagem contém mais de um código de barras (por exemplo, um QR code ao lado de um PDF417). Para lidar com esse cenário, basta omitir o `DecodeType` explícito ou passar `DecodeType.AllSupported` e percorrer os resultados. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Por que você precisa disso:** +Especificar `AllSupported` indica ao motor que ele deve tentar todos os formatos de código de barras que conhece, o que garante que você capture cada símbolo na imagem. Essa é a abordagem recomendada quando não é possível prever os tipos de código de barras com antecedência. + +## Como ler código de barras PDF417 usando C# + +Se você se interessa apenas pelo formato clássico PDF417 (não‑macro), altere o `DecodeType` para `Pdf417`. O restante do código permanece idêntico, exceto que os campos estendidos não estarão disponíveis. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Por que isso importa:** +O PDF417 clássico não expõe as propriedades específicas de macro, portanto o bloco `Extended.Pdf417` é desnecessário. Usar o `DecodeType` preciso também acelera a varredura, pois a biblioteca ignora algoritmos não suportados. + +## Exemplo completo de C# BarCodeReader que você pode copiar + +Abaixo está o programa completo que combina os três cenários em uma única aplicação de console fácil de executar. Substitua `YOUR_DIRECTORY/ExtPDF417Meta.png` pelo caminho real da sua imagem. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Saída esperada + +Quando a imagem de exemplo contém um código de barras Macro PDF417, o console imprime algo semelhante a: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Se a imagem contiver apenas um PDF417 regular, a seção “Macro PDF417” ficará vazia, e a seção “Classic PDF417” exibirá o texto decodificado. + +## Conclusão + +Agora você sabe como **ler código de barras a partir de imagem** em C# usando `BarCodeReader`, como **ler vários códigos de barras C#** em um único arquivo, e os passos exatos para **ler código de barras PDF417** — tanto nas variantes macro quanto clássica. O **exemplo completo de C# BarCodeReader** está pronto para ser colado em qualquer projeto .NET, e você pode estendê‑lo para lidar com outros formatos ou integrá‑lo a um pipeline maior de processamento de imagens. + +**Próximos passos** + +* Explore padrões de tratamento de erros, como `try / catch`, ao redor do bloco do leitor. +* Experimente o objeto `ReaderParameters` para ajustar a velocidade e a precisão da detecção. +* Combine a leitura de códigos de barras com bibliotecas de pré‑processamento de imagens ( + +## O que você deve aprender a seguir? + +Os tutoriais a seguir abordam tópicos intimamente relacionados que ampliam as técnicas demonstradas neste guia. Cada recurso inclui exemplos de código totalmente 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. + +- [Como ler códigos de barras DataMatrix com Aspose.BarCode para .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Ler código de barras DataMatrix C# – Gerar modo DataMatrix (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Ler código de barras a partir de imagem – Dominando a extração de região de código de barras em Java com Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/russian/net/compact-pdf417-encoding/_index.md index 18a43fe66..8eed71e88 100644 --- a/barcode/russian/net/compact-pdf417-encoding/_index.md +++ b/barcode/russian/net/compact-pdf417-encoding/_index.md @@ -84,6 +84,8 @@ Aspose.BarCode позволяет задать свойство `Pdf417ErrorCorr ## Руководства по Compact PDF417 Encoding ### [Creating Compact PDF417 Barcodes](./compact-pdf417-basic-configuration/) Узнайте, как генерировать Compact PDF417 штрих‑коды с помощью Aspose.BarCode для .NET. Полное руководство с пошаговыми инструкциями и примерами кода. +### [Создайте микроштрих‑код PDF417 в C# – пошаговое руководство](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Пошаговое руководство по созданию микроштрих‑кода PDF417 в C# с использованием Aspose.BarCode. ## Часто задаваемые вопросы @@ -113,4 +115,4 @@ Aspose.BarCode позволяет задать свойство `Pdf417ErrorCorr {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/russian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/russian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..aacad2b4e --- /dev/null +++ b/barcode/russian/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,246 @@ +--- +category: general +date: 2026-08-15 +description: Создайте микробарcode micro PDF417 в C# быстро с помощью Aspose.BarCode. + Узнайте, как использовать генератор штрихкодов, установить X‑размер, выбрать столбцы + и включить соответствие GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: ru +lastmod: 2026-08-15 +og_description: Создайте микро‑PDF417 штрих‑код в C# с помощью Aspose.BarCode. Следуйте + этому руководству, чтобы настроить генератор штрих‑кода, задать размеры и создать + PNG‑изображение. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Создание микробаркода PDF417 в C# – полное руководство по программированию +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Создание микро‑PDF417 штрих‑кода в C# – пошаговое руководство +url: /ru/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Создание микро PDF417 штрих‑кода в C# – пошаговое руководство + +Если вам нужно **создать микро PDF417 штрих‑код** в C#, это руководство покажет вам точно как. Мы пройдем процесс инициализации **генератора штрих‑кода**, настройки **X‑dimension**, выбора количества колонок и сохранения результата в файл PNG. + +Генерация микро PDF417 штрих‑кода полезна для компактного кодирования данных на небольших этикетках, билетах или устройствах IoT. К концу этого руководства у вас будет полностью готовый, исполняемый пример, который можно добавить в любой проект .NET. + +## Что понадобится + +Прежде чем начать, убедитесь, что у вас есть: + +- .NET 6.0 (или новее) – код также работает с .NET Framework 4.6+. +- Библиотека Aspose.BarCode for .NET (доступна через NuGet `Aspose.BarCode`). +- Среда разработки, например Visual Studio 2022 или VS Code. + +Дополнительные внешние сервисы не требуются; всё работает локально. + +## Как создать микро PDF417 штрих‑код с помощью Aspose.BarCode + +Основой процесса является объект **генератора штрих‑кода**, который умеет кодировать данные микро PDF417. Ниже приведены отдельные шаги настройки. + +### Шаг 1: Инициализировать генератор штрих‑кода + +Сначала импортируйте необходимые пространства имён и создайте экземпляр `BarcodeGenerator` с перечислением `EncodeTypes.MicroPdf417`. Второй аргумент — текст, который нужно закодировать. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Почему это важно:** Класс `BarcodeGenerator` инкапсулирует всю логику кодирования. Выбор `EncodeTypes.MicroPdf417` сообщает библиотеке использовать компактную символьную систему Micro PDF417, ограниченную 1‑4 колонками. + +### Шаг 2: Настроить X‑dimension (ширину модуля) + +**X‑dimension** определяет ширину одного модуля штрих‑кода в пикселях. Меньшее значение делает штрих‑код плотнее, большее — улучшает читаемость на принтерах с низким разрешением. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Совет:** Значения от 1 до 4 хорошо подходят для большинства экранов. Если планируете печать на термопринтере, протестируйте 3–4 пикселя, чтобы избежать размытия. + +### Шаг 3: Установить количество колонок + +Micro PDF417 поддерживает 1‑4 колонки. Большее количество колонок делает штрих‑код короче, но увеличивает его высоту. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Зачем выбирать 4 колонки?** При четырёх колонках штрих‑код занимает минимум горизонтального пространства, что идеально для узких этикеток. Если нужен более высокий, но уже штрих‑код, уменьшите количество колонок. + +### Шаг 4: Сохранить штрих‑код как PNG‑изображение + +Наконец, запишите штрих‑код в файл. PNG сохраняет точные пиксельные размеры, которые вы задали. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +После выполнения программы откройте `MicroPdf417.png`, чтобы увидеть результат. На изображении должен отображаться чёткий микро PDF417 штрих‑код, кодирующий примерный текст. + +#### Ожидаемый результат + +![Созданный микро PDF417 штрих‑код](/images/micro-pdf417-sample.png "Создание микро PDF417 штрих‑кода в C# – пример вывода") + +PNG‑файл содержит штрих‑код с: + +- X‑dimension = 2 px +- 4 колонками +- Текстом в кодировке UTF‑8 `"Åspóse.Barcóde©"` + +### Опционально: создать GS1‑совместимый микро PDF417 + +Если вашему приложению нужны **GS1‑совместимые данные штрих‑кода** (для стандартов цепочки поставок), включите GS1‑кодирование перед сохранением: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Пояснение:** Установка `IsGS1` заставляет Aspose.BarCode добавить GS1‑заголовок и применить правильные правила контрольных сумм. Это необходимо, когда ваш штрих‑код будет считываться GS1‑совместимыми сканерами. + +## Полный, исполняемый пример + +Ниже приведено полное консольное приложение, которое можно скопировать, вставить и запустить. В нём присутствуют все необходимые `using`‑директивы, обработка ошибок и комментарии. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Запуск кода:** +1. Создайте новый .NET консольный проект (`dotnet new console`). +2. Добавьте пакет Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. Замените сгенерированный `Program.cs` кодом выше. +4. При необходимости скорректируйте путь вывода и запустите (`dotnet run`). + +Вы увидите сообщение в консоли, подтверждающее расположение файла, а PNG будет содержать **микро PDF417 штрих‑код**, который вы только что создали. + +## Распространённые ошибки и рекомендации по лучшим практикам + +- **Обработка Unicode:** Aspose.BarCode автоматически кодирует символы UTF‑8, но убедитесь, что ваш исходный файл сохранён в кодировке UTF‑8, чтобы избежать искажённых символов. +- **Ограничения колонок:** Попытка установить `Columns` в значение вне диапазона 1‑4 вызывает `ArgumentException`. При предоставлении этой настройки пользователю проверяйте ввод. +- **Разрешение изображения:** PNG — без потерь, но если нужен векторный формат более высокого разрешения, используйте `BarCodeImageFormat.Svg`. +- **Длина GS1‑данных:** GS1‑совместимый микро PDF417 имеет более строгие ограничения по длине. Убедитесь, что кодируемая строка не превышает максимальную длину, установленную стандартом (обычно 90 символов для микро PDF417). + +## Заключение + +Теперь вы знаете, как **создать микро PDF417 штрих‑код** в C# с помощью Aspose.BarCode. В руководстве рассмотрены инициализация **генератора штрих‑кода**, установка **X‑dimension** в пикселях, выбор количества колонок, сохранение изображения и, при необходимости, включение **GS1‑совместимых** функций. + +Дальше вы можете экспериментировать с различными входными текстами, менять X‑dimension для разных разрешений печати или переключаться на вывод SVG для масштабируемой графики. Если нужно генерировать другие 2‑D символьные системы, изучите `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` или `EncodeTypes.QR` — паттерн конфигурации остаётся тем же. + +Удачной разработки! + +## Что изучать дальше? + +Следующие руководства охватывают близко связанные темы, расширяющие техники, продемонстрированные в этом руководстве. Каждый ресурс включает полностью работающие примеры кода с пошаговыми объяснениями, чтобы помочь вам освоить дополнительные возможности API и исследовать альтернативные подходы в собственных проектах. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/russian/net/one-dimensional-barcode-types/_index.md index 8a11b64f3..2a684f38e 100644 --- a/barcode/russian/net/one-dimensional-barcode-types/_index.md +++ b/barcode/russian/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ url: /ru/net/one-dimensional-barcode-types/ Узнайте, как обрабатывать исключения при создании одномерных штрих-кодов с помощью Aspose.BarCode для .NET. Это пошаговое руководство обеспечивает устойчивые к ошибкам решения в области штрих-кодов. Начать сейчас! ### [Одномерная конфигурация с широким и узким соотношением](./one-dimensional-wide-narrow-ratio-configuration/) Легко создавайте индивидуальные штрих-коды с помощью Aspose.BarCode для .NET. Пошаговое руководство по одномерной конфигурации с широким и узким соотношением сторон. +### [Считывание штрих‑кода из изображения в C# – руководство BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Узнайте, как с помощью Aspose.BarCode считывать штрих‑коды из изображений в C# с использованием BarCodeReader. ## Заключение @@ -89,4 +91,4 @@ url: /ru/net/one-dimensional-barcode-types/ {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/russian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/russian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..8c32ae13d --- /dev/null +++ b/barcode/russian/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,259 @@ +--- +category: general +date: 2026-08-15 +description: Считайте штрих‑код с изображения в C# с помощью BarCodeReader. Узнайте, + как считывать несколько штрих‑кодов в C#, как считывать штрих‑код PDF417, и посмотрите + полный пример BarCodeReader на C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: ru +lastmod: 2026-08-15 +og_description: Считайте штрих‑код с изображения в C# с пошаговым руководством. Узнайте, + как считывать несколько штрих‑кодов в C#, декодировать символы PDF417 и запустить + полноценный пример C# BarCodeReader. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Чтение штрихкода с изображения в C# – руководство BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Считывание штрихкода с изображения в C# – учебник BarCodeReader +url: /ru/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Считывание штрихкода с изображения в C# – руководство BarCodeReader + +Если вам нужно **считать штрихкод с изображения** в приложении .NET, это руководство покажет, как сделать это с помощью класса `BarCodeReader`. Вы также узнаете, как **считать несколько штрихкодов C#**, декодировать символ PDF417 и получите полный **пример C# BarCodeReader**, который можно скопировать в свой проект. + +В руководстве рассматривается каждый шаг — от добавления необходимого пакета NuGet до вывода расширенных полей PDF417 — чтобы в итоге получить готовую к запуску консольную программу. Внешняя документация не требуется; весь код и пояснения включены. + +## Что понадобится + +Прежде чем начать, убедитесь, что у вас есть: + +* .NET 6.0 SDK или новее (код работает с .NET Core и .NET Framework) +* Visual Studio 2022 или любой редактор, поддерживающий C# +* Пакет NuGet `Aspose.BarCode` (или эквивалентная библиотека, предоставляющая `BarCodeReader`) +* Файл изображения, содержащий штрихкод Macro PDF417 (например, `ExtPDF417Meta.png`) + +Наличие этих предварительных условий гарантирует, что пример скомпилируется без дополнительной настройки. + +## Считывание штрихкода с изображения с помощью BarCodeReader + +Первый шаг — создать экземпляр `BarCodeReader`, указывающий на файл изображения и сообщающий библиотеке, какой тип штрихкода искать. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Почему это работает:** +`BarCodeReader` открывает изображение, сканирует его в поисках указанного `DecodeType` и возвращает коллекцию объектов `BarCodeResult`. Каждый результат содержит общие данные штрихкода (`CodeTypeName`, `CodeText`) и, для Macro PDF417, объект `Extended.Pdf417`, который раскрывает все дополнительные поля, определённые стандартом. + +## Считывание нескольких штрихкодов C# на одном изображении + +Иногда изображение содержит более одного штрихкода (например, QR‑код рядом с PDF417). Чтобы обработать такой случай, просто опустите явное указание `DecodeType` или передайте `DecodeType.AllSupported` и пройдитесь по результатам в цикле. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Зачем это нужно:** +Указание `AllSupported` заставляет движок попытаться распознать каждый известный ему формат штрихкода, что гарантирует захват всех символов на изображении. Этот подход рекомендуется, когда типы штрихкодов заранее неизвестны. + +## Как считать штрихкод PDF417 с помощью C# + +Если вам нужен только классический PDF417 (не‑macro), измените `DecodeType` на `Pdf417`. Остальная часть кода остаётся той же, за исключением того, что расширенные поля недоступны. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Почему это важно:** +Классический PDF417 не раскрывает свойства, специфичные для macro, поэтому блок `Extended.Pdf417` не нужен. Точное указание `DecodeType` также ускоряет сканирование, поскольку библиотека пропускает неподдерживаемые алгоритмы. + +## Полный пример C# BarCodeReader, который можно скопировать + +Ниже представлена полная программа, объединяющая три сценария в одном простом консольном приложении. Замените `YOUR_DIRECTORY/ExtPDF417Meta.png` реальным путём к вашему изображению. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Ожидаемый вывод + +Если образец изображения содержит штрихкод Macro PDF417, консоль выведет что‑то вроде: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Если изображение содержит только обычный PDF417, раздел «Macro PDF417» будет пустым, а раздел «Classic PDF417» покажет декодированный текст. + +## Заключение + +Теперь вы знаете, как **считать штрихкод с изображения** в C# с помощью `BarCodeReader`, как **считать несколько штрихкодов C#** в одном файле и какие шаги нужны для **считывания штрихкода PDF417** — как макро, так и классической версии. Полный **пример C# BarCodeReader** готов к вставке в любой .NET‑проект, и вы можете расширять его для поддержки других форматов или интегрировать в более крупный конвейер обработки изображений. + +**Следующие шаги** + +* Изучите шаблоны обработки ошибок, такие как `try / catch`, вокруг блока чтения. +* Поэкспериментируйте с объектом `ReaderParameters` для настройки скорости и точности обнаружения. +* Объедините чтение штрихкодов с библиотеками предварительной обработки изображений ( + +## Что следует изучить дальше? + + +Следующие руководства охватывают тесно связанные темы, построенные на техниках, продемонстрированных в этом руководстве. Каждый ресурс включает полностью работающие примеры кода с пошаговыми объяснениями, чтобы помочь вам освоить дополнительные возможности API и исследовать альтернативные подходы реализации в своих проектах. + +- [Как считывать DataMatrix штрихкоды с Aspose.BarCode для .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Считывание DataMatrix штрихкода C# – режим генерации DataMatrix (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Считывание штрихкода с изображения – мастерство извлечения области штрихкода в Java с Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/spanish/net/compact-pdf417-encoding/_index.md index 6c5e3bd09..78894f566 100644 --- a/barcode/spanish/net/compact-pdf417-encoding/_index.md +++ b/barcode/spanish/net/compact-pdf417-encoding/_index.md @@ -85,6 +85,8 @@ Más allá de lo básico, aquí tienes algunos consejos prácticos para optimiza ## Tutoriales de codificación Compact PDF417 ### [Crear códigos de barras Compact PDF417](./compact-pdf417-basic-configuration/) Aprende a generar códigos de barras Compact PDF417 usando Aspose.BarCode para .NET. Guía completa con instrucciones paso a paso y ejemplos de código. +### [Crear código de barras micro PDF417 en C# – guía paso a paso](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Aprende a generar códigos de barras micro PDF417 en C# con Aspose.BarCode, siguiendo una guía detallada paso a paso. ## Preguntas frecuentes @@ -114,4 +116,4 @@ R: No se requieren fuentes externas; la biblioteca maneja todo el renderizado in {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/spanish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/spanish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..1a616d730 --- /dev/null +++ b/barcode/spanish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,246 @@ +--- +category: general +date: 2026-08-15 +description: Crea códigos de barras micro PDF417 en C# rápidamente con Aspose.BarCode. + Aprende a usar el generador de códigos de barras, establecer la dimensión X, elegir + columnas y habilitar el cumplimiento de GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: es +lastmod: 2026-08-15 +og_description: Crea un código de barras micro PDF417 en C# con Aspose.BarCode. Sigue + este tutorial para configurar el generador de códigos de barras, establecer dimensiones + y generar una imagen PNG. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Crear código de barras micro PDF417 en C# – guía completa de programación +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Crear código de barras micro PDF417 en C# – guía paso a paso +url: /es/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Crear código de barras micro PDF417 en C# – guía paso a paso + +Si necesitas **crear un código de barras micro PDF417** en C#, esta guía te muestra exactamente cómo hacerlo. Recorreremos la inicialización de un **generador de códigos de barras**, la configuración de la **dimensión X**, la elección del número de columnas y el guardado del resultado como archivo PNG. + +Generar un código de barras Micro PDF417 es útil para codificar datos de forma compacta en etiquetas pequeñas, tickets o dispositivos IoT. Al final de este tutorial tendrás un ejemplo completo y ejecutable que podrás incorporar a cualquier proyecto .NET. + +## Lo que necesitarás + +Antes de comenzar, asegúrate de contar con: + +- .NET 6.0 (o posterior) instalado – el código también funciona con .NET Framework 4.6+. +- La biblioteca Aspose.BarCode para .NET (disponible vía NuGet `Aspose.BarCode`). +- Un entorno de desarrollo como Visual Studio 2022 o VS Code. + +No se requieren servicios externos adicionales; todo se ejecuta localmente. + +## Cómo crear un código de barras micro PDF417 con Aspose.BarCode + +El núcleo del proceso es un objeto **generador de códigos de barras** que sabe cómo codificar datos Micro PDF417. Las siguientes secciones desglosan cada paso de configuración. + +### Paso 1: Inicializar el generador de códigos de barras + +Primero, importa los espacios de nombres requeridos y crea una instancia de `BarcodeGenerator` con el enumerado `EncodeTypes.MicroPdf417`. El segundo argumento es el texto que deseas codificar. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Por qué es importante:** La clase `BarcodeGenerator` encapsula toda la lógica de codificación. Seleccionar `EncodeTypes.MicroPdf417` indica a la biblioteca que use la simbología compacta Micro PDF417, que está limitada a 1‑4 columnas. + +### Paso 2: Configurar la dimensión X (ancho del módulo) + +La **dimensión X** controla el ancho de un solo módulo del código de barras en píxeles. Un valor menor produce un código más estrecho, mientras que un valor mayor mejora la legibilidad en impresoras de baja resolución. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Consejo:** Valores entre 1 y 4 funcionan bien para la mayoría de pantallas. Si planeas imprimir en una impresora térmica, prueba con 3–4 píxeles para evitar el desenfoque. + +### Paso 3: Establecer el número de columnas + +Micro PDF417 admite de 1 a 4 columnas. Más columnas hacen que el código sea más corto pero aumentan su altura. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**¿Por qué elegir 4 columnas?** Con cuatro columnas el código ocupa el menor espacio horizontal, lo cual es ideal para etiquetas estrechas. Si necesitas un código más alto pero más estrecho, reduce el número de columnas. + +### Paso 4: Guardar el código de barras como imagen PNG + +Finalmente, escribe el código de barras en un archivo. PNG conserva las dimensiones exactas de píxeles que configuraste. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Después de ejecutar el programa, abre `MicroPdf417.png` para ver el resultado. La imagen debe mostrar un código de barras Micro PDF417 nítido que codifica el texto de ejemplo. + +#### Resultado esperado + +![Código de barras micro PDF417 creado](/images/micro-pdf417-sample.png "Crear código de barras micro PDF417 en C# – salida de ejemplo") + +El archivo PNG contiene un código de barras con: + +- Dimensión X de 2 px +- 4 columnas +- Texto codificado en UTF‑8 `"Åspóse.Barcóde©"` + +### Opcional: generar un Micro PDF417 compatible con GS1 + +Si tu aplicación requiere datos de **código de barras compatible con GS1** (para normas de cadena de suministro), habilita la codificación GS1 antes de guardar: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Explicación:** Establecer `IsGS1` indica a Aspose.BarCode que añada el encabezado GS1 y aplique las reglas de checksum correctas. Esto es esencial cuando tu código será escaneado por lectores compatibles con GS1. + +## Ejemplo completo y ejecutable + +A continuación tienes una aplicación de consola completa que puedes copiar, pegar y ejecutar. Incluye todas las sentencias `using` necesarias, manejo de errores y comentarios. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Ejecutar el código:** +1. Crea un nuevo proyecto de consola .NET (`dotnet new console`). +2. Añade el paquete Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. Reemplaza el `Program.cs` generado con el código anterior. +4. Ajusta la ruta de salida si es necesario y ejecuta (`dotnet run`). + +Deberías ver un mensaje en la consola confirmando la ubicación del archivo, y el PNG contendrá el **código de barras micro PDF417** que acabas de crear. + +## Problemas comunes y consejos de buenas prácticas + +- **Manejo de Unicode:** Aspose.BarCode codifica automáticamente caracteres UTF‑8, pero asegúrate de que tu archivo fuente esté guardado con codificación UTF‑8 para evitar símbolos corruptos. +- **Límites de columnas:** Intentar establecer `Columns` a un valor fuera del rango 1‑4 lanza una `ArgumentException`. Valida la entrada del usuario si expones esta configuración en una UI. +- **Resolución de la imagen:** PNG es sin pérdida, pero si necesitas un formato vectorial de mayor resolución, usa `BarCodeImageFormat.Svg` en su lugar. +- **Longitud de datos GS1:** El Micro PDF417 compatible con GS1 tiene límites de longitud más estrictos. Verifica que la cadena codificada no supere el máximo permitido por la norma (típicamente 90 caracteres para Micro PDF417). + +## Conclusión + +Ahora sabes cómo **crear un código de barras micro PDF417** en C# usando Aspose.BarCode. El tutorial cubrió la inicialización de un **generador de códigos de barras**, la configuración de los **píxeles de dimensión X**, la elección del número de columnas, el guardado de la imagen y, opcionalmente, la activación de funciones **compatibles con GS1**. + +A partir de aquí puedes experimentar con diferentes entradas de texto, ajustar la dimensión X para distintas resoluciones de impresión o cambiar a salida SVG para gráficos escalables. Si necesitas generar otras simbologías 2‑D, explora `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` o `EncodeTypes.QR`—el mismo patrón de configuración se aplica. + +¡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 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 crear un código de barras – PDF417 compacto con Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Crear imagen de código de barras DotCode – filas y columnas (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Cómo crear zona silenciosa para ITF-14 usando Aspose.BarCode para .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/spanish/net/one-dimensional-barcode-types/_index.md index ca6d74659..3eb54581b 100644 --- a/barcode/spanish/net/one-dimensional-barcode-types/_index.md +++ b/barcode/spanish/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ Aprenda cómo generar códigos de barras en .NET con Aspose.BarCode para .NET. E Aprenda a manejar excepciones mientras genera códigos de barras unidimensionales utilizando Aspose.BarCode para .NET. Esta guía paso a paso garantiza soluciones de códigos de barras tolerantes a errores. ¡Empieza ahora! ### [Configuración unidimensional de relación ancha-estrecha](./one-dimensional-wide-narrow-ratio-configuration/) Genere códigos de barras personalizados fácilmente con Aspose.BarCode para .NET. Guía paso a paso para la configuración unidimensional de relación ancha-estrecha. +### [Leer código de barras desde una imagen en C# – tutorial BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Aprenda a leer códigos de barras de imágenes en C# usando BarCodeReader de Aspose.BarCode. Guía paso a paso. ## Conclusión @@ -89,4 +91,4 @@ Con este artículo, no sólo obtendrá conocimientos sobre varios tipos de códi {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/spanish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/spanish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..d5397b87c --- /dev/null +++ b/barcode/spanish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,256 @@ +--- +category: general +date: 2026-08-15 +description: Leer código de barras de una imagen en C# usando BarCodeReader. Aprende + cómo leer varios códigos de barras en C#, leer códigos de barras PDF417 y ver un + ejemplo completo de BarCodeReader en C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: es +lastmod: 2026-08-15 +og_description: Lee códigos de barras desde una imagen en C# con una guía paso a paso. + Descubre cómo leer múltiples códigos de barras en C#, decodificar símbolos PDF417 + y ejecutar un ejemplo completo de BarCodeReader en C#. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Leer código de barras de una imagen en C# – Tutorial de BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Leer código de barras de una imagen en C# – tutorial de BarCodeReader +url: /es/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Leer código de barras desde una imagen en C# – tutorial de BarCodeReader + +Si necesitas **leer código de barras desde una imagen** en una aplicación .NET, esta guía te muestra exactamente cómo hacerlo con la clase `BarCodeReader`. También verás cómo **leer varios códigos de barras C#**, decodificar un símbolo PDF417 y obtener un **ejemplo completo de C# BarCodeReader** que puedes copiar en tu proyecto. + +El tutorial cubre cada paso—desde agregar el paquete NuGet requerido hasta imprimir los campos extendidos de PDF417—para que termines con un programa de consola ejecutable. No se necesita documentación externa; todo el código y las explicaciones están incluidas. + +## Lo que necesitarás + +* .NET 6.0 SDK o posterior (el código funciona con .NET Core y .NET Framework) +* Visual Studio 2022 o cualquier editor compatible con C# +* El paquete NuGet `Aspose.BarCode` (o la biblioteca equivalente que proporciona `BarCodeReader`) +* Un archivo de imagen que contenga un código de barras Macro PDF417 (p. ej., `ExtPDF417Meta.png`) + +Tener estos requisitos previos garantiza que el ejemplo compile sin configuración adicional. + +## Leer código de barras desde una imagen con BarCodeReader + +El primer paso es crear una instancia de `BarCodeReader` que apunte al archivo de imagen y le indique a la biblioteca qué tipo de código de barras buscar. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Por qué esto funciona:** +`BarCodeReader` abre la imagen, escanea el `DecodeType` especificado y devuelve una colección de objetos `BarCodeResult`. Cada resultado contiene los datos genéricos del código de barras (`CodeTypeName`, `CodeText`) y, para Macro PDF417, un objeto `Extended.Pdf417` que expone todos los campos adicionales definidos por el estándar. + +## Leer varios códigos de barras C# en una sola imagen + +A veces una imagen contiene más de un código de barras (p. ej., un código QR junto a un PDF417). Para manejar ese escenario, simplemente omite el `DecodeType` explícito o pasa `DecodeType.AllSupported` y recorre los resultados. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Por qué necesitas esto:** +Especificar `AllSupported` indica al motor que pruebe todos los formatos de código de barras que conoce, lo que garantiza que captures cada símbolo en la imagen. Este es el enfoque recomendado cuando no puedes predecir los tipos de códigos de barras de antemano. + +## Cómo leer códigos de barras PDF417 usando C# + +Si solo te interesa el formato clásico PDF417 (no macro), cambia el `DecodeType` a `Pdf417`. El resto del código permanece idéntico, excepto que los campos extendidos no están disponibles. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Por qué esto es importante:** +El PDF417 clásico no expone las propiedades específicas del macro, por lo que el bloque `Extended.Pdf417` no es necesario. Usar el `DecodeType` preciso también acelera el escaneo porque la biblioteca omite algoritmos no compatibles. + +## Ejemplo completo de C# BarCodeReader que puedes copiar + +A continuación se muestra el programa completo que combina los tres escenarios en una única aplicación de consola fácil de ejecutar. Reemplaza `YOUR_DIRECTORY/ExtPDF417Meta.png` con la ruta real a tu imagen. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Salida esperada + +Cuando la imagen de ejemplo contiene un código de barras Macro PDF417, la consola imprime algo similar a: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Si la imagen contiene solo un PDF417 regular, la sección “Macro PDF417” estará vacía y la sección “Classic PDF417” mostrará el texto decodificado. + +## Conclusión + +Ahora sabes cómo **leer código de barras desde una imagen** en C# usando `BarCodeReader`, cómo **leer varios códigos de barras C#** en un solo archivo, y los pasos exactos para **leer códigos de barras PDF417**—tanto en sus variantes macro como clásicas. El **ejemplo completo de C# BarCodeReader** está listo para pegar en cualquier proyecto .NET, y puedes ampliarlo para manejar otros formatos o integrarlo en una canalización de procesamiento de imágenes más grande. + +**Próximos pasos** + +* Explora patrones de manejo de errores como `try / catch` alrededor del bloque del lector. +* Experimenta con el objeto `ReaderParameters` para ajustar la velocidad y precisión de la detección. +* Combina la lectura de códigos de barras con bibliotecas de preprocesamiento de imágenes ( + +## ¿Qué deberías aprender a continuación? + +Los siguientes tutoriales cubren temas estrechamente relacionados que se basan en las técnicas demostradas en esta guía. Cada recurso incluye ejemplos de código completos y funcionales con explicaciones paso a paso para ayudarte a dominar características adicionales de la API y explorar enfoques de implementación alternativos en tus propios proyectos. + +- [Cómo leer códigos de barras DataMatrix con Aspose.BarCode para .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Leer código de barras DataMatrix C# – Generar modo DataMatrix (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Leer código de barras desde una imagen – Dominio de la extracción de región de código de barras en Java con Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/swedish/net/compact-pdf417-encoding/_index.md index cc613e6f8..ea937653d 100644 --- a/barcode/swedish/net/compact-pdf417-encoding/_index.md +++ b/barcode/swedish/net/compact-pdf417-encoding/_index.md @@ -85,6 +85,9 @@ Utöver grunderna, här är några praktiska tips för att effektivisera ditt ar ### [Skapa kompakta PDF417-streckkoder](./compact-pdf417-basic-configuration/) Lär dig hur du genererar Compact PDF417‑streckkoder med Aspose.BarCode för .NET. Omfattande guide med steg‑för‑steg‑instruktioner och kodexempel. +### [Skapa mikro PDF417-streckkod i C# – steg‑för‑steg‑guide](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Lär dig att skapa en mikro PDF417‑streckkod i C# med en detaljerad steg‑för‑steg‑guide. + ## Vanliga frågor **Q: Vad är den maximala mängden data jag kan lagra i en Compact PDF417‑streckkod?** @@ -113,4 +116,4 @@ A: Inga externa typsnitt krävs; biblioteket hanterar all rendering internt. {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/swedish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/swedish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..d5ad834c1 --- /dev/null +++ b/barcode/swedish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,248 @@ +--- +category: general +date: 2026-08-15 +description: Skapa micro PDF417‑streckkod i C# snabbt med Aspose.BarCode. Lär dig + hur du använder streckkodsgeneratorn, ställer in X‑dimension, väljer kolumner och + aktiverar GS1‑kompatibilitet. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: sv +lastmod: 2026-08-15 +og_description: Skapa mikro‑PDF417‑streckkod i C# med Aspose.BarCode. Följ den här + handledningen för att konfigurera streckkodsgeneratorn, ange dimensioner och skapa + en PNG‑bild. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Skapa micro-PDF417-streckkod i C# – komplett programmeringsguide +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Skapa mikro‑PDF417‑streckkod i C# – steg‑för‑steg‑guide +url: /sv/net/compact-pdf417-encoding/create-micro-pdf417-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 micro PDF417‑streckkod i C# – steg‑för‑steg‑guide + +Om du behöver **skapa micro PDF417‑streckkod** i C#, visar den här guiden exakt hur du gör. Vi går igenom hur du initierar en **barcode generator**, konfigurerar **X‑dimension**, väljer kolumnantal och sparar resultatet som en PNG‑fil. + +Att generera en Micro PDF417‑streckkod är användbart för kompakt data‑kodning på små etiketter, biljetter eller IoT‑enheter. I slutet av denna handledning har du ett komplett, körbart exempel som du kan klistra in i vilket .NET‑projekt som helst. + +## Vad du behöver + +Innan du börjar, se till att du har: + +- .NET 6.0 (eller senare) installerat – koden fungerar även med .NET Framework 4.6+. +- Aspose.BarCode for .NET‑biblioteket (tillgängligt via NuGet `Aspose.BarCode`). +- En utvecklingsmiljö såsom Visual Studio 2022 eller VS Code. + +Inga ytterligare externa tjänster krävs; allt körs lokalt. + +## Hur du skapar micro PDF417‑streckkod med Aspose.BarCode + +Kärnan i processen är ett **barcode generator**‑objekt som vet hur man kodar Micro PDF417‑data. Följande avsnitt bryter ner varje konfigurationssteg. + +### Steg 1: Initiera barcode generatorn + +Importera först de nödvändiga namnutrymmena och skapa en instans av `BarcodeGenerator` med enum‑värdet `EncodeTypes.MicroPdf417`. Det andra argumentet är den text du vill koda. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Varför detta är viktigt:** Klassen `BarcodeGenerator` kapslar in all kodningslogik. Genom att välja `EncodeTypes.MicroPdf417` talar du om för biblioteket att använda den kompakta Micro PDF417‑symbologin, som är begränsad till 1‑4 kolumner. + +### Steg 2: Konfigurera X‑dimensionen (modulbredd) + +**X‑dimensionen** styr bredden på en enskild streckkodmodul i pixlar. Ett mindre värde ger en tätare streckkod, medan ett större värde förbättrar läsbarheten på lågupplösta skrivare. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Tips:** Värden mellan 1 och 4 fungerar bra för de flesta skärmar. Om du planerar att skriva ut på en termisk skrivare, testa med 3–4 pixlar för att undvika oskärpa. + +### Steg 3: Ange antal kolumner + +Micro PDF417 stödjer 1‑4 kolumner. Fler kolumner gör streckkoden kortare men ökar dess höjd. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Varför välja 4 kolumner?** Med fyra kolumner tar streckkoden upp minst horisontellt utrymme, vilket är idealiskt för smala etiketter. Om du behöver en högre men smalare streckkod, minska kolumnantalet. + +### Steg 4: Spara streckkoden som en PNG‑bild + +Skriv slutligen streckkoden till en fil. PNG bevarar exakt de pixelmått du konfigurerat. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Efter att programmet har körts, öppna `MicroPdf417.png` för att se resultatet. Bilden bör visa en skarp Micro PDF417‑streckkod som kodar exempeltexten. + +#### Förväntat resultat + +![Created micro PDF417 barcode](/images/micro-pdf417-sample.png "Create micro PDF417 barcode in C# – example output") + +PNG‑filen innehåller en streckkod med: + +- X‑dimension på 2 px +- 4 kolumner +- UTF‑8‑kodad text `"Åspóse.Barcóde©"` + +### Valfritt: generera en GS1‑kompatibel Micro PDF417 + +Om ditt program kräver **GS1‑kompatibel streckkod**‑data (för leveranskedjestandarder), aktivera GS1‑kodning innan du sparar: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Förklaring:** Att sätta `IsGS1` får Aspose.BarCode att lägga till GS1‑huvudet och tillämpa korrekta kontrollsummeregeln. Detta är nödvändigt när din streckkod ska läsas av GS1‑medvetna läsare. + +## Fullt, körbart exempel + +Nedan finns en komplett konsolapplikation som du kan kopiera, klistra in och köra. Den innehåller alla nödvändiga `using`‑satser, felhantering och kommentarer. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Kör koden:** +1. Skapa ett nytt .NET‑konsolprojekt (`dotnet new console`). +2. Lägg till Aspose.BarCode‑paketet (`dotnet add package Aspose.BarCode`). +3. Ersätt den genererade `Program.cs` med koden ovan. +4. Justera sökvägen för utdata om så behövs och kör (`dotnet run`). + +Du bör se ett konsolmeddelande som bekräftar filens plats, och PNG‑filen kommer att innehålla **micro PDF417‑streckkoden** du just skapade. + +## Vanliga fallgropar och bästa praxis‑tips + +- **Unicode‑hantering:** Aspose.BarCode kodar automatiskt UTF‑8‑tecken, men se till att din källfil sparas med UTF‑8‑kodning för att undvika korrupta symboler. +- **Kolumnbegränsningar:** Att försöka sätta `Columns` till ett värde utanför 1‑4 kastar ett `ArgumentException`. Validera användarens inmatning om du exponerar denna inställning i ett UI. +- **Bildupplösning:** PNG är förlustfri, men om du behöver ett högre‑upplöst vektorformat, använd `BarCodeImageFormat.Svg` istället. +- **GS1‑datalängd:** GS1‑kompatibel Micro PDF417 har striktare längdgränser. Verifiera att den kodade strängen inte överskrider det maximala antalet tecken enligt standarden (vanligtvis 90 tecken för Micro PDF417). + +## Slutsats + +Du vet nu hur du **skapar micro PDF417‑streckkod** i C# med Aspose.BarCode. Handledningen gick igenom initiering av en **barcode generator**, inställning av **X‑dimension**‑pixlar, val av kolumnantal, sparande av bilden och eventuellt aktivering av **GS1‑kompatibla streckkod**‑funktioner. + +Härifrån kan du experimentera med olika textinmatningar, justera X‑dimensionen för olika utskriftsupplösningar, eller byta till SVG‑utdata för skalbara grafik. Om du behöver generera andra 2‑D‑symbologier, utforska `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` eller `EncodeTypes.QR` – samma konfigurationsmönster gäller. + +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 vidare på teknikerna 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. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/swedish/net/one-dimensional-barcode-types/_index.md index e2ec8e481..a80ddb5ac 100644 --- a/barcode/swedish/net/one-dimensional-barcode-types/_index.md +++ b/barcode/swedish/net/one-dimensional-barcode-types/_index.md @@ -48,7 +48,7 @@ För dynamiska endimensionella DataBar-streckkoder kommer vår guide om rad- och ## Hantera undantag med lätthet -Även de mest erfarna utvecklarna står inför utmaningar. Lär dig hur du hanterar undantag effektivt samtidigt som du genererar endimensionella streckkoder. Aspose.BarCode är din bästa lösning för att skapa feltolerant streckkod. +Även de mest erfarna utvecklarna står inför utmaningar. Lär dig hur du hanterar undantag effektivt samtidigt med du genererar endimensionella streckkoder. Aspose.BarCode är din bästa lösning för att skapa feltolerant streckkod. ## Konfiguration av brett och smalt förhållande @@ -78,6 +78,8 @@ tjäna hur man genererar streckkoder i .NET med Aspose.BarCode för .NET. Den h Lär dig hur du hanterar undantag samtidigt som du genererar endimensionella streckkoder med Aspose.BarCode för .NET. Denna steg-för-steg-guide säkerställer feltoleranta streckkodslösningar. Börja nu! ### [Endimensionell Wide-Narrow Ratio Configuration](./one-dimensional-wide-narrow-ratio-configuration/) Generera anpassade streckkoder enkelt med Aspose.BarCode för .NET. Steg-för-steg-guide för endimensionell bred-smal konfiguration. +### [Läs streckkod från bild i C# – BarCodeReader-handledning](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Lär dig hur du läser streckkoder från bilder i C# med Aspose.BarCodeReader. En steg-för-steg-guide för enkel implementering. ## Slutsats @@ -89,4 +91,4 @@ Med den här artikeln kommer du inte bara att få kunskap om olika endimensionel {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/swedish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/swedish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..c5d8e1074 --- /dev/null +++ b/barcode/swedish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,255 @@ +--- +category: general +date: 2026-08-15 +description: Läs streckkod från bild i C# med BarCodeReader. Lär dig hur du läser + flera streckkoder i C#, läser PDF417‑streckkod och ser ett komplett C# BarCodeReader‑exempel. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: sv +lastmod: 2026-08-15 +og_description: Läs streckkod från bild i C# med en steg‑för‑steg‑guide. Upptäck hur + du läser flera streckkoder i C#, avkodar PDF417‑symboler och kör ett komplett C# + BarCodeReader‑exempel. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Läs streckkod från bild i C# – BarCodeReader-handledning +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Läs streckkod från bild i C# – BarCodeReader-handledning +url: /sv/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Läs streckkod från bild i C# – BarCodeReader‑handledning + +Om du behöver **läsa streckkod från bild** i en .NET‑applikation visar den här guiden exakt hur du gör det med `BarCodeReader`‑klassen. Du får också se hur du **läser flera streckkoder C#**, avkodar en PDF417‑symbol och får ett komplett **C# BarCodeReader‑exempel** som du kan kopiera in i ditt projekt. + +Handledningen täcker varje steg—från att lägga till det nödvändiga NuGet‑paketet till att skriva ut utökade PDF417‑fält—så att du slutar med ett körbart konsolprogram. Ingen extern dokumentation behövs; all kod och alla förklaringar ingår. + +## Vad du behöver + +* .NET 6.0 SDK eller senare (koden fungerar med .NET Core och .NET Framework) +* Visual Studio 2022 eller någon C#‑kompatibel editor +* `Aspose.BarCode` NuGet‑paketet (eller motsvarande bibliotek som tillhandahåller `BarCodeReader`) +* En bildfil som innehåller en Macro PDF417‑streckkod (t.ex. `ExtPDF417Meta.png`) + +Att ha dessa förutsättningar säkerställer att exempelprogrammet kompileras utan ytterligare konfiguration. + +## Läs streckkod från bild med BarCodeReader + +Det första steget är att skapa en `BarCodeReader`‑instans som pekar på bildfilen och talar om för biblioteket vilken streckkodstyp som ska sökas. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Varför detta fungerar:** +`BarCodeReader` öppnar bilden, skannar efter den angivna `DecodeType` och returnerar en samling av `BarCodeResult`‑objekt. Varje resultat innehåller den generiska streckkodsdata (`CodeTypeName`, `CodeText`) och, för Macro PDF417, ett `Extended.Pdf417`‑objekt som visar alla extra fält som definieras av standarden. + +## Läs flera streckkoder C# i en enda bild + +Ibland innehåller en bild mer än en streckkod (t.ex. en QR‑kod bredvid en PDF417). För att hantera det scenariot, utelämna helt enkelt den explicita `DecodeType` eller skicka `DecodeType.AllSupported` och loopa igenom resultaten. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Varför du behöver detta:** +Att specificera `AllSupported` instruerar motorn att prova alla streckkodformat den känner till, vilket garanterar att du fångar varje symbol i bilden. Detta är den rekommenderade metoden när du inte kan förutsäga streckkodstyperna i förväg. + +## Hur du läser PDF417‑streckkod med C# + +Om du bara är intresserad av det klassiska PDF417‑formatet (utan macro), ändra `DecodeType` till `Pdf417`. Resten av koden förblir identisk, förutom att de utökade fälten inte är tillgängliga. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Varför detta är viktigt:** +Klassisk PDF417 visar inte de macro‑specifika egenskaperna, så `Extended.Pdf417`‑blocket är onödigt. Att använda den exakta `DecodeType` snabbar också upp skanningen eftersom biblioteket hoppar över icke‑stödda algoritmer. + +## Fullständigt C# BarCodeReader‑exempel du kan kopiera + +Nedan är det kompletta programmet som kombinerar de tre scenarierna till ett enda, lätt‑att‑köra konsolprogram. Ersätt `YOUR_DIRECTORY/ExtPDF417Meta.png` med den faktiska sökvägen till din bild. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Förväntad utdata + +När exempelbilden innehåller en Macro PDF417‑streckkod skriver konsolen ut något liknande: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Om bilden bara innehåller en vanlig PDF417 kommer “Macro PDF417”‑avsnittet att vara tomt, och “Classic PDF417”‑avsnittet kommer att visa den avkodade texten. + +## Slutsats + +Du vet nu hur du **läser streckkod från bild** i C# med `BarCodeReader`, hur du **läser flera streckkoder C#** i en enda fil, och de exakta stegen för att **läsa PDF417‑streckkod**—både macro‑ och klassiska varianter. Det fullständiga **C# BarCodeReader‑exemplet** är redo att klistras in i vilket .NET‑projekt som helst, och du kan utöka det för att hantera andra format eller integrera det i en större bild‑behandlingspipeline. + +**Nästa steg** + +* Utforska felhanteringsmönster såsom `try / catch` runt läsarblocket. +* Experimentera med `ReaderParameters`‑objektet för att finjustera detekteringshastighet och noggrannhet. +* Kombinera streckkodsläsning med bild‑förbehandlingsbibliotek ( + +## Vad bör du lära dig härnäst? + +Följande handledningar täcker närliggande ämnen som bygger på teknikerna som demonstreras 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. + +- [Hur man läser DataMatrix‑streckkoder med Aspose.BarCode för .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Läs DataMatrix‑streckkod C# – Generera DataMatrix‑läge (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Läs streckkod från bild – Mästra extrahering av streckkodsområde i Java med Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/thai/net/compact-pdf417-encoding/_index.md index 642025381..12b9f8c8d 100644 --- a/barcode/thai/net/compact-pdf417-encoding/_index.md +++ b/barcode/thai/net/compact-pdf417-encoding/_index.md @@ -84,6 +84,8 @@ Aspose.BarCode ให้คุณตั้งค่าคุณสมบัต ## บทแนะนำการเข้ารหัส Compact PDF417 ### [Creating Compact PDF417 Barcodes](./compact-pdf417-basic-configuration/) เรียนรู้วิธีสร้างบาร์โค้ด Compact PDF417 ด้วย Aspose.BarCode for .NET คู่มือครบถ้วนพร้อมขั้นตอนและตัวอย่างโค้ด +### [สร้างบาร์โค้ด micro PDF417 ด้วย C# – คู่มือขั้นตอนโดยละเอียด](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +เรียนรู้วิธีสร้างบาร์โค้ด micro PDF417 ด้วย C# อย่างละเอียดด้วยขั้นตอนและตัวอย่างโค้ด ## คำถามที่พบบ่อย @@ -113,4 +115,4 @@ A: ไม่จำเป็นต้องใช้ฟอนต์ภายน {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/thai/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/thai/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..75bda2c89 --- /dev/null +++ b/barcode/thai/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,244 @@ +--- +category: general +date: 2026-08-15 +description: สร้างบาร์โค้ด micro PDF417 ด้วย C# อย่างรวดเร็วด้วย Aspose.BarCode. เรียนรู้วิธีใช้ตัวสร้างบาร์โค้ด, + ตั้งค่า X‑dimension, เลือกคอลัมน์, และเปิดใช้งานการปฏิบัติตามมาตรฐาน GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: th +lastmod: 2026-08-15 +og_description: สร้างบาร์โค้ด micro PDF417 ด้วย C# และ Aspose.BarCode. ทำตามบทแนะนำนี้เพื่อกำหนดค่าตัวสร้างบาร์โค้ด + ตั้งขนาด และสร้างภาพ PNG. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: สร้างบาร์โค้ด micro PDF417 ด้วย C# – คู่มือการเขียนโปรแกรมครบถ้วน +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: สร้างบาร์โค้ด micro PDF417 ด้วย C# – คู่มือแบบขั้นตอน +url: /th/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# สร้างบาร์โค้ด micro PDF417 ด้วย C# – คู่มือขั้นตอนโดยละเอียด + +หากคุณต้องการ **สร้างบาร์โค้ด micro PDF417** ด้วย C# คู่มือนี้จะแสดงวิธีทำอย่างละเอียด เราจะเดินผ่านการเริ่มต้น **barcode generator** การกำหนด **X‑dimension** การเลือกจำนวนคอลัมน์ และการบันทึกผลลัพธ์เป็นไฟล์ PNG + +การสร้างบาร์โค้ด Micro PDF417 มีประโยชน์สำหรับการเข้ารหัสข้อมูลแบบกะทัดรัดบนฉลากขนาดเล็ก ตั๋ว หรืออุปกรณ์ IoT เมื่อจบบทเรียนนี้คุณจะมีตัวอย่างที่ทำงานได้เต็มรูปแบบซึ่งสามารถนำไปใส่ในโปรเจกต์ .NET ใดก็ได้ + +## สิ่งที่คุณต้องมี + +ก่อนเริ่มทำงาน ตรวจสอบให้แน่ใจว่าคุณมี: + +- .NET 6.0 (หรือใหม่กว่า) ติดตั้งแล้ว – โค้ดนี้ยังทำงานกับ .NET Framework 4.6+ ด้วย +- ไลบรารี Aspose.BarCode for .NET (สามารถติดตั้งผ่าน NuGet `Aspose.BarCode`) +- สภาพแวดล้อมการพัฒนา เช่น Visual Studio 2022 หรือ VS Code + +ไม่ต้องใช้บริการภายนอกเพิ่มเติม; ทุกอย่างทำงานแบบออฟไลน์ + +## วิธีสร้างบาร์โค้ด micro PDF417 ด้วย Aspose.BarCode + +หัวใจของกระบวนการคืออ็อบเจกต์ **barcode generator** ที่รู้วิธีเข้ารหัสข้อมูล Micro PDF417 ส่วนต่อไปนี้จะแยกย่อยแต่ละขั้นตอนการกำหนดค่า + +### ขั้นตอนที่ 1: เริ่มต้น barcode generator + +แรกสุด ให้นำเข้า namespace ที่จำเป็นและสร้างอินสแตนซ์ของ `BarcodeGenerator` ด้วยค่า enum `EncodeTypes.MicroPdf417` อาร์กิวเมนต์ที่สองคือข้อความที่คุณต้องการเข้ารหัส + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**ทำไมจึงสำคัญ:** คลาส `BarcodeGenerator` รวมตรรกะการเข้ารหัสทั้งหมดไว้ด้วยกัน การเลือก `EncodeTypes.MicroPdf417` บอกไลบรารีให้ใช้สัญลักษณ์ Micro PDF417 แบบกะทัดรัด ซึ่งจำกัดที่ 1‑4 คอลัมน์ + +### ขั้นตอนที่ 2: กำหนด X‑dimension (ความกว้างโมดูล) + +**X‑dimension** ควบคุมความกว้างของโมดูลบาร์โค้ดแต่ละอันเป็นพิกเซล ค่าเล็กจะทำให้บาร์โค้ดแน่นกว่า ส่วนค่ามากจะทำให้อ่านง่ายบนเครื่องพิมพ์ความละเอียดต่ำ + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**เคล็ดลับ:** ค่าอยู่ระหว่าง 1‑4 ทำงานได้ดีสำหรับหน้าจอส่วนใหญ่ หากคุณวางแผนพิมพ์บนเครื่องพิมพ์ความร้อน ให้ทดสอบที่ 3‑4 พิกเซลเพื่อหลีกเลี่ยงการเบลอ + +### ขั้นตอนที่ 3: ตั้งค่าจำนวนคอลัมน์ + +Micro PDF417 รองรับ 1‑4 คอลัมน์ คอลัมน์มากจะทำให้บาร์โค้ดสั้นลงแต่ความสูงเพิ่มขึ้น + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**ทำไมต้องเลือก 4 คอลัมน์?** เมื่อใช้สี่คอลัมน์บาร์โค้ดจะใช้พื้นที่แนวนอนน้อยที่สุด เหมาะกับฉลากแคบ หากคุณต้องการบาร์โค้ดที่สูงแต่แคบลง ให้ลดจำนวนคอลัมน์ + +### ขั้นตอนที่ 4: บันทึกบาร์โค้ดเป็นไฟล์ PNG + +สุดท้าย ให้เขียนบาร์โค้ดลงไฟล์ PNG ซึ่งจะคงความละเอียดพิกเซลที่คุณกำหนดไว้ + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +หลังจากรันโปรแกรมแล้ว ให้เปิด `MicroPdf417.png` เพื่อตรวจสอบผลลัพธ์ ภาพควรแสดงบาร์โค้ด Micro PDF417 ที่คมชัดและเข้ารหัสข้อความตัวอย่าง + +#### ผลลัพธ์ที่คาดหวัง + +![สร้างบาร์โค้ด micro PDF417](/images/micro-pdf417-sample.png "สร้างบาร์โค้ด micro PDF417 ด้วย C# – ตัวอย่างผลลัพธ์") + +ไฟล์ PNG มีบาร์โค้ดที่มี: + +- X‑dimension 2 px +- 4 คอลัมน์ +- ข้อความที่เข้ารหัสเป็น UTF‑8 `"Åspóse.Barcóde©"` + +### ทางเลือก: สร้าง Micro PDF417 ที่สอดคล้องกับ GS1 + +หากแอปพลิเคชันของคุณต้องการ **บาร์โค้ดที่สอดคล้องกับ GS1** (มาตรฐานซัพพลายเชน) ให้เปิดใช้งานการเข้ารหัส GS1 ก่อนบันทึก: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**คำอธิบาย:** การตั้งค่า `IsGS1` จะทำให้ Aspose.BarCode เพิ่มส่วนหัว GS1 และใช้กฎตรวจสอบเช็คซัมที่ถูกต้อง ซึ่งจำเป็นเมื่อบาร์โค้ดของคุณจะถูกสแกนโดยเครื่องอ่านที่รองรับ GS1 + +## ตัวอย่างเต็มที่สามารถรันได้ + +ด้านล่างเป็นแอปพลิเคชันคอนโซลที่สมบูรณ์ คุณสามารถคัดลอก วาง และรันได้ รวมถึง `using` ที่จำเป็น การจัดการข้อผิดพลาด และคอมเมนต์ + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**วิธีรันโค้ด:** +1. สร้างโปรเจกต์คอนโซล .NET ใหม่ (`dotnet new console`) +2. เพิ่มแพคเกจ Aspose.BarCode (`dotnet add package Aspose.BarCode`) +3. แทนที่ไฟล์ `Program.cs` ที่สร้างขึ้นด้วยโค้ดด้านบน +4. ปรับเส้นทางออก (output path) หากจำเป็นแล้วรัน (`dotnet run`) + +คุณควรเห็นข้อความในคอนโซลยืนยันตำแหน่งไฟล์ และ PNG จะมี **บาร์โค้ด micro PDF417** ที่คุณสร้างขึ้น + +## ข้อผิดพลาดทั่วไปและเคล็ดลับปฏิบัติที่ดีที่สุด + +- **การจัดการ Unicode:** Aspose.BarCode จะเข้ารหัสอักขระ UTF‑8 โดยอัตโนมัติ แต่ต้องแน่ใจว่าไฟล์ซอร์สของคุณบันทึกด้วยการเข้ารหัส UTF‑8 เพื่อหลีกเลี่ยงสัญลักษณ์เสียหาย +- **ขีดจำกัดคอลัมน์:** การตั้งค่า `Columns` ให้เป็นค่าที่อยู่นอกช่วง 1‑4 จะทำให้เกิด `ArgumentException` ตรวจสอบค่าที่ผู้ใช้ป้อนหากคุณเปิดให้ตั้งค่านี้ใน UI +- **ความละเอียดภาพ:** PNG เป็นแบบ lossless แต่หากต้องการรูปแบบเวกเตอร์ความละเอียดสูง ให้ใช้ `BarCodeImageFormat.Svg` แทน +- **ความยาวข้อมูล GS1:** Micro PDF417 ที่สอดคล้องกับ GS1 มีข้อจำกัดความยาวที่เข้มงวด ตรวจสอบให้แน่ใจว่าข้อความที่เข้ารหัสไม่เกินขีดจำกัดสูงสุดของมาตรฐาน (โดยทั่วไป 90 ตัวอักษรสำหรับ Micro PDF417) + +## สรุป + +คุณได้เรียนรู้วิธี **สร้างบาร์โค้ด micro PDF417** ด้วย C# โดยใช้ Aspose.BarCode บทเรียนนี้ครอบคลุมการเริ่มต้น **barcode generator** การตั้งค่า **พิกเซล X‑dimension** การเลือกจำนวนคอลัมน์ การบันทึกภาพ และการเปิดใช้งานคุณสมบัติ **บาร์โค้ดที่สอดคล้องกับ GS1** + +จากนี้คุณสามารถทดลองกับข้อความต่าง ๆ ปรับ X‑dimension ให้เหมาะกับความละเอียดการพิมพ์ หรือเปลี่ยนเป็นรูปแบบ SVG เพื่อกราฟิกที่ปรับขนาดได้ หากต้องการสร้างสัญลักษณ์ 2‑D อื่น ๆ ให้สำรวจ `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix`, หรือ `EncodeTypes.QR` – รูปแบบการกำหนดค่าจะคล้ายกัน + +ขอให้สนุกกับการเขียนโค้ด! + +## สิ่งที่คุณควรเรียนต่อไป + +บทแนะนำต่อไปนี้ครอบคลุมหัวข้อที่เกี่ยวข้องอย่างใกล้ชิดและต่อยอดจากเทคนิคในคู่มือนี้ แต่ละแหล่งรวมตัวอย่างโค้ดทำงานเต็มรูปแบบพร้อมคำอธิบายขั้นตอนเพื่อช่วยให้คุณเชี่ยวชาญฟีเจอร์ API เพิ่มเติมและสำรวจแนวทางการทำงานอื่น ๆ ในโปรเจกต์ของคุณ + +- [วิธีสร้างบาร์โค้ด – Compact PDF417 ด้วย Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [สร้างภาพบาร์โค้ด DotCode – แถวและคอลัมน์ (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [วิธีสร้าง Quiet Zone สำหรับ ITF-14 ด้วย Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/thai/net/one-dimensional-barcode-types/_index.md index dcd2c96bb..a6981b4e0 100644 --- a/barcode/thai/net/one-dimensional-barcode-types/_index.md +++ b/barcode/thai/net/one-dimensional-barcode-types/_index.md @@ -24,7 +24,7 @@ url: /th/net/one-dimensional-barcode-types/ ## การกำหนดค่ารหัส 128 - ก่อนอื่นมาดำดิ่งกันก่อน**Code 128**บาร์โค้ดประเภทอเนกประสงค์นี้สามารถเข้ารหัสข้อมูลได้หลากหลาย ทำให้เป็นบาร์โค้ดยอดนิยมในหมู่นักพัฒนา ด้วย Aspose.BarCode คุณจะพบกับกระบวนการบูรณาการที่ราบรื่น ทำตามคำแนะนำทีละขั้นตอนของเราเพื่อเริ่มต้น + ก่อนแรกมาดำดิ่งกันก่อน**Code 128**บาร์โค้ดประเภทอเนกประสงค์นี้สามารถเข้ารหัสข้อมูลได้หลากหลาย ทำให้เป็นบาร์โค้ดยอดนิยมในหมู่นักพัฒนา ด้วย Aspose.BarCode คุณจะพบกับกระบวนการบูรณาการที่ราบรื่น ทำตามคำแนะนำทีละขั้นตอนของเราเพื่อเริ่มต้น ## การกำหนดค่ารหัส 39 @@ -78,6 +78,8 @@ url: /th/net/one-dimensional-barcode-types/ เรียนรู้วิธีจัดการกับข้อยกเว้นในขณะที่สร้างบาร์โค้ดหนึ่งมิติโดยใช้ Aspose.BarCode สำหรับ .NET คำแนะนำทีละขั้นตอนนี้ช่วยให้มั่นใจได้ถึงโซลูชันบาร์โค้ดที่ทนทานต่อข้อผิดพลาด เริ่มตอนนี้เลย! ### [การกำหนดค่าอัตราส่วนกว้าง-แคบหนึ่งมิติ](./one-dimensional-wide-narrow-ratio-configuration/) สร้างบาร์โค้ดแบบกำหนดเองได้อย่างง่ายดายด้วย Aspose.BarCode สำหรับ .NET คำแนะนำทีละขั้นตอนสำหรับการกำหนดค่าอัตราส่วนกว้าง-แคบหนึ่งมิติ +### [อ่านบาร์โค้ดจากภาพใน C# – บทแนะนำ BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +เรียนรู้วิธีอ่านบาร์โค้ดจากไฟล์ภาพด้วย BarCodeReader ใน C# อย่างละเอียด ## บทสรุป @@ -89,4 +91,4 @@ url: /th/net/one-dimensional-barcode-types/ {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/thai/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/thai/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..7d90b671a --- /dev/null +++ b/barcode/thai/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,258 @@ +--- +category: general +date: 2026-08-15 +description: อ่านบาร์โค้ดจากภาพใน C# ด้วย BarCodeReader. เรียนรู้วิธีอ่านบาร์โค้ดหลายรายการใน + C#, อ่านบาร์โค้ด PDF417, และดูตัวอย่างเต็มของ BarCodeReader ใน C# +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: th +lastmod: 2026-08-15 +og_description: อ่านบาร์โค้ดจากภาพใน C# ด้วยคู่มือขั้นตอนต่อขั้นตอน ค้นพบวิธีอ่านบาร์โค้ดหลายรายการใน + C# ถอดรหัสสัญลักษณ์ PDF417 และรันตัวอย่าง BarCodeReader ของ C# อย่างครบถ้วน +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: อ่านบาร์โค้ดจากภาพใน C# – บทเรียน BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: อ่านบาร์โค้ดจากภาพใน C# – บทแนะนำ BarCodeReader +url: /th/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# อ่านบาร์โค้ดจากรูปภาพใน C# – บทแนะนำ BarCodeReader + +หากคุณต้องการ **อ่านบาร์โค้ดจากรูปภาพ ** ในแอปพลิเคชัน .NET คำแนะนำนี้จะแสดงวิธีทำโดยใช้คลาส `BarCodeReader` อย่างละเอียด คุณยังจะได้เห็นวิธี **อ่านบาร์โค้ดหลายรายการใน C#**, การถอดรหัสสัญลักษณ์ PDF417, และตัวอย่าง **C# BarCodeReader** ที่คุณสามารถคัดลอกไปใช้ในโปรเจกต์ของคุณได้ + +บทแนะนำครอบคลุมทุกขั้นตอน — ตั้งแต่การเพิ่มแพ็กเกจ NuGet ที่จำเป็นจนถึงการพิมพ์ฟิลด์ PDF417 ที่ขยาย — เพื่อให้คุณได้โปรแกรมคอนโซลที่ทำงานได้ครบถ้วน ไม่ต้องอ้างอิงเอกสารภายนอก; โค้ดและคำอธิบายทั้งหมดรวมอยู่ที่นี่ + +## สิ่งที่คุณต้องมี + +ก่อนเริ่มทำงาน โปรดตรวจสอบว่าคุณมี: + +* .NET 6.0 SDK หรือใหม่กว่า (โค้ดทำงานได้กับ .NET Core และ .NET Framework) +* Visual Studio 2022 หรือเครื่องมือแก้ไขที่รองรับ C# +* แพ็กเกจ NuGet `Aspose.BarCode` (หรือไลบรารีที่ให้ `BarCodeReader` เทียบเท่า) +* ไฟล์รูปภาพที่มีบาร์โค้ด Macro PDF417 (เช่น `ExtPDF417Meta.png`) + +การมีสิ่งเหล่านี้จะทำให้ตัวอย่างคอมไพล์ได้โดยไม่ต้องตั้งค่าเพิ่มเติม + +## อ่านบาร์โค้ดจากรูปภาพด้วย BarCodeReader + +ขั้นตอนแรกคือการสร้างอินสแตนซ์ `BarCodeReader` ที่ชี้ไปยังไฟล์รูปภาพและบอกไลบรารีว่าต้องการค้นหาประเภทบาร์โค้ดใด + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**ทำไมวิธีนี้ถึงได้ผล:** +`BarCodeReader` จะเปิดรูปภาพ, สแกนหาประเภท `DecodeType` ที่ระบุ, แล้วคืนคอลเลกชันของอ็อบเจ็กต์ `BarCodeResult` แต่ละรายการจะมีข้อมูลบาร์โค้ดทั่วไป (`CodeTypeName`, `CodeText`) และสำหรับ Macro PDF417 จะมีอ็อบเจ็กต์ `Extended.Pdf417` ที่เปิดเผยฟิลด์เพิ่มเติมทั้งหมดตามมาตรฐาน + +## อ่านบาร์โค้ดหลายรายการใน C# จากรูปเดียว + +บางครั้งรูปภาพอาจมีบาร์โค้ดมากกว่าหนึ่งรายการ (เช่น QR code อยู่ข้างๆ PDF417) เพื่อจัดการสถานการณ์นี้ เพียงละเว้นการระบุ `DecodeType` อย่างชัดเจนหรือส่งค่า `DecodeType.AllSupported` แล้ววนลูปผลลัพธ์ + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**เหตุผลที่ต้องทำเช่นนี้:** +การระบุ `AllSupported` จะบอกเอนจินให้ลองทุกรูปแบบบาร์โค้ดที่รู้จัก, ซึ่งรับประกันว่าคุณจะจับสัญลักษณ์ทั้งหมดในภาพได้ วิธีนี้เป็นแนวทางแนะนำเมื่อคุณไม่สามารถคาดการณ์ประเภทบาร์โค้ดล่วงหน้าได้ + +## วิธีอ่านบาร์โค้ด PDF417 ด้วย C# + +หากคุณต้องการเพียงรูปแบบ PDF417 แบบคลาสสิก (ไม่ใช่ macro) ให้เปลี่ยน `DecodeType` เป็น `Pdf417` โค้ดส่วนที่เหลือคงเดิม ยกเว้นฟิลด์ที่ขยายจะไม่ปรากฏ + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**ทำไมจึงสำคัญ:** +PDF417 แบบคลาสสิกไม่เปิดเผยคุณสมบัติเฉพาะ macro, ดังนั้นบล็อก `Extended.Pdf417` จึงไม่จำเป็น การใช้ `DecodeType` ที่แม่นยำยังช่วยเร่งความเร็วการสแกน เพราะไลบรารีข้ามอัลกอริทึมที่ไม่รองรับ + +## ตัวอย่างเต็ม C# BarCodeReader ที่คุณสามารถคัดลอกได้ + +ด้านล่างเป็นโปรแกรมเต็มที่รวมสามสถานการณ์ไว้ในแอปพลิเคชันคอนโซลที่ง่ายต่อการรัน แทนที่ `YOUR_DIRECTORY/ExtPDF417Meta.png` ด้วยพาธจริงของรูปภาพของคุณ + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### ผลลัพธ์ที่คาดหวัง + +เมื่อรูปภาพตัวอย่างมีบาร์โค้ด Macro PDF417 คอนโซลจะพิมพ์ข้อความคล้ายกับนี้: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +หากรูปภาพมีเพียง PDF417 ปกติ ส่วน “Macro PDF417” จะว่างเปล่า และส่วน “Classic PDF417” จะแสดงข้อความที่ถอดรหัสได้ + +## สรุป + +ตอนนี้คุณรู้วิธี **อ่านบาร์โค้ดจากรูปภาพ** ใน C# ด้วย `BarCodeReader`, วิธี **อ่านบาร์โค้ดหลายรายการใน C#** จากไฟล์เดียว, และขั้นตอนที่แน่นอนในการ **อ่านบาร์โค้ด PDF417** — ทั้งแบบ macro และแบบคลาสสิก ตัวอย่าง **C# BarCodeReader** เต็มรูปแบบพร้อมคัดลอกไปใช้ในโปรเจกต์ .NET ใดก็ได้ และคุณสามารถขยายให้รองรับรูปแบบอื่นหรือรวมเข้ากับ pipeline การประมวลผลภาพที่ใหญ่ขึ้นได้ + +**ขั้นตอนต่อไป** + +* สำรวจรูปแบบการจัดการข้อผิดพลาดเช่น `try / catch` รอบบล็อก reader +* ทดลองใช้วัตถุ `ReaderParameters` เพื่อปรับความเร็วและความแม่นยำของการตรวจจับ +* รวมการอ่านบาร์โค้ดกับไลบรารีการเตรียมรูปภาพ ( + + +## คุณควรเรียนรู้อะไรต่อไป? + + +บทแนะนำต่อไปนี้ครอบคลุมหัวข้อที่เกี่ยวข้องอย่างใกล้ชิดและต่อยอดจากเทคนิคที่แสดงในคู่มือนี้ แต่ละแหล่งรวมตัวอย่างโค้ดทำงานเต็มรูปแบบพร้อมคำอธิบายทีละขั้นตอน เพื่อช่วยให้คุณเชี่ยวชาญฟีเจอร์ API เพิ่มเติมและสำรวจแนวทางการทำงานอื่นในโครงการของคุณ + +- [How to Read DataMatrix Barcodes with Aspose.BarCode for .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Read DataMatrix barcode C# – Generate DataMatrix Mode (Auto)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Read Barcode from Image – Mastering Barcode Region Extraction in Java with Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/turkish/net/compact-pdf417-encoding/_index.md index ea67f016b..9247c9428 100644 --- a/barcode/turkish/net/compact-pdf417-encoding/_index.md +++ b/barcode/turkish/net/compact-pdf417-encoding/_index.md @@ -83,6 +83,9 @@ Temellerin ötesinde, iş akışınızı hızlandıracak bazı pratik ipuçları ### [Compact PDF417 Barkodları Oluşturma](./compact-pdf417-basic-configuration/) Aspose.BarCode for .NET'i kullanarak Compact PDF417 barkodlarını nasıl oluşturacağınızı öğrenin. Adım‑adım talimatları ve kod örnekleri içeren kapsamlı bir rehber. +### [C#'ta mikro PDF417 barkodu oluşturma – adım adım rehber](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +C# kullanarak mikro PDF417 barkodu oluşturmayı adım adım öğrenin. Kısa bir rehber ve örnek kodlar. + ## Sıkça Sorulan Sorular **Q:** Compact PDF417 barkodunda saklayabileceğim maksimum veri miktarı nedir? @@ -111,4 +114,4 @@ Aspose.BarCode for .NET'i kullanarak Compact PDF417 barkodlarını nasıl oluşt {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/turkish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/turkish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..cacb26014 --- /dev/null +++ b/barcode/turkish/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,246 @@ +--- +category: general +date: 2026-08-15 +description: C# ile Aspose.BarCode kullanarak mikro PDF417 barkodu hızlıca oluşturun. + Barkod oluşturucuyu nasıl kullanacağınızı, X‑boyutunu nasıl ayarlayacağınızı, sütunları + nasıl seçeceğinizi ve GS1 uyumluluğunu nasıl etkinleştireceğinizi öğrenin. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: tr +lastmod: 2026-08-15 +og_description: C# ile Aspose.BarCode kullanarak mikro PDF417 barkod oluşturun. Barkod + oluşturucusunu yapılandırmak, boyutları ayarlamak ve bir PNG görüntüsü üretmek için + bu öğreticiyi izleyin. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: C#'ta mikro PDF417 barkod oluşturma – tam programlama rehberi +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: C#'ta mikro PDF417 barkod oluşturma – adım adım rehber +url: /tr/net/compact-pdf417-encoding/create-micro-pdf417-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 micro PDF417 barcode oluşturma – adım adım rehber + +C#’ta **micro PDF417 barcode** oluşturmanız gerekiyorsa, bu rehber tam olarak nasıl yapılacağını gösterir. Bir **barcode generator** başlatmayı, **X‑dimension** ayarlamayı, sütun sayısını seçmeyi ve sonucu PNG dosyası olarak kaydetmeyi adım adım ele alacağız. + +Micro PDF417 barcode oluşturmak, küçük etiketlerde, biletlerde veya IoT cihazlarında kompakt veri kodlaması için faydalıdır. Bu öğreticinin sonunda, herhangi bir .NET projesine ekleyebileceğiniz tam, çalıştırılabilir bir örnek elde edeceksiniz. + +## İhtiyacınız olanlar + +Başlamadan önce şunların yüklü olduğundan emin olun: + +- .NET 6.0 (veya daha yeni) – kod .NET Framework 4.6+ ile de çalışır. +- Aspose.BarCode for .NET kütüphanesi (NuGet `Aspose.BarCode` üzerinden temin edilebilir). +- Visual Studio 2022 veya VS Code gibi bir geliştirme ortamı. + +Ek bir dış hizmete ihtiyaç yoktur; her şey yerel olarak çalışır. + +## Aspose.BarCode ile micro PDF417 barcode nasıl oluşturulur + +Sürecin çekirdeği, Micro PDF417 verisini kodlayabilen bir **barcode generator** nesnesidir. Aşağıdaki bölümler her bir yapılandırma adımını ayrıntılı olarak açıklar. + +### Adım 1: barcode generator’ı başlatma + +İlk olarak gerekli ad alanlarını içe aktarın ve `EncodeTypes.MicroPdf417` enum’u ile bir `BarcodeGenerator` örneği oluşturun. İkinci parametre, kodlamak istediğiniz metindir. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Neden önemli:** `BarcodeGenerator` sınıfı tüm kodlama mantığını kapsar. `EncodeTypes.MicroPdf417` seçimi, kütüphaneye 1‑4 sütunla sınırlı kompakt Micro PDF417 sembolünü kullanmasını söyler. + +### Adım 2: X‑dimension (modül genişliği) yapılandırması + +**X‑dimension**, tek bir barcode modülünün piksel cinsinden genişliğini kontrol eder. Daha küçük bir değer daha sıkı bir barcode üretirken, daha büyük bir değer düşük çözünürlüklü yazıcılarda okunabilirliği artırır. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**İpucu:** Çoğu ekran görüntüsü için 1 ile 4 arasındaki değerler iyi çalışır. Termal bir yazıcıda basmayı planlıyorsanız, bulanıklığı önlemek için 3–4 piksel ile test edin. + +### Adım 3: Sütun sayısını ayarlama + +Micro PDF417 1‑4 sütunu destekler. Daha fazla sütun barcode’un yüksekliğini artırırken yatay uzunluğunu kısaltır. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Neden 4 sütun seçilir?** Dört sütun kullanıldığında barcode en az yatay alanı kaplar; bu, dar etiketler için idealdir. Daha uzun ama daha dar bir barcode ihtiyacınız varsa sütun sayısını azaltın. + +### Adım 4: Barcode’u PNG görüntüsü olarak kaydetme + +Son olarak barcode’u bir dosyaya yazın. PNG, yapılandırdığınız piksel boyutlarını tam olarak korur. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Programı çalıştırdıktan sonra `MicroPdf417.png` dosyasını açın. Görüntü, örnek metni kodlayan net bir Micro PDF417 barcode göstermelidir. + +#### Beklenen çıktı + +![Created micro PDF417 barcode](/images/micro-pdf417-sample.png "Create micro PDF417 barcode in C# – example output") + +PNG dosyası aşağıdaki özelliklere sahip bir barcode içerir: + +- 2 px X‑dimension +- 4 sütun +- UTF‑8 kodlu metin `"Åspóse.Barcóde©"` + +### Opsiyonel: GS1‑uyumlu Micro PDF417 oluşturma + +Uygulamanız **GS1‑uyumlu barcode** verisi (tedarik zinciri standartları) gerektiriyorsa, kaydetmeden önce GS1 kodlamasını etkinleştirin: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Açıklama:** `IsGS1` özelliğini `true` yapmak, Aspose.BarCode’a GS1 başlığını eklemesini ve doğru kontrol toplamı kurallarını uygulamasını söyler. Bu, barcode’unuzun GS1‑bilgili okuyucular tarafından taranması gerektiğinde kritiktir. + +## Tam, çalıştırılabilir örnek + +Aşağıda kopyalayıp yapıştırıp çalıştırabileceğiniz eksiksiz bir konsol uygulaması yer alıyor. Gerekli tüm `using` ifadeleri, hata yönetimi ve yorumlar dahildir. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Kodu çalıştırma:** +1. Yeni bir .NET konsol projesi oluşturun (`dotnet new console`). +2. Aspose.BarCode paketini ekleyin (`dotnet add package Aspose.BarCode`). +3. Oluşturulan `Program.cs` dosyasını yukarıdaki kodla değiştirin. +4. Gerekirse çıktı yolunu ayarlayın ve çalıştırın (`dotnet run`). + +Konsolda dosya konumunu belirten bir mesaj görmeli ve PNG, yeni oluşturduğunuz **micro PDF417 barcode**’u içermelidir. + +## Yaygın hatalar ve en iyi uygulama ipuçları + +- **Unicode işleme:** Aspose.BarCode otomatik olarak UTF‑8 karakterleri kodlar, ancak kaynak dosyanızın UTF‑8 olarak kaydedildiğinden emin olun; aksi takdirde bozuk semboller oluşabilir. +- **Sütun sınırlamaları:** `Columns` değerini 1‑4 dışına ayarlamaya çalışmak `ArgumentException` fırlatır. Bu ayarı bir UI’da sunuyorsanız kullanıcı girişini doğrulayın. +- **Görüntü çözünürlüğü:** PNG kayıpsızdır, ancak daha yüksek çözünürlüklü vektör formatına ihtiyacınız varsa `BarCodeImageFormat.Svg` kullanın. +- **GS1 veri uzunluğu:** GS1‑uyumlu Micro PDF417 daha katı uzunluk sınırlarına sahiptir. Kodlanan dizgenin standart tarafından izin verilen maksimum uzunluğu (genellikle Micro PDF417 için 90 karakter) aşmadığından emin olun. + +## Sonuç + +Artık Aspose.BarCode kullanarak C#’ta **micro PDF417 barcode** oluşturmayı biliyorsunuz. Eğitimde bir **barcode generator** başlatma, **X‑dimension** piksel ayarı, sütun sayısı seçimi, görüntüyü kaydetme ve isteğe bağlı **GS1‑uyumlu barcode** özelliklerini etkinleştirme konularını ele aldık. + +Bundan sonra farklı metin girdileriyle deneyebilir, çeşitli baskı çözünürlükleri için X‑dimension’ı ayarlayabilir veya ölçeklenebilir grafikler için SVG çıktısına geçebilirsiniz. Diğer 2‑D sembolleri oluşturmanız gerekiyorsa `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix` veya `EncodeTypes.QR` gibi seçenekleri keşfedin – aynı yapılandırma modeli geçerlidir. + +İyi kodlamalar! + +## Sonraki Öğrenmeniz Gerekenler + +Aşağıdaki öğreticiler, bu rehberde gösterilen tekniklere dayalı olarak yakından ilgili konuları kapsar. Her kaynak, ek API özelliklerini ustalaşmanız ve projelerinizde alternatif uygulama yaklaşımları keşfetmeniz için adım adım açıklamalı tam çalışan kod örnekleri içerir. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Create DotCode barcode image – rows & columns (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [How to Create Barcode Quiet Zone for ITF-14 Using Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/turkish/net/one-dimensional-barcode-types/_index.md index e88a66604..b294cd2ad 100644 --- a/barcode/turkish/net/one-dimensional-barcode-types/_index.md +++ b/barcode/turkish/net/one-dimensional-barcode-types/_index.md @@ -28,7 +28,7 @@ Tek boyutlu barkodlar, veri kodlamanın temelidir ve bilgiyi depolamanın basit ## Kod 39 Yapılandırması - Eğer üretmeniz gerekiyorsa**Code 39** barkodlar, Aspose.BarCode yanınızda. Bu barkod türü endüstriyelden sağlık hizmetlerine kadar çeşitli uygulamalarda yaygın olarak kullanılmaktadır. Geliştiriciler sorunsuz bir kurulum için adım adım kılavuzumuza güvenebilirler. + Eğer üretmeniz gerekiyorsa**Code 39** barkodlar, Aspose.BarCode yanınızda. Bu barkod türü endüstriyetten sağlık hizmetlerine kadar çeşitli uygulamalarda yaygın olarak kullanılmaktadır. Geliştiriciler sorunsuz bir kurulum için adım adım kılavuzumuza güvenebilirler. ## Kod 93 Yapılandırması @@ -78,6 +78,8 @@ Aspose.BarCode for .NET ile .NET'te barkod oluşturmayı öğrenin. Bu kapsamlı Aspose.BarCode for .NET'i kullanarak tek boyutlu barkodlar oluştururken istisnaları nasıl ele alacağınızı öğrenin. Bu adım adım kılavuz, hataya dayanıklı barkod çözümleri sağlar. Şimdi başla! ### [Tek Boyutlu Geniş-Dar Oranlı Yapılandırma](./one-dimensional-wide-narrow-ratio-configuration/) Aspose.BarCode for .NET ile özelleştirilmiş barkodları kolayca oluşturun. Tek boyutlu geniş-dar oranlı yapılandırma için adım adım kılavuz. +### [C#'ta Görüntüden Barkod Okuma – BarCodeReader Eğitimi](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Aspose.BarCode kullanarak C# ile bir görüntüden barkod okuma adımlarını öğrenin. ## Çözüm @@ -89,4 +91,4 @@ Bu makaleyle yalnızca çeşitli tek boyutlu barkod türleri hakkında bilgi edi {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/turkish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/turkish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..35a4739c0 --- /dev/null +++ b/barcode/turkish/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,258 @@ +--- +category: general +date: 2026-08-15 +description: BarCodeReader kullanarak C#'ta görüntüden barkod okuyun. Birden fazla + barkodu C#'ta nasıl okuyacağınızı, PDF417 barkodunu nasıl okuyacağınızı öğrenin + ve tam bir C# BarCodeReader örneğini görün. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: tr +lastmod: 2026-08-15 +og_description: C#'ta adım adım kılavuzla görüntüden barkod okuyun. Birden fazla barkodu + C#'ta nasıl okuyacağınızı, PDF417 sembollerini nasıl çözeceğinizi keşfedin ve tam + bir C# BarCodeReader örneğini çalıştırın. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: C#'de görüntüden barkod okuyun – BarCodeReader öğreticisi +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: C#'ta Görüntüden Barkod Okuma – BarCodeReader Öğreticisi +url: /tr/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C#'ta Görüntüden Barkod Okuma – BarCodeReader Öğreticisi + +Bir .NET uygulamasında **görüntüden barkod okuma** ihtiyacınız varsa, bu rehber `BarCodeReader` sınıfı ile bunu tam olarak nasıl yapacağınızı gösterir. Ayrıca **C#'ta birden fazla barkod okuma**, bir PDF417 sembolünü çözme ve projenize kopyalayabileceğiniz tam bir **C# BarCodeReader örneği** elde etme konularını da göreceksiniz. + +Bu öğretici, gerekli NuGet paketinin eklenmesinden genişletilmiş PDF417 alanlarının yazdırılmasına kadar her adımı kapsar—böylece çalıştırılabilir bir konsol programı ile bitirirsiniz. Harici bir belgeye ihtiyaç yoktur; tüm kod ve açıklamalar dahil edilmiştir. + +## Gereksinimler + +Before you start, make sure you have: + +* .NET 6.0 SDK veya daha yenisi (kod .NET Core ve .NET Framework ile çalışır) +* Visual Studio 2022 veya herhangi bir C# uyumlu editör +* `Aspose.BarCode` NuGet paketi (veya `BarCodeReader` sağlayan eşdeğer kütüphane) +* Macro PDF417 barkod içeren bir görüntü dosyası (ör. `ExtPDF417Meta.png`) + +Bu önkoşullara sahip olmak, örnek kodun ek yapılandırma olmadan derlenmesini sağlar. + +## BarCodeReader ile Görüntüden Barkod Okuma + +İlk adım, görüntü dosyasını işaret eden ve kütüphaneye hangi barkod tipini araması gerektiğini belirten bir `BarCodeReader` örneği oluşturmaktır. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Neden bu çalışır:** +`BarCodeReader` görüntüyü açar, belirtilen `DecodeType` için tarama yapar ve bir `BarCodeResult` nesneleri koleksiyonu döndürür. Her sonuç, genel barkod verilerini (`CodeTypeName`, `CodeText`) ve Macro PDF417 için, standartta tanımlanan tüm ek alanları ortaya çıkaran bir `Extended.Pdf417` nesnesini içerir. + +## Tek Bir Görüntüde C# ile Birden Fazla Barkod Okuma + +Bazen bir görüntü birden fazla barkod içerir (ör. PDF417 yanındaki QR kod). Bu senaryoyu ele almak için, açık `DecodeType` değerini atlayabilir veya `DecodeType.AllSupported` geçebilir ve sonuçlar üzerinde döngü yapabilirsiniz. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Neden buna ihtiyacınız var:** +`AllSupported` belirtmek, motorun bildiği her barkod formatını denemesini sağlar, bu da görüntüdeki her sembolün yakalanmasını garantiler. Barkod tiplerini önceden tahmin edemediğiniz durumlarda önerilen yaklaşımdır. + +## C# Kullanarak PDF417 Barkod Okuma + +Sadece klasik PDF417 (macro olmayan) formatıyla ilgileniyorsanız, `DecodeType` değerini `Pdf417` olarak değiştirin. Kodun geri kalanı aynı kalır, ancak genişletilmiş alanlar mevcut olmaz. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Neden bu önemli:** +Klasik PDF417, macro‑özel özellikleri ortaya çıkarmaz, bu yüzden `Extended.Pdf417` bloğu gereksizdir. Kesin `DecodeType` kullanmak ayrıca taramayı hızlandırır çünkü kütüphane desteklenmeyen algoritmaları atlar. + +## Kopyalayabileceğiniz Tam C# BarCodeReader Örneği + +Aşağıda, üç senaryoyu tek bir, çalıştırması kolay konsol uygulamasında birleştiren tam program yer almaktadır. `YOUR_DIRECTORY/ExtPDF417Meta.png` ifadesini görüntünüzün gerçek yolu ile değiştirin. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Beklenen çıktı + +Örnek görüntü bir Macro PDF417 barkod içerdiğinde, konsol aşağıdakine benzer bir şey yazdırır: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Görüntü yalnızca normal bir PDF417 içeriyorsa, “Macro PDF417” bölümü boş olur ve “Classic PDF417” bölümü çözülen metni gösterir. + +## Sonuç + +Artık `BarCodeReader` kullanarak C#'ta **görüntüden barkod okuma**, tek bir dosyada **C# ile birden fazla barkod okuma** ve **PDF417 barkod okuma**—hem macro hem de klasik varyantlar—için kesin adımları biliyorsunuz. Tam **C# BarCodeReader örneği** herhangi bir .NET projesine yapıştırılmaya hazırdır ve diğer formatları işlemek veya daha büyük bir görüntü‑işleme hattına entegre etmek için genişletebilirsiniz. + +**Sonraki adımlar** + +* Okuyucu bloğu etrafında `try / catch` gibi hata‑işleme desenlerini keşfedin. +* `ReaderParameters` nesnesiyle algılama hızını ve doğruluğunu ayarlamak için deneyler yapın. +* Barkod okuma işlemini görüntü ön işleme kütüphaneleriyle birleştirin ( + +## Sonra Ne Öğrenmelisiniz? + +Aşağıdaki öğreticiler, bu rehberde gösterilen tekniklere dayanan ve yakından ilgili konuları kapsar. Her kaynak, ek API özelliklerini öğrenmenize ve kendi projelerinizde alternatif uygulama yaklaşımlarını keşfetmenize yardımcı olmak için adım adım açıklamalar içeren tam çalışan kod örnekleri sunar. + +- [Aspose.BarCode ile .NET için DataMatrix Barkodları Nasıl Okunur](/barcode/english/net/datamatrix-barcode-reading/) +- [DataMatrix barkodunu C# ile okuma – DataMatrix Modu (Otomatik) Oluşturma](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Görüntüden Barkod Okuma – Java'da Aspose.BarCode ile Barkod Bölgesi Çıkarma Uzmanlığı](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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/net/compact-pdf417-encoding/_index.md b/barcode/vietnamese/net/compact-pdf417-encoding/_index.md index 8c0240726..b07332f8b 100644 --- a/barcode/vietnamese/net/compact-pdf417-encoding/_index.md +++ b/barcode/vietnamese/net/compact-pdf417-encoding/_index.md @@ -85,6 +85,9 @@ Ngoài các kiến thức cơ bản, dưới đây là một số mẹo thực t ### [Tạo Mã Vạch Compact PDF417](./compact-pdf417-basic-configuration/) Tìm hiểu cách tạo mã vạch Compact PDF417 bằng Aspose.BarCode cho .NET. Hướng dẫn chi tiết với các bước thực hiện và ví dụ mã nguồn. +### [Tạo mã vạch micro PDF417 bằng C# – hướng dẫn từng bước](./create-micro-pdf417-barcode-in-c-step-by-step-guide/) +Hướng dẫn chi tiết cách tạo mã vạch micro PDF417 trong C# bằng Aspose.BarCode, bao gồm các bước cấu hình và ví dụ mã nguồn. + ## Câu hỏi thường gặp **Q: Dung lượng tối đa tôi có thể lưu trữ trong một mã vạch Compact PDF417 là bao nhiêu?** @@ -111,4 +114,4 @@ A: Không cần font bên ngoài; thư viện tự xử lý việc render nội {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/vietnamese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md b/barcode/vietnamese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md new file mode 100644 index 000000000..2c5cead47 --- /dev/null +++ b/barcode/vietnamese/net/compact-pdf417-encoding/create-micro-pdf417-barcode-in-c-step-by-step-guide/_index.md @@ -0,0 +1,245 @@ +--- +category: general +date: 2026-08-15 +description: Tạo mã vạch micro PDF417 trong C# nhanh chóng với Aspose.BarCode. Tìm + hiểu cách sử dụng trình tạo mã vạch, thiết lập kích thước X, chọn số cột và bật + tuân thủ GS1. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- create micro PDF417 barcode +- Micro PDF417 barcode +- barcode generator +- X-dimension pixels +- GS1-compliant barcode +language: vi +lastmod: 2026-08-15 +og_description: Tạo mã vạch micro PDF417 bằng C# với Aspose.BarCode. Tham khảo hướng + dẫn này để cấu hình trình tạo mã vạch, đặt kích thước và tạo ảnh PNG. +og_image_alt: Screenshot showing a created micro PDF417 barcode generated by C# code +og_title: Tạo mã vạch micro PDF417 bằng C# – hướng dẫn lập trình đầy đủ +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + headline: Create micro PDF417 barcode in C# – step‑by‑step guide + type: TechArticle +- description: Create micro PDF417 barcode in C# quickly with Aspose.BarCode. Learn + how to use the barcode generator, set X‑dimension, choose columns, and enable + GS1 compliance. + name: Create micro PDF417 barcode in C# – step‑by‑step guide + steps: + - name: Initialize the barcode generator + text: First, import the required namespaces and create an instance of `BarcodeGenerator` + with the `EncodeTypes.MicroPdf417` enum. The second argument is the text you + want to encode. + - name: Configure the X‑dimension (module width) + text: The **X‑dimension** controls the width of a single barcode module in pixels. + A smaller value produces a tighter barcode, while a larger value improves readability + on low‑resolution printers. + - name: Set the number of columns + text: Micro PDF417 supports 1‑4 columns. More columns make the barcode shorter + but increase its height. + - name: Save the barcode as a PNG image + text: Finally, write the barcode to a file. PNG preserves the exact pixel dimensions + you configured. + - name: 'Optional: generate a GS1‑compliant Micro PDF417' + text: 'If your application requires **GS1‑compliant barcode** data (for supply‑chain + standards), enable GS1 encoding before saving:' + type: HowTo +tags: +- barcode +- C# +- PDF417 +- image generation +title: Tạo mã vạch micro PDF417 trong C# – hướng dẫn từng bước +url: /vi/net/compact-pdf417-encoding/create-micro-pdf417-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 micro PDF417 trong C# – hướng dẫn từng bước + +Nếu bạn cần **tạo mã vạch micro PDF417** trong C#, hướng dẫn này sẽ chỉ cho bạn cách thực hiện. Chúng tôi sẽ hướng dẫn cách khởi tạo **barcode generator**, cấu hình **X‑dimension**, chọn số cột, và lưu kết quả dưới dạng file PNG. + +Việc tạo mã vạch Micro PDF417 hữu ích cho việc mã hoá dữ liệu gọn gàng trên các nhãn nhỏ, vé, hoặc thiết bị IoT. Khi kết thúc tutorial này, bạn sẽ có một ví dụ hoàn chỉnh, có thể chạy ngay và chèn vào bất kỳ dự án .NET nào. + +## Những gì bạn cần + +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ã cũng hoạt động với .NET Framework 4.6+. +- Thư viện Aspose.BarCode for .NET (có sẵn qua NuGet `Aspose.BarCode`). +- Môi trường phát triển như Visual Studio 2022 hoặc VS Code. + +Không cần dịch vụ bên ngoài nào thêm; mọi thứ chạy cục bộ. + +## Cách tạo mã vạch micro PDF417 với Aspose.BarCode + +Cốt lõi của quá trình là một đối tượng **barcode generator** biết cách mã hoá dữ liệu Micro PDF417. Các phần sau sẽ phân tích từng bước cấu hình. + +### Bước 1: Khởi tạo barcode generator + +Đầu tiên, import các namespace cần thiết và tạo một thể hiện của `BarcodeGenerator` với enum `EncodeTypes.MicroPdf417`. Tham số thứ hai là văn bản bạn muốn mã hoá. + +```csharp +using Aspose.BarCode.Generation; +using Aspose.BarCode; + +// ... + +// Create a Micro PDF417 barcode generator with the desired text. +// The text can contain Unicode characters; here we use a sample string. +BarcodeGenerator microPdf417 = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); +``` + +**Tại sao lại quan trọng:** Lớp `BarcodeGenerator` bao hàm toàn bộ logic mã hoá. Việc chọn `EncodeTypes.MicroPdf417` báo cho thư viện sử dụng ký hiệu Micro PDF417 gọn gàng, giới hạn trong 1‑4 cột. + +### Bước 2: Cấu hình X‑dimension (độ rộng module) + +**X‑dimension** điều khiển độ rộng của một module mã vạch tính bằng pixel. Giá trị nhỏ hơn tạo mã vạch chặt hơn, trong khi giá trị lớn hơn giúp đọc dễ hơn trên máy in độ phân giải thấp. + +```csharp +// Define the X‑dimension (module width) in pixels. +microPdf417.Parameters.Barcode.XDimension.Pixels = 2; +``` + +**Mẹo:** Giá trị từ 1 đến 4 thường hoạt động tốt trên hầu hết màn hình. Nếu bạn dự định in trên máy in nhiệt, thử với 3–4 pixel để tránh hiện tượng nhòe. + +### Bước 3: Đặt số cột + +Micro PDF417 hỗ trợ 1‑4 cột. Nhiều cột hơn sẽ làm mã vạch ngắn hơn nhưng tăng chiều cao của nó. + +```csharp +// Set the column count (allowed values: 1‑4). +microPdf417.Parameters.Barcode.Pdf417.Columns = 4; +``` + +**Tại sao chọn 4 cột?** Với bốn cột, mã vạch chiếm ít không gian ngang nhất, rất thích hợp cho các nhãn hẹp. Nếu bạn cần một mã vạch cao hơn nhưng hẹp hơn, hãy giảm số cột. + +### Bước 4: Lưu mã vạch dưới dạng ảnh PNG + +Cuối cùng, ghi mã vạch ra file. PNG giữ nguyên kích thước pixel bạn đã cấu hình. + +```csharp +// Save the generated barcode as a PNG image. +microPdf417.Save(@"C:\Barcodes\MicroPdf417.png", BarCodeImageFormat.Png); +``` + +Sau khi chạy chương trình, mở `MicroPdf417.png` để xem kết quả. Ảnh sẽ hiển thị một mã vạch Micro PDF417 sắc nét, mã hoá văn bản mẫu. + +#### Kết quả mong đợi + +![Created micro PDF417 barcode](/images/micro-pdf417-sample.png "Create micro PDF417 barcode in C# – example output") + +File PNG chứa một mã vạch với: + +- X‑dimension là 2 px +- 4 cột +- Văn bản được mã hoá UTF‑8 là `"Åspóse.Barcóde©"` + +### Tùy chọn: tạo Micro PDF417 tuân thủ GS1 + +Nếu ứng dụng của bạn yêu cầu **dữ liệu mã vạch tuân thủ GS1** (cho tiêu chuẩn chuỗi cung ứng), bật mã hoá GS1 trước khi lưu: + +```csharp +// Enable GS1 encoding for the barcode. +microPdf417.Parameters.Barcode.IsGS1 = true; + +// Optionally, set a GS1 Application Identifier (AI) prefix. +microPdf417.Parameters.Barcode.Gs1DataBar.Stacked = true; // example setting + +// Save the GS1 barcode. +microPdf417.Save(@"C:\Barcodes\MicroPdf417_GS1.png", BarCodeImageFormat.Png); +``` + +**Giải thích:** Thiết lập `IsGS1` khiến Aspose.BarCode thêm phần đầu GS1 và áp dụng các quy tắc checksum đúng. Điều này rất cần thiết khi mã vạch của bạn sẽ được quét bằng máy đọc hỗ trợ GS1. + +## Ví dụ đầy đủ, có thể chạy ngay + +Dưới đây là một ứng dụng console hoàn chỉnh mà bạn có thể sao chép, dán và chạy. Nó bao gồm tất cả các câu lệnh `using` cần thiết, xử lý lỗi, và chú thích. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.Generation; + +namespace MicroPdf417Demo +{ + class Program + { + static void Main() + { + try + { + // 1️⃣ Initialize the barcode generator with the desired text. + var generator = new BarcodeGenerator( + EncodeTypes.MicroPdf417, + "Åspóse.Barcóde©"); + + // 2️⃣ Configure the X‑dimension (module width) in pixels. + generator.Parameters.Barcode.XDimension.Pixels = 2; + + // 3️⃣ Choose the number of columns (1‑4). Here we use the maximum. + generator.Parameters.Barcode.Pdf417.Columns = 4; + + // 4️⃣ (Optional) Enable GS1 compliance if required. + // generator.Parameters.Barcode.IsGS1 = true; + + // 5️⃣ Save the barcode as a PNG image. + string outputPath = @"C:\Barcodes\MicroPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Micro PDF417 barcode saved to: {outputPath}"); + } + catch (Exception ex) + { + Console.Error.WriteLine($"Error generating barcode: {ex.Message}"); + } + } + } +} +``` + +**Chạy mã:** +1. Tạo một dự án console .NET mới (`dotnet new console`). +2. Thêm gói Aspose.BarCode (`dotnet add package Aspose.BarCode`). +3. Thay thế file `Program.cs` được tạo bằng đoạn mã ở trên. +4. Điều chỉnh đường dẫn xuất nếu cần và chạy (`dotnet run`). + +Bạn sẽ thấy một thông báo trên console xác nhận vị trí file, và file PNG sẽ chứa **mã vạch micro PDF417** mà bạn vừa tạo. + +## Những lỗi thường gặp và mẹo thực hành + +- **Xử lý Unicode:** Aspose.BarCode tự động mã hoá ký tự UTF‑8, nhưng hãy chắc chắn file nguồn của bạn được lưu dưới dạng UTF‑8 để tránh ký tự bị hỏng. +- **Giới hạn cột:** Cố gắng đặt `Columns` ngoài phạm vi 1‑4 sẽ gây ra `ArgumentException`. Hãy kiểm tra đầu vào người dùng nếu bạn cho phép thay đổi cài đặt này trong UI. +- **Độ phân giải ảnh:** PNG không mất dữ liệu, nhưng nếu bạn cần định dạng vector độ phân giải cao hơn, hãy dùng `BarCodeImageFormat.Svg` thay thế. +- **Độ dài dữ liệu GS1:** Micro PDF417 tuân thủ GS1 có giới hạn độ dài nghiêm ngặt hơn. Kiểm tra chuỗi đã mã hoá không vượt quá giới hạn tối đa của tiêu chuẩn (thông thường 90 ký tự cho Micro PDF417). + +## Kết luận + +Bây giờ bạn đã biết cách **tạo mã vạch micro PDF417** trong C# bằng Aspose.BarCode. Tutorial đã hướng dẫn khởi tạo **barcode generator**, đặt **pixel X‑dimension**, chọn số cột, lưu ảnh, và tùy chọn bật tính năng **mã vạch tuân thủ GS1**. + +Từ đây, bạn có thể thử nghiệm với các đầu vào văn bản khác nhau, điều chỉnh X‑dimension cho các độ phân giải in khác nhau, hoặc chuyển sang xuất SVG để có đồ họa có thể mở rộng. Nếu bạn cần tạo các ký hiệu 2‑D khác, hãy khám phá `EncodeTypes.Pdf417`, `EncodeTypes.DataMatrix`, hoặc `EncodeTypes.QR` — mẫu cấu hình tương tự sẽ áp dụng. + +Chúc bạn lập trình vui vẻ! + +## 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 đã trình bày trong hướng dẫn này. Mỗi tài nguyên đều bao gồm mã mẫu đầy đủ 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. + +- [Cách tạo Barcode – Compact PDF417 với Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Tạo ảnh barcode DotCode – hàng & cột (Aspose.BarCode)](/barcode/english/net/dotcode-barcode-configuration/dotcode-rows-columns-configuration/) +- [Cách tạo Barcode Quiet Zone cho ITF-14 bằng Aspose.BarCode for .NET](/barcode/english/net/itf-14-barcode-customization/itf-14-barcode-quiet-zone-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/net/one-dimensional-barcode-types/_index.md b/barcode/vietnamese/net/one-dimensional-barcode-types/_index.md index e62a15ca4..3bb7f2c07 100644 --- a/barcode/vietnamese/net/one-dimensional-barcode-types/_index.md +++ b/barcode/vietnamese/net/one-dimensional-barcode-types/_index.md @@ -78,6 +78,8 @@ tìm hiểu cách tạo mã vạch trong .NET bằng Aspose.BarCode cho .NET. H Tìm hiểu cách xử lý các trường hợp ngoại lệ trong khi tạo mã vạch một chiều bằng Aspose.BarCode cho .NET. Hướng dẫn từng bước này đảm bảo các giải pháp mã vạch có khả năng chịu lỗi. Bắt đầu ngay bây giờ! ### [Cấu hình tỷ lệ rộng-hẹp một chiều](./one-dimensional-wide-narrow-ratio-configuration/) Tạo mã vạch tùy chỉnh dễ dàng với Aspose.BarCode cho .NET. Hướng dẫn từng bước cho cấu hình tỷ lệ rộng-hẹp một chiều. +### [Đọc mã vạch từ hình ảnh trong C# – Hướng dẫn BarCodeReader](./read-barcode-from-image-in-c-barcodereader-tutorial/) +Hướng dẫn cách đọc mã vạch từ ảnh trong C# bằng BarCodeReader của Aspose.BarCode. ## Phần kết luận @@ -89,4 +91,4 @@ Với bài viết này, bạn không chỉ có được kiến thức về các {{< /blocks/products/pf/main-container >}} {{< /blocks/products/pf/main-wrap-class >}} -{{< blocks/products/products-backtop-button >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/vietnamese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md b/barcode/vietnamese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md new file mode 100644 index 000000000..aa2362c19 --- /dev/null +++ b/barcode/vietnamese/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/_index.md @@ -0,0 +1,258 @@ +--- +category: general +date: 2026-08-15 +description: Đọc mã vạch từ hình ảnh trong C# bằng BarCodeReader. Tìm hiểu cách đọc + nhiều mã vạch trong C#, đọc mã vạch PDF417, và xem một ví dụ đầy đủ về BarCodeReader + trong C#. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- read barcode from image +- read multiple barcodes c# +- how to read pdf417 barcode +- c# barcodereader example +language: vi +lastmod: 2026-08-15 +og_description: Đọc mã vạch từ hình ảnh trong C# với hướng dẫn từng bước. Khám phá + cách đọc nhiều mã vạch trong C#, giải mã ký hiệu PDF417 và chạy một ví dụ hoàn chỉnh + về BarCodeReader trong C#. +og_image_alt: Screenshot of C# code that reads barcode from image using BarCodeReader +og_title: Đọc mã vạch từ hình ảnh trong C# – Hướng dẫn BarCodeReader +schemas: +- author: Aspose + dateModified: '2026-08-15' + description: Read barcode from image in C# using BarCodeReader. Learn how to read + multiple barcodes C#, read PDF417 barcode, and see a full C# BarCodeReader example. + headline: Read barcode from image in C# – BarCodeReader tutorial + type: TechArticle +tags: +- barcode +- C# +- .NET +- image processing +title: Đọc mã vạch từ hình ảnh trong C# – Hướng dẫn BarCodeReader +url: /vi/net/one-dimensional-barcode-types/read-barcode-from-image-in-c-barcodereader-tutorial/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Đọc mã vạch từ hình ảnh trong C# – Hướng dẫn BarCodeReader + +Nếu bạn cần **đọc mã vạch từ hình ảnh** trong một ứng dụng .NET, hướng dẫn này sẽ chỉ cho bạn cách thực hiện chính xác bằng lớp `BarCodeReader`. Bạn cũng sẽ thấy cách **đọc nhiều mã vạch C#**, giải mã ký hiệu PDF417, và có được một **ví dụ C# BarCodeReader** hoàn chỉnh mà bạn có thể sao chép vào dự án của mình. + +Hướng dẫn bao gồm mọi bước—từ việc thêm gói NuGet cần thiết đến việc in các trường PDF417 mở rộng—để bạn có một chương trình console có thể chạy được. Không cần tài liệu bên ngoài; tất cả mã và giải thích đều được bao gồm. + +## Những gì bạn cần + +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ỳ trình soạn thảo nào hỗ trợ C# +* Gói NuGet `Aspose.BarCode` (hoặc thư viện tương đương cung cấp `BarCodeReader`) +* Một tệp hình ảnh chứa mã vạch Macro PDF417 (ví dụ: `ExtPDF417Meta.png`) + +Có đầy đủ các điều kiện tiên quyết này sẽ đảm bảo mẫu biên dịch mà không cần cấu hình bổ sung. + +## Đọc mã vạch từ hình ảnh bằng BarCodeReader + +Bước đầu tiên là tạo một thể hiện `BarCodeReader` trỏ tới tệp hình ảnh và cho thư viện biết loại mã vạch cần tìm. + +```csharp +using System; +using Aspose.BarCode; // Namespace for BarCodeReader +using Aspose.BarCode.BarCodeRecognition; // DecodeType enum + +class Program +{ + static void Main() + { + // Path to the image that holds the Macro PDF417 barcode + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // Initialize the reader for Macro PDF417 barcodes only + using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.MacroPdf417)) + { + // Read all barcodes present in the image + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + // Basic barcode information + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + + // Extended Macro PDF417 fields (available only for this type) + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + Console.WriteLine($"Segment ID : {result.Extended.Pdf417.MacroPdf417SegmentID}"); + Console.WriteLine($"Segments Count : {result.Extended.Pdf417.MacroPdf417SegmentsCount}"); + Console.WriteLine($"File Name : {result.Extended.Pdf417.MacroPdf417FileName}"); + Console.WriteLine($"Checksum : {result.Extended.Pdf417.MacroPdf417Checksum}"); + Console.WriteLine($"File Size : {result.Extended.Pdf417.MacroPdf417FileSize}"); + Console.WriteLine($"Time Stamp : {result.Extended.Pdf417.MacroPdf417TimeStamp}"); + Console.WriteLine($"Addressee : {result.Extended.Pdf417.MacroPdf417Addressee}"); + Console.WriteLine($"Sender : {result.Extended.Pdf417.MacroPdf417Sender}"); + Console.WriteLine($"Terminator Flag : {result.Extended.Pdf417.MacroPdf417Terminator}"); + Console.WriteLine(new string('-', 40)); + } + } + } +} +``` + +**Tại sao cách này hoạt động:** +`BarCodeReader` mở hình ảnh, quét theo `DecodeType` đã chỉ định và trả về một tập hợp các đối tượng `BarCodeResult`. Mỗi kết quả chứa dữ liệu mã vạch chung (`CodeTypeName`, `CodeText`) và, đối với Macro PDF417, một đối tượng `Extended.Pdf417` hiển thị tất cả các trường bổ sung được định nghĩa trong tiêu chuẩn. + +## Đọc nhiều mã vạch C# trong một hình ảnh duy nhất + +Đôi khi một hình ảnh chứa hơn một mã vạch (ví dụ: QR code bên cạnh PDF417). Để xử lý trường hợp này, chỉ cần bỏ qua `DecodeType` cụ thể hoặc truyền `DecodeType.AllSupported` và lặp qua các kết quả. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.AllSupported)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Found {result.CodeTypeName}: {result.CodeText}"); + } +} +``` + +**Tại sao bạn cần điều này:** +Việc chỉ định `AllSupported` yêu cầu engine thử mọi định dạng mã vạch mà nó biết, đảm bảo bạn bắt được mọi ký hiệu trong hình ảnh. Đây là cách tiếp cận được khuyến nghị khi bạn không thể dự đoán trước loại mã vạch. + +## Cách đọc mã vạch PDF417 bằng C# + +Nếu bạn chỉ quan tâm đến định dạng PDF417 cổ điển (không phải macro), hãy đổi `DecodeType` thành `Pdf417`. Phần còn lại của mã vẫn giống hệt, chỉ khác là các trường mở rộng không có sẵn. + +```csharp +using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.Pdf417)) +{ + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } +} +``` + +**Tại sao điều này quan trọng:** +PDF417 cổ điển không cung cấp các thuộc tính đặc thù của macro, vì vậy khối `Extended.Pdf417` là không cần thiết. Sử dụng `DecodeType` chính xác cũng giúp tăng tốc quét vì thư viện bỏ qua các thuật toán không hỗ trợ. + +## Ví dụ đầy đủ C# BarCodeReader mà bạn có thể sao chép + +Dưới đây là chương trình hoàn chỉnh kết hợp ba kịch bản thành một ứng dụng console dễ chạy. Thay thế `YOUR_DIRECTORY/ExtPDF417Meta.png` bằng đường dẫn thực tế tới hình ảnh của bạn. + +```csharp +using System; +using Aspose.BarCode; +using Aspose.BarCode.BarCodeRecognition; + +class Program +{ + static void Main() + { + const string imagePath = @"YOUR_DIRECTORY/ExtPDF417Meta.png"; + + // 1️⃣ Read Macro PDF417 and show extended fields + Console.WriteLine("=== Macro PDF417 ==="); + ReadMacroPdf417(imagePath); + + // 2️⃣ Read any barcode type present (multiple barcodes) + Console.WriteLine("\n=== All supported barcodes ==="); + ReadAllBarcodes(imagePath); + + // 3️⃣ Read classic PDF417 only + Console.WriteLine("\n=== Classic PDF417 ==="); + ReadClassicPdf417(imagePath); + } + + static void ReadMacroPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.MacroPdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"Code Type : {result.CodeTypeName}"); + Console.WriteLine($"Code Text : {result.CodeText}"); + Console.WriteLine($"File ID : {result.Extended.Pdf417.MacroPdf417FileID}"); + // ... other extended fields omitted for brevity + Console.WriteLine(new string('-', 30)); + } + } + } + + static void ReadAllBarcodes(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.AllSupported)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"{result.CodeTypeName}: {result.CodeText}"); + } + } + } + + static void ReadClassicPdf417(string path) + { + using (BarCodeReader reader = new BarCodeReader(path, DecodeType.Pdf417)) + { + foreach (BarCodeResult result in reader.ReadBarCodes()) + { + Console.WriteLine($"PDF417 text: {result.CodeText}"); + } + } + } +} +``` + +### Kết quả mong đợi + +Khi hình ảnh mẫu chứa mã vạch Macro PDF417, console sẽ in ra một nội dung tương tự như: + +``` +=== Macro PDF417 === +Code Type : MacroPdf417 +Code Text : 1234567890 +File ID : 5 +Segment ID : 2 +Segments Count : 3 +File Name : report.pdf +Checksum : 0x1A2B +File Size : 84212 +Time Stamp : 2024-03-15T10:22:31Z +Addressee : John Doe +Sender : Acme Corp +Terminator Flag : True +------------------------------ + +=== All supported barcodes === +MacroPdf417: 1234567890 +QrCode: https://example.com + +=== Classic PDF417 === +PDF417 text: 0987654321 +``` + +Nếu hình ảnh chỉ chứa PDF417 thông thường, phần “Macro PDF417” sẽ để trống, và phần “Classic PDF417” sẽ hiển thị văn bản đã giải mã. + +## Kết luận + +Bạn đã biết cách **đọc mã vạch từ hình ảnh** trong C# bằng `BarCodeReader`, cách **đọc nhiều mã vạch C#** trong một tệp duy nhất, và các bước chính xác để **đọc mã vạch PDF417**—cả phiên bản macro và cổ điển. Toàn bộ **ví dụ C# BarCodeReader** đã sẵn sàng để dán vào bất kỳ dự án .NET nào, và bạn có thể mở rộng nó để xử lý các định dạng khác hoặc tích hợp vào quy trình xử lý ảnh lớn hơn. + +**Các bước tiếp theo** + +* Khám phá các mẫu xử lý lỗi như `try / catch` quanh khối reader. +* Thử nghiệm với đối tượng `ReaderParameters` để tinh chỉnh tốc độ và độ chính xác phát hiện. +* Kết hợp việc đọc mã vạch với các thư viện tiền xử lý ảnh ( + +## 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ẽ, dựa 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ạt động đầ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. + +- [Cách đọc mã DataMatrix với Aspose.BarCode cho .NET](/barcode/english/net/datamatrix-barcode-reading/) +- [Đọc mã DataMatrix C# – Tạo chế độ DataMatrix (Tự động)](/barcode/english/net/datamatrix-barcode-configuration/datamatrix-encoding-mode-auto/) +- [Đọc mã vạch từ hình ảnh – Thành thạo việc trích xuất vùng mã vạch trong Java với Aspose.BarCode](/barcode/english/java/advanced-settings-and-optimization/extracting-barcode-region-information/) + +{{< /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