diff --git a/barcode/arabic/net/compact-pdf417-encoding/_index.md b/barcode/arabic/net/compact-pdf417-encoding/_index.md index 6b447ecb2..ceac08cbc 100644 --- a/barcode/arabic/net/compact-pdf417-encoding/_index.md +++ b/barcode/arabic/net/compact-pdf417-encoding/_index.md @@ -84,6 +84,10 @@ PDF417 المدمج هو رمز ثنائي الأبعاد عالي السعة ي ## دروس ترميز PDF417 المدمج ### [إنشاء باركودات PDF417 المدمجة](./compact-pdf417-basic-configuration/) تعلم كيفية إنشاء باركودات PDF417 المدمجة باستخدام Aspose.BarCode for .NET. دليل شامل مع تعليمات خطوة بخطوة وأمثلة شفرة. +### [إنشاء باركود PDF417 في C# – دليل كامل مع التخطيط المدمج](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +دليل شامل لإنشاء باركود PDF417 باستخدام C# مع تخطيط مدمج. +### [إنشاء باركود C# مع Macro PDF417 – مثال كامل](./generate-barcode-c-with-macro-pdf417-full-example/) +مثال كامل لإنشاء باركود C# باستخدام Macro PDF417 مع Aspose.BarCode. ## الأسئلة المتكررة @@ -113,4 +117,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/arabic/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..78e4ef5e1 --- /dev/null +++ b/barcode/arabic/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: إنشاء باركود باستخدام C# و Aspose.BarCode لإنشاء Macro PDF417 بنص مخصص + وحفظه كملف صورة. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: ar +lastmod: 2026-08-19 +og_description: إنشاء باركود C# باستخدام Aspose.BarCode، تعلم كيفية إنشاء PDF417، + إضافة نص مخصص، وحفظ ملف صورة الباركود. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: إنشاء باركود C# – دليل Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: إنشاء باركود C# باستخدام Macro PDF417 – مثال كامل +url: /ar/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# إنشاء باركود C# باستخدام Macro PDF417 – مثال كامل + +إذا كنت بحاجة إلى **generate barcode C#** لتنسيق Macro PDF417، يوضح لك هذا الدليل حلاً جاهزًا للتنفيذ. سترى كيف **how to generate pdf417**، وتضمين نص مخصص، و**generate barcode image file** في برنامج واحد مستقل. + +يغطي هذا الدليل كل شيء من تثبيت مكتبة Aspose.BarCode إلى تكوين بيانات تعريف Macro PDF417، بحيث يمكنك نسخ الشيفرة مباشرةً إلى مشروعك ورؤية النتيجة فورًا. + +## المتطلبات المسبقة + +- .NET 6.0 SDK أو أحدث (الشيفرة تعمل أيضًا مع .NET Framework 4.7+) +- Visual Studio 2022 (أو أي بيئة تطوير تدعم C#) +- ترخيص Aspose.BarCode for .NET (الإصدار التجريبي المجاني يعمل للتقييم) +- إلمام أساسي بصياغة C# + +> **نصيحة احترافية:** قم بتثبيت حزمة NuGet عبر سطر الأوامر لتجنب تعارض الإصدارات: +> `dotnet add package Aspose.BarCode` + +## الخطوة 1: إعداد المشروع واستيراد المكتبة + +أنشئ تطبيقًا جديدًا من نوع console وأضف توجيهات `using` المطلوبة. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**لماذا هذه الخطوة مهمة:** +توفر مساحة الاسم `Aspose.BarCode.Generation` الفئة `BarcodeGenerator`، وهي نقطة الدخول لإنشاء أي نوع من الباركود، بما في ذلك Macro PDF417. استيراد `System` يمنحك الوصول إلى `DateTime` لبيانات تعريف الطابع الزمني. + +## الخطوة 2: إنشاء مولد Macro PDF417 بنص مخصص + +استبدل التعليق النائب بتهيئة المولد. يوضح هذا **create barcode custom text** مع اختيار نوع الترميز الصحيح. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**شرح:** +- `EncodeTypes.MacroPdf417` يخبر Aspose بإنتاج باركود PDF417 يدعم ميزات الماكرو (تقسيم الملف، التحقق من الصحة، إلخ). +- النص `"Åspóse.Barcóde©"` يوضح أن الأحرف Unicode مدعومة بالكامل، وهو ما يُطلب غالبًا في التطبيقات الدولية. + +## الخطوة 3: تكوين المظهر وبيانات تعريف Macro PDF417 + +قم بضبط أبعاد الباركود بدقة واضبط الحقول الخاصة بالماكرو المطلوبة لمعالجة الملفات المقسمة. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**لماذا هذه الإعدادات مهمة:** + +| Setting | Purpose | +|---------|---------| +| `XDimension.Pixels` | يتحكم في الكثافة البصرية؛ 2 px ينتج صورة واضحة قابلة للمسح. | +| `Columns` | يحدد عدد الأعمدة البياناتية في كل صف، مما يؤثر على حجم الباركود. | +| `MacroPdf417FileID` | يعرّف الملف المنطقي بشكل فريد عبر جميع القطاعات. | +| `MacroPdf417SegmentID` / `SegmentsCount` | يتيح إعادة بناء الملف الأصلي من عدة باركودات. | +| `MacroPdf417FileName` | اسم قابل للقراءة البشرية يُخزن داخل الباركود للمعالجة اللاحقة. | +| `MacroPdf417Checksum` | يوفر كشف الأخطاء باستخدام خوارزمية CCITT‑16 CRC. | +| `MacroPdf417FileSize` | يساعد المُفكك على معرفة متى تم استلام الملف بالكامل. | +| `MacroPdf417TimeStamp` | يسجل وقت إنشاء الباركود، مفيد لتتبع التدقيق. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | حقول اختيارية يمكن استخدامها في سير عمل الأعمال. | +| `MacroPdf417Terminator` | يشير إلى أن هذا القطاع هو الأخير (`Set`). | + +## الخطوة 4: حفظ الباركود كملف صورة + +أخيرًا، احفظ الباركود في ملف PNG حتى تتمكن من عرضه أو تضمينه في مكان آخر. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**ما ستراه:** +صورة PNG باسم `ExtPDF417Meta.png` تحتوي على باركود Macro PDF417 يشفّر النص المخصص وجميع حقول البيانات التعريفية التي قمت بتحديدها أعلاه. يمكن فتح الصورة بأي عارض قياسي أو إدراجها في ملفات PDF أو تقارير أو صفحات ويب. + +## الشيفرة المصدرية الكاملة (جاهزة للنسخ واللصق) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### النتيجة المتوقعة + +تشغيل البرنامج يطبع: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +فتح `ExtPDF417Meta.png` يظهر باركود Macro PDF417 نظيف يُمسح بشكل صحيح بأي قارئ PDF417، مع الحفاظ على النص المخصص `"Åspóse.Barcóde©"` وبيانات التعريف الماكرو التي حددتها. + +## الأسئلة الشائعة والحالات الخاصة + +- **هل يمكنني إنشاء تنسيق صورة مختلف؟** + نعم. استبدل `BarCodeImageFormat.Png` بـ `Jpeg` أو `Bmp` أو `Gif` حسب الحاجة. + +- **ماذا لو تجاوزت بياناتي حجم باركود واحد؟** + تم تصميم Macro PDF417 للتقسيم. عدّل `MacroPdf417SegmentsCount` و `MacroPdf417SegmentID` لكل جزء، ثم اجمع النتائج الممسوحة. + +- **هل دعم Unicode مضمون؟** + Aspose.BarCode يدعم Unicode بالكامل. تأكد من حفظ ملف المصدر بترميز UTF‑8 لتجنب تشويه الأحرف. + +- **هل أحتاج إلى ترخيص للإنتاج؟** + الإصدار المرخص يزيل علامة التقييم المائية ويوفر الوظائف الكاملة. النسخة التجريبية تعمل للاختبار والتعلم. + +## الخاتمة + +أنت الآن تعرف كيف **generate barcode C#** لتنسيق Macro PDF417، **how to generate pdf417** مع بيانات تعريف غنية، **create barcode custom text**، و**generate barcode image file** باستخدام Aspose.BarCode. المثال الكامل القابل للتنفيذ يوضح كل خطوة مطلوبة — من إعداد المشروع إلى حفظ صورة PNG النهائية. + +### الخطوات التالية + +- جرّب إعدادات PDF417 أخرى مثل `ErrorCorrectionLevel` و `CompactPdf417` للحصول على رموز أصغر. +- دمج الباركود المُولد في تقرير PDF باستخدام Aspose.PDF. +- استكشف إنشاء دفعات: كرّر عبر مجموعة من الملفات وانتج سلسلة من باركودات Macro PDF417 المقسمة. + +لا تتردد في تعديل الشيفرة لتناسب سير عملك، ودع إنشاء الباركود يصبح جزءًا سلسًا من تطبيقات C# الخاصة بك. برمجة سعيدة! + +## ما الذي يجب أن تتعلمه بعد ذلك؟ + +الدروس التالية تغطي مواضيع ذات صلة وثيقة تبني على التقنيات الموضحة في هذا الدليل. كل مورد يتضمن أمثلة شيفرة كاملة مع شروحات خطوة بخطوة لمساعدتك على إتقان ميزات API إضافية واستكشاف أساليب تنفيذ بديلة في مشاريعك. + +- [كيفية إنشاء باركود Aztec بنسبة أبعاد مخصصة باستخدام Aspose.BarCode لـ .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [إنشاء صورة باركود – Code 93 باستخدام Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [كيفية إنشاء وضبط ارتفاع باركود Databar أحادي الأبعاد باستخدام Aspose.BarCode لـ .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/arabic/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..3f4d3f034 --- /dev/null +++ b/barcode/arabic/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,250 @@ +--- +category: general +date: 2026-08-19 +description: إنشاء رمز شريطي PDF417 في C# بسرعة. تعلم كيفية إنشاء رمز شريطي PDF417 + باستخدام C# و Aspose.BarCode مع وضع الضغط والإعدادات المخصصة. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: ar +lastmod: 2026-08-19 +og_description: إنشاء رمز شريطي PDF417 في C# باستخدام Aspose.BarCode. يوضح هذا الدرس + كيفية إنشاء رمز شريطي PDF417 في C# في الوضع المضغوط، وتعيين البُعد X، وحفظه كملف + PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: إنشاء رمز شريطي PDF417 في C# – دليل خطوة بخطوة +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: إنشاء رمز شريطي PDF417 بلغة C# – دليل كامل مع تخطيط مدمج +url: /ar/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# إنشاء باركود PDF417 في C# – دليل شامل + +إذا كنت بحاجة إلى **إنشاء باركود PDF417** في تطبيق .NET، فإن هذا الدليل يوضح لك بالضبط كيفية القيام بذلك. سترى مثالًا مختصرًا وجاهزًا للإنتاج يُنشئ باركود PDF417 مدمجًا، يخصص بُعد X، ويحفظ النتيجة كصورة PNG. + +يُعد إنشاء باركود PDF417 أمرًا شائعًا عندما تحتاج إلى ترميز كميات كبيرة من البيانات—مثل معلومات التذاكر، قوائم الشحن، أو وثائق الهوية—بتنسيق يمكن قراءته آليًا. باستخدام Aspose.BarCode تصبح العملية بسيطة، والكود يعمل مع .NET 6+ أو .NET Framework 4.7.2 وما بعده. + +في هذا الدليل ستقوم بـ: + +* تثبيت حزمة NuGet الخاصة بـ Aspose.BarCode. +* كتابة برنامج C# مستقل **ينشئ باركود PDF417** بعدد أعمدة صغير ووضع مدمج (مقتطع). +* ضبط عرض الخط (X‑dimension) للحصول على عرض أكثر وضوحًا. +* حفظ الباركود كملف PNG. +* استكشاف التغييرات، الحالات الحدية، ونصائح أفضل الممارسات. + +## المتطلبات المسبقة + +قبل أن تبدأ، تأكد من وجود ما يلي: + +* Visual Studio 2022 (أو أي بيئة تطوير C#) مع .NET 6 SDK مثبت. +* اتصال بالإنترنت لتنزيل حزمة **Aspose.BarCode** من NuGet. +* صلاحية كتابة في المجلد الذي سيُحفظ فيه ملف PNG. + +لا توجد مكتبات إضافية مطلوبة؛ فـ Aspose.BarCode يتعامل مع ترميز الصورة داخليًا. + +## الخطوة 1: إضافة حزمة Aspose.BarCode + +افتح مشروعك في Visual Studio، انقر بزر الماوس الأيمن على الحل، واختر **Manage NuGet Packages**. ابحث عن `Aspose.BarCode` وقم بتثبيت أحدث نسخة مستقرة. + +```bash +dotnet add package Aspose.BarCode +``` + +> **نصيحة احترافية:** حافظ على تحديث الحزمة. الإصدارات الجديدة غالبًا ما تتضمن تحسينات في الأداء ودعمًا لأحدث إصدارات .NET. + +## الخطوة 2: إنشاء تطبيق console بسيط + +أنشئ مشروع console جديد بلغة C# إذا لم يكن لديك واحد بالفعل: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +استبدل محتوى `Program.cs` بالمثال الكامل أدناه. يوضح هذا البرنامج **كيفية إنشاء باركود PDF417 باستخدام C#** من البداية حتى النهاية. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### لماذا كل سطر مهم + +* **`EncodeTypes.Pdf417`** – يحدد رموز PDF417، التي تدعم ما يصل إلى ~1.1 KB من البيانات. +* **`XDimension.Pixels = 2`** – يضبط عرض الخط الأساسي. القيم الأصغر تجعل الباركود أرفع؛ القيم الأكبر تحسن القابلية للقراءة على الأجهزة منخفضة الدقة. +* **`Pdf417.Columns = 3`** – يحد عدد الأعمدة، مما يجبر المولد على استخدام المزيد من الصفوف، وبالتالي ينتج باركودًا أطول لكنه أضيق. +* **`Pdf417.Truncate = true`** – يفعّل الوضع المدمج، بإزالة نمط الإيقاف وتقليص الصورة دون فقدان سلامة البيانات. +* **`Save(..., BarCodeImageFormat.Png)`** – يحفظ الملف بصيغة PNG. يمكنك أيضًا اختيار `Jpeg` أو `Bmp` أو `Svg` حسب احتياجاتك اللاحقة. + +شغّل البرنامج: + +```bash +dotnet run +``` + +ستظهر لك رسالة في وحدة التحكم تؤكد موقع الملف، وسيحتوي المجلد على `CompactPdf417.png`. عند فتح ملف PNG سترى باركود PDF417 مدمجًا وواضحًا يرمّز السلسلة Unicode. + +## الخطوة 3: التحقق من الباركود (اختياري لكن يُنصح به) + +للتأكد من أن الباركود قابل للقراءة، يمكنك استخدام أي تطبيق ماسح PDF417 قياسي على الهاتف الذكي أو مكتبة فك ترميز على سطح المكتب. يجب أن يتطابق النص المشفر مع سلسلة `data` الأصلية تمامًا، بما في ذلك الأحرف الخاصة. + +إذا واجهت مشاكل في الفك: + +* زد قيمة `XDimension` إلى 3 أو 4 بكسل. +* قلل عدد الأعمدة (مثلاً `Columns = 2`). +* عطل وضع `Truncate` (`Truncate = false`) لإضافة نمط الإيقاف. + +هذه التعديلات توازن بين الحجم والقابلية للقراءة، وهو ما يكون مفيدًا للطابعات أو الماسحات منخفضة الدقة. + +## الخطوة 4: استكشاف التغييرات الشائعة + +### 4️⃣ إنشاء PDF417 عالي الكثافة للطباعة + +إذا كنت بحاجة إلى باركود يناسب ملصقًا صغيرًا، زد عدد الأعمدة وقلل بُعد X: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ تغيير صيغة الإخراج إلى SVG للتكبير المتجهي + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +تُتيح صيغة SVG التكبير دون فقدان الجودة، مما يجعلها مثالية للصفحات الويب المتجاوبة. + +### 6️⃣ ترميز بيانات ثنائية (مثال: مصفوفة بايت) + +إذا كنت بحاجة إلى تضمين حمولة ثنائية، حوّلها أولًا إلى سلسلة Base64: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +الآن يحمل الباركود المعلومات الثنائية، ويجب على القارئ عكس خطوة Base64 لفك الترميز. + +## الأسئلة المتكررة + +| السؤال | الجواب | +|----------|--------| +| **هل يمكنني إنشاء PDF417 بدون Aspose؟** | نعم، توجد مكتبات أخرى مثل ZXing.Net أو Dynamsoft، لكن Aspose.BarCode يوفر تحكمًا أقوى في التخطيط (الأعمدة، الاقتطاع) وتعاملًا أفضل مع Unicode. | +| **ما هو الحد الأقصى لطول البيانات؟** | يمكن لـ PDF417 ترميز ما يصل إلى 1,108 بايت (≈ 1 KB) من البيانات الثنائية. إذا تجاوزت هذا الحد، فكر في تقسيم البيانات على عدة باركودات. | +| **هل وضع المدمج متوافق مع المعايير؟** | PDF417 المقتطع هو جزء من مواصفة ISO/IEC 15438 ويُدعم على نطاق واسع، لكن تأكد من أن الماسح المستهدف يدعم هذا الوضع صراحةً. | +| **كيف أغيّر لون الخلفية؟** | عيّن `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` و `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` قبل الحفظ. | + +## الخلاصة + +أنت الآن تعرف **كيفية إنشاء باركود PDF417 باستخدام C#** عبر Aspose.BarCode، وكيفية ضبط بُعد X، وتفعيل الوضع المدمج، وتصدير النتيجة كصورة PNG. يمكن نسخ المثال الكامل القابل للتنفيذ إلى أي مشروع .NET، وتتيح لك التغييرات الموضحة تعديل الباركود للطباعة أو الويب أو سيناريوهات الحمولة الثنائية. + +الخطوات التالية التي قد تستكشفها: + +* دمج توليد الباركود في API ASP.NET Core يُعيد الصورة عند الطلب. +* الجمع بين PDF417 وQR codes على نفس الملصق للمسح المزدوج. +* استخدام فئة `Reader` في Aspose.BarCode لفك ترميز الصورة التي تم إنشاؤها والتحقق من البيانات برمجيًا. + +نتمنى لك برمجة سعيدة، واستمتع بالمرونة التي توفرها حلول **إنشاء باركود PDF417** لتطبيقاتك! + +## ماذا يجب أن تتعلم بعد ذلك؟ + +الدروس التالية تغطي مواضيع ذات صلة وثيقة تبني على التقنيات التي تم توضيحها في هذا الدليل. كل مورد يتضمن أمثلة شاملة مع شروحات خطوة بخطوة لمساعدتك على إتقان ميزات API إضافية واستكشاف أساليب تنفيذ بديلة في مشاريعك. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [How to Generate Barcode Image with Supplemental Space Customization using Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/chinese/net/compact-pdf417-encoding/_index.md b/barcode/chinese/net/compact-pdf417-encoding/_index.md index 165dd64a9..162bd37c8 100644 --- a/barcode/chinese/net/compact-pdf417-encoding/_index.md +++ b/barcode/chinese/net/compact-pdf417-encoding/_index.md @@ -85,7 +85,9 @@ Aspose.BarCode 允许您设置 `Pdf417ErrorCorrectionLevel` 属性(0‑8)。 ### [创建紧凑 PDF417 条形码](./compact-pdf417-basic-configuration/) -了解如何使用 Aspose.BarCode for .NET 生成紧凑 PDF417 条形码。提供完整的分步指南和代码示例。 +### [在 C# 中生成 PDF417 条码 – 紧凑布局完整指南](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) + +### [使用宏 PDF417 生成条形码(C#) – 完整示例](./generate-barcode-c-with-macro-pdf417-full-example/) ## 常见问题 @@ -115,4 +117,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/chinese/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..4d8e04c10 --- /dev/null +++ b/barcode/chinese/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: 使用 Aspose.BarCode 在 C# 中生成条形码,创建带自定义文本的 Macro PDF417 并保存为图像文件。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: zh +lastmod: 2026-08-19 +og_description: 使用 Aspose.BarCode 在 C# 中生成条形码,学习如何生成 PDF417,添加自定义文本,并保存条形码图像文件。 +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: 生成条码 C# – Macro PDF417 指南 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: 使用 Macro PDF417 生成 C# 条码 – 完整示例 +url: /zh/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 使用 Macro PDF417 生成条形码 C# – 完整示例 + +如果您需要为 Macro PDF417 格式 **generate barcode C#**,本指南提供一个可直接运行的解决方案。您将看到如何 **how to generate pdf417**,嵌入自定义文本,以及在单个独立程序中 **generate barcode image file**。 + +本教程涵盖了从安装 Aspose.BarCode 库到配置 Macro PDF417 元数据的全部内容,您可以直接将代码复制到项目中并立即看到结果。 + +## 前置条件 + +在开始之前,请确保您拥有: + +- .NET 6.0 SDK 或更高版本(代码同样适用于 .NET Framework 4.7+) +- Visual Studio 2022(或任何支持 C# 的 IDE) +- Aspose.BarCode for .NET 许可证(免费试用可用于评估) +- 对 C# 语法有基本了解 + +> **专业提示:** 通过 CLI 安装 NuGet 包以避免版本不匹配: +> `dotnet add package Aspose.BarCode` + +## 第 1 步:设置项目并导入库 + +创建一个新的控制台应用程序并添加所需的 `using` 指令。 + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**此步骤的重要性:** +`Aspose.BarCode.Generation` 命名空间提供了 `BarcodeGenerator` 类,这是创建任何条形码类型(包括 Macro PDF417)的入口。导入 `System` 可让您使用 `DateTime` 来获取时间戳元数据。 + +## 第 2 步:使用自定义文本创建 Macro PDF417 生成器 + +将占位注释替换为生成器初始化代码。这演示了 **create barcode custom text**,同时选择了正确的编码类型。 + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**说明:** +- `EncodeTypes.MacroPdf417` 告诉 Aspose 生成支持宏功能(文件分段、校验和等)的 PDF417 条形码。 +- 文本 `"Åspóse.Barcóde©"` 表明 Unicode 字符得到完整支持,这在国际化应用中常常是必需的。 + +## 第 3 步:配置外观和 Macro PDF417 元数据 + +微调条形码尺寸并设置分段文件处理所需的宏特定字段。 + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**这些设置为何重要:** + +| 设置 | 目的 | +|---------|---------| +| `XDimension.Pixels` | 控制视觉密度;2 px 可产生清晰、可扫描的图像。 | +| `Columns` | 决定每行显示多少数据列,影响条形码大小。 | +| `MacroPdf417FileID` | 在所有分段中唯一标识逻辑文件。 | +| `MacroPdf417SegmentID` / `SegmentsCount` | 使得可以通过多个条形码重建原始文件。 | +| `MacroPdf417FileName` | 在条形码内部存储的人类可读文件名,供后续处理使用。 | +| `MacroPdf417Checksum` | 使用 CCITT‑16 CRC 算法提供错误检测。 | +| `MacroPdf417FileSize` | 帮助解码器判断何时已接收完整文件。 | +| `MacroPdf417TimeStamp` | 记录条形码生成时间,便于审计追踪。 | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | 可选字段,可用于业务工作流。 | +| `MacroPdf417Terminator` | 表示此分段为最后一个(`Set`)。 | + +## 第 4 步:将条形码保存为图像文件 + +最后,将条形码写入 PNG 文件,以便您在其他地方查看或嵌入。 + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**您将看到的内容:** +一个名为 `ExtPDF417Meta.png` 的 PNG 图像,内部包含一个 Macro PDF417 条形码,编码了自定义文本以及上述所有元数据字段。该图像可使用任何标准查看器打开,或插入 PDF、报告或网页中。 + +## 完整源代码(可直接复制粘贴) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### 预期输出 + +运行程序后会打印: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +打开 `ExtPDF417Meta.png` 可看到一个清晰的 Macro PDF417 条形码,使用任何 PDF417 阅读器均能正确扫描,并保留了自定义文本 `"Åspóse.Barcóde©"` 与您定义的宏元数据。 + +## 常见问题与边缘情况 + +- **我可以生成其他图像格式吗?** + 可以。根据需要将 `BarCodeImageFormat.Png` 替换为 `Jpeg`、`Bmp` 或 `Gif`。 + +- **如果我的数据超过单个条形码怎么办?** + Macro PDF417 设计用于分段。为每个部分调整 `MacroPdf417SegmentsCount` 和 `MacroPdf417SegmentID`,然后将扫描结果拼接起来。 + +- **Unicode 支持是否有保障?** + Aspose.BarCode 完全支持 Unicode。请确保源文件以 UTF‑8 编码保存,以避免字符损坏。 + +- **生产环境是否需要许可证?** + 许可证版会去除评估水印并提供全部功能。试用版可用于测试和学习。 + +## 结论 + +您现在已经了解如何使用 Aspose.BarCode **generate barcode C#** 生成带丰富元数据的 Macro PDF417,**how to generate pdf417**,**create barcode custom text**,以及 **generate barcode image file**。完整的可运行示例展示了从项目设置到保存最终 PNG 图像的每一步。 + +### 后续步骤 + +- 试验其他 PDF417 设置,如 `ErrorCorrectionLevel` 和 `CompactPdf417`,以获得更小的符号。 +- 使用 Aspose.PDF 将生成的条形码集成到 PDF 报告中。 +- 探索批量生成:遍历文件集合,生成一系列分段的 Macro PDF417 条形码。 + +欢迎根据自己的工作流调整代码,让条形码生成成为 C# 应用的无缝组成部分。祝编码愉快! + +## 接下来您应该学习什么? + +以下教程涵盖与本指南技术紧密相关的主题,帮助您在项目中进一步掌握 API 功能并探索替代实现方式。每个资源都提供完整的可运行代码示例和逐步解释。 + +- [如何使用 Aspose.BarCode for .NET 生成具有自定义宽高比的 Aztec 条形码](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [生成条形码图像 – 使用 Aspose.BarCode 的 Code 93](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [如何使用 Aspose.BarCode for .NET 生成并调整一维 Databar 条形码的高度](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/chinese/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..4d9467e90 --- /dev/null +++ b/barcode/chinese/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,248 @@ +--- +category: general +date: 2026-08-19 +description: 快速在 C# 中生成 PDF417 条码。学习如何使用 Aspose.BarCode 在 C# 中生成 PDF417 条码,使用紧凑模式和自定义设置。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: zh +lastmod: 2026-08-19 +og_description: 使用 Aspose.BarCode 在 C# 中生成 PDF417 条码。本教程展示了如何在紧凑模式下生成 PDF417 条码、设置 + X 维度并保存为 PNG。 +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: 在 C# 中生成 PDF417 条码 – 步骤指南 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: 在 C# 中生成 PDF417 条码 – 完整指南(紧凑布局) +url: /zh/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 在 C# 中生成 PDF417 条码 – 完整指南 + +如果您需要在 .NET 应用程序中 **生成 PDF417 条码**,本教程将准确展示如何操作。您将看到一个简洁、可用于生产环境的示例,能够创建紧凑的 PDF417 条码、自定义 X 维度,并将结果保存为 PNG 图像。 + +在需要将大量数据(例如票务信息、装运清单或身份证件)编码为机器可读格式时,生成 PDF417 条码是常见需求。使用 Aspose.BarCode 可让过程变得直截了当,代码兼容 .NET 6+ 或 .NET Framework 4.7.2 及更高版本。 + +在本指南中,您将: + +* 安装 Aspose.BarCode NuGet 包。 +* 编写一个独立的 C# 程序,**生成 PDF417 条码**,使用小列数和紧凑(截断)模式。 +* 调整条码宽度(X‑dimension)以获得更清晰的渲染。 +* 将条码保存为 PNG 文件。 +* 探索变体、边缘情况以及最佳实践技巧。 + +## 前提条件 + +在开始之前,请确保您具备: + +* 已安装 .NET 6 SDK 的 Visual Studio 2022(或任意 C# IDE)。 +* 可访问互联网以下载 **Aspose.BarCode** NuGet 包。 +* 对将保存 PNG 文件的文件夹拥有写入权限。 + +无需额外库;Aspose.BarCode 在内部处理图像编码。 + +## 第 1 步:添加 Aspose.BarCode 包 + +在 Visual Studio 中打开项目,右键单击解决方案,选择 **Manage NuGet Packages**。搜索 `Aspose.BarCode` 并安装最新的稳定版本。 + +```bash +dotnet add package Aspose.BarCode +``` + +> **专业提示:** 保持包的最新状态。新版本通常包含性能改进并支持最新的 .NET 运行时。 + +## 第 2 步:创建最小化的控制台应用程序 + +如果还没有项目,创建一个新的 C# 控制台项目: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +将 `Program.cs` 的内容替换为下面的完整示例。该程序演示了 **如何在 C# 中生成 PDF417 条码** 的全过程。 + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### 为什么每行代码都很重要 + +* **`EncodeTypes.Pdf417`** – 选择 PDF417 编码方式,支持约 1.1 KB 的数据。 +* **`XDimension.Pixels = 2`** – 设置基础条宽。数值越小条码越细,数值越大在低分辨率设备上可提升可读性。 +* **`Pdf417.Columns = 3`** – 限制列数,迫使生成器使用更多行,从而得到更高但更窄的条码。 +* **`Pdf417.Truncate = true`** – 启用紧凑模式,去除停止图案并在不失去数据完整性的前提下缩小图像。 +* **`Save(..., BarCodeImageFormat.Png)`** – 将文件写入 PNG 格式。也可以根据下游需求选择 `Jpeg`、`Bmp` 或 `Svg`。 + +运行程序: + +```bash +dotnet run +``` + +您应该会在控制台看到确认文件位置的输出,文件夹中会出现 `CompactPdf417.png`。打开该 PNG 可看到清晰、紧凑的 PDF417 条码,已编码 Unicode 字符串。 + +## 第 3 步:验证条码(可选但推荐) + +为确保条码可被读取,您可以使用智能手机上的任意标准 PDF417 扫描应用或桌面解码库。解码后的文本应与原始 `data` 字符串完全一致,包括特殊字符。 + +如果遇到解码问题: + +* 将 `XDimension` 提高到 3 或 4 像素。 +* 减少列数(例如设为 `Columns = 2`)。 +* 关闭 `Truncate`(`Truncate = false`)以添加停止图案。 + +这些调整在尺寸与可读性之间进行权衡,适用于低分辨率打印机或扫描仪。 + +## 第 4 步:探索常见变体 + +### 4️⃣ 为打印生成高密度 PDF417 + +如果需要在小标签上放置条码,可增加列数并降低 X‑dimension: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ 将输出格式改为 SVG 以实现矢量缩放 + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +SVG 输出可在不失真情况下任意缩放,适合响应式网页。 + +### 6️⃣ 编码二进制数据(例如字节数组) + +若需嵌入二进制负载,先将其转换为 Base64 字符串: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +条码现在携带二进制信息,解码器需要逆向执行 Base64 步骤。 + +## 常见问题 + +| 问题 | 回答 | +|----------|--------| +| **我可以不使用 Aspose 生成 PDF417 吗?** | 可以,其他库如 ZXing.Net 或 Dynamsoft 也能实现,但 Aspose.BarCode 提供更丰富的布局控制(列数、截断)和更好的 Unicode 处理。 | +| **最大数据长度是多少?** | PDF417 最多可编码 1,108 字节(≈ 1 KB)的二进制数据。如果超过此限制,建议将数据拆分到多个条码中。 | +| **紧凑模式符合标准吗?** | 截断 PDF417 属于 ISO/IEC 15438 规范的一部分,得到广泛支持,但请确认目标扫描仪明确支持该模式。 | +| **如何更改背景颜色?** | 在保存之前设置 `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` 并 `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;`。 | + +## 结论 + +现在,您已经掌握了使用 Aspose.BarCode **在 C# 中生成 PDF417 条码** 的方法,了解了如何微调 X‑dimension、启用紧凑模式,并将结果导出为 PNG 图像。完整、可运行的示例可直接复制到任意 .NET 项目中,而本文展示的变体则帮助您根据打印、网页或二进制负载场景进行适配。 + +接下来可以进一步探索: + +* 将条码生成集成到 ASP.NET Core API 中,按需返回图像。 +* 在同一标签上同时放置 PDF417 与 QR 码,实现双格式扫描。 +* 使用 Aspose.BarCode 的 `Reader` 类对生成的图像进行解码,以编程方式验证数据。 + +祝编码愉快,尽情享受 **生成 PDF417 条码** 解决方案为您的应用带来的灵活性! + +## 接下来应该学习什么? + +以下教程涵盖了与本指南技术紧密相关的主题,帮助您进一步掌握 API 功能并在项目中探索替代实现方式,每篇资源均提供完整可运行的代码示例和逐步说明。 + +- [如何使用 Aspose.BarCode 创建条码 – 紧凑 PDF417](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [如何使用 Aspose.BarCode 生成带有补充空格自定义的条码图像](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [如何使用 Aspose.BarCode for .NET 生成具有自定义宽高比的 Aztec 条码](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/czech/net/compact-pdf417-encoding/_index.md b/barcode/czech/net/compact-pdf417-encoding/_index.md index 29de108a1..094d1d581 100644 --- a/barcode/czech/net/compact-pdf417-encoding/_index.md +++ b/barcode/czech/net/compact-pdf417-encoding/_index.md @@ -86,6 +86,12 @@ 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. +### [Generování PDF417 čárového kódu v C# – kompletní průvodce s kompaktním rozvržením](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Naučte se generovat PDF417 čárové kódy v C# s kompaktním rozvržením pomocí Aspose.BarCode. + +### [Generování čárového kódu v C# s Macro PDF417 – kompletní příklad](./generate-barcode-c-with-macro-pdf417-full-example/) +Ukázkový kód pro generování čárového kódu Macro PDF417 v C# pomocí Aspose.BarCode. + ## Č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 +120,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/czech/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..33a281803 --- /dev/null +++ b/barcode/czech/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Vygenerujte čárový kód v C# pomocí Aspose.BarCode k vytvoření Macro PDF417 + s vlastním textem a uložte jej jako soubor obrázku. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: cs +lastmod: 2026-08-19 +og_description: Generujte čárový kód v C# pomocí Aspose.BarCode, naučte se vytvářet + PDF417, přidejte vlastní text a uložte soubor s obrázkem čárového kódu. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Generování čárového kódu v C# – Průvodce Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Generovat čárový kód C# s Macro PDF417 – kompletní příklad +url: /cs/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generování čárového kódu C# s Macro PDF417 – kompletní příklad + +Pokud potřebujete **generovat čárový kód C#** ve formátu Macro PDF417, tento návod vám ukáže připravené řešení připravené k okamžitému spuštění. Uvidíte, jak **generovat pdf417**, vložit vlastní text a **vytvořit soubor s obrázkem čárového kódu** v jednom samostatném programu. + +Tutoriál pokrývá vše od instalace knihovny Aspose.BarCode po konfiguraci metadat Macro PDF417, takže můžete kód zkopírovat přímo do svého projektu a okamžitě vidět výsledek. + +## Požadavky + +- .NET 6.0 SDK nebo novější (kód také funguje s .NET Framework 4.7+) +- Visual Studio 2022 (nebo jakékoli IDE podporující C#) +- Licence Aspose.BarCode pro .NET (bezplatná zkušební verze funguje pro hodnocení) +- Základní znalost syntaxe C# + +> **Tip:** Nainstalujte NuGet balíček pomocí CLI, abyste se vyhnuli nesouladu verzí: +> `dotnet add package Aspose.BarCode` + +## Krok 1: Nastavení projektu a import knihovny + +Vytvořte novou konzolovou aplikaci a přidejte požadované direktivy `using`. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Proč je tento krok důležitý:** +`Aspose.BarCode.Generation` jmenný prostor poskytuje třídu `BarcodeGenerator`, která je vstupním bodem pro vytváření libovolného typu čárového kódu, včetně Macro PDF417. Import `System` vám umožní přístup k `DateTime` pro metadata časových razítek. + +## Krok 2: Vytvoření generátoru Macro PDF417 s vlastním textem + +Nahraďte zástupný komentář inicializací generátoru. Tím se ukáže **vytvoření vlastního textu čárového kódu**, přičemž se také vybere správný typ kódování. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Vysvětlení:** +- `EncodeTypes.MacroPdf417` říká Aspose, aby vytvořil PDF417 čárový kód, který podporuje makro funkce (segmentace souboru, kontrolní součet atd.). +- Text `"Åspóse.Barcóde©"` ukazuje, že Unicode znaky jsou plně podporovány, což je často vyžadováno pro mezinárodní aplikace. + +## Krok 3: Konfigurace vzhledu a metadat Macro PDF417 + +Doladěte rozměry čárového kódu a nastavte makro‑specifická pole vyžadovaná pro zpracování segmentovaných souborů. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Proč jsou tato nastavení důležitá:** + +| Setting | Purpose | +|---------|---------| +| `XDimension.Pixels` | Řídí vizuální hustotu; 2 px poskytuje čistý, čitelný obrázek. | +| `Columns` | Určuje, kolik datových sloupců se zobrazí v řádku, což ovlivňuje velikost čárového kódu. | +| `MacroPdf417FileID` | Jedinečně identifikuje logický soubor napříč všemi segmenty. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Umožňuje rekonstrukci původního souboru z více čárových kódů. | +| `MacroPdf417FileName` | Lidsky čitelný název uložený v čárovém kódu pro následné zpracování. | +| `MacroPdf417Checksum` | Poskytuje detekci chyb pomocí algoritmu CCITT‑16 CRC. | +| `MacroPdf417FileSize` | Pomáhá dekodéru vědět, kdy byl celý soubor přijat. | +| `MacroPdf417TimeStamp` | Zaznamenává, kdy byl čárový kód vygenerován, užitečné pro auditní záznamy. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Volitelná pole, která mohou být použita v obchodních pracovních postupech. | +| `MacroPdf417Terminator` | Indikuje, že tento segment je poslední (`Set`). | + +## Krok 4: Uložení čárového kódu jako obrázkový soubor + +Nakonec zapíšete čárový kód do PNG souboru, abyste jej mohli zobrazit nebo vložit jinde. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Co uvidíte:** +PNG obrázek pojmenovaný `ExtPDF417Meta.png` obsahující Macro PDF417 čárový kód, který kóduje vlastní text a všechna metadata, která jste výše nastavili. Obrázek lze otevřít v libovolném standardním prohlížeči nebo vložit do PDF, reportů či webových stránek. + +## Kompletní zdrojový kód (připravený ke kopírování) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Očekávaný výstup + +Spuštěním programu se vypíše: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Otevřením `ExtPDF417Meta.png` se zobrazí čistý Macro PDF417 čárový kód, který se správně načte v libovolném PDF417 čtečce a zachová vlastní text `"Åspóse.Barcóde©"` a makro metadata, která jste definovali. + +## Časté otázky a okrajové případy + +- **Mohu generovat jiný formát obrázku?** + Ano. Nahraďte `BarCodeImageFormat.Png` za `Jpeg`, `Bmp` nebo `Gif` podle potřeby. + +- **Co když moje data přesáhnou jeden čárový kód?** + Macro PDF417 je navržen pro segmentaci. Upravit `MacroPdf417SegmentsCount` a `MacroPdf417SegmentID` pro každou část a poté spojit naskenované výsledky. + +- **Je podpora Unicode zaručena?** + Aspose.BarCode plně podporuje Unicode. Ujistěte se, že váš zdrojový soubor je uložen v kódování UTF‑8, aby nedošlo k poškození znaků. + +- **Potřebuji licenci pro produkci?** + Licencovaná verze odstraňuje vodotisk pro hodnocení a poskytuje plnou funkčnost. Zkušební verze funguje pro testování a učení. + +## Závěr + +Nyní víte, jak **generovat čárový kód C#** pro Macro PDF417, **generovat pdf417** s bohatými metadaty, **vytvořit vlastní text čárového kódu** a **vytvořit soubor s obrázkem čárového kódu** pomocí Aspose.BarCode. Kompletní, spustitelný příklad demonstruje každý potřebný krok – od nastavení projektu po uložení finálního PNG obrázku. + +### Další kroky + +- Experimentujte s dalšími nastaveními PDF417, jako jsou `ErrorCorrectionLevel` a `CompactPdf417`, pro menší symboly. +- Integrujte vygenerovaný čárový kód do PDF reportu pomocí Aspose.PDF. +- Prozkoumejte hromadné generování: projděte kolekci souborů a vytvořte sérii segmentovaných Macro PDF417 čárových kódů. + +Neváhejte upravit kód podle svého pracovního postupu a nechte generování čárových kódů stát se plynulou součástí vašich C# aplikací. Šťastné programování! + +## Co byste se měli naučit dál? + +Následující tutoriály pokrývají úzce související témata, která staví na technikách předvedených v tomto 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 generovat Aztec čárový kód s vlastním poměrem stran pomocí Aspose.BarCode pro .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Vytvořit obrázek čárového kódu – Code 93 s Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Jak generovat a upravit výšku čárového kódu pro One-Dimensional Databar pomocí Aspose.BarCode pro .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/czech/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..f90487bb0 --- /dev/null +++ b/barcode/czech/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,250 @@ +--- +category: general +date: 2026-08-19 +description: Rychle generujte čárový kód PDF417 v C#. Naučte se, jak generovat čárový + kód PDF417 v C# pomocí Aspose.BarCode s kompaktním režimem a vlastními nastaveními. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: cs +lastmod: 2026-08-19 +og_description: Vytvořte čárový kód PDF417 v C# pomocí Aspose.BarCode. Tento tutoriál + ukazuje, jak v C# generovat čárový kód PDF417 v kompaktním režimu, nastavit X‑rozměr + a uložit jako PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Vytvořte čárový kód PDF417 v C# – krok za krokem průvodce +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Generování čárového kódu PDF417 v C# – kompletní průvodce s kompaktním rozložením +url: /cs/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generování PDF417 čárového kódu v C# – kompletní průvodce + +Pokud potřebujete **generovat PDF417 čárový kód** v .NET aplikaci, tento tutoriál vám přesně ukáže, jak na to. Uvidíte stručný, připravený pro produkci příklad, který vytvoří kompaktní PDF417 čárový kód, přizpůsobí X‑dimenzi a uloží výsledek jako PNG obrázek. + +Generování PDF417 čárového kódu je běžné, když potřebujete zakódovat velké množství dat—například informace o vstupenkách, přepravní manifesty nebo identifikační dokumenty—do strojově čitelného formátu. Použití Aspose.BarCode proces zjednodušuje a kód funguje s .NET 6+ nebo .NET Framework 4.7.2 a novějšími. + +V tomto průvodci se naučíte: + +* Nainstalovat NuGet balíček Aspose.BarCode. +* Napsat samostatný C# program, který **generuje PDF417 čárový kód** s malým počtem sloupců a v kompaktním (zkráceném) režimu. +* Upravit šířku čáry (X‑dimenzi) pro ostřejší vykreslení. +* Uložit čárový kód jako PNG soubor. +* Prozkoumat varianty, okrajové případy a tipy pro nejlepší praxi. + +## Požadavky + +Než začnete, ujistěte se, že máte: + +* Visual Studio 2022 (nebo jakékoli C# IDE) s nainstalovaným .NET 6 SDK. +* Přístup k internetu pro stažení **Aspose.BarCode** NuGet balíčku. +* Oprávnění k zápisu do složky, kam bude PNG soubor uložen. + +Žádné další knihovny nejsou potřeba; Aspose.BarCode interně zpracovává kódování obrázku. + +## Krok 1: Přidejte balíček Aspose.BarCode + +Otevřete svůj projekt ve Visual Studiu, klikněte pravým tlačítkem na řešení a vyberte **Manage NuGet Packages**. Vyhledejte `Aspose.BarCode` a nainstalujte nejnovější stabilní verzi. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** Udržujte balíček aktuální. Nová vydání často obsahují vylepšení výkonu a podporu nejnovějších .NET runtime. + +## Krok 2: Vytvořte minimální konzolovou aplikaci + +Vytvořte nový C# konzolový projekt, pokud ještě žádný nemáte: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Nahraďte obsah souboru `Program.cs` následujícím kompletním příkladem. Tento program demonstruje **jak generovat PDF417 čárový kód C#** od začátku až do konce. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Proč je každý řádek důležitý + +* **`EncodeTypes.Pdf417`** – vybírá symbologii PDF417, která podporuje až ~1,1 KB dat. +* **`XDimension.Pixels = 2`** – nastavuje základní šířku čáry. Menší hodnoty činí čárový kód tenčím; větší hodnoty zlepšují čitelnost na zařízeních s nízkým rozlišením. +* **`Pdf417.Columns = 3`** – omezuje počet sloupců, což nutí generátor použít více řádků a výsledkem je vyšší, ale užší čárový kód. +* **`Pdf417.Truncate = true`** – aktivuje kompaktní režim, odstraňuje stopovací vzor a zmenšuje obrázek, aniž by došlo ke ztrátě integrity dat. +* **`Save(..., BarCodeImageFormat.Png)`** – zapíše PNG soubor. Můžete také zvolit `Jpeg`, `Bmp` nebo `Svg` podle následných potřeb. + +Spusťte program: + +```bash +dotnet run +``` + +Měli byste vidět výstup v konzoli potvrzující umístění souboru a složka bude obsahovat `CompactPdf417.png`. Otevření PNG ukáže jasný, kompaktní PDF417 čárový kód, který kóduje Unicode řetězec. + +## Krok 3: Ověřte čárový kód (volitelné, ale doporučené) + +Aby byl čárový kód čitelný, můžete použít jakoukoli standardní PDF417 skener aplikaci na chytrém telefonu nebo knihovnu dekodéru na desktopu. Zakódovaný text by měl přesně odpovídat původnímu řetězci `data`, včetně speciálních znaků. + +Pokud narazíte na problémy s dekódováním: + +* Zvyšte `XDimension` na 3 nebo 4 pixely. +* Snižte počet sloupců (např. nastavte `Columns = 2`). +* Vypněte `Truncate` (`Truncate = false`) a přidejte stopovací vzor. + +Tyto úpravy mění poměr velikosti a čitelnosti, což je užitečné pro tiskárny nebo skenery s nízkým rozlišením. + +## Krok 4: Prozkoumejte běžné varianty + +### 4️⃣ Vytvořte vysoce hustý PDF417 pro tisk + +Pokud potřebujete čárový kód, který se vejde na malý štítek, zvyšte počet sloupců a snižte X‑dimenzi: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Změňte výstupní formát na SVG pro vektorové škálování + +SVG výstup se škáluje bez ztráty kvality, ideální pro responzivní webové stránky. + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +### 6️⃣ Zakódujte binární data (např. pole bajtů) + +Pokud potřebujete vložit binární payload, nejprve jej převeďte na Base64 řetězec: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Čárový kód nyní nese binární informace a dekodér musí provést opačný krok Base64. + +## Často kladené otázky + +| Otázka | Odpověď | +|----------|--------| +| **Mohu generovat PDF417 bez Aspose?** | Ano, existují jiné knihovny jako ZXing.Net nebo Dynamsoft, ale Aspose.BarCode nabízí bohatší kontrolu rozvržení (sloupce, zkrácení) a lepší podporu Unicode. | +| **Jaká je maximální délka dat?** | PDF417 může kódovat až 1 108 bajtů (≈ 1 KB) binárních dat. Pokud tuto hranici překročíte, zvažte rozdělení dat do více čárových kódů. | +| **Je kompaktní režim v souladu se standardy?** | Zkrácený PDF417 je součástí specifikace ISO/IEC 15438 a je široce podporován, ale ověřte, že váš cílový skener jej explicitně podporuje. | +| **Jak změním barvu pozadí?** | Nastavte `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` a `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` před uložením. | + +## Závěr + +Nyní víte **jak generovat PDF417 čárový kód C#** pomocí Aspose.BarCode, jak jemně doladit X‑dimenzi, povolit kompaktní režim a exportovat výsledek jako PNG obrázek. Kompletní, spustitelný příklad můžete zkopírovat do libovolného .NET projektu a ukázané varianty vám umožní přizpůsobit čárový kód pro tisk, web nebo binární payload scénáře. + +Další kroky, které můžete prozkoumat: + +* Integrovat generování čárového kódu do ASP.NET Core API, které vrací obrázek na vyžádání. +* Kombinovat PDF417 s QR kódy na stejném štítku pro dvojformátové skenování. +* Použít třídu Aspose.BarCode `Reader` k dekódování vygenerovaného obrázku a programově ověřit data. + +Šťastné programování a užijte si flexibilitu, kterou **generování PDF417 čárových kódů** přináší vašim aplikacím! + +## 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í kódové příklady s podrobným vysvětlením, aby vám pomohl zvládnout další funkce API a prozkoumat alternativní implementační přístupy 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/) +- [Jak generovat obrázek čárového kódu s přizpůsobením doplňkového prostoru pomocí Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [Jak generovat Aztec čárový kód s vlastním poměrem stran pomocí Aspose.BarCode pro .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/dutch/net/compact-pdf417-encoding/_index.md b/barcode/dutch/net/compact-pdf417-encoding/_index.md index 64f0fba6f..f354060f7 100644 --- a/barcode/dutch/net/compact-pdf417-encoding/_index.md +++ b/barcode/dutch/net/compact-pdf417-encoding/_index.md @@ -82,7 +82,9 @@ Voorbij de basis, hier zijn enkele praktische tips om je workflow te stroomlijne ## Compact PDF417 Codering Tutorials ### [Compact PDF417 Barcodes Maken](./compact-pdf417-basic-configuration/) -Leer hoe je Compact PDF417 barcodes genereert met Aspose.BarCode voor .NET. Uitgebreide gids met stap‑voor‑stap instructies en code‑voorbeelden. +### [PDF417-barcode genereren in C# – volledige gids met compacte lay-out](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) + +### [Barcode genereren in C# met Macro PDF417 – volledig voorbeeld](./generate-barcode-c-with-macro-pdf417-full-example/) ## Veelgestelde Vragen @@ -112,4 +114,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/dutch/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..9cb46fe21 --- /dev/null +++ b/barcode/dutch/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Genereer een barcode in C# met Aspose.BarCode om een Macro PDF417 met + aangepaste tekst te maken en op te slaan als een afbeeldingsbestand. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: nl +lastmod: 2026-08-19 +og_description: Genereer barcode C# met Aspose.BarCode, leer hoe je PDF417 genereert, + voeg aangepaste tekst toe en sla het barcode‑afbeeldingsbestand op. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Barcode genereren C# – Macro PDF417 gids +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Barcode genereren in C# met Macro PDF417 – volledig voorbeeld +url: /nl/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Barcode genereren C# met Macro PDF417 – volledig voorbeeld + +Als je **barcode C# wilt genereren** voor een Macro PDF417‑formaat, laat deze gids je een kant‑klaar werkende oplossing zien. Je ziet hoe je **pdf417 kunt genereren**, aangepaste tekst kunt insluiten, en **barcode‑afbeeldingsbestand kunt genereren** in één zelf‑containend programma. + +De tutorial behandelt alles, van het installeren van de Aspose.BarCode‑bibliotheek tot het configureren van Macro PDF417‑metadata, zodat je de code direct in je project kunt kopiëren en het resultaat meteen ziet. + +## Vereisten + +- .NET 6.0 SDK of later (de code werkt ook met .NET Framework 4.7+) +- Visual Studio 2022 (of een IDE die C# ondersteunt) +- Een Aspose.BarCode voor .NET‑licentie (de gratis proefversie werkt voor evaluatie) +- Basiskennis van C#‑syntaxis + +> **Pro tip:** Installeer het NuGet‑pakket via de CLI om versieconflicten te voorkomen: +> `dotnet add package Aspose.BarCode` + +## Stap 1: Het project opzetten en de bibliotheek importeren + +Maak een nieuwe console‑applicatie aan en voeg de benodigde `using`‑directieven toe. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Waarom deze stap belangrijk is:** +De `Aspose.BarCode.Generation`‑namespace levert de `BarcodeGenerator`‑klasse, die het startpunt is voor het maken van elk barcode‑type, inclusief Macro PDF417. Het importeren van `System` geeft je toegang tot `DateTime` voor tijdstempel‑metadata. + +## Stap 2: Een Macro PDF417‑generator maken met aangepaste tekst + +Vervang de tijdelijke opmerking door de generator‑initialisatie. Dit toont **barcode‑aangepaste tekst maken** terwijl je ook het juiste coderings‑type selecteert. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Uitleg:** +- `EncodeTypes.MacroPdf417` vertelt Aspose een PDF417‑barcode te produceren die macro‑functies ondersteunt (bestandsegmentatie, controlesom, enz.). +- De tekst `"Åspóse.Barcóde©"` laat zien dat Unicode‑tekens volledig worden ondersteund, wat vaak vereist is voor internationale toepassingen. + +## Stap 3: Uiterlijk en Macro PDF417‑metadata configureren + +Stel de barcode‑afmetingen nauwkeurig af en stel de macro‑specifieke velden in die nodig zijn voor het verwerken van gesegmenteerde bestanden. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Waarom deze instellingen belangrijk zijn:** + +| Instelling | Doel | +|------------|------| +| `XDimension.Pixels` | Regelt de visuele dichtheid; 2 px geeft een duidelijke, scanbare afbeelding. | +| `Columns` | Bepaalt hoeveel datakolommen per rij verschijnen, wat de barcode‑grootte beïnvloedt. | +| `MacroPdf417FileID` | Identificeert het logische bestand uniek over alle segmenten. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Maakt reconstructie van het oorspronkelijke bestand mogelijk uit meerdere barcodes. | +| `MacroPdf417FileName` | Menselijk leesbare naam opgeslagen in de barcode voor verdere verwerking. | +| `MacroPdf417Checksum` | Biedt foutdetectie met het CCITT‑16 CRC‑algoritme. | +| `MacroPdf417FileSize` | Helpt de decoder te weten wanneer het volledige bestand is ontvangen. | +| `MacroPdf417TimeStamp` | Registreert wanneer de barcode is gegenereerd, nuttig voor audit‑trails. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Optionele velden die door bedrijfsprocessen kunnen worden gebruikt. | +| `MacroPdf417Terminator` | Geeft aan dat dit segment het laatste is (`Set`). | + +## Stap 4: De barcode opslaan als afbeeldingsbestand + +Schrijf tenslotte de barcode naar een PNG‑bestand zodat je deze kunt bekijken of elders kunt insluiten. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Wat je zult zien:** +Een PNG‑afbeelding met de naam `ExtPDF417Meta.png` die een Macro PDF417‑barcode bevat die de aangepaste tekst en alle metadata‑velden die je hierboven hebt ingesteld codeert. De afbeelding kan worden geopend met elke standaardviewer of worden ingevoegd in PDF‑bestanden, rapporten of webpagina's. + +## Volledige broncode (klaar om te kopiëren en plakken) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Verwachte output + +Het uitvoeren van het programma geeft het volgende weer: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Het openen van `ExtPDF417Meta.png` toont een schone Macro PDF417‑barcode die correct wordt gescand met elke PDF417‑lezer, waarbij de aangepaste tekst `"Åspóse.Barcóde©"` en de macro‑metadata die je hebt gedefinieerd behouden blijven. + +## Veelgestelde vragen en randgevallen + +- **Kan ik een ander afbeeldingsformaat genereren?** + Ja. Vervang `BarCodeImageFormat.Png` door `Jpeg`, `Bmp` of `Gif` indien nodig. + +- **Wat als mijn data een enkele barcode overschrijdt?** + Macro PDF417 is ontworpen voor segmentatie. Pas `MacroPdf417SegmentsCount` en `MacroPdf417SegmentID` voor elk deel aan, en concateneer vervolgens de gescande resultaten. + +- **Is Unicode‑ondersteuning gegarandeerd?** + Aspose.BarCode ondersteunt Unicode volledig. Zorg ervoor dat je bronbestand is opgeslagen met UTF‑8‑codering om tekencorruptie te voorkomen. + +- **Heb ik een licentie nodig voor productie?** + Een gelicentieerde versie verwijdert het evaluatiewatermerk en biedt volledige functionaliteit. De proefversie werkt voor testen en leren. + +## Conclusie + +Je weet nu hoe je **barcode C# kunt genereren** voor een Macro PDF417, **hoe je pdf417 kunt genereren** met rijke metadata, **barcode‑aangepaste tekst kunt maken**, en **barcode‑afbeeldingsbestand kunt genereren** met Aspose.BarCode. Het volledige, uitvoerbare voorbeeld toont elke benodigde stap — van projectconfiguratie tot het opslaan van de uiteindelijke PNG‑afbeelding. + +### Volgende stappen + +- Experimenteer met andere PDF417‑instellingen zoals `ErrorCorrectionLevel` en `CompactPdf417` voor kleinere symbolen. +- Integreer de gegenereerde barcode in een PDF‑rapport met behulp van Aspose.PDF. +- Verken batchgeneratie: loop over een verzameling bestanden en produceer een reeks gesegmenteerde Macro PDF417‑barcodes. + +Voel je vrij de code aan te passen aan je eigen workflow, en laat de barcode‑generatie een naadloos onderdeel worden van je C#‑applicaties. Veel programmeerplezier! + +## Wat moet je hierna leren? + +De volgende tutorials behandelen nauw verwante onderwerpen die voortbouwen op de technieken die in deze gids worden getoond. Elke bron bevat volledige werkende code‑voorbeelden met 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 een Aztec‑barcode te genereren met aangepaste beeldverhouding met Aspose.BarCode voor .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Barcode‑afbeelding genereren – Code 93 met Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Hoe de barcode‑hoogte te genereren en aan te passen voor One‑Dimensional Databar met Aspose.BarCode voor .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/dutch/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..0fde9c9c1 --- /dev/null +++ b/barcode/dutch/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,248 @@ +--- +category: general +date: 2026-08-19 +description: Genereer PDF417-barcode in C# snel. Leer hoe je een PDF417-barcode in + C# kunt genereren met Aspose.BarCode in compacte modus en aangepaste instellingen. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: nl +lastmod: 2026-08-19 +og_description: Genereer PDF417‑barcode in C# met Aspose.BarCode. Deze tutorial laat + zien hoe je een PDF417‑barcode in C# genereert in compacte modus, de X‑dimensie + instelt en opslaat als PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: PDF417‑barcode genereren in C# – stapsgewijze handleiding +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: PDF417-barcode genereren in C# – volledige gids met compacte indeling +url: /nl/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Genereer PDF417 barcode in C# – volledige gids + +Als je een **PDF417 barcode wilt genereren** in een .NET‑applicatie, laat deze tutorial je precies zien hoe je dat doet. Je ziet een beknopt, productie‑klaar voorbeeld dat een compacte PDF417 barcode maakt, de X‑dimensie aanpast en het resultaat opslaat als een PNG‑afbeelding. + +Het genereren van een PDF417 barcode is gebruikelijk wanneer je grote hoeveelheden data moet coderen—zoals ticketinformatie, verzendmanifesten of identiteitsdocumenten—in een machine‑leesbaar formaat. Het gebruik van Aspose.BarCode maakt het proces eenvoudig, en de code werkt met .NET 6+ of .NET Framework 4.7.2 en later. + +In deze gids zal je: + +* Het Aspose.BarCode NuGet‑pakket installeren. +* Een zelfstandige C#‑programma schrijven dat **PDF417 barcode genereert** met een klein aantal kolommen en compacte (afgekorte) modus. +* De balkbreedte (X‑dimensie) aanpassen voor scherpere weergave. +* De barcode opslaan als een PNG‑bestand. +* Variaties, randgevallen en best‑practice‑tips verkennen. + +## Vereisten + +Voordat je begint, zorg dat je het volgende hebt: + +* Visual Studio 2022 (of een andere C#‑IDE) met .NET 6 SDK geïnstalleerd. +* Internettoegang om het **Aspose.BarCode** NuGet‑pakket te downloaden. +* Schrijfrechten op een map waar het PNG‑bestand wordt opgeslagen. + +Er zijn geen extra bibliotheken nodig; Aspose.BarCode verwerkt de afbeeldingcodering intern. + +## Stap 1: Voeg het Aspose.BarCode‑pakket toe + +Open je project in Visual Studio, klik met de rechtermuisknop op de solution en selecteer **Manage NuGet Packages**. Zoek naar `Aspose.BarCode` en installeer de nieuwste stabiele versie. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** Houd het pakket up‑to‑date. Nieuwe releases bevatten vaak prestatieverbeteringen en ondersteuning voor de nieuwste .NET‑runtimes. + +## Stap 2: Maak een minimale console‑applicatie + +Maak een nieuw C# console‑project aan als je er nog geen hebt: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Vervang de inhoud van `Program.cs` door het volledige voorbeeld hieronder. Dit programma laat zien **hoe je PDF417 barcode in C# genereert** van begin tot eind. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Waarom elke regel belangrijk is + +* **`EncodeTypes.Pdf417`** – selecteert de PDF417‑symbool, die tot ongeveer 1,1 KB aan data ondersteunt. +* **`XDimension.Pixels = 2`** – stelt de basisbalkbreedte in. Kleinere waarden maken de barcode dunner; grotere waarden verbeteren de leesbaarheid op apparaten met lage resolutie. +* **`Pdf417.Columns = 3`** – beperkt het aantal kolommen, waardoor de generator meer rijen gebruikt, wat resulteert in een hogere maar smallere barcode. +* **`Pdf417.Truncate = true`** – activeert compacte modus, verwijdert het stop‑patroon en verkleint de afbeelding zonder verlies van gegevensintegriteit. +* **`Save(..., BarCodeImageFormat.Png)`** – schrijft een PNG‑bestand. Je kunt ook `Jpeg`, `Bmp` of `Svg` kiezen, afhankelijk van downstream‑behoeften. + +Voer het programma uit: + +```bash +dotnet run +``` + +Je zou de console‑output moeten zien die de bestandslocatie bevestigt, en de map zal `CompactPdf417.png` bevatten. Het openen van de PNG toont een duidelijke, compacte PDF417 barcode die de Unicode‑string codeert. + +## Stap 3: Verifieer de barcode (optioneel maar aanbevolen) + +Om te zorgen dat de barcode leesbaar is, kun je een standaard PDF417‑scanner‑app op een smartphone of een desktop‑decoder‑bibliotheek gebruiken. De gecodeerde tekst moet exact overeenkomen met de oorspronkelijke `data`‑string, inclusief de speciale tekens. + +Als je decoderingproblemen tegenkomt: + +* Verhoog de `XDimension` naar 3 of 4 pixels. +* Verminder het aantal kolommen (bijv. `Columns = 2`). +* Schakel `Truncate` uit (`Truncate = false`) om het stop‑patroon toe te voegen. + +Deze aanpassingen ruilen grootte in voor leesbaarheid, wat nuttig is voor printers of scanners met lage resolutie. + +## Stap 4: Verken veelvoorkomende variaties + +### 4️⃣ Genereer een hoge‑dichtheid PDF417 voor afdrukken + +Als je een barcode nodig hebt die op een klein label past, verhoog dan het aantal kolommen en verlaag de X‑dimensie: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Verander het uitvoerformaat naar SVG voor vector‑schaling + +SVG‑output schaalt zonder kwaliteitsverlies, perfect voor responsieve webpagina's. + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +### 6️⃣ Encode binaire data (bijv. een byte‑array) + +Als je binaire payloads moet insluiten, converteer ze dan eerst naar een Base64‑string: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +## Veelgestelde vragen + +| Vraag | Antwoord | +|----------|--------| +| **Kan ik PDF417 genereren zonder Aspose?** | Ja, andere bibliotheken zoals ZXing.Net of Dynamsoft bestaan, maar Aspose.BarCode biedt rijkere lay-outcontrole (kolommen, afkapping) en betere Unicode‑afhandeling. | +| **Wat is de maximale datalengte?** | PDF417 kan tot 1.108 bytes (≈ 1 KB) binaire data coderen. Als je dit overschrijdt, overweeg dan de data over meerdere barcodes te verdelen. | +| **Is compacte modus conform aan standaarden?** | Afgekorte PDF417 maakt deel uit van de ISO/IEC 15438‑specificatie en wordt breed ondersteund, maar controleer of je doelscanner het expliciet ondersteunt. | +| **Hoe wijzig ik de achtergrondkleur?** | Stel `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` en `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` in vóór het opslaan. | + +## Conclusie + +Je weet nu **hoe je PDF417 barcode in C# genereert** met Aspose.BarCode, hoe je de X‑dimensie fijnstelt, compacte modus inschakelt en het resultaat exporteert als een PNG‑afbeelding. Het volledige, uitvoerbare voorbeeld kan in elk .NET‑project worden gekopieerd, en de getoonde variaties laten je de barcode aanpassen voor afdrukken, web of binaire payload‑scenario's. + +Volgende stappen die je kunt verkennen: + +* Integreer de barcode‑generatie in een ASP.NET Core API die de afbeelding op aanvraag retourneert. +* Combineer PDF417 met QR‑codes op hetzelfde label voor dual‑format scanning. +* Gebruik de Aspose.BarCode `Reader`‑klasse om de gegenereerde afbeelding te decoderen en de data programmatisch te verifiëren. + +Veel plezier met coderen, en geniet van de flexibiliteit die **PDF417 barcode‑generatie** oplossingen aan je applicaties bieden! + +## 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 – Compacte PDF417 met Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Hoe een barcode‑afbeelding te genereren met aanvullende ruimte‑aanpassing met Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [Hoe een Aztec‑barcode te genereren met aangepaste beeldverhouding met Aspose.BarCode voor .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/english/net/compact-pdf417-encoding/_index.md b/barcode/english/net/compact-pdf417-encoding/_index.md index 1762ea2a8..d346da8d0 100644 --- a/barcode/english/net/compact-pdf417-encoding/_index.md +++ b/barcode/english/net/compact-pdf417-encoding/_index.md @@ -83,6 +83,10 @@ Beyond the basics, here are some practical tips to streamline your workflow: ## Compact PDF417 Encoding Tutorials ### [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. +### [Generate PDF417 barcode in C# – complete guide with compact layout](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Complete guide to generating PDF417 barcodes in C# with compact layout using Aspose.BarCode. +### [Generate barcode C# with Macro PDF417 – full example](./generate-barcode-c-with-macro-pdf417-full-example/) +Full step‑by‑step example for generating Macro PDF417 barcodes in C# using Aspose.BarCode for .NET. ## Frequently Asked Questions @@ -112,4 +116,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/english/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..b509f2e71 --- /dev/null +++ b/barcode/english/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,253 @@ +--- +category: general +date: 2026-08-19 +description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: en +lastmod: 2026-08-19 +og_description: Generate barcode C# with Aspose.BarCode, learn how to generate PDF417, + add custom text, and save the barcode image file. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Generate barcode C# – Macro PDF417 guide +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Generate barcode C# with Macro PDF417 – full example +url: /net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generate barcode C# with Macro PDF417 – full example + +If you need to **generate barcode C#** for a Macro PDF417 format, this guide shows you a ready‑to‑run solution. You’ll see how to **how to generate pdf417**, embed custom text, and **generate barcode image file** in a single, self‑contained program. + +The tutorial covers everything from installing the Aspose.BarCode library to configuring Macro PDF417 metadata, so you can copy the code directly into your project and see the result immediately. + +## Prerequisites + +Before you start, make sure you have: + +- .NET 6.0 SDK or later (the code also works with .NET Framework 4.7+) +- Visual Studio 2022 (or any IDE that supports C#) +- An Aspose.BarCode for .NET license (the free trial works for evaluation) +- Basic familiarity with C# syntax + +> **Pro tip:** Install the NuGet package via the CLI to avoid version mismatches: +> `dotnet add package Aspose.BarCode` + +## Step 1: Set up the project and import the library + +Create a new console application and add the required `using` directives. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Why this step matters:** +The `Aspose.BarCode.Generation` namespace provides the `BarcodeGenerator` class, which is the entry point for creating any barcode type, including Macro PDF417. Importing `System` gives you access to `DateTime` for timestamp metadata. + +## Step 2: Create a Macro PDF417 generator with custom text + +Replace the placeholder comment with the generator initialization. This demonstrates **create barcode custom text** while also selecting the correct encoding type. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Explanation:** +- `EncodeTypes.MacroPdf417` tells Aspose to produce a PDF417 barcode that supports macro features (file segmentation, checksum, etc.). +- The text `"Åspóse.Barcóde©"` shows that Unicode characters are fully supported, which is often required for international applications. + +## Step 3: Configure appearance and Macro PDF417 metadata + +Fine‑tune the barcode dimensions and set the macro‑specific fields required for segmented file handling. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Why these settings are important:** + +| Setting | Purpose | +|---------|---------| +| `XDimension.Pixels` | Controls the visual density; 2 px yields a clear, scannable image. | +| `Columns` | Determines how many data columns appear per row, affecting barcode size. | +| `MacroPdf417FileID` | Uniquely identifies the logical file across all segments. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Enables reconstruction of the original file from multiple barcodes. | +| `MacroPdf417FileName` | Human‑readable name stored inside the barcode for downstream processing. | +| `MacroPdf417Checksum` | Provides error detection using the CCITT‑16 CRC algorithm. | +| `MacroPdf417FileSize` | Helps the decoder know when the entire file has been received. | +| `MacroPdf417TimeStamp` | Records when the barcode was generated, useful for audit trails. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Optional fields that can be used by business workflows. | +| `MacroPdf417Terminator` | Indicates that this segment is the final one (`Set`). | + +## Step 4: Save the barcode as an image file + +Finally, write the barcode to a PNG file so you can view or embed it elsewhere. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**What you’ll see:** +A PNG image named `ExtPDF417Meta.png` containing a Macro PDF417 barcode that encodes the custom text and all metadata fields you set above. The image can be opened with any standard viewer or inserted into PDFs, reports, or web pages. + +## Full source code (copy‑paste ready) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Expected output + +Running the program prints: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Opening `ExtPDF417Meta.png` shows a clean Macro PDF417 barcode that scans correctly with any PDF417 reader, preserving the custom text `"Åspóse.Barcóde©"` and the macro metadata you defined. + +## Common questions and edge cases + +- **Can I generate a different image format?** + Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as needed. + +- **What if my data exceeds a single barcode?** + Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + +- **Is Unicode support guaranteed?** + Aspose.BarCode fully supports Unicode. Ensure your source file is saved with UTF‑8 encoding to avoid character corruption. + +- **Do I need a license for production?** + A licensed version removes the evaluation watermark and provides full functionality. The trial works for testing and learning. + +## Conclusion + +You now know how to **generate barcode C#** for a Macro PDF417, **how to generate pdf417** with rich metadata, **create barcode custom text**, and **generate barcode image file** using Aspose.BarCode. The complete, runnable example demonstrates every required step—from project setup to saving the final PNG image. + +### Next steps + +- Experiment with other PDF417 settings such as `ErrorCorrectionLevel` and `CompactPdf417` for smaller symbols. +- Integrate the generated barcode into a PDF report using Aspose.PDF. +- Explore batch generation: loop over a collection of files and produce a series of segmented Macro PDF417 barcodes. + +Feel free to adapt the code for your own workflow, and let the barcode generation become a seamless part of your C# applications. Happy coding! + + +## What Should You Learn Next? + + +The following tutorials cover closely related topics that build on the techniques demonstrated in this guide. Each resource includes complete working code examples with step-by-step explanations to help you master additional API features and explore alternative implementation approaches in your own projects. + +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generate barcode image – Code 93 with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [How to Generate and Adjust Barcode Height for One-Dimensional Databar using Aspose.BarCode for .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-barcode-c-with-macro-pdf417-full-example/og-image.png b/barcode/english/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/og-image.png new file mode 100644 index 000000000..62b13692b Binary files /dev/null and b/barcode/english/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/og-image.png differ diff --git a/barcode/english/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/english/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..4529a3a77 --- /dev/null +++ b/barcode/english/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,252 @@ +--- +category: general +date: 2026-08-19 +description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 barcode + C# using Aspose.BarCode with compact mode and custom settings. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: en +lastmod: 2026-08-19 +og_description: Generate PDF417 barcode in C# with Aspose.BarCode. This tutorial shows + how to generate PDF417 barcode C# in compact mode, set X‑dimension, and save as + PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Generate PDF417 barcode in C# – step‑by‑step guide +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Generate PDF417 barcode in C# – complete guide with compact layout +url: /net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generate PDF417 barcode in C# – complete guide + +If you need to **generate PDF417 barcode** in a .NET application, this tutorial shows you exactly how to do it. You’ll see a concise, production‑ready example that creates a compact PDF417 barcode, customizes the X‑dimension, and saves the result as a PNG image. + +Generating a PDF417 barcode is common when you have to encode large amounts of data—such as ticket information, shipping manifests, or identity documents—in a machine‑readable format. Using Aspose.BarCode makes the process straightforward, and the code works with .NET 6+ or .NET Framework 4.7.2 and later. + +In this guide you will: + +* Install the Aspose.BarCode NuGet package. +* Write a self‑contained C# program that **generates PDF417 barcode** with a small column count and compact (truncated) mode. +* Adjust the bar width (X‑dimension) for sharper rendering. +* Save the barcode as a PNG file. +* Explore variations, edge cases, and best‑practice tips. + +## Prerequisites + +Before you start, make sure you have: + +* Visual Studio 2022 (or any C# IDE) with .NET 6 SDK installed. +* Internet access to download the **Aspose.BarCode** NuGet package. +* Write permission to a folder where the PNG file will be saved. + +No additional libraries are required; Aspose.BarCode handles image encoding internally. + +## Step 1: Add the Aspose.BarCode package + +Open your project in Visual Studio, right‑click the solution, and select **Manage NuGet Packages**. Search for `Aspose.BarCode` and install the latest stable version. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** Keep the package up to date. New releases often include performance improvements and support for the latest .NET runtimes. + +## Step 2: Create a minimal console application + +Create a new C# console project if you don’t already have one: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Replace the content of `Program.cs` with the full example below. This program demonstrates **how to generate PDF417 barcode C#** from start to finish. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Why each line matters + +* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports up to ~1.1 KB of data. +* **`XDimension.Pixels = 2`** – sets the basic bar width. Smaller values make the barcode thinner; larger values improve readability on low‑resolution devices. +* **`Pdf417.Columns = 3`** – limits the number of columns, forcing the generator to use more rows, which results in a taller but narrower barcode. +* **`Pdf417.Truncate = true`** – activates compact mode, removing the stop pattern and shrinking the image without losing data integrity. +* **`Save(..., BarCodeImageFormat.Png)`** – writes a PNG file. You could also choose `Jpeg`, `Bmp`, or `Svg` depending on downstream needs. + +Run the program: + +```bash +dotnet run +``` + +You should see the console output confirming the file location, and the folder will contain `CompactPdf417.png`. Opening the PNG shows a clear, compact PDF417 barcode that encodes the Unicode string. + +## Step 3: Verify the barcode (optional but recommended) + +To ensure the barcode is readable, you can use any standard PDF417 scanner app on a smartphone or a desktop decoder library. The encoded text should match the original `data` string exactly, including the special characters. + +If you encounter decoding issues: + +* Increase the `XDimension` to 3 or 4 pixels. +* Reduce the number of columns (e.g., set `Columns = 2`). +* Disable `Truncate` (`Truncate = false`) to add the stop pattern. + +These adjustments trade size for readability, which is useful for low‑resolution printers or scanners. + +## Step 4: Explore common variations + +### 4️⃣ Generate a high‑density PDF417 for printing + +If you need a barcode that fits on a small label, increase the column count and lower the X‑dimension: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Change the output format to SVG for vector scaling + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +SVG output scales without loss of quality, perfect for responsive web pages. + +### 6️⃣ Encode binary data (e.g., a byte array) + +If you need to embed binary payloads, convert them to a Base64 string first: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +The barcode now carries the binary information, and the decoder must reverse the Base64 step. + +## Frequently asked questions + +| Question | Answer | +|----------|--------| +| **Can I generate PDF417 without Aspose?** | Yes, other libraries like ZXing.Net or Dynamsoft exist, but Aspose.BarCode offers richer layout control (columns, truncation) and better Unicode handling. | +| **What is the maximum data length?** | PDF417 can encode up to 1,108 bytes (≈ 1 KB) of binary data. If you exceed this, consider splitting the data across multiple barcodes. | +| **Is compact mode compliant with standards?** | Truncated PDF417 is part of the ISO/IEC 15438 spec and is widely supported, but verify that your target scanner explicitly supports it. | +| **How do I change the background color?** | Set `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` and `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` before saving. | + +## Conclusion + +You now know **how to generate PDF417 barcode C#** using Aspose.BarCode, how to fine‑tune the X‑dimension, enable compact mode, and export the result as a PNG image. The complete, runnable example can be copied into any .NET project, and the variations shown let you adapt the barcode for printing, web, or binary payload scenarios. + +Next steps you might explore: + +* Integrate the barcode generation into an ASP.NET Core API that returns the image on demand. +* Combine PDF417 with QR codes on the same label for dual‑format scanning. +* Use the Aspose.BarCode `Reader` class to decode the generated image and verify data programmatically. + +Happy coding, and enjoy the flexibility that **generate PDF417 barcode** solutions bring to your applications! + + +## 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/) +- [How to Generate Barcode Image with Supplemental Space Customization using Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/english/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/og-image.png b/barcode/english/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/og-image.png new file mode 100644 index 000000000..7ba611f19 Binary files /dev/null and b/barcode/english/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/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..2fa543611 100644 --- a/barcode/french/net/compact-pdf417-encoding/_index.md +++ b/barcode/french/net/compact-pdf417-encoding/_index.md @@ -87,6 +87,12 @@ 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. +### [Générer un code-barres PDF417 en C# – guide complet avec mise en page compacte](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Apprenez à créer un code-barres PDF417 compact en C# avec Aspose.BarCode, incluant configuration et exemples complets. + +### [Générer un code-barres C# avec Macro PDF417 – exemple complet](./generate-barcode-c-with-macro-pdf417-full-example/) +Apprenez à créer un code-barres Macro PDF417 en C# avec Aspose.BarCode, incluant un exemple complet et toutes les options de configuration. + ## Questions fréquentes **Q : Quelle est la quantité maximale de données que je peux stocker dans un code‑barcode Compact PDF417 ?** @@ -115,4 +121,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/french/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..81216521b --- /dev/null +++ b/barcode/french/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Générer un code‑barres C# avec Aspose.BarCode pour créer un Macro PDF417 + avec du texte personnalisé et l’enregistrer sous forme de fichier image. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: fr +lastmod: 2026-08-19 +og_description: Générez un code-barres C# avec Aspose.BarCode, apprenez à créer du + PDF417, ajoutez du texte personnalisé et enregistrez le fichier image du code-barres. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Générer un code-barres C# – Guide Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Générer un code-barres C# avec Macro PDF417 – exemple complet +url: /fr/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Générer un code-barres C# avec Macro PDF417 – exemple complet + +Si vous devez **générer un code-barres C#** au format Macro PDF417, ce guide vous présente une solution prête à l’emploi. Vous verrez comment **générer pdf417**, intégrer du texte personnalisé et **générer un fichier d’image de code-barres** dans un programme autonome. + +Le tutoriel couvre tout, de l’installation de la bibliothèque Aspose.BarCode à la configuration des métadonnées Macro PDF417, afin que vous puissiez copier le code directement dans votre projet et voir le résultat immédiatement. + +## Prérequis + +- .NET 6.0 SDK ou version ultérieure (le code fonctionne également avec .NET Framework 4.7+) +- Visual Studio 2022 (ou tout IDE supportant C#) +- Une licence Aspose.BarCode pour .NET (l’essai gratuit fonctionne pour l’évaluation) +- Familiarité de base avec la syntaxe C# + +> **Conseil pro :** Installez le package NuGet via la CLI pour éviter les incompatibilités de version : +> `dotnet add package Aspose.BarCode` + +## Étape 1 : Configurer le projet et importer la bibliothèque + +Créez une nouvelle application console et ajoutez les directives `using` requises. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Pourquoi cette étape est importante :** +L’espace de noms `Aspose.BarCode.Generation` fournit la classe `BarcodeGenerator`, qui est le point d’entrée pour créer tout type de code-barres, y compris Macro PDF417. L’importation de `System` vous donne accès à `DateTime` pour les métadonnées de timestamp. + +## Étape 2 : Créer un générateur Macro PDF417 avec texte personnalisé + +Remplacez le commentaire d’espace réservé par l’initialisation du générateur. Cela montre comment **créer du texte personnalisé pour le code-barres** tout en sélectionnant le type d’encodage correct. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Explication :** +- `EncodeTypes.MacroPdf417` indique à Aspose de produire un code-barres PDF417 qui prend en charge les fonctionnalités macro (segmentation de fichier, somme de contrôle, etc.). +- Le texte `"Åspóse.Barcóde©"` montre que les caractères Unicode sont entièrement pris en charge, ce qui est souvent requis pour les applications internationales. + +## Étape 3 : Configurer l’apparence et les métadonnées Macro PDF417 + +Ajustez finement les dimensions du code-barres et définissez les champs spécifiques à la macro requis pour la gestion de fichiers segmentés. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Pourquoi ces paramètres sont importants :** + +| Paramètre | Objectif | +|-----------|----------| +| `XDimension.Pixels` | Contrôle la densité visuelle ; 2 px donnent une image claire et lisible. | +| `Columns` | Détermine le nombre de colonnes de données par ligne, affectant la taille du code-barres. | +| `MacroPdf417FileID` | Identifie de façon unique le fichier logique à travers tous les segments. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Permet la reconstruction du fichier original à partir de plusieurs codes-barres. | +| `MacroPdf417FileName` | Nom lisible par l’homme stocké dans le code-barres pour le traitement en aval. | +| `MacroPdf417Checksum` | Fournit la détection d’erreurs en utilisant l’algorithme CRC CCITT‑16. | +| `MacroPdf417FileSize` | Aide le décodeur à savoir quand le fichier complet a été reçu. | +| `MacroPdf417TimeStamp` | Enregistre le moment où le code-barres a été généré, utile pour les pistes d’audit. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Champs optionnels pouvant être utilisés dans les flux de travail métier. | +| `MacroPdf417Terminator` | Indique que ce segment est le dernier (`Set`). | + +## Étape 4 : Enregistrer le code-barres sous forme de fichier image + +Enfin, écrivez le code-barres dans un fichier PNG afin de pouvoir le visualiser ou l’intégrer ailleurs. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Ce que vous verrez :** +Une image PNG nommée `ExtPDF417Meta.png` contenant un code-barres Macro PDF417 qui encode le texte personnalisé et tous les champs de métadonnées que vous avez définis ci‑dessus. L’image peut être ouverte avec n’importe quel visualiseur standard ou insérée dans des PDF, rapports ou pages web. + +## Code source complet (prêt à copier‑coller) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Résultat attendu + +L’exécution du programme affiche : + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Ouvrir `ExtPDF417Meta.png` montre un code-barres Macro PDF417 propre qui se lit correctement avec n’importe quel lecteur PDF417, en conservant le texte personnalisé `"Åspóse.Barcóde©"` et les métadonnées macro que vous avez définies. + +## Questions fréquentes et cas particuliers + +- **Puis-je générer un format d’image différent ?** + Oui. Remplacez `BarCodeImageFormat.Png` par `Jpeg`, `Bmp` ou `Gif` selon vos besoins. + +- **Que faire si mes données dépassent un seul code-barres ?** + Macro PDF417 est conçu pour la segmentation. Ajustez `MacroPdf417SegmentsCount` et `MacroPdf417SegmentID` pour chaque partie, puis concaténez les résultats scannés. + +- **Le support Unicode est‑il garanti ?** + Aspose.BarCode prend pleinement en charge Unicode. Assurez‑vous que votre fichier source est enregistré avec l’encodage UTF‑8 pour éviter la corruption des caractères. + +- **Ai‑je besoin d’une licence pour la production ?** + Une version sous licence supprime le filigrane d’évaluation et offre toutes les fonctionnalités. L’essai fonctionne pour les tests et l’apprentissage. + +## Conclusion + +Vous savez maintenant comment **générer un code-barres C#** pour un Macro PDF417, **générer pdf417** avec des métadonnées riches, **créer du texte personnalisé pour le code-barres**, et **générer un fichier d’image de code-barres** en utilisant Aspose.BarCode. L’exemple complet et exécutable montre chaque étape requise — de la configuration du projet à l’enregistrement de l’image PNG finale. + +### Prochaines étapes + +- Expérimentez d’autres paramètres PDF417 tels que `ErrorCorrectionLevel` et `CompactPdf417` pour des symboles plus petits. +- Intégrez le code-barres généré dans un rapport PDF à l’aide d’Aspose.PDF. +- Explorez la génération en lot : parcourez une collection de fichiers et produisez une série de codes-barres Macro PDF417 segmentés. + +N’hésitez pas à adapter le code à votre propre flux de travail, et laissez la génération de codes-barres devenir une partie fluide de vos applications C#. Bon codage ! + +## Que devriez‑vous apprendre ensuite ? + +Les tutoriels suivants couvrent des sujets étroitement liés qui s’appuient sur les techniques démontrées dans ce guide. Chaque ressource comprend des exemples de code complets et fonctionnels avec des explications étape par étape pour vous aider à maîtriser des fonctionnalités API supplémentaires et explorer des approches d’implémentation alternatives dans vos propres projets. + +- [Comment générer un code-barres Aztec avec un ratio d’aspect personnalisé en utilisant Aspose.BarCode pour .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Générer une image de code-barres – Code 93 avec Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Comment générer et ajuster la hauteur du code-barres pour One-Dimensional Databar en utilisant Aspose.BarCode pour .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/french/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..138f9827c --- /dev/null +++ b/barcode/french/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: Générez rapidement un code‑barres PDF417 en C#. Apprenez comment générer + un code‑barres PDF417 en C# en utilisant Aspose.BarCode avec le mode compact et + des paramètres personnalisés. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: fr +lastmod: 2026-08-19 +og_description: Générez un code‑barres PDF417 en C# avec Aspose.BarCode. Ce tutoriel + montre comment générer un code‑barres PDF417 en C# en mode compact, définir la dimension + X et enregistrer au format PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Générer un code‑barres PDF417 en C# – guide étape par étape +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Générer un code‑barres PDF417 en C# – guide complet avec mise en page compacte +url: /fr/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Générer un code‑barres PDF417 en C# – guide complet + +Si vous devez **générer un code‑barres PDF417** dans une application .NET, ce tutoriel vous montre exactement comment le faire. Vous verrez un exemple concis, prêt pour la production, qui crée un code‑barres PDF417 compact, personnalise la dimension X et enregistre le résultat sous forme d’image PNG. + +Générer un code‑barres PDF417 est fréquent lorsque vous devez encoder de grandes quantités de données — comme des informations de billet, des manifestes d’expédition ou des documents d’identité — dans un format lisible par machine. L’utilisation d’Aspose.BarCode rend le processus simple, et le code fonctionne avec .NET 6+ ou .NET Framework 4.7.2 et versions ultérieures. + +Dans ce guide, vous allez : + +* Installer le package NuGet Aspose.BarCode. +* Écrire un programme C# autonome qui **génère un code‑barres PDF417** avec un petit nombre de colonnes et le mode compact (truncation). +* Ajuster la largeur des barres (dimension X) pour un rendu plus net. +* Enregistrer le code‑barres sous forme de fichier PNG. +* Explorer des variantes, des cas limites et des conseils de bonnes pratiques. + +## Prérequis + +Avant de commencer, assurez-vous d’avoir : + +* Visual Studio 2022 (ou tout IDE C#) avec le SDK .NET 6 installé. +* Un accès Internet pour télécharger le package NuGet **Aspose.BarCode**. +* Les droits d’écriture sur un dossier où le fichier PNG sera enregistré. + +Aucune bibliothèque supplémentaire n’est requise ; Aspose.BarCode gère l’encodage d’image en interne. + +## Étape 1 : Ajouter le package Aspose.BarCode + +Ouvrez votre projet dans Visual Studio, faites un clic droit sur la solution et sélectionnez **Manage NuGet Packages**. Recherchez `Aspose.BarCode` et installez la dernière version stable. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Astuce pro :** Gardez le package à jour. Les nouvelles versions incluent souvent des améliorations de performances et la prise en charge des derniers runtimes .NET. + +## Étape 2 : Créer une application console minimale + +Créez un nouveau projet console C# si vous n’en avez pas déjà un : + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Remplacez le contenu de `Program.cs` par l’exemple complet ci‑dessous. Ce programme montre **comment générer un code‑barres PDF417 en C#** de bout en bout. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Pourquoi chaque ligne est importante + +* **`EncodeTypes.Pdf417`** – sélectionne la symbologie PDF417, qui supporte jusqu’à ~1,1 KB de données. +* **`XDimension.Pixels = 2`** – définit la largeur de base des barres. Des valeurs plus petites rendent le code‑barres plus fin ; des valeurs plus grandes améliorent la lisibilité sur les appareils à basse résolution. +* **`Pdf417.Columns = 3`** – limite le nombre de colonnes, forçant le générateur à utiliser plus de rangées, ce qui donne un code‑barres plus haut mais plus étroit. +* **`Pdf417.Truncate = true`** – active le mode compact, supprime le motif d’arrêt et réduit l’image sans perdre l’intégrité des données. +* **`Save(..., BarCodeImageFormat.Png)`** – écrit un fichier PNG. Vous pouvez également choisir `Jpeg`, `Bmp` ou `Svg` selon les besoins en aval. + +Exécutez le programme : + +```bash +dotnet run +``` + +Vous devriez voir la sortie console confirmant l’emplacement du fichier, et le dossier contiendra `CompactPdf417.png`. L’ouverture du PNG montre un code‑barres PDF417 compact et clair qui encode la chaîne Unicode. + +## Étape 3 : Vérifier le code‑barres (optionnel mais recommandé) + +Pour vous assurer que le code‑barres est lisible, vous pouvez utiliser n’importe quelle application de lecture PDF417 standard sur smartphone ou une bibliothèque de décodage sur ordinateur. Le texte encodé doit correspondre exactement à la chaîne `data` d’origine, caractères spéciaux inclus. + +Si vous rencontrez des problèmes de décodage : + +* Augmentez le `XDimension` à 3 ou 4 pixels. +* Réduisez le nombre de colonnes (par ex., `Columns = 2`). +* Désactivez `Truncate` (`Truncate = false`) pour ajouter le motif d’arrêt. + +Ces ajustements échangent taille contre lisibilité, ce qui est utile pour les imprimantes ou scanners à basse résolution. + +## Étape 4 : Explorer les variantes courantes + +### 4️⃣ Générer un PDF417 haute densité pour l’impression + +Si vous avez besoin d’un code‑barres qui tient sur une petite étiquette, augmentez le nombre de colonnes et réduisez la dimension X : + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Changer le format de sortie en SVG pour un redimensionnement vectoriel + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +La sortie SVG s’adapte sans perte de qualité, idéale pour les pages web responsives. + +### 6️⃣ Encoder des données binaires (p. ex., un tableau d’octets) + +Si vous devez intégrer des charges binaires, convertissez‑les d’abord en chaîne Base64 : + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Le code‑barres transporte maintenant l’information binaire, et le décodage doit inverser l’étape Base64. + +## Questions fréquentes + +| Question | Réponse | +|----------|--------| +| **Puis‑je générer un PDF417 sans Aspose ?** | Oui, d’autres bibliothèques comme ZXing.Net ou Dynamsoft existent, mais Aspose.BarCode offre un contrôle de mise en page plus riche (colonnes, troncature) et une meilleure gestion Unicode. | +| **Quelle est la longueur maximale des données ?** | PDF417 peut encoder jusqu’à 1 108 octets (≈ 1 KB) de données binaires. Si vous dépassez cette limite, envisagez de scinder les données sur plusieurs codes‑barres. | +| **Le mode compact est‑il conforme aux normes ?** | Le PDF417 tronqué fait partie de la spécification ISO/IEC 15438 et est largement supporté, mais vérifiez que votre scanner cible le supporte explicitement. | +| **Comment changer la couleur de fond ?** | Définissez `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` et `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` avant l’enregistrement. | + +## Conclusion + +Vous savez maintenant **comment générer un code‑barres PDF417 en C#** avec Aspose.BarCode, comment affiner la dimension X, activer le mode compact et exporter le résultat en image PNG. L’exemple complet et exécutable peut être copié dans n’importe quel projet .NET, et les variantes présentées vous permettent d’adapter le code‑barres à l’impression, au web ou aux scénarios de charge binaire. + +Prochaines étapes possibles : + +* Intégrer la génération de code‑barres dans une API ASP.NET Core qui renvoie l’image à la demande. +* Combiner PDF417 avec des QR‑codes sur la même étiquette pour une lecture double format. +* Utiliser la classe `Reader` d’Aspose.BarCode pour décoder l’image générée et vérifier les données programmatiquement. + +Bon codage, et profitez de la flexibilité que les solutions **générer un code‑barres PDF417** apportent à vos applications ! + +## Que devriez‑vous apprendre ensuite ? + +Les tutoriels suivants couvrent des sujets étroitement liés qui s’appuient sur les techniques démontrées dans ce guide. Chaque ressource comprend des exemples de code complets et fonctionnels avec des explications pas à pas pour vous aider à maîtriser des fonctionnalités API supplémentaires et explorer des approches d’implémentation alternatives dans vos propres projets. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [How to Generate Barcode Image with Supplemental Space Customization using Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/german/net/compact-pdf417-encoding/_index.md b/barcode/german/net/compact-pdf417-encoding/_index.md index 201fcffef..6b1f999b5 100644 --- a/barcode/german/net/compact-pdf417-encoding/_index.md +++ b/barcode/german/net/compact-pdf417-encoding/_index.md @@ -84,6 +84,10 @@ 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. +### [PDF417-Barcode in C# generieren – vollständiger Leitfaden mit kompaktem Layout](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Erfahren Sie, wie Sie PDF417‑Barcodes in C# mit kompakter Layout‑Option erstellen – Schritt‑für‑Schritt‑Anleitung und Code‑Beispiele. +### [Barcode in C# mit Macro PDF417 generieren – vollständiges Beispiel](./generate-barcode-c-with-macro-pdf417-full-example/) +Erfahren Sie, wie Sie mit Aspose.BarCode für .NET einen vollständigen Macro PDF417 Barcode in C# erzeugen. ## Häufig gestellte Fragen @@ -113,4 +117,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/german/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..b6a2e6850 --- /dev/null +++ b/barcode/german/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Barcode in C# mit Aspose.BarCode generieren, um ein Macro‑PDF417 mit + benutzerdefiniertem Text zu erstellen und als Bilddatei zu speichern. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: de +lastmod: 2026-08-19 +og_description: Erzeugen Sie Barcodes in C# mit Aspose.BarCode, lernen Sie, wie man + PDF417 generiert, benutzerdefinierten Text hinzufügt und die Barcode‑Bilddatei speichert. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Barcode generieren C# – Macro‑PDF417‑Anleitung +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Barcode in C# mit Macro PDF417 generieren – vollständiges Beispiel +url: /de/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Barcode C# mit Macro PDF417 generieren – vollständiges Beispiel + +Wenn Sie **barcode C# generieren** für ein Macro PDF417‑Format benötigen, zeigt Ihnen dieser Leitfaden eine sofort einsatzbereite Lösung. Sie sehen, wie man **pdf417 generiert**, benutzerdefinierten Text einbettet und **barcode image file generiert** in einem einzigen, eigenständigen Programm. + +Das Tutorial deckt alles ab, von der Installation der Aspose.BarCode‑Bibliothek bis zur Konfiguration von Macro PDF417‑Metadaten, sodass Sie den Code direkt in Ihr Projekt kopieren und das Ergebnis sofort sehen können. + +## Voraussetzungen + +- .NET 6.0 SDK oder neuer (der Code funktioniert auch mit .NET Framework 4.7+) +- Visual Studio 2022 (oder jede IDE, die C# unterstützt) +- Eine Aspose.BarCode for .NET Lizenz (die kostenlose Testversion funktioniert für Evaluierung) +- Grundlegende Kenntnisse der C#‑Syntax + +> **Pro Tipp:** Installieren Sie das NuGet‑Paket über die CLI, um Versionskonflikte zu vermeiden: +> `dotnet add package Aspose.BarCode` + +## Schritt 1: Projekt einrichten und Bibliothek importieren + +Erstellen Sie eine neue Konsolenanwendung und fügen Sie die erforderlichen `using`‑Direktiven hinzu. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Warum dieser Schritt wichtig ist:** +Der Namespace `Aspose.BarCode.Generation` stellt die Klasse `BarcodeGenerator` bereit, die Einstiegspunkt für die Erstellung jeglicher Barcode‑Typen, einschließlich Macro PDF417, ist. Das Importieren von `System` gibt Ihnen Zugriff auf `DateTime` für Zeitstempel‑Metadaten. + +## Schritt 2: Einen Macro PDF417‑Generator mit benutzerdefiniertem Text erstellen + +Ersetzen Sie den Platzhalter‑Kommentar durch die Initialisierung des Generators. Dies demonstriert **create barcode custom text**, während gleichzeitig der korrekte Kodierungstyp ausgewählt wird. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Erklärung:** +- `EncodeTypes.MacroPdf417` weist Aspose an, einen PDF417‑Barcode zu erzeugen, der Makro‑Funktionen (Dateisegmentierung, Prüfsumme usw.) unterstützt. +- Der Text `"Åspóse.Barcóde©"` zeigt, dass Unicode‑Zeichen vollständig unterstützt werden, was häufig für internationale Anwendungen erforderlich ist. + +## Schritt 3: Aussehen und Macro PDF417‑Metadaten konfigurieren + +Feinabstimmung der Barcode‑Abmessungen und Festlegung der makro‑spezifischen Felder, die für die Handhabung segmentierter Dateien erforderlich sind. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Warum diese Einstellungen wichtig sind:** + +| Einstellung | Zweck | +|------------|-------| +| `XDimension.Pixels` | Steuert die visuelle Dichte; 2 px ergeben ein klares, scanbares Bild. | +| `Columns` | Bestimmt, wie viele Daten­spalten pro Zeile erscheinen, was die Barcode‑Größe beeinflusst. | +| `MacroPdf417FileID` | Identifiziert die logische Datei eindeutig über alle Segmente hinweg. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Ermöglicht die Rekonstruktion der Originaldatei aus mehreren Barcodes. | +| `MacroPdf417FileName` | Menschlich lesbarer Name, der im Barcode gespeichert wird für nachgelagerte Verarbeitung. | +| `MacroPdf417Checksum` | Bietet Fehl­erkennung mittels des CCITT‑16‑CRC‑Algorithmus. | +| `MacroPdf417FileSize` | Hilft dem Decoder zu erkennen, wann die gesamte Datei empfangen wurde. | +| `MacroPdf417TimeStamp` | Protokolliert, wann der Barcode erzeugt wurde, nützlich für Prüfpfade. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Optionale Felder, die von Geschäfts‑Workflows verwendet werden können. | +| `MacroPdf417Terminator` | Zeigt an, dass dieses Segment das letzte ist (`Set`). | + +## Schritt 4: Barcode als Bilddatei speichern + +Schließlich schreiben Sie den Barcode in eine PNG‑Datei, damit Sie ihn ansehen oder an anderer Stelle einbetten können. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Was Sie sehen werden:** +Ein PNG‑Bild mit dem Namen `ExtPDF417Meta.png`, das einen Macro PDF417‑Barcode enthält, der den benutzerdefinierten Text und alle oben gesetzten Metadatenfelder kodiert. Das Bild kann mit jedem Standard‑Viewer geöffnet oder in PDFs, Berichte oder Webseiten eingefügt werden. + +## Vollständiger Quellcode (zum Kopieren‑Einfügen bereit) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Erwartete Ausgabe + +Das Ausführen des Programms gibt aus: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Das Öffnen von `ExtPDF417Meta.png` zeigt einen sauberen Macro PDF417‑Barcode, der mit jedem PDF417‑Reader korrekt gescannt wird und den benutzerdefinierten Text `"Åspóse.Barcóde©"` sowie die von Ihnen definierten Makro‑Metadaten beibehält. + +## Häufige Fragen und Sonderfälle + +- **Kann ich ein anderes Bildformat erzeugen?** + Ja. Ersetzen Sie `BarCodeImageFormat.Png` durch `Jpeg`, `Bmp` oder `Gif`, je nach Bedarf. + +- **Was, wenn meine Daten einen einzelnen Barcode überschreiten?** + Macro PDF417 ist für Segmentierung ausgelegt. Passen Sie `MacroPdf417SegmentsCount` und `MacroPdf417SegmentID` für jeden Teil an und verketten Sie anschließend die gescannten Ergebnisse. + +- **Ist Unicode‑Unterstützung garantiert?** + Aspose.BarCode unterstützt Unicode vollständig. Stellen Sie sicher, dass Ihre Quelldatei mit UTF‑8‑Kodierung gespeichert ist, um Zeichenkorruption zu vermeiden. + +- **Benötige ich eine Lizenz für die Produktion?** + Eine lizenzierte Version entfernt das Evaluations‑Wasserzeichen und bietet die volle Funktionalität. Die Testversion funktioniert für Tests und zum Lernen. + +## Fazit + +Sie wissen jetzt, wie man **barcode C# generiert** für ein Macro PDF417, **wie man pdf417 mit umfangreichen Metadaten generiert**, **barcode custom text erstellt** und **barcode image file generiert** mit Aspose.BarCode. Das vollständige, ausführbare Beispiel demonstriert jeden erforderlichen Schritt – von der Projekteinstellung bis zum Speichern des finalen PNG‑Bildes. + +### Nächste Schritte + +- Experimentieren Sie mit anderen PDF417‑Einstellungen wie `ErrorCorrectionLevel` und `CompactPdf417` für kleinere Symbole. +- Integrieren Sie den erzeugten Barcode in einen PDF‑Bericht mithilfe von Aspose.PDF. +- Untersuchen Sie die Batch‑Erzeugung: Durchlaufen Sie eine Sammlung von Dateien und erzeugen Sie eine Reihe segmentierter Macro PDF417‑Barcodes. + +Passen Sie den Code gerne an Ihren eigenen Workflow an, und lassen Sie die Barcode‑Erzeugung zu einem nahtlosen Teil Ihrer C#‑Anwendungen werden. Viel Spaß beim Programmieren! + +## 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. + +- [Wie man Aztec‑Barcode mit benutzerdefiniertem Seitenverhältnis mit Aspose.BarCode für .NET generiert](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Barcode‑Bild erzeugen – Code 93 mit Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Wie man die Barcode‑Höhe für eindimensionalen Databar mit Aspose.BarCode für .NET erzeugt und anpasst](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/german/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..2dcf5dfbe --- /dev/null +++ b/barcode/german/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: PDF417-Barcode in C# schnell generieren. Erfahren Sie, wie Sie einen + PDF417-Barcode in C# mit Aspose.BarCode im kompakten Modus und benutzerdefinierten + Einstellungen erzeugen. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: de +lastmod: 2026-08-19 +og_description: PDF417-Barcode in C# mit Aspose.BarCode generieren. Dieses Tutorial + zeigt, wie man einen PDF417-Barcode in C# im kompakten Modus erzeugt, die X‑Dimension + festlegt und als PNG speichert. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: PDF417-Barcode in C# generieren – Schritt‑für‑Schritt‑Anleitung +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: PDF417-Barcode in C# generieren – vollständige Anleitung mit kompaktem Layout +url: /de/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# PDF417-Barcode in C# generieren – vollständige Anleitung + +Wenn Sie **PDF417-Barcode** in einer .NET-Anwendung generieren müssen, zeigt Ihnen dieses Tutorial genau, wie Sie das machen. Sie sehen ein prägnantes, produktionsreifes Beispiel, das einen kompakten PDF417-Barcode erstellt, die X‑Dimension anpasst und das Ergebnis als PNG‑Bild speichert. + +Das Generieren eines PDF417-Barcodes ist üblich, wenn große Datenmengen – wie Ticketinformationen, Versandmanifesten oder Ausweisdokumenten – in einem maschinenlesbaren Format codiert werden müssen. Die Verwendung von Aspose.BarCode macht den Prozess unkompliziert, und der Code funktioniert mit .NET 6+ oder .NET Framework 4.7.2 und höher. + +In diesem Leitfaden werden Sie: + +* Das Aspose.BarCode NuGet‑Paket installieren. +* Ein eigenständiges C#‑Programm schreiben, das **PDF417-Barcode** mit einer kleinen Spaltenanzahl und kompaktem (abgeschnittenem) Modus generiert. +* Die Balkenbreite (X‑Dimension) für schärfere Darstellung anpassen. +* Den Barcode als PNG‑Datei speichern. +* Varianten, Sonderfälle und Best‑Practice‑Tipps erkunden. + +## Voraussetzungen + +Bevor Sie beginnen, stellen Sie sicher, dass Sie folgendes haben: + +* Visual Studio 2022 (oder jede andere C#‑IDE) mit installiertem .NET 6 SDK. +* Internetzugang, um das **Aspose.BarCode** NuGet‑Paket herunterzuladen. +* Schreibrechte für einen Ordner, in dem die PNG‑Datei gespeichert wird. + +Weitere Bibliotheken sind nicht erforderlich; Aspose.BarCode übernimmt die Bildkodierung intern. + +## Schritt 1: Aspose.BarCode-Paket hinzufügen + +Öffnen Sie Ihr Projekt in Visual Studio, klicken Sie mit der rechten Maustaste auf die Lösung und wählen Sie **Manage NuGet Packages**. Suchen Sie nach `Aspose.BarCode` und installieren Sie die neueste stabile Version. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro‑Tipp:** Halten Sie das Paket aktuell. Neue Releases enthalten häufig Leistungsverbesserungen und Unterstützung für die neuesten .NET‑Runtimes. + +## Schritt 2: Minimalanwendung für die Konsole erstellen + +Erstellen Sie ein neues C#‑Konsolenprojekt, falls Sie noch keines haben: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Ersetzen Sie den Inhalt von `Program.cs` durch das vollständige Beispiel unten. Dieses Programm demonstriert **wie man PDF417-Barcode C#** von Anfang bis Ende generiert. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Warum jede Zeile wichtig ist + +* **`EncodeTypes.Pdf417`** – wählt die PDF417‑Symbologie, die bis zu ~1,1 KB Daten unterstützt. +* **`XDimension.Pixels = 2`** – legt die Grundbreite der Balken fest. Kleinere Werte machen den Barcode dünner; größere Werte verbessern die Lesbarkeit auf Niedrigauflösungs‑Geräten. +* **`Pdf417.Columns = 3`** – begrenzt die Spaltenzahl, zwingt den Generator mehr Zeilen zu verwenden, was zu einem höheren, aber schmaleren Barcode führt. +* **`Pdf417.Truncate = true`** – aktiviert den kompakten Modus, entfernt das Stopp‑Muster und verkleinert das Bild, ohne die Datenintegrität zu verlieren. +* **`Save(..., BarCodeImageFormat.Png)`** – schreibt eine PNG‑Datei. Sie können auch `Jpeg`, `Bmp` oder `Svg` wählen, je nach nachgelagerten Anforderungen. + +Programm ausführen: + +```bash +dotnet run +``` + +Sie sollten die Konsolenausgabe sehen, die den Dateipfad bestätigt, und der Ordner enthält `CompactPdf417.png`. Öffnen Sie die PNG‑Datei und Sie sehen einen klaren, kompakten PDF417-Barcode, der den Unicode‑String kodiert. + +## Schritt 3: Barcode überprüfen (optional aber empfohlen) + +Um sicherzustellen, dass der Barcode lesbar ist, können Sie jede gängige PDF417‑Scanner‑App auf einem Smartphone oder eine Desktop‑Decoder‑Bibliothek verwenden. Der kodierte Text sollte exakt dem ursprünglichen `data`‑String entsprechen, einschließlich Sonderzeichen. + +Wenn Sie Dekodierungsprobleme feststellen: + +* Erhöhen Sie die `XDimension` auf 3 oder 4 Pixel. +* Reduzieren Sie die Spaltenzahl (z. B. `Columns = 2` setzen). +* Deaktivieren Sie `Truncate` (`Truncate = false`), um das Stopp‑Muster hinzuzufügen. + +Diese Anpassungen tauschen Größe gegen Lesbarkeit aus, was bei Niedrigauflösungs‑Druckern oder Scannern nützlich ist. + +## Schritt 4: Häufige Variationen erkunden + +### 4️⃣ Hochdichte PDF417 für den Druck erzeugen + +Wenn Sie einen Barcode benötigen, der auf ein kleines Etikett passt, erhöhen Sie die Spaltenzahl und senken Sie die X‑Dimension: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Ausgabeformat zu SVG für Vektorskalierung ändern + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +SVG‑Ausgabe skaliert ohne Qualitätsverlust, ideal für responsive Webseiten. + +### 6️⃣ Binärdaten codieren (z. B. ein Byte‑Array) + +Wenn Sie binäre Nutzdaten einbetten müssen, konvertieren Sie diese zuerst in einen Base64‑String: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Der Barcode trägt nun die binären Informationen, und der Decoder muss den Base64‑Schritt rückgängig machen. + +## Häufig gestellte Fragen + +| Frage | Antwort | +|----------|--------| +| **Kann ich PDF417 ohne Aspose generieren?** | Ja, andere Bibliotheken wie ZXing.Net oder Dynamsoft existieren, aber Aspose.BarCode bietet umfangreichere Layout‑Kontrolle (Spalten, Trunkierung) und bessere Unicode‑Verarbeitung. | +| **Wie lang darf der maximale Datenstring sein?** | PDF417 kann bis zu 1 108 Bytes (≈ 1 KB) binäre Daten kodieren. Wenn Sie das überschreiten, sollten Sie die Daten auf mehrere Barcodes aufteilen. | +| **Entspricht der kompakte Modus den Standards?** | Trunkierter PDF417 ist Teil der ISO/IEC 15438‑Spezifikation und wird breit unterstützt, prüfen Sie jedoch, ob Ihr Ziel‑Scanner ihn explizit unterstützt. | +| **Wie ändere ich die Hintergrundfarbe?** | Setzen Sie `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` und `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` vor dem Speichern. | + +## Fazit + +Sie wissen jetzt **wie man PDF417-Barcode C#** mit Aspose.BarCode generiert, wie Sie die X‑Dimension feinjustieren, den kompakten Modus aktivieren und das Ergebnis als PNG‑Bild exportieren. Das vollständige, ausführbare Beispiel kann in jedes .NET‑Projekt kopiert werden, und die gezeigten Varianten ermöglichen Ihnen, den Barcode für Druck, Web oder binäre Nutzdaten anzupassen. + +Nächste Schritte, die Sie erkunden könnten: + +* Die Barcode‑Erzeugung in eine ASP.NET Core‑API integrieren, die das Bild bei Bedarf zurückgibt. +* PDF417 mit QR‑Codes auf demselben Etikett kombinieren für Dual‑Format‑Scanning. +* Die Aspose.BarCode `Reader`‑Klasse verwenden, um das erzeugte Bild programmgesteuert zu dekodieren und die Daten zu verifizieren. + +Viel Spaß beim Coden und genießen Sie die Flexibilität, die **PDF417‑Barcode‑Generierung** Ihren Anwendungen bietet! + +## Was sollten Sie als Nächstes lernen? + +Die folgenden Tutorials behandeln eng verwandte Themen, die auf den in diesem Leitfaden gezeigten Techniken aufbauen. Jede Ressource enthält vollständige, funktionierende Code‑Beispiele mit Schritt‑für‑Schritt‑Erklärungen, um Ihnen zu helfen, weitere API‑Funktionen zu meistern und alternative Implementierungsansätze in Ihren Projekten zu erkunden. + +- [Wie man Barcode erstellt – Kompakter PDF417 mit Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Wie man Barcode‑Bild mit Anpassung des Zusatzabstands generiert using Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [Wie man Aztec-Barcode mit benutzerdefiniertem Seitenverhältnis generiert using Aspose.BarCode für .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/greek/net/compact-pdf417-encoding/_index.md b/barcode/greek/net/compact-pdf417-encoding/_index.md index 06b8d9294..8fbdb0100 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 @@ -86,6 +86,11 @@ weight: 29 ### [Δημιουργία Συμπαγών PDF417 Κωδικών](./compact-pdf417-basic-configuration/) Μάθετε πώς να δημιουργείτε Συμπαγείς PDF417 κωδικούς χρησιμοποιώντας το Aspose.BarCode for .NET. Αναλυτικός οδηγός με βήμα‑βήμα οδηγίες και παραδείγματα κώδικα. +### [Δημιουργία barcode PDF417 σε C# – πλήρης οδηγός με συμπαγή διάταξη](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Μάθετε πώς να δημιουργήσετε barcode PDF417 σε C# με συμπαγή διάταξη, βήμα‑βήμα οδηγίες και παραδείγματα κώδικα. + +### [Δημιουργία barcode C# με Macro PDF417 – πλήρης παράδειγμα](./generate-barcode-c-with-macro-pdf417-full-example/) + ## Συχνές Ερωτήσεις **Ε: Ποιο είναι το μέγιστο ποσό δεδομένων που μπορώ να αποθηκεύσω σε έναν Συμπαγή PDF417 κώδικα;** @@ -114,4 +119,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/greek/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..52abfcc91 --- /dev/null +++ b/barcode/greek/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,252 @@ +--- +category: general +date: 2026-08-19 +description: Δημιουργήστε barcode C# χρησιμοποιώντας το Aspose.BarCode για να δημιουργήσετε + ένα Macro PDF417 με προσαρμοσμένο κείμενο και να το αποθηκεύσετε ως αρχείο εικόνας. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: el +lastmod: 2026-08-19 +og_description: Δημιουργήστε γραμμωτό κώδικα C# με το Aspose.BarCode, μάθετε πώς να + δημιουργείτε PDF417, προσθέστε προσαρμοσμένο κείμενο και αποθηκεύστε το αρχείο εικόνας + του γραμμωτού κώδικα. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Δημιουργία barcode C# – Οδηγός Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Δημιουργία γραμμωτού κώδικα C# με Macro PDF417 – πλήρες παράδειγμα +url: /el/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Δημιουργία barcode C# με Macro PDF417 – πλήρες παράδειγμα + +Αν χρειάζεστε **generate barcode C#** για μορφή Macro PDF417, αυτός ο οδηγός σας παρουσιάζει μια έτοιμη‑για‑εκτέλεση λύση. Θα δείτε πώς να **how to generate pdf417**, να ενσωματώσετε προσαρμοσμένο κείμενο και να **generate barcode image file** σε ένα ενιαίο, αυτόνομο πρόγραμμα. + +Το tutorial καλύπτει όλα, από την εγκατάσταση της βιβλιοθήκης Aspose.BarCode μέχρι τη διαμόρφωση των μεταδεδομένων Macro PDF417, ώστε να μπορείτε να αντιγράψετε τον κώδικα απευθείας στο έργο σας και να δείτε το αποτέλεσμα αμέσως. + +## Προαπαιτούμενα + +Πριν ξεκινήσετε, βεβαιωθείτε ότι έχετε: + +- .NET 6.0 SDK ή νεότερο (ο κώδικας λειτουργεί επίσης με .NET Framework 4.7+) +- Visual Studio 2022 (ή οποιοδήποτε IDE που υποστηρίζει C#) +- Άδεια Aspose.BarCode for .NET (η δωρεάν δοκιμή λειτουργεί για αξιολόγηση) +- Βασική εξοικείωση με τη σύνταξη C# + +> **Συμβουλή:** Εγκαταστήστε το πακέτο NuGet μέσω της CLI για να αποφύγετε ασυμφωνίες εκδόσεων: +> `dotnet add package Aspose.BarCode` + +## Βήμα 1: Ρύθμιση του έργου και εισαγωγή της βιβλιοθήκης + +Δημιουργήστε μια νέα εφαρμογή console και προσθέστε τις απαιτούμενες οδηγίες `using`. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Γιατί αυτό το βήμα είναι σημαντικό:** +Ο χώρος ονομάτων `Aspose.BarCode.Generation` παρέχει την κλάση `BarcodeGenerator`, η οποία είναι το σημείο εισόδου για τη δημιουργία οποιουδήποτε τύπου barcode, συμπεριλαμβανομένου του Macro PDF417. Η εισαγωγή του `System` σας δίνει πρόσβαση στο `DateTime` για μεταδεδομένα χρονικής σήμανσης. + +## Βήμα 2: Δημιουργία γεννήτριας Macro PDF417 με προσαρμοσμένο κείμενο + +Αντικαταστήστε το σχόλιο placeholder με την αρχικοποίηση του γεννήτρια. Αυτό δείχνει **create barcode custom text** ενώ επιλέγετε τον σωστό τύπο κωδικοποίησης. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Εξήγηση:** +- `EncodeTypes.MacroPdf417` λέει στο Aspose να παραγάγει ένα barcode PDF417 που υποστηρίζει λειτουργίες macro (κατακερματισμός αρχείου, checksum κ.λπ.). +- Το κείμενο `"Åspóse.Barcóde©"` δείχνει ότι οι χαρακτήρες Unicode υποστηρίζονται πλήρως, κάτι που συχνά απαιτείται για διεθνείς εφαρμογές. + +## Βήμα 3: Διαμόρφωση εμφάνισης και μεταδεδομένων Macro PDF417 + +Ρυθμίστε με ακρίβεια τις διαστάσεις του barcode και ορίστε τα macro‑συγκεκριμένα πεδία που απαιτούνται για τη διαχείριση τμηματισμένων αρχείων. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Γιατί αυτές οι ρυθμίσεις είναι σημαντικές:** + +| Ρύθμιση | Σκοπός | +|---------|---------| +| `XDimension.Pixels` | Ελέγχει την οπτική πυκνότητα· 2 px δίνει καθαρή, αναγνώσιμη εικόνα. | +| `Columns` | Καθορίζει πόσες στήλες δεδομένων εμφανίζονται ανά σειρά, επηρεάζοντας το μέγεθος του barcode. | +| `MacroPdf417FileID` | Αναγνωρίζει μοναδικά το λογικό αρχείο σε όλα τα τμήματα. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Επιτρέπει την ανασύνθεση του αρχικού αρχείου από πολλαπλά barcodes. | +| `MacroPdf417FileName` | Ανθρώπινα αναγνώσιμο όνομα αποθηκευμένο μέσα στο barcode για επεξεργασία downstream. | +| `MacroPdf417Checksum` | Παρέχει ανίχνευση σφαλμάτων με τον αλγόριθμο CCITT‑16 CRC. | +| `MacroPdf417FileSize` | Βοηθά τον αποκωδικοποιητή να γνωρίζει πότε έχει ληφθεί ολόκληρο το αρχείο. | +| `MacroPdf417TimeStamp` | Καταγράφει πότε δημιουργήθηκε το barcode, χρήσιμο για ίχνη ελέγχου. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Προαιρετικά πεδία που μπορούν να χρησιμοποιηθούν σε επιχειρηματικές ροές εργασίας. | +| `MacroPdf417Terminator` | Δείχνει ότι αυτό το τμήμα είναι το τελικό (`Set`). | + +## Βήμα 4: Αποθήκευση του barcode ως αρχείο εικόνας + +Τέλος, γράψτε το barcode σε αρχείο PNG ώστε να μπορείτε να το προβάλετε ή να το ενσωματώσετε αλλού. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Τι θα δείτε:** +Μια εικόνα PNG με όνομα `ExtPDF417Meta.png` που περιέχει ένα Macro PDF417 barcode το οποίο κωδικοποιεί το προσαρμοσμένο κείμενο και όλα τα πεδία μεταδεδομένων που ορίσατε παραπάνω. Η εικόνα μπορεί να ανοιχθεί με οποιονδήποτε τυπικό προβολέα ή να ενσωματωθεί σε PDF, αναφορές ή ιστοσελίδες. + +## Πλήρης κώδικας πηγής (έτοιμος για αντιγραφή‑επικόλληση) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Αναμενόμενη έξοδος + +Η εκτέλεση του προγράμματος εκτυπώνει: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Ανοίγοντας το `ExtPDF417Meta.png` εμφανίζεται ένα καθαρό Macro PDF417 barcode που διαβάζεται σωστά με οποιονδήποτε αναγνώστη PDF417, διατηρώντας το προσαρμοσμένο κείμενο `"Åspóse.Barcóde©"` και τα macro μεταδεδομένα που ορίσατε. + +## Συχνές ερωτήσεις και ειδικές περιπτώσεις + +- **Μπορώ να δημιουργήσω διαφορετική μορφή εικόνας;** + Ναι. Αντικαταστήστε το `BarCodeImageFormat.Png` με `Jpeg`, `Bmp` ή `Gif` ανάλογα με τις ανάγκες. + +- **Τι γίνεται αν τα δεδομένα μου υπερβαίνουν ένα μόνο barcode;** + Το Macro PDF417 έχει σχεδιαστεί για τμηματισμό. Προσαρμόστε το `MacroPdf417SegmentsCount` και το `MacroPdf417SegmentID` για κάθε μέρος, έπειτα συνδέστε τα σαρωμένα αποτελέσματα. + +- **Εγγυάται η υποστήριξη Unicode;** + Το Aspose.BarCode υποστηρίζει πλήρως Unicode. Βεβαιωθείτε ότι το αρχείο πηγής σας είναι αποθηκευμένο με κωδικοποίηση UTF‑8 ώστε να αποφύγετε διαφθορά χαρακτήρων. + +- **Χρειάζομαι άδεια για παραγωγή;** + Μια αδειοδοτημένη έκδοση αφαιρεί το υδατογράφημα αξιολόγησης και παρέχει πλήρη λειτουργικότητα. Η δοκιμαστική έκδοση λειτουργεί για δοκιμές και εκμάθηση. + +## Συμπέρασμα + +Τώρα ξέρετε πώς να **generate barcode C#** για Macro PDF417, **how to generate pdf417** με πλούσια μεταδεδομένα, **create barcode custom text**, και **generate barcode image file** χρησιμοποιώντας το Aspose.BarCode. Το πλήρες, εκτελέσιμο παράδειγμα δείχνει κάθε απαιτούμενο βήμα—from την εγκατάσταση του έργου μέχρι την αποθήκευση της τελικής εικόνας PNG. + +### Επόμενα βήματα + +- Πειραματιστείτε με άλλες ρυθμίσεις PDF417 όπως `ErrorCorrectionLevel` και `CompactPdf417` για μικρότερα σύμβολα. +- Ενσωματώστε το παραγόμενο barcode σε αναφορά PDF χρησιμοποιώντας Aspose.PDF. +- Εξερευνήστε την μαζική δημιουργία: κάντε βρόχο πάνω σε μια συλλογή αρχείων και παράγετε μια σειρά τμηματισμένων Macro PDF417 barcodes. + +Αισθανθείτε ελεύθεροι να προσαρμόσετε τον κώδικα στη δική σας ροή εργασίας, και αφήστε τη δημιουργία barcode να γίνει αδιάσπαστο μέρος των εφαρμογών C# σας. Καλό κώδικα! + +## Τι θα πρέπει να μάθετε στη συνέχεια; + +Τα παρακάτω tutorials καλύπτουν στενά συναφή θέματα που επεκτείνουν τις τεχνικές που παρουσιάστηκαν σε αυτόν τον οδηγό. Κάθε πόρος περιλαμβάνει πλήρη λειτουργικό κώδικα με βήμα‑βήμα εξηγήσεις για να σας βοηθήσει να κυριαρχήσετε επιπλέον δυνατότητες API και να εξερευνήσετε εναλλακτικές προσεγγίσεις στα δικά σας έργα. + +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generate barcode image – Code 93 with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [How to Generate and Adjust Barcode Height for One-Dimensional Databar using Aspose.BarCode for .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/greek/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..4d3c6e4c7 --- /dev/null +++ b/barcode/greek/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Δημιουργήστε γρήγορα barcode PDF417 σε C#. Μάθετε πώς να δημιουργείτε + barcode PDF417 σε C# χρησιμοποιώντας το Aspose.BarCode με συμπαγή λειτουργία και + προσαρμοσμένες ρυθμίσεις. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: el +lastmod: 2026-08-19 +og_description: Δημιουργία γραμμωτού κώδικα PDF417 σε C# με το Aspose.BarCode. Αυτό + το σεμινάριο δείχνει πώς να δημιουργήσετε γραμμωτό κώδικα PDF417 σε C# σε συμπαγή + λειτουργία, να ορίσετε τη διάσταση X και να αποθηκεύσετε ως PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Δημιουργία barcode PDF417 σε C# – οδηγός βήμα‑βήμα +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Δημιουργία barcode PDF417 σε C# – πλήρης οδηγός με συμπαγή διάταξη +url: /el/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Δημιουργία PDF417 barcode σε C# – πλήρης οδηγός + +Αν χρειάζεστε **να δημιουργήσετε PDF417 barcode** σε μια εφαρμογή .NET, αυτό το tutorial σας δείχνει ακριβώς πώς να το κάνετε. Θα δείτε ένα σύντομο, έτοιμο για παραγωγή παράδειγμα που δημιουργεί ένα συμπαγές PDF417 barcode, προσαρμόζει τη διάσταση X και αποθηκεύει το αποτέλεσμα ως εικόνα PNG. + +Η δημιουργία ενός PDF417 barcode είναι συνηθισμένη όταν πρέπει να κωδικοποιήσετε μεγάλες ποσότητες δεδομένων—όπως πληροφορίες εισιτηρίων, αποστολών ή έγγραφα ταυτότητας—in a machine‑readable format. Η χρήση του Aspose.BarCode κάνει τη διαδικασία απλή, και ο κώδικας λειτουργεί με .NET 6+ ή .NET Framework 4.7.2 και μεταγενέστερα. + +Σε αυτόν τον οδηγό θα: + +* Εγκαταστήσετε το πακέτο NuGet Aspose.BarCode. +* Γράψετε ένα αυτόνομο πρόγραμμα C# που **δημιουργεί PDF417 barcode** με μικρό αριθμό στηλών και συμπαγή (truncated) λειτουργία. +* Ρυθμίσετε το πλάτος της γραμμής (διάσταση X) για πιο καθαρή απόδοση. +* Αποθηκεύσετε το barcode ως αρχείο PNG. +* Εξερευνήσετε παραλλαγές, ακραίες περιπτώσεις και συμβουλές βέλτιστων πρακτικών. + +## Προαπαιτούμενα + +Πριν ξεκινήσετε, βεβαιωθείτε ότι έχετε: + +* Visual Studio 2022 (ή οποιοδήποτε IDE C#) με εγκατεστημένο .NET 6 SDK. +* Πρόσβαση στο Internet για λήψη του πακέτου NuGet **Aspose.BarCode**. +* Δικαίωμα εγγραφής σε φάκελο όπου θα αποθηκευτεί το αρχείο PNG. + +Δεν απαιτούνται πρόσθετες βιβλιοθήκες· το Aspose.BarCode διαχειρίζεται την κωδικοποίηση εικόνας εσωτερικά. + +## Βήμα 1: Προσθήκη του πακέτου Aspose.BarCode + +Ανοίξτε το έργο σας στο Visual Studio, κάντε δεξί κλικ στη λύση και επιλέξτε **Manage NuGet Packages**. Αναζητήστε το `Aspose.BarCode` και εγκαταστήστε την πιο πρόσφατη σταθερή έκδοση. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** Κρατήστε το πακέτο ενημερωμένο. Οι νέες κυκλοφορίες συχνά περιλαμβάνουν βελτιώσεις απόδοσης και υποστήριξη για τις πιο πρόσφατες .NET runtime. + +## Βήμα 2: Δημιουργία ελάχιστης εφαρμογής console + +Δημιουργήστε ένα νέο έργο console C# εάν δεν έχετε ήδη ένα: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Αντικαταστήστε το περιεχόμενο του `Program.cs` με το πλήρες παράδειγμα παρακάτω. Αυτό το πρόγραμμα δείχνει **πώς να δημιουργήσετε PDF417 barcode C#** από την αρχή μέχρι το τέλος. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Γιατί κάθε γραμμή έχει σημασία + +* **`EncodeTypes.Pdf417`** – επιλέγει τη συμβολική PDF417, η οποία υποστηρίζει έως ~1.1 KB δεδομένων. +* **`XDimension.Pixels = 2`** – ορίζει το βασικό πλάτος της γραμμής. Οι μικρότερες τιμές κάνουν το barcode πιο λεπτό· οι μεγαλύτερες τιμές βελτιώνουν την αναγνωσιμότητα σε συσκευές χαμηλής ανάλυσης. +* **`Pdf417.Columns = 3`** – περιορίζει τον αριθμό των στηλών, αναγκάζοντας τον δημιουργό να χρησιμοποιήσει περισσότερες γραμμές, κάτι που οδηγεί σε πιο ψηλό αλλά πιο στενό barcode. +* **`Pdf417.Truncate = true`** – ενεργοποιεί τη συμπαγή λειτουργία, αφαιρώντας το μοτίβο τερματισμού και μειώνοντας το μέγεθος της εικόνας χωρίς να χαθεί η ακεραιότητα των δεδομένων. +* **`Save(..., BarCodeImageFormat.Png)`** – γράφει ένα αρχείο PNG. Μπορείτε επίσης να επιλέξετε `Jpeg`, `Bmp` ή `Svg` ανάλογα με τις ανάγκες downstream. + +Εκτελέστε το πρόγραμμα: + +```bash +dotnet run +``` + +Θα πρέπει να δείτε την έξοδο της κονσόλας που επιβεβαιώνει τη θέση του αρχείου, και ο φάκελος θα περιέχει το `CompactPdf417.png`. Ανοίγοντας το PNG θα δείτε ένα καθαρό, συμπαγές PDF417 barcode που κωδικοποιεί τη συμβολοσειρά Unicode. + +## Βήμα 3: Επαλήθευση του barcode (προαιρετικό αλλά συνιστάται) + +Για να διασφαλίσετε ότι το barcode είναι αναγνώσιμο, μπορείτε να χρησιμοποιήσετε οποιαδήποτε τυπική εφαρμογή σάρωσης PDF417 σε smartphone ή μια βιβλιοθήκη αποκωδικοποίησης για υπολογιστή. Το κωδικοποιημένο κείμενο πρέπει να ταιριάζει ακριβώς με την αρχική συμβολοσειρά `data`, συμπεριλαμβανομένων των ειδικών χαρακτήρων. + +Αν αντιμετωπίσετε προβλήματα αποκωδικοποίησης: + +* Αυξήστε το `XDimension` σε 3 ή 4 pixel. +* Μειώστε τον αριθμό των στηλών (π.χ., ορίστε `Columns = 2`). +* Απενεργοποιήστε το `Truncate` (`Truncate = false`) για να προσθέσετε το μοτίβο τερματισμού. + +Αυτές οι προσαρμογές ανταλλάσσουν το μέγεθος με την αναγνωσιμότητα, κάτι χρήσιμο για εκτυπωτές ή σαρωτές χαμηλής ανάλυσης. + +## Βήμα 4: Εξερεύνηση κοινών παραλλαγών + +### 4️⃣ Δημιουργία PDF417 υψηλής πυκνότητας για εκτύπωση + +Εάν χρειάζεστε ένα barcode που να χωράει σε μικρή ετικέτα, αυξήστε τον αριθμό στηλών και μειώστε τη διάσταση X: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Αλλαγή μορφής εξόδου σε SVG για κλιμάκωση διανυσματικά + +Η έξοδος SVG κλιμακώνεται χωρίς απώλεια ποιότητας, ιδανική για ανταποκρινόμενες ιστοσελίδες. + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +### 6️⃣ Κωδικοποίηση δυαδικών δεδομένων (π.χ., byte array) + +Εάν χρειάζεστε ενσωμάτωση δυαδικών φορτίων, μετατρέψτε τα πρώτα σε συμβολοσειρά Base64: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +## Συχνές ερωτήσεις + +| Ερώτηση | Απάντηση | +|----------|--------| +| **Μπορώ να δημιουργήσω PDF417 χωρίς το Aspose;** | Ναι, υπάρχουν άλλες βιβλιοθήκες όπως ZXing.Net ή Dynamsoft, αλλά το Aspose.BarCode προσφέρει πιο πλούσιο έλεγχο διάταξης (στήλες, περικοπή) και καλύτερη διαχείριση Unicode. | +| **Ποιο είναι το μέγιστο μήκος δεδομένων;** | Το PDF417 μπορεί να κωδικοποιήσει έως 1.108 bytes (≈ 1 KB) δυαδικών δεδομένων. Εάν το υπερβείτε, σκεφτείτε να χωρίσετε τα δεδομένα σε πολλαπλά barcodes. | +| **Συμμορφώνεται η συμπαγής λειτουργία με τα πρότυπα;** | Το Truncated PDF417 αποτελεί μέρος του προτύπου ISO/IEC 15438 και υποστηρίζεται ευρέως, αλλά βεβαιωθείτε ότι ο στοχευόμενος σαρωτής σας το υποστηρίζει ρητά. | +| **Πώς αλλάζω το χρώμα φόντου;** | Ορίστε `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` και `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` πριν την αποθήκευση. | + +## Συμπέρασμα + +Τώρα γνωρίζετε **πώς να δημιουργήσετε PDF417 barcode C#** χρησιμοποιώντας το Aspose.BarCode, πώς να ρυθμίσετε ακριβώς τη διάσταση X, να ενεργοποιήσετε τη συμπαγή λειτουργία και να εξάγετε το αποτέλεσμα ως εικόνα PNG. Το πλήρες, εκτελέσιμο παράδειγμα μπορεί να αντιγραφεί σε οποιοδήποτε έργο .NET, και οι εμφανιζόμενες παραλλαγές σας επιτρέπουν να προσαρμόσετε το barcode για εκτύπωση, web ή σενάρια δυαδικών φορτίων. + +Επόμενα βήματα που μπορείτε να εξερευνήσετε: + +* Ενσωματώστε τη δημιουργία barcode σε ένα ASP.NET Core API που επιστρέφει την εικόνα κατ' απαίτηση. +* Συνδυάστε PDF417 με QR codes στην ίδια ετικέτα για σάρωση διπλής μορφής. +* Χρησιμοποιήστε την κλάση `Reader` του Aspose.BarCode για να αποκωδικοποιήσετε την παραγόμενη εικόνα και να επαληθεύσετε τα δεδομένα προγραμματιστικά. + +Καλή προγραμματιστική δουλειά, και απολαύστε την ευελιξία που προσφέρουν οι λύσεις **δημιουργίας PDF417 barcode** στις εφαρμογές σας! + +## Τι Θα Πρέπει Να Μάθετε Στη Σειρά; + +Τα παρακάτω tutorials καλύπτουν στενά σχετιζόμενα θέματα που βασίζονται στις τεχνικές που παρουσιάζονται σε αυτόν τον οδηγό. Κάθε πόρος περιλαμβάνει πλήρη λειτουργικά παραδείγματα κώδικα με βήμα‑βήμα εξηγήσεις για να σας βοηθήσει να κατακτήσετε πρόσθετες δυνατότητες API και να εξερευνήσετε εναλλακτικές προσεγγίσεις υλοποίησης στα δικά σας έργα. + +- [Πώς να δημιουργήσετε Barcode – Compact PDF417 με Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Πώς να δημιουργήσετε εικόνα Barcode με προσαρμογή συμπληρωματικού χώρου χρησιμοποιώντας Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [Πώς να δημιουργήσετε Aztec barcode με προσαρμοσμένη αναλογία διαστάσεων χρησιμοποιώντας Aspose.BarCode για .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hindi/net/compact-pdf417-encoding/_index.md b/barcode/hindi/net/compact-pdf417-encoding/_index.md index 7df391155..267f405ea 100644 --- a/barcode/hindi/net/compact-pdf417-encoding/_index.md +++ b/barcode/hindi/net/compact-pdf417-encoding/_index.md @@ -86,6 +86,14 @@ Aspose.BarCode आपको `Pdf417ErrorCorrectionLevel` प्रॉपर् Aspose.BarCode for .NET का उपयोग करके Compact PDF417 बारकोड कैसे जनरेट करें सीखें। चरण‑दर‑चरण निर्देशों और कोड उदाहरणों के साथ व्यापक गाइड। +### [C# में PDF417 बारकोड जनरेट करें – कॉम्पैक्ट लेआउट के साथ पूर्ण गाइड](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) + +Aspose.BarCode for .NET का उपयोग करके C# में कॉम्पैक्ट लेआउट के साथ PDF417 बारकोड बनाने की पूरी प्रक्रिया। + +### [Macro PDF417 के साथ C# में बारकोड जनरेट करें – पूर्ण उदाहरण](./generate-barcode-c-with-macro-pdf417-full-example/) + +Aspose.BarCode for .NET का उपयोग करके C# में Macro PDF417 बारकोड बनाने का पूर्ण कोड उदाहरण। + ## अक्सर पूछे जाने वाले प्रश्न **Q: Compact PDF417 बारकोड में मैं अधिकतम कितना डेटा स्टोर कर सकता हूँ?** @@ -114,4 +122,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/hindi/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..ca2735a9a --- /dev/null +++ b/barcode/hindi/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: Aspose.BarCode का उपयोग करके C# में बारकोड जेनरेट करें, कस्टम टेक्स्ट + के साथ एक मैक्रो PDF417 बनाएं और इसे इमेज फ़ाइल के रूप में सहेजें। +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: hi +lastmod: 2026-08-19 +og_description: Aspose.BarCode के साथ C# में बारकोड जनरेट करें, PDF417 कैसे बनाना + है सीखें, कस्टम टेक्स्ट जोड़ें, और बारकोड इमेज फ़ाइल को सहेजें। +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: बारकोड C# जनरेट करें – मैक्रो PDF417 गाइड +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: मैक्रो PDF417 के साथ C# में बारकोड जनरेट करें – पूर्ण उदाहरण +url: /hi/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generate barcode C# with Macro PDF417 – full example + +यदि आपको **generate barcode C#** को Macro PDF417 फ़ॉर्मेट में बनाना है, तो यह गाइड एक तैयार‑चलाने योग्य समाधान दिखाता है। आप देखेंगे कि **how to generate pdf417**, कस्टम टेक्स्ट कैसे एम्बेड करें, और **generate barcode image file** को एक ही, स्व-समाहित प्रोग्राम में कैसे बनाएं। + +यह ट्यूटोरियल Aspose.BarCode लाइब्रेरी को इंस्टॉल करने से लेकर Macro PDF417 मेटाडेटा को कॉन्फ़िगर करने तक सब कुछ कवर करता है, ताकि आप कोड को सीधे अपने प्रोजेक्ट में कॉपी करके तुरंत परिणाम देख सकें। + +## Prerequisites + +शुरू करने से पहले सुनिश्चित करें कि आपके पास है: + +- .NET 6.0 SDK या बाद का संस्करण (कोड .NET Framework 4.7+ के साथ भी काम करता है) +- Visual Studio 2022 (या कोई भी IDE जो C# को सपोर्ट करता हो) +- Aspose.BarCode for .NET लाइसेंस (मुफ़्त ट्रायल मूल्यांकन के लिए काम करता है) +- C# सिंटैक्स की बुनियादी समझ + +> **Pro tip:** संस्करण असंगतियों से बचने के लिए CLI के ज़रिए NuGet पैकेज इंस्टॉल करें: +> `dotnet add package Aspose.BarCode` + +## Step 1: Set up the project and import the library + +एक नया कंसोल एप्लिकेशन बनाएं और आवश्यक `using` निर्देश जोड़ें। + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Why this step matters:** +`Aspose.BarCode.Generation` नेमस्पेस `BarcodeGenerator` क्लास प्रदान करता है, जो किसी भी बारकोड प्रकार, जिसमें Macro PDF417 भी शामिल है, को बनाने का एंट्री पॉइंट है। `System` को इम्पोर्ट करने से आपको `DateTime` तक पहुंच मिलती है, जो टाइमस्टैम्प मेटाडेटा के लिए आवश्यक है। + +## Step 2: Create a Macro PDF417 generator with custom text + +प्लेसहोल्डर कमेंट को जेनरेटर इनिशियलाइज़ेशन से बदलें। यह **create barcode custom text** को दर्शाता है और साथ ही सही एन्कोडिंग टाइप का चयन करता है। + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Explanation:** +- `EncodeTypes.MacroPdf417` Aspose को बताता है कि वह PDF417 बारकोड बनाए जो मैक्रो सुविधाओं (फ़ाइल सेगमेंटेशन, चेकसम, आदि) को सपोर्ट करता है। +- टेक्स्ट `"Åspóse.Barcóde©"` यह दिखाता है कि यूनिकोड कैरेक्टर्स पूरी तरह सपोर्टेड हैं, जो अक्सर अंतरराष्ट्रीय एप्लिकेशन में आवश्यक होते हैं। + +## Step 3: Configure appearance and Macro PDF417 metadata + +बारकोड के आयामों को फाइन‑ट्यून करें और सेगमेंटेड फ़ाइल हैंडलिंग के लिए आवश्यक मैक्रो‑विशिष्ट फ़ील्ड सेट करें। + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Why these settings are important:** + +| Setting | Purpose | +|---------|---------| +| `XDimension.Pixels` | विज़ुअल डेंसिटी को नियंत्रित करता है; 2 px एक स्पष्ट, स्कैन करने योग्य इमेज देता है। | +| `Columns` | प्रति पंक्ति डेटा कॉलम की संख्या निर्धारित करता है, जिससे बारकोड का आकार प्रभावित होता है। | +| `MacroPdf417FileID` | सभी सेगमेंट्स में लॉजिकल फ़ाइल को यूनिकली पहचानता है। | +| `MacroPdf417SegmentID` / `SegmentsCount` | कई बारकोड्स से मूल फ़ाइल को पुनः बनाना संभव बनाता है। | +| `MacroPdf417FileName` | बारकोड के अंदर स्टोर किया गया मानव‑पठनीय नाम, डाउनस्ट्रीम प्रोसेसिंग के लिए उपयोगी। | +| `MacroPdf417Checksum` | CCITT‑16 CRC एल्गोरिद्म द्वारा एरर डिटेक्शन प्रदान करता है। | +| `MacroPdf417FileSize` | डिकोडर को बताता है कि पूरी फ़ाइल कब प्राप्त हो गई है। | +| `MacroPdf417TimeStamp` | बारकोड के जेनरेट होने का समय रिकॉर्ड करता है, ऑडिट ट्रेल के लिए उपयोगी। | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | वैकल्पिक फ़ील्ड्स जो बिज़नेस वर्कफ़्लो में इस्तेमाल हो सकते हैं। | +| `MacroPdf417Terminator` | दर्शाता है कि यह सेगमेंट अंतिम है (`Set`)। | + +## Step 4: Save the barcode as an image file + +अंत में, बारकोड को PNG फ़ाइल में लिखें ताकि आप इसे देख या कहीं और एम्बेड कर सकें। + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**What you’ll see:** +`ExtPDF417Meta.png` नाम की एक PNG इमेज जिसमें Macro PDF417 बारकोड है, जो कस्टम टेक्स्ट और ऊपर सेट किए गए सभी मेटाडेटा फ़ील्ड्स को एन्कोड करता है। इमेज को किसी भी स्टैंडर्ड व्यूअर से खोला जा सकता है या PDFs, रिपोर्ट्स, या वेब पेजेज़ में डाला जा सकता है। + +## Full source code (copy‑paste ready) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Expected output + +प्रोग्राम चलाने पर यह प्रिंट करेगा: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +`ExtPDF417Meta.png` खोलने पर एक साफ़ Macro PDF417 बारकोड दिखेगा जो किसी भी PDF417 रीडर से सही ढंग से स्कैन होता है, कस्टम टेक्स्ट `"Åspóse.Barcóde©"` और आपने परिभाषित मैक्रो मेटाडेटा को बरकरार रखता है। + +## Common questions and edge cases + +- **क्या मैं अलग इमेज फ़ॉर्मेट जेनरेट कर सकता हूँ?** + हाँ। `BarCodeImageFormat.Png` को `Jpeg`, `Bmp`, या `Gif` से बदलें जैसा आवश्यक हो। + +- **अगर मेरा डेटा एक बारकोड में फिट नहीं होता तो?** + Macro PDF417 सेगमेंटेशन के लिए डिज़ाइन किया गया है। प्रत्येक भाग के लिए `MacroPdf417SegmentsCount` और `MacroPdf417SegmentID` को समायोजित करें, फिर स्कैन किए गए परिणामों को जोड़ें। + +- **क्या Unicode सपोर्ट गारंटीड है?** + Aspose.BarCode पूरी तरह Unicode को सपोर्ट करता है। कैरेक्टर करप्शन से बचने के लिए अपने सोर्स फ़ाइल को UTF‑8 एन्कोडिंग में सेव करें। + +- **प्रोडक्शन के लिए क्या लाइसेंस चाहिए?** + लाइसेंस्ड संस्करण मूल्यांकन वॉटरमार्क को हटाता है और पूरी फ़ंक्शनैलिटी देता है। ट्रायल टेस्टिंग और सीखने के लिए पर्याप्त है। + +## Conclusion + +अब आप जानते हैं कि **generate barcode C#** को Macro PDF417 के लिए कैसे बनाएं, **how to generate pdf417** को रिच मेटाडेटा के साथ कैसे करें, **create barcode custom text**, और Aspose.BarCode का उपयोग करके **generate barcode image file** कैसे बनाएं। यह पूर्ण, चलाने योग्य उदाहरण हर आवश्यक चरण को दर्शाता है—प्रोजेक्ट सेटअप से लेकर अंतिम PNG इमेज सेव करने तक। + +### Next steps + +- `ErrorCorrectionLevel` और `CompactPdf417` जैसे अन्य PDF417 सेटिंग्स के साथ प्रयोग करें ताकि छोटे सिम्बॉल मिलें। +- Aspose.PDF का उपयोग करके जेनरेटेड बारकोड को PDF रिपोर्ट में इंटीग्रेट करें। +- बैच जेनरेशन एक्सप्लोर करें: फ़ाइलों के संग्रह पर लूप चलाकर कई सेगमेंटेड Macro PDF417 बारकोड बनाएं। + +कोड को अपने वर्कफ़्लो के अनुसार अनुकूलित करें, और बारकोड जेनरेशन को अपने C# एप्लिकेशन का सहज हिस्सा बनाएं। Happy coding! + +## What Should You Learn Next? + +निम्नलिखित ट्यूटोरियल्स उन विषयों को कवर करते हैं जो इस गाइड में दिखाए गए तकनीकों पर आधारित हैं। प्रत्येक संसाधन में पूर्ण कार्यशील कोड उदाहरण और चरण‑दर‑चरण व्याख्याएँ शामिल हैं, जिससे आप अतिरिक्त API फीचर्स में महारत हासिल कर सकें और अपने प्रोजेक्ट्स में वैकल्पिक इम्प्लीमेंटेशन अप्रोचेज़ को एक्सप्लोर कर सकें। + +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generate barcode image – Code 93 with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [How to Generate and Adjust Barcode Height for One-Dimensional Databar using Aspose.BarCode for .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/hindi/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..fea4ba2b3 --- /dev/null +++ b/barcode/hindi/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,250 @@ +--- +category: general +date: 2026-08-19 +description: सी# में PDF417 बारकोड जल्दी बनाएं। कॉम्पैक्ट मोड और कस्टम सेटिंग्स के + साथ Aspose.BarCode का उपयोग करके सी# में PDF417 बारकोड कैसे बनाएं, सीखें। +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: hi +lastmod: 2026-08-19 +og_description: Aspose.BarCode के साथ C# में PDF417 बारकोड जनरेट करें। यह ट्यूटोरियल + दिखाता है कि कैसे कॉम्पैक्ट मोड में C# में PDF417 बारकोड जनरेट करें, X‑डायमेंशन + सेट करें, और PNG के रूप में सहेजें। +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: C# में PDF417 बारकोड जेनरेट करें – चरण‑दर‑चरण गाइड +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: C# में PDF417 बारकोड जेनरेट करें – कॉम्पैक्ट लेआउट के साथ पूर्ण गाइड +url: /hi/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# में PDF417 बारकोड जनरेट करें – पूर्ण गाइड + +यदि आपको .NET एप्लिकेशन में **PDF417 बारकोड जनरेट** करना है, तो यह ट्यूटोरियल आपको ठीक‑ठीक दिखाता है कि कैसे करना है। आप एक संक्षिप्त, प्रोडक्शन‑रेडी उदाहरण देखेंगे जो एक कॉम्पैक्ट PDF417 बारकोड बनाता है, X‑डायमेंशन को कस्टमाइज़ करता है, और परिणाम को PNG इमेज के रूप में सेव करता है। + +PDF417 बारकोड का जनरेशन आमतौर पर तब किया जाता है जब आपको बड़ी मात्रा में डेटा—जैसे टिकट जानकारी, शिपिंग मैनिफेस्ट, या पहचान दस्तावेज़—को मशीन‑रीडेबल फॉर्मेट में एन्कोड करना हो। Aspose.BarCode का उपयोग प्रक्रिया को सरल बनाता है, और कोड .NET 6+ या .NET Framework 4.7.2 और उसके बाद के संस्करणों के साथ काम करता है। + +इस गाइड में आप सीखेंगे: + +* Aspose.BarCode NuGet पैकेज को इंस्टॉल करना। +* एक सेल्फ‑कंटेन्ड C# प्रोग्राम लिखना जो **PDF417 बारकोड जनरेट** करता है, जिसमें कम कॉलम काउंट और कॉम्पैक्ट (ट्रंकेटेड) मोड हो। +* शार्पर रेंडरिंग के लिए बार की चौड़ाई (X‑डायमेंशन) को एडजस्ट करना। +* बारकोड को PNG फ़ाइल के रूप में सेव करना। +* वैरिएशन्स, एज केस, और बेस्ट‑प्रैक्टिस टिप्स को एक्सप्लोर करना। + +## प्री‑रिक्विज़िट्स + +शुरू करने से पहले सुनिश्चित करें कि आपके पास है: + +* Visual Studio 2022 (या कोई भी C# IDE) जिसमें .NET 6 SDK इंस्टॉल हो। +* **Aspose.BarCode** NuGet पैकेज डाउनलोड करने के लिए इंटरनेट एक्सेस। +* उस फ़ोल्डर में लिखने की अनुमति जहाँ PNG फ़ाइल सेव होगी। + +कोई अतिरिक्त लाइब्रेरी आवश्यक नहीं है; Aspose.BarCode इमेज एन्कोडिंग को अंदरूनी रूप से संभालता है। + +## चरण 1: Aspose.BarCode पैकेज जोड़ें + +Visual Studio में अपने प्रोजेक्ट को खोलें, सॉल्यूशन पर राइट‑क्लिक करें, और **Manage NuGet Packages** चुनें। `Aspose.BarCode` खोजें और नवीनतम स्थिर संस्करण को इंस्टॉल करें। + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** पैकेज को हमेशा अपडेट रखें। नए रिलीज़ अक्सर परफ़ॉर्मेंस सुधार और नवीनतम .NET रनटाइम सपोर्ट लेकर आते हैं। + +## चरण 2: एक न्यूनतम कंसोल एप्लिकेशन बनाएं + +यदि आपके पास पहले से नहीं है, तो एक नया C# कंसोल प्रोजेक्ट बनाएं: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +`Program.cs` की सामग्री को नीचे दिए गए पूर्ण उदाहरण से बदलें। यह प्रोग्राम **C# में PDF417 बारकोड कैसे जनरेट करें** को शुरुआत से अंत तक दर्शाता है। + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### प्रत्येक लाइन का महत्व + +* **`EncodeTypes.Pdf417`** – PDF417 सिम्बोलॉजी चुनता है, जो लगभग ~1.1 KB डेटा को सपोर्ट करता है। +* **`XDimension.Pixels = 2`** – बेसिक बार की चौड़ाई सेट करता है। छोटे मान बारकोड को पतला बनाते हैं; बड़े मान कम‑रिज़ॉल्यूशन डिवाइस पर पठनीयता बढ़ाते हैं। +* **`Pdf417.Columns = 3`** – कॉलम की संख्या को सीमित करता है, जिससे जेनरेटर अधिक रो का उपयोग करता है, और बारकोड लंबा लेकिन संकरा बनता है। +* **`Pdf417.Truncate = true`** – कॉम्पैक्ट मोड सक्रिय करता है, स्टॉप पैटर्न को हटाता है और इमेज को छोटा करता है बिना डेटा इंटेग्रिटी खोए। +* **`Save(..., BarCodeImageFormat.Png)`** – PNG फ़ाइल लिखता है। आप अपनी आवश्यकता के अनुसार `Jpeg`, `Bmp`, या `Svg` भी चुन सकते हैं। + +प्रोग्राम चलाएँ: + +```bash +dotnet run +``` + +आपको कंसोल आउटपुट में फ़ाइल लोकेशन की पुष्टि दिखेगी, और फ़ोल्डर में `CompactPdf417.png` मौजूद होगा। PNG खोलने पर एक स्पष्ट, कॉम्पैक्ट PDF417 बारकोड दिखेगा जिसमें यूनिकोड स्ट्रिंग एन्कोडेड होगी। + +## चरण 3: बारकोड को वेरिफ़ाई करें (वैकल्पिक लेकिन अनुशंसित) + +बारकोड पढ़ने योग्य है या नहीं, यह सुनिश्चित करने के लिए आप किसी भी स्टैंडर्ड PDF417 स्कैनर ऐप को स्मार्टफ़ोन पर या डेस्कटॉप डिकोडर लाइब्रेरी का उपयोग कर सकते हैं। एन्कोडेड टेक्स्ट मूल `data` स्ट्रिंग से बिल्कुल मेल खाना चाहिए, जिसमें विशेष कैरेक्टर भी शामिल हों। + +यदि डिकोडिंग में समस्या आती है: + +* `XDimension` को 3 या 4 पिक्सेल तक बढ़ाएँ। +* कॉलम की संख्या घटाएँ (जैसे `Columns = 2` सेट करें)। +* `Truncate` को डिसेबल करें (`Truncate = false`) ताकि स्टॉप पैटर्न जोड़ सकें। + +ये समायोजन आकार और पठनीयता के बीच ट्रेड‑ऑफ़ करते हैं, जो लो‑रिज़ॉल्यूशन प्रिंटर या स्कैनर के लिए उपयोगी होते हैं। + +## चरण 4: सामान्य वैरिएशन्स एक्सप्लोर करें + +### 4️⃣ प्रिंटिंग के लिए हाई‑डेंसिटी PDF417 जनरेट करें + +यदि आपको छोटा लेबल चाहिए, तो कॉलम काउंट बढ़ाएँ और X‑डायमेंशन कम करें: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ आउटपुट फॉर्मेट को SVG में बदलें ताकि वेक्टर स्केलिंग मिल सके + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +SVG आउटपुट क्वालिटी लॉस के बिना स्केल होता है, जो रिस्पॉन्सिव वेब पेजों के लिए परफ़ेक्ट है। + +### 6️⃣ बाइनरी डेटा एन्कोड करें (जैसे बाइट एरे) + +यदि आपको बाइनरी पेलोड एम्बेड करना है, तो पहले उसे Base64 स्ट्रिंग में बदलें: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +अब बारकोड बाइनरी जानकारी ले जाता है, और डिकोडर को Base64 स्टेप को रिवर्स करना होगा। + +## अक्सर पूछे जाने वाले प्रश्न + +| Question | Answer | +|----------|--------| +| **क्या मैं Aspose के बिना PDF417 जनरेट कर सकता हूँ?** | हाँ, ZXing.Net या Dynamsoft जैसी अन्य लाइब्रेरीज़ मौजूद हैं, लेकिन Aspose.BarCode कॉलम, ट्रंकेशन और बेहतर Unicode हैंडलिंग जैसी उन्नत लेआउट कंट्रोल प्रदान करता है। | +| **अधिकतम डेटा लंबाई क्या है?** | PDF417 अधिकतम 1,108 बाइट्स (≈ 1 KB) बाइनरी डेटा एन्कोड कर सकता है। यदि आप इससे अधिक डेटा रखते हैं, तो डेटा को कई बारकोड में विभाजित करने पर विचार करें। | +| **क्या कॉम्पैक्ट मोड मानकों के अनुरूप है?** | ट्रंकेटेड PDF417 ISO/IEC 15438 स्पेक का हिस्सा है और व्यापक रूप से सपोर्टेड है, लेकिन सुनिश्चित करें कि आपका टार्गेट स्कैनर इसे स्पष्ट रूप से सपोर्ट करता है। | +| **बैकग्राउंड कलर कैसे बदलें?** | `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` और `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` को सेव करने से पहले सेट करें। | + +## निष्कर्ष + +अब आप **C# में PDF417 बारकोड जनरेट** करने के लिए Aspose.BarCode का उपयोग, X‑डायमेंशन को फाइन‑ट्यून करने, कॉम्पैक्ट मोड एनेबल करने, और परिणाम को PNG इमेज के रूप में एक्सपोर्ट करने में निपुण हैं। पूरा, रन करने योग्य उदाहरण किसी भी .NET प्रोजेक्ट में कॉपी किया जा सकता है, और दिखाए गए वैरिएशन्स आपको बारकोड को प्रिंटिंग, वेब, या बाइनरी पेलोड परिदृश्यों के लिए अनुकूलित करने में मदद करेंगे। + +आगे आप ये कर सकते हैं: + +* बारकोड जनरेशन को एक ASP.NET Core API में इंटीग्रेट करें जो ऑन‑डिमांड इमेज रिटर्न करे। +* उसी लेबल पर PDF417 के साथ QR कोड जोड़ें ताकि ड्यूल‑फ़ॉर्मेट स्कैनिंग संभव हो। +* Aspose.BarCode `Reader` क्लास का उपयोग करके जेनरेटेड इमेज को प्रोग्रामेटिकली डिकोड करें और डेटा वैरिफ़ाई करें। + +हैप्पी कोडिंग, और **PDF417 बारकोड जनरेट** समाधान आपके एप्लिकेशन में लाने वाली लचीलापन का आनंद लें! + +## आप अगला क्या सीखें? + +नीचे दिए गए ट्यूटोरियल्स उन विषयों को कवर करते हैं जो इस गाइड में दिखाए गए तकनीकों पर आधारित हैं। प्रत्येक रिसोर्स में पूर्ण कार्यशील कोड उदाहरण और स्टेप‑बाय‑स्टेप एक्सप्लानेशन शामिल हैं, जिससे आप अतिरिक्त API फीचर्स में महारत हासिल कर सकें और अपने प्रोजेक्ट्स में वैकल्पिक इम्प्लीमेंटेशन अप्रोचेज़ को एक्सप्लोर कर सकें। + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [How to Generate Barcode Image with Supplemental Space Customization using Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hongkong/net/compact-pdf417-encoding/_index.md b/barcode/hongkong/net/compact-pdf417-encoding/_index.md index 9254eb3ec..5c532f6a1 100644 --- a/barcode/hongkong/net/compact-pdf417-encoding/_index.md +++ b/barcode/hongkong/net/compact-pdf417-encoding/_index.md @@ -82,7 +82,8 @@ Aspose.BarCode 讓你設定 `Pdf417ErrorCorrectionLevel` 屬性 (0‑8)。較高 ## 緊湊式 PDF417 編碼教學 ### [建立緊湊式 PDF417 條碼](./compact-pdf417-basic-configuration/) -了解如何使用 Aspose.BarCode for .NET 產生緊湊式 PDF417 條碼。完整指南包含一步一步說明與程式碼範例。 +### [在 C# 中產生 PDF417 條碼 – 完整指南(緊湊版)](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +### [在 C# 中產生 Macro PDF417 條碼 – 完整範例](./generate-barcode-c-with-macro-pdf417-full-example/) ## 常見問題 @@ -112,4 +113,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/hongkong/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..9a29c9095 --- /dev/null +++ b/barcode/hongkong/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,247 @@ +--- +category: general +date: 2026-08-19 +description: 使用 Aspose.BarCode 於 C# 產生條碼,建立帶有自訂文字的 Macro PDF417,並儲存為影像檔案。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: zh-hant +lastmod: 2026-08-19 +og_description: 使用 Aspose.BarCode 於 C# 產生條碼,學習如何產生 PDF417、加入自訂文字,並儲存條碼圖像檔案。 +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: 產生條碼 C# – Macro PDF417 指南 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: 使用 Macro PDF417 於 C# 產生條碼 – 完整範例 +url: /zh-hant/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 使用 Macro PDF417 產生條碼 C# – 完整範例 + +如果您需要為 Macro PDF417 格式 **generate barcode C#**,本指南提供一個可直接執行的解決方案。您將看到如何 **how to generate pdf417**、嵌入自訂文字,以及 **generate barcode image file**,全部在單一自足的程式中。 + +本教學涵蓋從安裝 Aspose.BarCode 函式庫到設定 Macro PDF417 中繼資料的所有步驟,讓您可以直接將程式碼複製到專案中,立即看到結果。 + +## 前置條件 + +- .NET 6.0 SDK 或更新版本(此程式碼亦可於 .NET Framework 4.7+ 執行) +- Visual Studio 2022(或任何支援 C# 的 IDE) +- Aspose.BarCode for .NET 授權(免費試用版可用於評估) +- 具備基本的 C# 語法知識 + +> **Pro tip:** 透過 CLI 安裝 NuGet 套件以避免版本不匹配: +> `dotnet add package Aspose.BarCode` + +## 步驟 1:設定專案並匯入函式庫 + +建立一個新的主控台應用程式,並加入所需的 `using` 指令。 + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**為什麼此步驟重要:** +`Aspose.BarCode.Generation` 命名空間提供 `BarcodeGenerator` 類別,這是建立任何條碼類型(包括 Macro PDF417)的入口點。匯入 `System` 可取得 `DateTime` 以用於時間戳記中繼資料。 + +## 步驟 2:使用自訂文字建立 Macro PDF417 產生器 + +將佔位符註解替換為產生器的初始化程式碼。此範例示範 **create barcode custom text**,同時選擇正確的編碼類型。 + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**說明:** +- `EncodeTypes.MacroPdf417` 告訴 Aspose 產生支援宏功能(檔案分段、檢查碼等)的 PDF417 條碼。 +- 文字 `"Åspóse.Barcóde©"` 顯示 Unicode 字元得到完整支援,這在國際化應用中常見。 + +## 步驟 3:設定外觀與 Macro PDF417 中繼資料 + +微調條碼尺寸,並設定分段檔案處理所需的宏特定欄位。 + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**為什麼這些設定重要:** + +| 設定 | 目的 | +|---------|---------| +| `XDimension.Pixels` | 控制視覺密度;2 px 可產生清晰、可掃描的影像。 | +| `Columns` | 決定每列顯示多少資料欄位,影響條碼大小。 | +| `MacroPdf417FileID` | 唯一識別跨所有段的邏輯檔案。 | +| `MacroPdf417SegmentID` / `SegmentsCount` | 允許從多個條碼重建原始檔案。 | +| `MacroPdf417FileName` | 以人類可讀的名稱儲存在條碼內,供後續處理使用。 | +| `MacroPdf417Checksum` | 使用 CCITT‑16 CRC 演算法提供錯誤偵測。 | +| `MacroPdf417FileSize` | 協助解碼器判斷何時已收到完整檔案。 | +| `MacroPdf417TimeStamp` | 記錄條碼產生時間,對稽核追蹤有用。 | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | 可供業務工作流程使用的選用欄位。 | +| `MacroPdf417Terminator` | 表示此段為最後一段(`Set`)。 | + +## 步驟 4:將條碼儲存為影像檔案 + +最後,將條碼寫入 PNG 檔案,以便您檢視或嵌入其他地方。 + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**您將看到的結果:** +一個名為 `ExtPDF417Meta.png` 的 PNG 影像,內含編碼自訂文字與上述所有中繼資料欄位的 Macro PDF417 條碼。此影像可使用任何標準檢視器開啟,或插入 PDF、報告或網頁中。 + +## 完整原始碼(可直接複製貼上) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### 預期輸出 + +執行程式會輸出: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +開啟 `ExtPDF417Meta.png` 後會看到一個乾淨的 Macro PDF417 條碼,使用任何 PDF417 讀取器皆能正確掃描,且保留了自訂文字 `"Åspóse.Barcóde©"` 與您定義的宏中繼資料。 + +## 常見問題與邊緣案例 + +- **我可以產生其他影像格式嗎?** + 可以。視需求將 `BarCodeImageFormat.Png` 替換為 `Jpeg`、`Bmp` 或 `Gif`。 + +- **如果我的資料超過單一條碼的容量怎麼辦?** + Macro PDF417 為分段設計。為每個部分調整 `MacroPdf417SegmentsCount` 與 `MacroPdf417SegmentID`,然後將掃描結果串接起來。 + +- **Unicode 支援是否有保證?** + Aspose.BarCode 完全支援 Unicode。請確保您的原始檔案以 UTF‑8 編碼儲存,以免字元損壞。 + +- **正式環境需要授權嗎?** + 授權版會移除評估水印並提供完整功能。試用版可用於測試與學習。 + +## 結論 + +您現在已了解如何使用 Aspose.BarCode **generate barcode C#** 產生 Macro PDF417、**how to generate pdf417** 搭配豐富中繼資料、**create barcode custom text**,以及 **generate barcode image file**。完整且可執行的範例示範了所有必要步驟——從專案設定到儲存最終的 PNG 影像。 + +### 後續步驟 + +- 嘗試其他 PDF417 設定,例如 `ErrorCorrectionLevel` 與 `CompactPdf417`,以產生較小的符號。 +- 使用 Aspose.PDF 將產生的條碼整合至 PDF 報告中。 +- 探索批次產生:對檔案集合迴圈,產生一系列分段的 Macro PDF417 條碼。 + +隨意將程式碼套用到您的工作流程,讓條碼產生成為 C# 應用程式中順暢的一環。祝開發愉快! + +## 接下來該學什麼? + +以下教學涵蓋與本指南技術密切相關的主題,並以完整可執行的程式碼範例與逐步說明,協助您精通更多 API 功能,並在專案中探索其他實作方式。 + +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generate barcode image – Code 93 with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [How to Generate and Adjust Barcode Height for One-Dimensional Databar using Aspose.BarCode for .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/hongkong/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..e81491749 --- /dev/null +++ b/barcode/hongkong/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,248 @@ +--- +category: general +date: 2026-08-19 +description: 快速在 C# 中生成 PDF417 條碼。了解如何使用 Aspose.BarCode 於 C# 生成 PDF417 條碼,並使用緊湊模式及自訂設定。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: zh-hant +lastmod: 2026-08-19 +og_description: 使用 Aspose.BarCode 在 C# 中產生 PDF417 條碼。本教學示範如何在緊湊模式下產生 PDF417 條碼、設定 + X 尺寸,並儲存為 PNG。 +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: 在 C# 中產生 PDF417 條碼 – 步驟指南 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: 在 C# 中生成 PDF417 條碼 – 完整指南(緊湊版面) +url: /zh-hant/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# 在 C# 中產生 PDF417 條碼 – 完整指南 + +如果您需要在 .NET 應用程式中 **產生 PDF417 條碼**,本教學將會完整示範操作步驟。您將會看到一個簡潔、可投入生產環境的範例,能建立緊湊的 PDF417 條碼、調整 X‑dimension,並將結果儲存為 PNG 圖片。 + +產生 PDF417 條碼在需要將大量資料(例如票證資訊、運送清單或身分證件)編碼為機器可讀格式時相當常見。使用 Aspose.BarCode 可讓此流程變得簡單,且程式碼相容 .NET 6+ 或 .NET Framework 4.7.2 及以上版本。 + +在本指南中您將會: + +* 安裝 Aspose.BarCode NuGet 套件。 +* 撰寫一個自包含的 C# 程式,**產生 PDF417 條碼**,使用少量欄位且啟用緊湊(截斷)模式。 +* 調整條碼寬度(X‑dimension)以提升渲染銳利度。 +* 將條碼儲存為 PNG 檔案。 +* 探索變化、邊緣案例與最佳實踐技巧。 + +## 前置條件 + +在開始之前,請確保您具備: + +* 已安裝 .NET 6 SDK 的 Visual Studio 2022(或任何 C# IDE)。 +* 可連網下載 **Aspose.BarCode** NuGet 套件的網路環境。 +* 有寫入權限的資料夾,以便儲存 PNG 檔案。 + +不需要額外的函式庫;Aspose.BarCode 內部已處理影像編碼。 + +## 步驟 1:加入 Aspose.BarCode 套件 + +在 Visual Studio 中開啟您的專案,於方案上點右鍵,選取 **Manage NuGet Packages**。搜尋 `Aspose.BarCode` 並安裝最新的穩定版。 + +```bash +dotnet add package Aspose.BarCode +``` + +> **專業提示:** 請保持套件為最新版本。新版本通常包含效能提升與對最新 .NET 執行階段的支援。 + +## 步驟 2:建立最小化的主控台應用程式 + +如果尚未有專案,請建立一個新的 C# 主控台專案: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +將 `Program.cs` 的內容取代為以下完整範例。此程式示範 **如何在 C# 中產生 PDF417 條碼**,從頭到尾完整流程。 + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### 為何每一行都很重要 + +* **`EncodeTypes.Pdf417`** – 選取 PDF417 符號集,支援約 1.1 KB 的資料量。 +* **`XDimension.Pixels = 2`** – 設定基本條寬。較小的數值會讓條碼更細,較大的數值則提升低解析度裝置的可讀性。 +* **`Pdf417.Columns = 3`** – 限制欄位數,迫使產生器使用更多列,產生較高但較窄的條碼。 +* **`Pdf417.Truncate = true`** – 啟用緊湊模式,移除停止圖樣,縮小影像大小且不影響資料完整性。 +* **`Save(..., BarCodeImageFormat.Png)`** – 輸出 PNG 檔案。您亦可根據下游需求選擇 `Jpeg`、`Bmp` 或 `Svg`。 + +執行程式: + +```bash +dotnet run +``` + +您應該會在主控台看到確認檔案位置的訊息,且資料夾內會出現 `CompactPdf417.png`。開啟 PNG 後可看到清晰、緊湊的 PDF417 條碼,已正確編碼 Unicode 字串。 + +## 步驟 3:驗證條碼(可選但建議執行) + +為確保條碼可被讀取,您可以使用智慧手機上的任意標準 PDF417 掃描應用程式,或是桌面解碼函式庫。編碼後的文字應與原始 `data` 字串完全相同,包含所有特殊字元。 + +若遇到解碼問題: + +* 將 `XDimension` 提升至 3 或 4 像素。 +* 減少欄位數(例如設定 `Columns = 2`)。 +* 停用 `Truncate`(`Truncate = false`)以加入停止圖樣。 + +這些調整會在尺寸與可讀性之間取得平衡,對於低解析度的印表機或掃描器特別有用。 + +## 步驟 4:探索常見變化 + +### 4️⃣ 產生高密度 PDF417 以供列印 + +如果需要在小標籤上放置條碼,請提升欄位數並降低 X‑dimension: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ 變更輸出格式為 SVG 以支援向量縮放 + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +SVG 輸出可在不失真的情況下自由縮放,適合回應式網頁使用。 + +### 6️⃣ 編碼二進位資料(例如 byte 陣列) + +若需嵌入二進位負載,請先將其轉換為 Base64 字串: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +條碼現在攜帶二進位資訊,解碼端必須先還原 Base64 步驟。 + +## 常見問題 + +| 問題 | 答案 | +|----------|--------| +| **可以不使用 Aspose 產生 PDF417 嗎?** | 可以,還有 ZXing.Net、Dynamsoft 等其他函式庫,但 Aspose.BarCode 提供更豐富的版面控制(欄位、截斷)與更佳的 Unicode 處理。 | +| **最大資料長度是多少?** | PDF417 最多可編碼 1,108 位元組(≈ 1 KB)的二進位資料。若超過此上限,建議將資料切分至多個條碼。 | +| **緊湊模式符合標準嗎?** | 截斷式 PDF417 為 ISO/IEC 15438 規範的一部份,廣受支援,但請確認目標掃描器明確支援此模式。 | +| **如何變更背景顏色?** | 在儲存前設定 `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` 以及 `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;`。 | + +## 結論 + +您現在已掌握使用 Aspose.BarCode **在 C# 中產生 PDF417 條碼** 的方法,了解如何微調 X‑dimension、啟用緊湊模式,並將結果匯出為 PNG 圖片。完整、可執行的範例可直接複製至任何 .NET 專案,而上述變化示例則讓您能依需求將條碼應用於列印、網頁或二進位負載情境。 + +接下來可以探索的方向: + +* 將條碼產生整合至 ASP.NET Core API,依需求即時回傳影像。 +* 在同一標籤上同時結合 PDF417 與 QR Code,實現雙格式掃描。 +* 使用 Aspose.BarCode 的 `Reader` 類別解碼產生的影像,並以程式方式驗證資料。 + +祝您開發順利,盡情體驗 **產生 PDF417 條碼** 解決方案為應用程式帶來的彈性! + +## 接下來該學什麼? + +以下教學與本指南所示技術緊密相關,能協助您進一步掌握 API 功能並探索其他實作方式: + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [How to Generate Barcode Image with Supplemental Space Customization using Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/hungarian/net/compact-pdf417-encoding/_index.md b/barcode/hungarian/net/compact-pdf417-encoding/_index.md index 17598f023..d2627a062 100644 --- a/barcode/hungarian/net/compact-pdf417-encoding/_index.md +++ b/barcode/hungarian/net/compact-pdf417-encoding/_index.md @@ -83,6 +83,10 @@ 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. +### [PDF417 vonalkód generálása C#‑ban – teljes útmutató kompakt elrendezéssel](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Tanulja meg, hogyan generáljon PDF417 vonalkódot C#‑ban a kompakt elrendezéssel az Aspose.BarCode for .NET segítségével. +### [Macro PDF417 vonalkód generálása C#‑ban – teljes példa](./generate-barcode-c-with-macro-pdf417-full-example/) +Ismerje meg, hogyan hozhat létre teljes körű Macro PDF417 vonalkódot C#‑ban az Aspose.BarCode for .NET segítségével. ## Gyakran Ismételt Kérdések @@ -112,4 +116,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/hungarian/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..bee29a0b7 --- /dev/null +++ b/barcode/hungarian/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,250 @@ +--- +category: general +date: 2026-08-19 +description: Generáljon vonalkódot C#-ban az Aspose.BarCode használatával, hogy egyedi + szöveggel rendelkező Macro PDF417-et hozzon létre, és mentse képfájlba. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: hu +lastmod: 2026-08-19 +og_description: Generáljon vonalkódot C#-ban az Aspose.BarCode segítségével, tanulja + meg, hogyan generáljon PDF417-et, adjon hozzá egyéni szöveget, és mentse el a vonalkód + képfájlt. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: C#-ban vonalkód generálása – Macro PDF417 útmutató +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Vonalkód generálása C#-ban Macro PDF417-vel – teljes példa +url: /hu/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Macro PDF417 vonalkód generálása C#‑ban – teljes példa + +Ha **generate barcode C#**-ra van szükséged egy Macro PDF417 formátumhoz, ez az útmutató egy kész‑a‑futtatáshoz megoldást mutat be. Megmutatja, hogyan **how to generate pdf417**, beágyaz egy egyedi szöveget, és **generate barcode image file** egyetlen, önálló programban. + +Az útmutató mindent lefed az Aspose.BarCode könyvtár telepítésétől a Macro PDF417 metaadatok konfigurálásáig, így a kódot közvetlenül a projektedbe másolhatod, és azonnal láthatod az eredményt. + +## Előfeltételek + +- .NET 6.0 SDK vagy újabb (a kód .NET Framework 4.7+‑vel is működik) +- Visual Studio 2022 (vagy bármely C#‑t támogató IDE) +- Aspose.BarCode for .NET licenc (az ingyenes próba a kiértékeléshez megfelelő) +- Alapvető ismeretek a C# szintaxisról + +> **Pro tip:** Telepítsd a NuGet csomagot a CLI‑val a verzióeltérések elkerülése érdekében: +> `dotnet add package Aspose.BarCode` + +## 1. lépés: A projekt beállítása és a könyvtár importálása + +Hozz létre egy új konzolos alkalmazást, és add hozzá a szükséges `using` direktívákat. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Miért fontos ez a lépés:** +Az `Aspose.BarCode.Generation` névtér biztosítja a `BarcodeGenerator` osztályt, amely bármely vonalkód típus, köztük a Macro PDF417 létrehozásának belépési pontja. A `System` importálása hozzáférést ad a `DateTime`-hoz az időbélyeg metaadatokhoz. + +## 2. lépés: Macro PDF417 generátor létrehozása egyedi szöveggel + +Cseréld le a helyőrző megjegyzést a generátor inicializálására. Ez bemutatja a **create barcode custom text**-et, miközben a megfelelő kódolási típust választja. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Magyarázat:** +- `EncodeTypes.MacroPdf417` azt mondja az Aspose-nak, hogy PDF417 vonalkódot állítson elő, amely támogatja a makró funkciókat (fájl szegmentálás, ellenőrzőösszeg stb.). +- A `"Åspóse.Barcóde©"` szöveg azt mutatja, hogy a Unicode karakterek teljesen támogatottak, ami gyakran szükséges nemzetközi alkalmazásoknál. + +## 3. lépés: Megjelenés és Macro PDF417 metaadatok konfigurálása + +Finomhangold a vonalkód méreteit, és állítsd be a szegmentált fájlkezeléshez szükséges makró‑specifikus mezőket. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Miért fontosak ezek a beállítások:** + +| Setting | Purpose | +|---------|---------| +| `XDimension.Pixels` | A vizuális sűrűséget szabályozza; 2 px tiszta, beolvasható képet eredményez. | +| `Columns` | Meghatározza, hány adat oszlop jelenik meg soronként, befolyásolva a vonalkód méretét. | +| `MacroPdf417FileID` | Egyedileg azonosítja a logikai fájlt az összes szegmens között. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Lehetővé teszi az eredeti fájl rekonstruálását több vonalkódból. | +| `MacroPdf417FileName` | Ember által olvasható név, amely a vonalkódban tárolódik a további feldolgozáshoz. | +| `MacroPdf417Checksum` | Hibadetektálást biztosít a CCITT‑16 CRC algoritmus használatával. | +| `MacroPdf417FileSize` | Segíti a dekódert felismerni, mikor érkezett meg a teljes fájl. | +| `MacroPdf417TimeStamp` | Rögzíti, mikor készült a vonalkód, ami hasznos audit nyomvonalakhoz. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Opcionális mezők, amelyeket üzleti munkafolyamatok használhatnak. | +| `MacroPdf417Terminator` | Jelzi, hogy ez a szegmens az utolsó (`Set`). | + +## 4. lépés: A vonalkód mentése képfájlba + +Végül írd a vonalkódot egy PNG fájlba, hogy megtekintsd vagy máshová beágyazd. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Ami megjelenik:** +Egy `ExtPDF417Meta.png` nevű PNG kép, amely Macro PDF417 vonalkódot tartalmaz, és kódolja a fenti egyedi szöveget és az összes metaadat mezőt. A képet bármely szabványos megjelenítővel megnyithatod, vagy PDF‑ekbe, jelentésekbe, weboldalakba beillesztheted. + +## Teljes forráskód (másolás‑beillesztés kész) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Várható kimenet + +A program futtatása a következőt írja ki: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +`ExtPDF417Meta.png` megnyitása egy tiszta Macro PDF417 vonalkódot mutat, amely bármely PDF417 olvasóval helyesen beolvasható, megőrizve a `"Åspóse.Barcóde©"` egyedi szöveget és a definiált makró metaadatokat. + +## Gyakori kérdések és szélhelyzetek + +- **Generálhatok más képkimenetet?** + Igen. Cseréld le a `BarCodeImageFormat.Png`-t `Jpeg`, `Bmp` vagy `Gif`‑re igény szerint. + +- **Mi van, ha az adataim meghaladják egyetlen vonalkód kapacitását?** + A Macro PDF417 a szegmentálásra van tervezve. Állítsd be a `MacroPdf417SegmentsCount` és `MacroPdf417SegmentID` értékeket minden részhez, majd fűzd össze a beolvasott eredményeket. + +- **Garantált a Unicode támogatás?** + Az Aspose.BarCode teljes mértékben támogatja a Unicode‑ot. Győződj meg róla, hogy a forrásfájl UTF‑8 kódolással van mentve a karakterhibák elkerülése érdekében. + +- **Szükség van licencre a termeléshez?** + A licencelt verzió eltávolítja a kiértékelési vízjelet és teljes funkcionalitást biztosít. A próba verzió teszteléshez és tanuláshoz megfelelő. + +## Következtetés + +Most már tudod, hogyan **generate barcode C#** egy Macro PDF417-hez, **how to generate pdf417** gazdag metaadatokkal, **create barcode custom text**, és **generate barcode image file** az Aspose.BarCode használatával. A teljes, futtatható példa bemutatja az összes szükséges lépést – a projekt beállításától a végső PNG kép mentéséig. + +### Következő lépések + +- Kísérletezz más PDF417 beállításokkal, például `ErrorCorrectionLevel` és `CompactPdf417` kisebb szimbólumokhoz. +- Integráld a generált vonalkódot egy PDF jelentésbe az Aspose.PDF segítségével. +- Fedezd fel a kötegelt generálást: iterálj egy fájlgyűjteményen, és állíts elő egy sor szegmentált Macro PDF417 vonalkódot. + +Nyugodtan igazítsd a kódot a saját munkafolyamatodhoz, és engedd, hogy a vonalkód generálás zökkenőmentes része legyen a C# alkalmazásaidnak. Boldog kódolást! + +## Mit érdemes legközelebb megtanulni? + +A következő útmutatók szorosan kapcsolódó témákat fednek le, amelyek a jelen útmutatóban bemutatott technikákra épülnek. Minden forrás teljes, működő kódrészleteket tartalmaz lépésről‑lépésre magyarázatokkal, hogy elsajátíthasd a további API funkciókat, és alternatív megvalósítási megközelítéseket fedezhess fel saját projektjeidben. + +- [Hogyan generáljunk Aztec vonalkódot egyedi képaránnyal az Aspose.BarCode for .NET használatával](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Vonalkód kép generálása – Code 93 az Aspose.BarCode-dal](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Hogyan generáljunk és állítsunk be vonalkód magasságot egy dimenziós Databarhoz az Aspose.BarCode for .NET használatával](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/hungarian/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..ce5fb9c71 --- /dev/null +++ b/barcode/hungarian/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: PDF417 vonalkód gyors generálása C#-ban. Tanulja meg, hogyan generáljon + PDF417 vonalkódot C#-ban az Aspose.BarCode segítségével kompakt módban és egyéni + beállításokkal. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: hu +lastmod: 2026-08-19 +og_description: PDF417 vonalkód generálása C#-ban az Aspose.BarCode segítségével. + Ez az útmutató bemutatja, hogyan generáljunk PDF417 vonalkódot C#-ban kompakt módban, + állítsuk be az X-dimenziót, és mentsük PNG formátumban. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: PDF417 vonalkód generálása C#‑ban – lépésről‑lépésre útmutató +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: PDF417 vonalkód generálása C#-ban – teljes útmutató kompakt elrendezéssel +url: /hu/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# PDF417 vonalkód generálása C#‑ban – teljes útmutató + +Ha **PDF417 vonalkódot** kell generálnia egy .NET alkalmazásban, ez a bemutató pontosan megmutatja, hogyan teheti meg. Egy tömör, termelésre kész példát láthat, amely egy kompakt PDF417 vonalkódot hoz létre, testreszabja az X‑dimenziót, és PNG képként menti az eredményt. + +PDF417 vonalkód generálása gyakori, ha nagy mennyiségű adatot – például jegyinformációkat, szállítási jegyzékeket vagy személyazonosító dokumentumokat – géppel olvasható formátumban kell kódolni. Az Aspose.BarCode használata egyszerűvé teszi a folyamatot, és a kód .NET 6+ vagy .NET Framework 4.7.2 és újabb verziókkal működik. + +Ebben az útmutatóban Ön: + +* Az Aspose.BarCode NuGet csomag telepítése. +* Önálló C# program írása, amely **PDF417 vonalkódot** generál kis oszlopszámmal és kompakt (csonkított) móddal. +* A vonal szélességének (X‑dimenzió) beállítása a tisztább megjelenítéshez. +* A vonalkód mentése PNG fájlként. +* Változatok, szélsőséges esetek és legjobb gyakorlatok felfedezése. + +## Előfeltételek + +Mielőtt elkezdené, győződjön meg róla, hogy rendelkezik: + +* Visual Studio 2022 (vagy bármely C# IDE) .NET 6 SDK‑val telepítve. +* Internetkapcsolat a **Aspose.BarCode** NuGet csomag letöltéséhez. +* Írási jogosultság egy olyan mappához, ahová a PNG fájl mentésre kerül. + +Nem szükséges további könyvtár; az Aspose.BarCode belsőleg kezeli a kép kódolását. + +## 1. lépés: Az Aspose.BarCode csomag hozzáadása + +Nyissa meg a projektet a Visual Studio‑ban, kattintson jobb gombbal a megoldásra, és válassza a **Manage NuGet Packages** menüpontot. Keressen rá a `Aspose.BarCode` csomagra, és telepítse a legújabb stabil verziót. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** Tartsa a csomagot naprakészen. Az új kiadások gyakran tartalmaznak teljesítményjavításokat és támogatást a legújabb .NET futtatókörnyezetekhez. + +## 2. lépés: Minimális konzolalkalmazás létrehozása + +Ha még nincs, hozzon létre egy új C# konzolprojektet: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Cserélje le a `Program.cs` tartalmát az alábbi teljes példára. Ez a program bemutatja, hogyan **generáljon PDF417 vonalkódot C#‑ban** a kezdetektől a végéig. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Miért fontos minden sor + +* **`EncodeTypes.Pdf417`** – kiválasztja a PDF417 szimbólumot, amely körülbelül 1,1 KB adatot támogat. +* **`XDimension.Pixels = 2`** – beállítja az alap vonal szélességet. A kisebb értékek vékonyabb vonalkódot eredményeznek; a nagyobb értékek javítják az olvashatóságot alacsony felbontású eszközökön. +* **`Pdf417.Columns = 3`** – korlátozza az oszlopok számát, így a generátor több sort használ, ami magasabb, de keskenyebb vonalkódot eredményez. +* **`Pdf417.Truncate = true`** – aktiválja a kompakt módot, eltávolítja a stop mintát és zsugorítja a képet adat integritás vesztesége nélkül. +* **`Save(..., BarCodeImageFormat.Png)`** – PNG fájlt ír. A `Jpeg`, `Bmp` vagy `Svg` formátumot is választhatja a további igényeknek megfelelően. + +Futtassa a programot: + +```bash +dotnet run +``` + +A konzolban látnia kell a fájl helyét megerősítő üzenetet, és a mappában megtalálja a `CompactPdf417.png` fájlt. A PNG megnyitása egy tiszta, kompakt PDF417 vonalkódot mutat, amely a Unicode karakterláncot kódolja. + +## 3. lépés: A vonalkód ellenőrzése (opcionális, de ajánlott) + +A vonalkód olvashatóságának biztosításához használhat bármely szabványos PDF417 szkenner alkalmazást okostelefonon vagy asztali dekóder könyvtárat. A kódolt szövegnek pontosan meg kell egyeznie az eredeti `data` karakterlánccal, beleértve a speciális karaktereket is. + +Ha dekódolási problémákat tapasztal: + +* Növelje a `XDimension` értékét 3 vagy 4 pixelre. +* Csökkentse az oszlopok számát (például állítsa `Columns = 2`‑re). +* `Truncate` letiltása (`Truncate = false`) a stop minta hozzáadásához. + +Ezek a beállítások a méretet a olvashatóság javára cserélik, ami alacsony felbontású nyomtatók vagy szkennerek esetén hasznos. + +## 4. lépés: Gyakori változatok felfedezése + +### 4️⃣ Magas sűrűségű PDF417 generálása nyomtatáshoz + +Ha olyan vonalkódra van szüksége, amely egy kis címkén elfér, növelje az oszlopok számát és csökkentse az X‑dimenziót: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Kimeneti formátum SVG‑re változtatása vektoros skálázáshoz + +Az SVG kimenet minőségvesztés nélkül skálázható, tökéletes a reszponzív weboldalakhoz. + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +### 6️⃣ Bináris adatok kódolása (például byte tömb) + +Ha bináris terhelést kell beágyazni, először konvertálja Base64 karakterláncra: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +A vonalkód most már a bináris információt hordozza, és a dekódernek vissza kell fordítania a Base64 lépést. + +## Gyakran ismételt kérdések + +| Question | Answer | +|----------|--------| +| **Generálhatok PDF417-et Aspose nélkül?** | Igen, léteznek más könyvtárak, mint a ZXing.Net vagy a Dynamsoft, de az Aspose.BarCode gazdagabb elrendezés‑vezérlést (oszlopok, csonkítás) és jobb Unicode kezelést kínál. | +| **Mi a maximális adatméret?** | A PDF417 legfeljebb 1 108 bájtot (≈ 1 KB) bináris adatot képes kódolni. Ha ezt meghaladja, fontolja meg az adat több vonalkódra bontását. | +| **A kompakt mód megfelel a szabványoknak?** | A csonkított PDF417 része az ISO/IEC 15438 specifikációnak és széles körben támogatott, de ellenőrizze, hogy a cél szkenner kifejezetten támogatja‑e. | +| **Hogyan változtathatom meg a háttérszínt?** | Állítsa be `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` és `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` értékeket a mentés előtt. | + +## Összegzés + +Most már tudja, **hogyan generáljon PDF417 vonalkódot C#‑ban** az Aspose.BarCode használatával, hogyan finomhangolja az X‑dimenziót, aktiválja a kompakt módot, és exportálja az eredményt PNG képként. A teljes, futtatható példát bármely .NET projektbe másolhatja, és a bemutatott változatok lehetővé teszik a vonalkód testreszabását nyomtatáshoz, webhez vagy bináris terhelés esetén. + +Az alábbi következő lépéseket érdemes megvizsgálni: + +* Integrálja a vonalkód generálást egy ASP.NET Core API‑ba, amely kérésre visszaadja a képet. +* Kombinálja a PDF417-et QR kódokkal ugyanazon a címkén a kettős formátumú szkenneléshez. +* Használja az Aspose.BarCode `Reader` osztályt a generált kép dekódolásához és az adatok programozott ellenőrzéséhez. + +Boldog kódolást, és élvezze a **PDF417 vonalkód generálás** megoldások nyújtotta rugalmasságot alkalmazásaiban! + +## Mit érdemes legközelebb tanulni? + +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 teljes, működő kódrészleteket tartalmaz lépésről‑lépésre magyarázatokkal, hogy elsajátíthassa a további API funkciókat és alternatív megvalósítási megközelítéseket saját projektjeiben. + +- [Hogyan hozzunk létre vonalkódot – Kompakt PDF417 az Aspose.BarCode‑dal](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Hogyan generáljunk vonalkód képet kiegészítő tér testreszabásával az Aspose.BarCode használatával](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [Hogyan generáljunk Aztec vonalkódot egyedi képaránnyal az Aspose.BarCode for .NET használatával](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/indonesian/net/compact-pdf417-encoding/_index.md b/barcode/indonesian/net/compact-pdf417-encoding/_index.md index e49f3f784..fbb9865e8 100644 --- a/barcode/indonesian/net/compact-pdf417-encoding/_index.md +++ b/barcode/indonesian/net/compact-pdf417-encoding/_index.md @@ -78,6 +78,12 @@ 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. +### [Menghasilkan barcode PDF417 di C# – panduan lengkap dengan tata letak kompak](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Panduan langkah demi langkah untuk membuat barcode PDF417 dengan layout kompak menggunakan C# dan Aspose.BarCode. + +### [Menghasilkan barcode C# dengan Macro PDF417 – contoh lengkap](./generate-barcode-c-with-macro-pdf417-full-example/) +Panduan lengkap contoh kode untuk menghasilkan barcode Macro PDF417 menggunakan C# dengan Aspose.BarCode. + ## Frequently Asked Questions **Q: Apa jumlah maksimum data yang dapat saya simpan dalam barcode Compact PDF417?** @@ -106,4 +112,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/indonesian/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..834be53bc --- /dev/null +++ b/barcode/indonesian/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Hasilkan barcode C# menggunakan Aspose.BarCode untuk membuat Macro PDF417 + dengan teks khusus dan simpan sebagai file gambar. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: id +lastmod: 2026-08-19 +og_description: Buat barcode C# dengan Aspose.BarCode, pelajari cara menghasilkan + PDF417, tambahkan teks khusus, dan simpan file gambar barcode. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Buat barcode C# – Panduan Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Buat barcode C# dengan Macro PDF417 – contoh lengkap +url: /id/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Menghasilkan barcode C# dengan Macro PDF417 – contoh lengkap + +Jika Anda perlu **menghasilkan barcode C#** untuk format Macro PDF417, panduan ini menunjukkan solusi siap‑jalankan. Anda akan melihat cara **menghasilkan pdf417**, menyematkan teks khusus, dan **menghasilkan file gambar barcode** dalam satu program yang berdiri sendiri. + +Tutorial ini mencakup semua hal mulai dari menginstal pustaka Aspose.BarCode hingga mengonfigurasi metadata Macro PDF417, sehingga Anda dapat menyalin kode langsung ke dalam proyek Anda dan melihat hasilnya segera. + +## Prasyarat + +- .NET 6.0 SDK atau yang lebih baru (kode juga berfungsi dengan .NET Framework 4.7+) +- Visual Studio 2022 (atau IDE apa pun yang mendukung C#) +- Lisensi Aspose.BarCode untuk .NET (versi percobaan gratis dapat digunakan untuk evaluasi) +- Familiaritas dasar dengan sintaks C# + +> **Pro tip:** Instal paket NuGet melalui CLI untuk menghindari ketidaksesuaian versi: +> `dotnet add package Aspose.BarCode` + +## Langkah 1: Siapkan proyek dan impor pustaka + +Buat aplikasi konsol baru dan tambahkan direktif `using` yang diperlukan. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Mengapa langkah ini penting:** +Namespace `Aspose.BarCode.Generation` menyediakan kelas `BarcodeGenerator`, yang merupakan titik masuk untuk membuat jenis barcode apa pun, termasuk Macro PDF417. Mengimpor `System` memberi Anda akses ke `DateTime` untuk metadata timestamp. + +## Langkah 2: Buat generator Macro PDF417 dengan teks khusus + +Ganti komentar placeholder dengan inisialisasi generator. Ini menunjukkan **membuat teks khusus barcode** sambil juga memilih tipe enkoding yang tepat. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Penjelasan:** +- `EncodeTypes.MacroPdf417` memberi tahu Aspose untuk menghasilkan barcode PDF417 yang mendukung fitur macro (segmentasi file, checksum, dll.). +- Teks `"Åspóse.Barcóde©"` menunjukkan bahwa karakter Unicode didukung sepenuhnya, yang sering diperlukan untuk aplikasi internasional. + +## Langkah 3: Konfigurasikan tampilan dan metadata Macro PDF417 + +Sesuaikan dimensi barcode dan atur bidang khusus macro yang diperlukan untuk penanganan file tersegmentasi. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Mengapa pengaturan ini penting:** + +| Pengaturan | Tujuan | +|------------|--------| +| `XDimension.Pixels` | Mengontrol kepadatan visual; 2 px menghasilkan gambar yang jelas dan dapat dipindai. | +| `Columns` | Menentukan berapa banyak kolom data yang muncul per baris, memengaruhi ukuran barcode. | +| `MacroPdf417FileID` | Mengidentifikasi secara unik file logis di seluruh segmen. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Memungkinkan rekonstruksi file asli dari beberapa barcode. | +| `MacroPdf417FileName` | Nama yang dapat dibaca manusia disimpan di dalam barcode untuk pemrosesan selanjutnya. | +| `MacroPdf417Checksum` | Menyediakan deteksi kesalahan menggunakan algoritma CRC CCITT‑16. | +| `MacroPdf417FileSize` | Membantu decoder mengetahui kapan seluruh file telah diterima. | +| `MacroPdf417TimeStamp` | Mencatat kapan barcode dihasilkan, berguna untuk jejak audit. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Bidang opsional yang dapat digunakan dalam alur kerja bisnis. | +| `MacroPdf417Terminator` | Menunjukkan bahwa segmen ini adalah yang terakhir (`Set`). | + +## Langkah 4: Simpan barcode sebagai file gambar + +Akhirnya, tulis barcode ke file PNG sehingga Anda dapat melihat atau menyematkannya di tempat lain. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Apa yang akan Anda lihat:** +Sebuah gambar PNG bernama `ExtPDF417Meta.png` yang berisi barcode Macro PDF417 yang mengenkode teks khusus dan semua bidang metadata yang Anda atur di atas. Gambar ini dapat dibuka dengan penampil standar apa pun atau disisipkan ke dalam PDF, laporan, atau halaman web. + +## Kode sumber lengkap (siap salin‑tempel) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Output yang diharapkan + +Running the program prints: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Membuka `ExtPDF417Meta.png` menampilkan barcode Macro PDF417 yang bersih dan dapat dipindai dengan benar oleh pembaca PDF417 apa pun, mempertahankan teks khusus `"Åspóse.Barcóde©"` dan metadata macro yang Anda definisikan. + +## Pertanyaan umum dan kasus tepi + +- **Apakah saya dapat menghasilkan format gambar lain?** + Ya. Ganti `BarCodeImageFormat.Png` dengan `Jpeg`, `Bmp`, atau `Gif` sesuai kebutuhan. + +- **Bagaimana jika data saya melebihi satu barcode?** + Macro PDF417 dirancang untuk segmentasi. Sesuaikan `MacroPdf417SegmentsCount` dan `MacroPdf417SegmentID` untuk setiap bagian, lalu gabungkan hasil pemindaian. + +- **Apakah dukungan Unicode dijamin?** + Aspose.BarCode sepenuhnya mendukung Unicode. Pastikan file sumber Anda disimpan dengan encoding UTF‑8 untuk menghindari korupsi karakter. + +- **Apakah saya memerlukan lisensi untuk produksi?** + Versi berlisensi menghapus watermark evaluasi dan menyediakan fungsionalitas penuh. Versi percobaan dapat digunakan untuk pengujian dan pembelajaran. + +## Kesimpulan + +Anda kini tahu cara **menghasilkan barcode C#** untuk Macro PDF417, **cara menghasilkan pdf417** dengan metadata kaya, **membuat teks khusus barcode**, dan **menghasilkan file gambar barcode** menggunakan Aspose.BarCode. Contoh lengkap yang dapat dijalankan ini memperlihatkan setiap langkah yang diperlukan—dari penyiapan proyek hingga menyimpan gambar PNG akhir. + +### Langkah selanjutnya + +- Bereksperimen dengan pengaturan PDF417 lainnya seperti `ErrorCorrectionLevel` dan `CompactPdf417` untuk simbol yang lebih kecil. +- Integrasikan barcode yang dihasilkan ke dalam laporan PDF menggunakan Aspose.PDF. +- Jelajahi pembuatan batch: lakukan loop pada koleksi file dan hasilkan serangkaian barcode Macro PDF417 yang tersegmentasi. + +Silakan sesuaikan kode untuk alur kerja Anda sendiri, dan biarkan pembuatan barcode menjadi bagian yang mulus dari aplikasi C# Anda. Selamat coding! + +## Apa yang Harus Anda Pelajari Selanjutnya? + +Tutorial berikut mencakup topik yang sangat terkait yang membangun teknik yang ditunjukkan dalam panduan ini. Setiap sumber menyertakan contoh kode lengkap yang berfungsi dengan penjelasan langkah demi langkah untuk membantu Anda menguasai fitur API tambahan dan mengeksplorasi pendekatan implementasi alternatif dalam proyek Anda sendiri. + +- [Cara menghasilkan barcode Aztec dengan rasio aspek khusus menggunakan Aspose.BarCode untuk .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Hasilkan gambar barcode – Code 93 dengan Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Cara Menghasilkan dan Menyesuaikan Tinggi Barcode untuk One-Dimensional Databar menggunakan Aspose.BarCode untuk .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/indonesian/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..4290b54c2 --- /dev/null +++ b/barcode/indonesian/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: Hasilkan kode batang PDF417 dalam C# dengan cepat. Pelajari cara menghasilkan + kode batang PDF417 C# menggunakan Aspose.BarCode dengan mode kompak dan pengaturan + khusus. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: id +lastmod: 2026-08-19 +og_description: Hasilkan kode batang PDF417 dalam C# dengan Aspose.BarCode. Tutorial + ini menunjukkan cara menghasilkan kode batang PDF417 C# dalam mode kompak, mengatur + dimensi X, dan menyimpan sebagai PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Buat kode batang PDF417 di C# – panduan langkah demi langkah +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Menghasilkan barcode PDF417 di C# – panduan lengkap dengan tata letak kompak +url: /id/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Menghasilkan barcode PDF417 di C# – panduan lengkap + +Jika Anda perlu **menghasilkan barcode PDF417** dalam aplikasi .NET, tutorial ini menunjukkan secara tepat cara melakukannya. Anda akan melihat contoh singkat yang siap produksi yang membuat barcode PDF417 yang kompak, menyesuaikan dimensi X, dan menyimpan hasilnya sebagai gambar PNG. + +Membuat barcode PDF417 umum dilakukan ketika Anda harus mengkodekan sejumlah besar data—seperti informasi tiket, manifest pengiriman, atau dokumen identitas—dalam format yang dapat dibaca mesin. Menggunakan Aspose.BarCode membuat prosesnya sederhana, dan kode tersebut bekerja dengan .NET 6+ atau .NET Framework 4.7.2 dan yang lebih baru. + +Dalam panduan ini Anda akan: + +* Menginstal paket NuGet Aspose.BarCode. +* Menulis program C# mandiri yang **menghasilkan barcode PDF417** dengan jumlah kolom kecil dan mode kompak (dipotong). +* Menyesuaikan lebar bar (dimensi X) untuk tampilan yang lebih tajam. +* Menyimpan barcode sebagai file PNG. +* Menjelajahi variasi, kasus tepi, dan tip praktik terbaik. + +## Prasyarat + +Sebelum Anda memulai, pastikan Anda memiliki: + +* Visual Studio 2022 (atau IDE C# apa pun) dengan .NET 6 SDK terinstal. +* Akses internet untuk mengunduh paket NuGet **Aspose.BarCode**. +* Izin menulis ke folder tempat file PNG akan disimpan. + +Tidak ada pustaka tambahan yang diperlukan; Aspose.BarCode menangani enkoding gambar secara internal. + +## Langkah 1: Tambahkan paket Aspose.BarCode + +Buka proyek Anda di Visual Studio, klik kanan solusi, dan pilih **Manage NuGet Packages**. Cari `Aspose.BarCode` dan instal versi stabil terbaru. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** Jaga paket tetap terbaru. Rilis baru sering menyertakan peningkatan performa dan dukungan untuk runtime .NET terbaru. + +## Langkah 2: Buat aplikasi konsol minimal + +Buat proyek konsol C# baru jika Anda belum memilikinya: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Ganti isi `Program.cs` dengan contoh lengkap di bawah ini. Program ini menunjukkan **cara menghasilkan barcode PDF417 C#** dari awal hingga akhir. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Mengapa setiap baris penting + +* **`EncodeTypes.Pdf417`** – memilih simbolologi PDF417, yang mendukung hingga ~1,1 KB data. +* **`XDimension.Pixels = 2`** – mengatur lebar bar dasar. Nilai yang lebih kecil membuat barcode lebih tipis; nilai yang lebih besar meningkatkan keterbacaan pada perangkat beresolusi rendah. +* **`Pdf417.Columns = 3`** – membatasi jumlah kolom, memaksa generator menggunakan lebih banyak baris, yang menghasilkan barcode lebih tinggi tetapi lebih sempit. +* **`Pdf417.Truncate = true`** – mengaktifkan mode kompak, menghapus pola berhenti dan memperkecil gambar tanpa kehilangan integritas data. +* **`Save(..., BarCodeImageFormat.Png)`** – menulis file PNG. Anda juga dapat memilih `Jpeg`, `Bmp`, atau `Svg` tergantung kebutuhan downstream. + +Jalankan program: + +```bash +dotnet run +``` + +Anda akan melihat output konsol yang mengonfirmasi lokasi file, dan folder akan berisi `CompactPdf417.png`. Membuka PNG menampilkan barcode PDF417 yang jelas dan kompak yang mengenkode string Unicode. + +## Langkah 3: Verifikasi barcode (opsional tetapi disarankan) + +Untuk memastikan barcode dapat dibaca, Anda dapat menggunakan aplikasi pemindai PDF417 standar pada smartphone atau pustaka decoder desktop. Teks yang dienkode harus cocok persis dengan string `data` asli, termasuk karakter khusus. + +Jika Anda mengalami masalah decoding: + +* Tingkatkan `XDimension` menjadi 3 atau 4 piksel. +* Kurangi jumlah kolom (misalnya, set `Columns = 2`). +* Nonaktifkan `Truncate` (`Truncate = false`) untuk menambahkan pola berhenti. + +Penyesuaian ini menukar ukuran dengan keterbacaan, yang berguna untuk printer atau pemindai beresolusi rendah. + +## Langkah 4: Jelajahi variasi umum + +### 4️⃣ Hasilkan PDF417 berkecepatan tinggi untuk pencetakan + +Jika Anda memerlukan barcode yang muat pada label kecil, tingkatkan jumlah kolom dan turunkan dimensi X: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Ubah format output ke SVG untuk penskalaan vektor + +Output SVG dapat diskalakan tanpa kehilangan kualitas, sempurna untuk halaman web responsif. + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +### 6️⃣ Enkode data biner (mis., array byte) + +Jika Anda perlu menyematkan muatan biner, konversikan terlebih dahulu ke string Base64: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Barcode kini membawa informasi biner, dan decoder harus membalikkan langkah Base64. + +## Pertanyaan yang sering diajukan + +| Pertanyaan | Jawaban | +|------------|---------| +| **Apakah saya dapat menghasilkan PDF417 tanpa Aspose?** | Ya, pustaka lain seperti ZXing.Net atau Dynamsoft ada, tetapi Aspose.BarCode menawarkan kontrol tata letak yang lebih kaya (kolom, pemotongan) dan penanganan Unicode yang lebih baik. | +| **Berapa panjang data maksimum?** | PDF417 dapat mengenkode hingga 1.108 byte (≈ 1 KB) data biner. Jika Anda melebihi ini, pertimbangkan membagi data ke beberapa barcode. | +| **Apakah mode kompak sesuai standar?** | PDF417 yang dipotong merupakan bagian dari spesifikasi ISO/IEC 15438 dan didukung secara luas, tetapi pastikan pemindai target Anda secara eksplisit mendukungnya. | +| **Bagaimana cara mengubah warna latar belakang?** | Setel `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` dan `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` sebelum menyimpan. | + +## Kesimpulan + +Anda kini tahu **cara menghasilkan barcode PDF417 C#** menggunakan Aspose.BarCode, cara menyesuaikan dimensi X, mengaktifkan mode kompak, dan mengekspor hasilnya sebagai gambar PNG. Contoh lengkap yang dapat dijalankan dapat disalin ke proyek .NET apa pun, dan variasi yang ditunjukkan memungkinkan Anda menyesuaikan barcode untuk pencetakan, web, atau skenario muatan biner. + +Langkah selanjutnya yang dapat Anda jelajahi: + +* Mengintegrasikan pembuatan barcode ke dalam API ASP.NET Core yang mengembalikan gambar sesuai permintaan. +* Menggabungkan PDF417 dengan kode QR pada label yang sama untuk pemindaian format ganda. +* Menggunakan kelas `Reader` Aspose.BarCode untuk mendekode gambar yang dihasilkan dan memverifikasi data secara programatik. + +Selamat coding, dan nikmati fleksibilitas yang dibawa solusi **menghasilkan barcode PDF417** ke aplikasi Anda! + +## Apa yang Harus Anda Pelajari Selanjutnya? + +Tutorial berikut mencakup topik terkait yang erat dengan teknik yang ditunjukkan dalam panduan ini. Setiap sumber menyertakan contoh kode lengkap yang berfungsi dengan penjelasan langkah demi langkah untuk membantu Anda menguasai fitur API tambahan dan mengeksplorasi pendekatan implementasi alternatif dalam proyek Anda sendiri. + +- [Cara Membuat Barcode – PDF417 Kompak dengan Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Cara Menghasilkan Gambar Barcode dengan Kustomisasi Ruang Tambahan menggunakan Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [Cara menghasilkan barcode Aztec dengan rasio aspek khusus menggunakan Aspose.BarCode untuk .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/italian/net/compact-pdf417-encoding/_index.md b/barcode/italian/net/compact-pdf417-encoding/_index.md index 9fd32044d..e9ea909f4 100644 --- a/barcode/italian/net/compact-pdf417-encoding/_index.md +++ b/barcode/italian/net/compact-pdf417-encoding/_index.md @@ -86,6 +86,12 @@ Oltre alle basi, ecco alcuni consigli pratici per ottimizzare il tuo flusso di l ### [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. +### [Genera codice a barre PDF417 in C# – guida completa con layout compatto](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Scopri come creare codici a barre PDF417 in C# con layout compatto usando Aspose.BarCode per .NET. + +### [Genera codice a barre C# con Macro PDF417 – esempio completo](./generate-barcode-c-with-macro-pdf417-full-example/) +Scopri come creare un codice a barre Macro PDF417 in C# con un esempio completo usando Aspose.BarCode per .NET. + ## Domande frequenti **D: Qual è la quantità massima di dati che posso memorizzare in un codice a barre Compact PDF417?** @@ -114,4 +120,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/italian/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..a917658ef --- /dev/null +++ b/barcode/italian/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Genera codice a barre in C# usando Aspose.BarCode per creare un Macro + PDF417 con testo personalizzato e salvarlo come file immagine. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: it +lastmod: 2026-08-19 +og_description: Genera barcode C# con Aspose.BarCode, impara a generare PDF417, aggiungi + testo personalizzato e salva il file immagine del barcode. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Genera codice a barre C# – Guida Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Genera barcode C# con Macro PDF417 – esempio completo +url: /it/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Genera barcode C# con Macro PDF417 – esempio completo + +Se hai bisogno di **generare barcode C#** per un formato Macro PDF417, questa guida ti mostra una soluzione pronta all'uso. Vedrai come **generare pdf417**, incorporare testo personalizzato e **generare file immagine del barcode** in un unico programma autonomo. + +Il tutorial copre tutto, dall'installazione della libreria Aspose.BarCode alla configurazione dei metadati Macro PDF417, così potrai copiare il codice direttamente nel tuo progetto e vedere subito il risultato. + +## Prerequisiti + +- .NET 6.0 SDK o versioni successive (il codice funziona anche con .NET Framework 4.7+) +- Visual Studio 2022 (o qualsiasi IDE che supporti C#) +- Una licenza Aspose.BarCode per .NET (la versione di prova gratuita è valida per la valutazione) +- Familiarità di base con la sintassi C# + +> **Suggerimento professionale:** Installa il pacchetto NuGet tramite la CLI per evitare incompatibilità di versione: +> `dotnet add package Aspose.BarCode` + +## Passo 1: Configura il progetto e importa la libreria + +Crea una nuova applicazione console e aggiungi le direttive `using` richieste. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Perché questo passo è importante:** +Lo spazio dei nomi `Aspose.BarCode.Generation` fornisce la classe `BarcodeGenerator`, che è il punto di ingresso per creare qualsiasi tipo di barcode, incluso Macro PDF417. L'importazione di `System` ti dà accesso a `DateTime` per i metadati del timestamp. + +## Passo 2: Crea un generatore Macro PDF417 con testo personalizzato + +Sostituisci il commento segnaposto con l'inizializzazione del generatore. Questo dimostra **creare testo personalizzato per il barcode** selezionando anche il tipo di codifica corretto. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Spiegazione:** +- `EncodeTypes.MacroPdf417` indica ad Aspose di produrre un barcode PDF417 che supporta le funzionalità macro (segmentazione file, checksum, ecc.). +- Il testo `"Åspóse.Barcóde©"` dimostra che i caratteri Unicode sono pienamente supportati, cosa spesso necessaria per applicazioni internazionali. + +## Passo 3: Configura l'aspetto e i metadati Macro PDF417 + +Affina le dimensioni del barcode e imposta i campi specifici della macro necessari per la gestione di file segmentati. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Perché queste impostazioni sono importanti:** + +| Impostazione | Scopo | +|--------------|-------| +| `XDimension.Pixels` | Controlla la densità visiva; 2 px producono un'immagine chiara e leggibile. | +| `Columns` | Determina quante colonne di dati appaiono per riga, influenzando le dimensioni del barcode. | +| `MacroPdf417FileID` | Identifica in modo univoco il file logico attraverso tutti i segmenti. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Consente la ricostruzione del file originale da più barcode. | +| `MacroPdf417FileName` | Nome leggibile dall'uomo memorizzato all'interno del barcode per l'elaborazione a valle. | +| `MacroPdf417Checksum` | Fornisce il rilevamento degli errori usando l'algoritmo CRC CCITT‑16. | +| `MacroPdf417FileSize` | Aiuta il decoder a sapere quando l'intero file è stato ricevuto. | +| `MacroPdf417TimeStamp` | Registra quando il barcode è stato generato, utile per tracciamenti di audit. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Campi opzionali che possono essere usati nei flussi di lavoro aziendali. | +| `MacroPdf417Terminator` | Indica che questo segmento è quello finale (`Set`). | + +## Passo 4: Salva il barcode come file immagine + +Infine, scrivi il barcode in un file PNG così potrai visualizzarlo o incorporarlo altrove. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Cosa vedrai:** +Un'immagine PNG chiamata `ExtPDF417Meta.png` contenente un barcode Macro PDF417 che codifica il testo personalizzato e tutti i campi di metadati impostati sopra. L'immagine può essere aperta con qualsiasi visualizzatore standard o inserita in PDF, report o pagine web. + +## Codice sorgente completo (pronto per copia‑incolla) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Output previsto + +Eseguendo il programma stampa: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Aprendo `ExtPDF417Meta.png` si vede un barcode Macro PDF417 pulito che viene scansionato correttamente con qualsiasi lettore PDF417, conservando il testo personalizzato `"Åspóse.Barcóde©"` e i metadati macro definiti. + +## Domande comuni e casi particolari + +- **Posso generare un formato immagine diverso?** + Sì. Sostituisci `BarCodeImageFormat.Png` con `Jpeg`, `Bmp` o `Gif` secondo necessità. + +- **Cosa succede se i miei dati superano un singolo barcode?** + Macro PDF417 è progettato per la segmentazione. Regola `MacroPdf417SegmentsCount` e `MacroPdf417SegmentID` per ogni parte, poi concatena i risultati scansionati. + +- **Il supporto Unicode è garantito?** + Aspose.BarCode supporta pienamente Unicode. Assicurati che il tuo file sorgente sia salvato con codifica UTF‑8 per evitare corruzione dei caratteri. + +- **È necessaria una licenza per la produzione?** + Una versione con licenza rimuove il watermark di valutazione e fornisce piena funzionalità. La versione di prova è valida per test e apprendimento. + +## Conclusione + +Ora sai come **generare barcode C#** per un Macro PDF417, **come generare pdf417** con metadati ricchi, **creare testo personalizzato per il barcode**, e **generare file immagine del barcode** usando Aspose.BarCode. L'esempio completo e eseguibile dimostra ogni passaggio necessario—dalla configurazione del progetto al salvataggio dell'immagine PNG finale. + +### Prossimi passi + +- Sperimenta con altre impostazioni PDF417 come `ErrorCorrectionLevel` e `CompactPdf417` per simboli più piccoli. +- Integra il barcode generato in un report PDF usando Aspose.PDF. +- Esplora la generazione batch: itera su una collezione di file e produce una serie di barcode Macro PDF417 segmentati. + +Sentiti libero di adattare il codice al tuo flusso di lavoro, e lascia che la generazione di barcode diventi una parte fluida delle tue applicazioni C#. Buon coding! + +## Cosa dovresti imparare dopo? + +I seguenti tutorial coprono argomenti strettamente correlati che si basano sulle tecniche dimostrate in questa guida. Ogni risorsa include esempi di codice completi e funzionanti con spiegazioni passo‑passo per aiutarti a padroneggiare funzionalità API aggiuntive ed esplorare approcci di implementazione alternativi nei tuoi progetti. + +- [Come generare barcode Aztec con rapporto d'aspetto personalizzato usando Aspose.BarCode per .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Genera immagine barcode – Code 93 con Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Come generare e regolare l'altezza del barcode per One-Dimensional Databar usando Aspose.BarCode per .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/italian/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..9b5fccc2d --- /dev/null +++ b/barcode/italian/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: Genera codice a barre PDF417 in C# rapidamente. Scopri come generare + il codice a barre PDF417 in C# usando Aspose.BarCode con modalità compatta e impostazioni + personalizzate. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: it +lastmod: 2026-08-19 +og_description: Genera codice a barre PDF417 in C# con Aspose.BarCode. Questo tutorial + mostra come generare un codice a barre PDF417 in C# in modalità compatta, impostare + la dimensione X e salvare come PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Genera codice a barre PDF417 in C# – guida passo passo +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Genera codice a barre PDF417 in C# – guida completa con layout compatto +url: /it/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generare PDF417 barcode in C# – guida completa + +Se hai bisogno di **generare PDF417 barcode** in un'applicazione .NET, questo tutorial ti mostra esattamente come farlo. Vedrai un esempio conciso, pronto per la produzione, che crea un PDF417 barcode compatto, personalizza la X‑dimension e salva il risultato come immagine PNG. + +Generare un PDF417 barcode è comune quando devi codificare grandi quantità di dati — come informazioni sui biglietti, manifesti di spedizione o documenti d'identità — in un formato leggibile da macchine. L'uso di Aspose.BarCode rende il processo semplice, e il codice funziona con .NET 6+ o .NET Framework 4.7.2 e versioni successive. + +In questa guida farai: + +* Installa il pacchetto NuGet Aspose.BarCode. +* Scrivi un programma C# autonomo che **generi PDF417 barcode** con un piccolo numero di colonne e modalità compatta (troncata). +* Regola la larghezza della barra (X‑dimension) per una resa più nitida. +* Salva il codice a barre come file PNG. +* Esplora variazioni, casi limite e consigli di best‑practice. + +## Prerequisiti + +Prima di iniziare, assicurati di avere: + +* Visual Studio 2022 (o qualsiasi IDE C#) con .NET 6 SDK installato. +* Accesso a Internet per scaricare il pacchetto NuGet **Aspose.BarCode**. +* Permessi di scrittura su una cartella dove verrà salvato il file PNG. + +Non sono richieste librerie aggiuntive; Aspose.BarCode gestisce internamente la codifica delle immagini. + +## Passo 1: Aggiungi il pacchetto Aspose.BarCode + +Apri il tuo progetto in Visual Studio, fai clic con il tasto destro sulla soluzione e seleziona **Manage NuGet Packages**. Cerca `Aspose.BarCode` e installa l'ultima versione stabile. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Consiglio professionale:** mantieni il pacchetto aggiornato. Le nuove versioni includono spesso miglioramenti delle prestazioni e supporto per i runtime .NET più recenti. + +## Passo 2: Crea un'applicazione console minimale + +Crea un nuovo progetto console C# se non ne hai già uno: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Sostituisci il contenuto di `Program.cs` con l'esempio completo qui sotto. Questo programma dimostra **come generare PDF417 barcode C#** dall'inizio alla fine. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Perché ogni riga è importante + +* **`EncodeTypes.Pdf417`** – seleziona la simbologia PDF417, che supporta fino a ~1,1 KB di dati. +* **`XDimension.Pixels = 2`** – imposta la larghezza di base della barra. Valori più piccoli rendono il codice a barre più sottile; valori più grandi migliorano la leggibilità su dispositivi a bassa risoluzione. +* **`Pdf417.Columns = 3`** – limita il numero di colonne, costringendo il generatore a usare più righe, il che produce un codice a barre più alto ma più stretto. +* **`Pdf417.Truncate = true`** – attiva la modalità compatta, rimuovendo il pattern di stop e riducendo l'immagine senza perdere l'integrità dei dati. +* **`Save(..., BarCodeImageFormat.Png)`** – scrive un file PNG. Puoi anche scegliere `Jpeg`, `Bmp` o `Svg` a seconda delle esigenze successive. + +Esegui il programma: + +```bash +dotnet run +``` + +Dovresti vedere l'output della console che conferma la posizione del file, e la cartella conterrà `CompactPdf417.png`. Aprendo il PNG vedrai un PDF417 barcode chiaro e compatto che codifica la stringa Unicode. + +## Passo 3: Verifica il codice a barre (opzionale ma consigliato) + +Per assicurarti che il codice a barre sia leggibile, puoi usare qualsiasi app scanner PDF417 standard su smartphone o una libreria decoder desktop. Il testo codificato dovrebbe corrispondere esattamente alla stringa originale `data`, inclusi i caratteri speciali. + +Se incontri problemi di decodifica: + +* Aumenta `XDimension` a 3 o 4 pixel. +* Riduci il numero di colonne (ad esempio imposta `Columns = 2`). +* Disabilita `Truncate` (`Truncate = false`) per aggiungere il pattern di stop. + +Queste regolazioni scambiano dimensione con leggibilità, utile per stampanti o scanner a bassa risoluzione. + +## Passo 4: Esplora variazioni comuni + +### 4️⃣ Genera un PDF417 ad alta densità per la stampa + +Se ti serve un codice a barre che si adatti a un'etichetta piccola, aumenta il conteggio delle colonne e abbassa la X‑dimension: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Cambia il formato di output in SVG per il ridimensionamento vettoriale + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +L'output SVG si scala senza perdita di qualità, perfetto per pagine web responsive. + +### 6️⃣ Codifica dati binari (ad esempio, un array di byte) + +Se devi incorporare payload binari, converti prima in una stringa Base64: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Il codice a barre ora trasporta le informazioni binarie, e il decoder dovrà invertire il passaggio Base64. + +## Domande frequenti + +| Domanda | Risposta | +|----------|--------| +| **Posso generare PDF417 senza Aspose?** | Sì, esistono altre librerie come ZXing.Net o Dynamsoft, ma Aspose.BarCode offre un controllo di layout più ricco (colonne, troncamento) e una migliore gestione Unicode. | +| **Qual è la lunghezza massima dei dati?** | PDF417 può codificare fino a 1 108 byte (≈ 1 KB) di dati binari. Se superi questo limite, considera di suddividere i dati su più codici a barre. | +| **La modalità compatta è conforme agli standard?** | Il PDF417 troncato fa parte della specifica ISO/IEC 15438 ed è ampiamente supportato, ma verifica che lo scanner di destinazione la supporti esplicitamente. | +| **Come cambio il colore di sfondo?** | Imposta `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` e `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` prima di salvare. | + +## Conclusione + +Ora sai **come generare PDF417 barcode C#** usando Aspose.BarCode, come affinare la X‑dimension, abilitare la modalità compatta e esportare il risultato come immagine PNG. L'esempio completo, eseguibile, può essere copiato in qualsiasi progetto .NET, e le variazioni mostrate ti permettono di adattare il codice a barre per stampa, web o scenari con payload binari. + +Prossimi passi che potresti esplorare: + +* Integrare la generazione del codice a barre in un'API ASP.NET Core che restituisce l'immagine su richiesta. +* Combinare PDF417 con codici QR sulla stessa etichetta per la scansione a doppio formato. +* Utilizzare la classe `Reader` di Aspose.BarCode per decodificare l'immagine generata e verificare i dati programmaticamente. + +Buon coding e goditi la flessibilità che le soluzioni **generate PDF417 barcode** offrono alle tue applicazioni! + +## 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 alternativi di implementazione nei tuoi progetti. + +- [Come creare un barcode – PDF417 compatto con Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Come generare un'immagine barcode con personalizzazione dello spazio supplementare usando Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [Come generare un barcode Aztec con rapporto d'aspetto personalizzato usando Aspose.BarCode per .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/japanese/net/compact-pdf417-encoding/_index.md b/barcode/japanese/net/compact-pdf417-encoding/_index.md index a3cc7ebe8..f4cb46236 100644 --- a/barcode/japanese/net/compact-pdf417-encoding/_index.md +++ b/barcode/japanese/net/compact-pdf417-encoding/_index.md @@ -84,7 +84,9 @@ Aspose.BarCode では `Pdf417ErrorCorrectionLevel` プロパティ(0‑8)を ### [Compact PDF417 バーコードの作成](./compact-pdf417-basic-configuration/) -Aspose.BarCode for .NET を使用して Compact PDF417 バーコードを生成する方法を学びます。ステップバイステップの手順とコード例を含む包括的なガイドです。 +### [C# で PDF417 バーコードを生成する – コンパクトレイアウト完全ガイド](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) + +### [Macro PDF417 を使用した C# バーコード生成 – 完全例](./generate-barcode-c-with-macro-pdf417-full-example/) ## よくある質問 @@ -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/japanese/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/japanese/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..ecff59bbc --- /dev/null +++ b/barcode/japanese/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Aspose.BarCode を使用して C# でバーコードを生成し、カスタムテキストを含む Macro PDF417 を作成し、画像ファイルとして保存する。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: ja +lastmod: 2026-08-19 +og_description: Aspose.BarCode を使用して C# でバーコードを生成し、PDF417 の生成方法を学び、カスタムテキストを追加し、バーコード画像ファイルを保存します。 +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: バーコード生成 C# – マクロ PDF417 ガイド +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Macro PDF417でバーコードを生成するC# – 完全例 +url: /ja/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Macro PDF417 でバーコード C# を生成 – 完全例 + +Macro PDF417 形式の **generate barcode C#** が必要な場合、このガイドではすぐに実行できるソリューションを示します。**how to generate pdf417** の方法、カスタムテキストの埋め込み、そして **generate barcode image file** を単一の自己完結型プログラムで行う方法が分かります。 + +このチュートリアルは、Aspose.BarCode ライブラリのインストールから Macro PDF417 メタデータの設定までを網羅しているため、コードをそのままプロジェクトにコピーしてすぐに結果を確認できます。 + +## 前提条件 + +開始する前に、以下が揃っていることを確認してください。 + +- .NET 6.0 SDK 以上(コードは .NET Framework 4.7+ でも動作します) +- Visual Studio 2022(または C# をサポートする任意の IDE) +- Aspose.BarCode for .NET のライセンス(評価用の無料トライアルで試せます) +- C# の基本的な構文に関する知識 + +> **Pro tip:** バージョン不一致を防ぐために CLI で NuGet パッケージをインストールしてください: +> `dotnet add package Aspose.BarCode` + +## Step 1: プロジェクトのセットアップとライブラリのインポート + +新しいコンソール アプリケーションを作成し、必要な `using` ディレクティブを追加します。 + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**このステップが重要な理由:** +`Aspose.BarCode.Generation` 名前空間は `BarcodeGenerator` クラスを提供し、Macro PDF417 を含む任意のバーコードタイプの作成エントリーポイントとなります。`System` をインポートすることで、タイムスタンプ メタデータに使用する `DateTime` が利用可能になります。 + +## Step 2: カスタムテキスト付き Macro PDF417 ジェネレータの作成 + +プレースホルダー コメントをジェネレータ初期化コードに置き換えます。これにより **create barcode custom text** を実演し、正しいエンコーディング タイプも選択できます。 + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**説明:** +- `EncodeTypes.MacroPdf417` は、ファイル分割やチェックサムなどのマクロ機能をサポートする PDF417 バーコードを生成するよう Aspose に指示します。 +- テキスト `"Åspóse.Barcóde©"` は、Unicode 文字が完全にサポートされていることを示し、国際化アプリケーションでよく必要とされます。 + +## Step 3: 外観と Macro PDF417 メタデータの設定 + +バーコードの寸法を微調整し、分割ファイル処理に必要なマクロ固有フィールドを設定します。 + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**これらの設定が重要な理由:** + +| Setting | Purpose | +|---------|---------| +| `XDimension.Pixels` | 視覚的密度を制御します。2 px でクリアでスキャンしやすい画像になります。 | +| `Columns` | 行ごとのデータ列数を決定し、バーコードのサイズに影響します。 | +| `MacroPdf417FileID` | すべてのセグメントにわたって論理ファイルを一意に識別します。 | +| `MacroPdf417SegmentID` / `SegmentsCount` | 複数のバーコードから元のファイルを再構築できるようにします。 | +| `MacroPdf417FileName` | 後続処理のためにバーコード内に格納される人間可読のファイル名です。 | +| `MacroPdf417Checksum` | CCITT‑16 CRC アルゴリズムを使用したエラー検出を提供します。 | +| `MacroPdf417FileSize` | デコーダがファイル全体の受信完了を判断するのに役立ちます。 | +| `MacroPdf417TimeStamp` | バーコード生成時刻を記録し、監査トレイルに有用です。 | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | ビジネス ワークフローで使用できるオプション フィールドです。 | +| `MacroPdf417Terminator` | このセグメントが最終セグメントであることを示します(`Set`)。 | + +## Step 4: バーコードを画像ファイルとして保存 + +最後に、バーコードを PNG ファイルとして書き出し、他の場所で表示または埋め込めるようにします。 + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**表示される内容:** +`ExtPDF417Meta.png` という名前の PNG 画像が生成され、カスタムテキストと上記で設定したすべてのメタデータをエンコードした Macro PDF417 バーコードが含まれます。この画像は標準のビューアで開くことができ、PDF、レポート、Web ページなどに挿入可能です。 + +## 完全なソースコード(コピー&ペースト可能) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### 期待される出力 + +プログラム実行時に次が表示されます: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +`ExtPDF417Meta.png` を開くと、任意の PDF417 リーダーで正しくスキャンできるクリーンな Macro PDF417 バーコードが確認でき、カスタムテキスト `"Åspóse.Barcóde©"` と定義したマクロ メタデータが保持されています。 + +## よくある質問とエッジケース + +- **別の画像形式で出力できますか?** + はい。`BarCodeImageFormat.Png` を `Jpeg`、`Bmp`、`Gif` など必要な形式に置き換えてください。 + +- **データが単一のバーコードに収まらない場合は?** + Macro PDF417 は分割用に設計されています。各部分の `MacroPdf417SegmentsCount` と `MacroPdf417SegmentID` を調整し、スキャン結果を結合してください。 + +- **Unicode のサポートは保証されていますか?** + Aspose.BarCode は Unicode を完全にサポートしています。文字化けを防ぐため、ソース ファイルは UTF‑8 エンコーディングで保存してください。 + +- **本番環境でライセンスは必要ですか?** + ライセンス版は評価用の透かしを除去し、すべての機能を利用可能にします。トライアルはテストと学習に使用できます。 + +## 結論 + +これで Macro PDF417 用の **generate barcode C#**、リッチなメタデータ付き **how to generate pdf417**、**create barcode custom text**、そして Aspose.BarCode を使用した **generate barcode image file** の方法が分かりました。プロジェクトのセットアップから最終 PNG 画像の保存まで、すべての必須ステップを実行可能なサンプルで示しています。 + +### 次のステップ + +- `ErrorCorrectionLevel` や `CompactPdf417` など、他の PDF417 設定を試してシンボルを小さくしてみましょう。 +- Aspose.PDF を使用して生成したバーコードを PDF レポートに組み込みます。 +- バッチ生成を検討してください。ファイル コレクションをループし、分割された Macro PDF417 バーコードのシリーズを作成します。 + +コードを自分のワークフローに合わせて自由にカスタマイズし、バーコード生成を C# アプリケーションのシームレスな一部にしてください。コーディングを楽しんでください! + +## 次に学ぶべきことは? + +以下のチュートリアルは、本ガイドで示した手法を基にした密接に関連するトピックを取り上げています。各リソースには、完全な動作コード例とステップバイステップの解説が含まれており、追加の API 機能を習得したり、独自プロジェクトで代替実装アプローチを探求したりするのに役立ちます。 + +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generate barcode image – Code 93 with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [How to Generate and Adjust Barcode Height for One-Dimensional Databar using Aspose.BarCode for .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/japanese/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..0c124bfc7 --- /dev/null +++ b/barcode/japanese/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,248 @@ +--- +category: general +date: 2026-08-19 +description: C#でPDF417バーコードを素早く生成する。コンパクトモードとカスタム設定を使用して、Aspose.BarCodeでC#のPDF417バーコード生成方法を学びましょう。 +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: ja +lastmod: 2026-08-19 +og_description: Aspose.BarCode を使用して C# で PDF417 バーコードを生成します。このチュートリアルでは、コンパクトモードで + PDF417 バーコードを C# で生成し、X 軸寸法を設定し、PNG として保存する方法を示します。 +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: C#でPDF417バーコードを生成する – ステップバイステップガイド +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: C#でPDF417バーコードを生成する – コンパクトレイアウトの完全ガイド +url: /ja/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C# で PDF417 バーコードを生成する – 完全ガイド + +.NET アプリケーションで **PDF417 バーコードを生成** する必要がある場合、このチュートリアルで手順をすべて解説します。コンパクトな PDF417 バーコードを作成し、X‑ディメンションをカスタマイズし、PNG 画像として保存する、実用的で本番環境向けのサンプルをご覧いただけます。 + +PDF417 バーコードの生成は、チケット情報、出荷明細、身分証明書など大量のデータを機械可読形式でエンコードする必要があるときに一般的です。Aspose.BarCode を使用すれば手順はシンプルで、コードは .NET 6+ または .NET Framework 4.7.2 以降で動作します。 + +このガイドで学べること: + +* Aspose.BarCode NuGet パッケージをインストールする方法。 +* 列数を少なくし、コンパクト(トランケート)モードで **PDF417 バーコードを生成** する自己完結型 C# プログラムの作成。 +* 鮮明な描画のためにバー幅(X‑ディメンション)を調整する方法。 +* バーコードを PNG ファイルとして保存する手順。 +* バリエーション、エッジケース、ベストプラクティスのヒントを紹介。 + +## 前提条件 + +開始する前に、以下を確認してください: + +* Visual Studio 2022(または任意の C# IDE)に .NET 6 SDK がインストールされていること。 +* **Aspose.BarCode** NuGet パッケージをダウンロードできるインターネット接続。 +* PNG ファイルを保存するフォルダーへの書き込み権限。 + +追加のライブラリは不要です。Aspose.BarCode が画像エンコードを内部で処理します。 + +## 手順 1: Aspose.BarCode パッケージを追加する + +Visual Studio でプロジェクトを開き、ソリューションを右クリックして **Manage NuGet Packages** を選択します。`Aspose.BarCode` を検索し、最新の安定版をインストールします。 + +```bash +dotnet add package Aspose.BarCode +``` + +> **プロのコツ:** パッケージは常に最新に保ちましょう。新しいリリースにはパフォーマンス向上や最新 .NET ランタイムへの対応が含まれることが多いです。 + +## 手順 2: 最小限のコンソール アプリケーションを作成する + +まだプロジェクトがない場合は、新しい C# コンソール プロジェクトを作成します: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +`Program.cs` の内容を以下の完全なサンプルに置き換えてください。このプログラムは **C# で PDF417 バーコードを生成** する手順を最初から最後まで示しています。 + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### 各行の重要ポイント + +* **`EncodeTypes.Pdf417`** – PDF417 シンボルを選択します。最大約 1.1 KB のデータをエンコード可能です。 +* **`XDimension.Pixels = 2`** – 基本的なバー幅を設定します。値が小さいほどバーコードは細くなり、値が大きいほど低解像度デバイスでの可読性が向上します。 +* **`Pdf417.Columns = 3`** – 列数を制限し、行数を増やすことで、縦長で横幅が狭いバーコードになります。 +* **`Pdf417.Truncate = true`** – コンパクトモードを有効にし、ストップパターンを除去して画像サイズを縮小します(データの完全性は保持)。 +* **`Save(..., BarCodeImageFormat.Png)`** – PNG ファイルとして保存します。必要に応じて `Jpeg`、`Bmp`、`Svg` も選択可能です。 + +プログラムを実行します: + +```bash +dotnet run +``` + +コンソールにファイルの場所が表示され、フォルダー内に `CompactPdf417.png` が生成されます。PNG を開くと、Unicode 文字列をエンコードしたクリアでコンパクトな PDF417 バーコードが確認できます。 + +## 手順 3: バーコードを検証する(任意だが推奨) + +バーコードが正しく読み取れるか確認するには、スマートフォンの標準 PDF417 スキャナーアプリやデスクトップ向けデコーダーライブラリを使用してください。エンコードされたテキストは元の `data` 文字列と完全に一致するはずです(特殊文字も含む)。 + +デコードに問題がある場合は以下を試してください: + +* `XDimension` を 3 または 4 ピクセルに増やす。 +* 列数を減らす(例: `Columns = 2`)。 +* `Truncate` を無効にする(`Truncate = false`)ことでストップパターンを追加。 + +これらの調整はサイズと可読性のトレードオフで、低解像度のプリンターやスキャナーに有効です。 + +## 手順 4: 一般的なバリエーションを探る + +### 4️⃣ 印刷用の高密度 PDF417 を生成する + +小さなラベルに収める必要がある場合は、列数を増やし X‑ディメンションを下げます: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ ベクトル拡大のために出力形式を SVG に変更する + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +SVG 出力は品質を失うことなく拡大できるため、レスポンシブなウェブページに最適です。 + +### 6️⃣ バイナリ データをエンコードする(例: バイト配列) + +バイナリ ペイロードを埋め込む場合は、まず Base64 文字列に変換します: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +これでバーコードはバイナリ情報を保持し、デコーダー側で Base64 デコードを行う必要があります。 + +## よくある質問 + +| 質問 | 回答 | +|----------|--------| +| **Aspose を使わずに PDF417 を生成できますか?** | はい、ZXing.Net や Dynamsoft など他のライブラリもありますが、Aspose.BarCode は列数やトランケーションなどのレイアウト制御が豊富で、Unicode の取り扱いも優れています。 | +| **最大データ長はどれくらいですか?** | PDF417 は最大 1,108 バイト(約 1 KB)のバイナリ データをエンコードできます。これを超える場合は、複数のバーコードに分割することを検討してください。 | +| **コンパクトモードは規格に準拠していますか?** | トランケートされた PDF417 は ISO/IEC 15438 仕様の一部で、広くサポートされていますが、対象のスキャナーが明示的に対応しているか確認してください。 | +| **背景色を変更するには?** | 保存前に `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` と `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` を設定します。 | + +## 結論 + +Aspose.BarCode を使用して **C# で PDF417 バーコードを生成** し、X‑ディメンションの微調整、コンパクトモードの有効化、PNG 画像へのエクスポート方法を習得しました。完全に実行可能なサンプルは任意の .NET プロジェクトにコピーでき、示したバリエーションを活用すれば、印刷、ウェブ、バイナリ ペイロード向けにバーコードを柔軟に適応できます。 + +次に検討できるステップ: + +* バーコード生成を ASP.NET Core API に統合し、リクエストに応じて画像を返す。 +* 同じラベル上に PDF417 と QR コードを組み合わせ、デュアルフォーマットスキャンを実現する。 +* Aspose.BarCode の `Reader` クラスを使って生成画像をプログラム上でデコードし、データを自動検証する。 + +コーディングを楽しみながら、**PDF417 バーコード生成** ソリューションがもたらす柔軟性を活用してください! + +## 次に学ぶべきことは? + +以下のチュートリアルは、本ガイドで示したテクニックを基に、さらに関連するトピックを深く掘り下げたものです。各リソースには、ステップバイステップの解説と完全なコード例が含まれています。 + +- [バーコードの作成方法 – Aspose.BarCode を使用したコンパクト PDF417](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Aspose.BarCode を使用した補足スペース カスタマイズ付きバーコード画像の生成方法](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [.NET 用 Aspose.BarCode でカスタムアスペクト比の Aztec バーコードを生成する方法](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/korean/net/compact-pdf417-encoding/_index.md b/barcode/korean/net/compact-pdf417-encoding/_index.md index 0ecfa04d3..e5b983714 100644 --- a/barcode/korean/net/compact-pdf417-encoding/_index.md +++ b/barcode/korean/net/compact-pdf417-encoding/_index.md @@ -86,6 +86,12 @@ Aspose.BarCode는 `Pdf417ErrorCorrectionLevel` 속성(0‑8)을 설정할 수 ### [Compact PDF417 바코드 만들기](./compact-pdf417-basic-configuration/) Aspose.BarCode for .NET를 사용해 Compact PDF417 바코드를 생성하는 방법을 배웁니다. 단계별 지침과 코드 예제가 포함된 포괄적인 가이드입니다. +### [C#에서 PDF417 바코드 생성 – 컴팩트 레이아웃 완전 가이드](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Compact 레이아웃을 활용한 C# 기반 PDF417 바코드 생성 방법을 단계별로 안내합니다. + +### [Macro PDF417를 사용한 C# 바코드 생성 – 전체 예제](./generate-barcode-c-with-macro-pdf417-full-example/) +Macro PDF417를 활용해 C#에서 바코드를 생성하는 전체 예제를 제공합니다. + ## 자주 묻는 질문 **Q: Compact PDF417 바코드에 저장할 수 있는 최대 데이터 양은?** @@ -114,4 +120,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/korean/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..899cc32a4 --- /dev/null +++ b/barcode/korean/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: Aspose.BarCode를 사용하여 C#에서 매크로 PDF417 바코드를 생성하고 사용자 지정 텍스트를 포함한 뒤 이미지 + 파일로 저장합니다. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: ko +lastmod: 2026-08-19 +og_description: Aspose.BarCode를 사용하여 C#에서 바코드를 생성하고, PDF417 생성 방법을 배우며, 사용자 정의 텍스트를 + 추가하고 바코드 이미지 파일을 저장합니다. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: 바코드 생성 C# – 매크로 PDF417 가이드 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Macro PDF417를 사용한 C# 바코드 생성 – 전체 예제 +url: /ko/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Macro PDF417로 바코드 C# 생성 – 전체 예제 + +Macro PDF417 형식의 **generate barcode C#**가 필요하다면, 이 가이드는 바로 실행할 수 있는 솔루션을 보여줍니다. **how to generate pdf417** 방법, 사용자 정의 텍스트 삽입, 그리고 **generate barcode image file**을 단일 독립 프로그램에서 수행하는 방법을 확인할 수 있습니다. + +이 튜토리얼은 Aspose.BarCode 라이브러리 설치부터 Macro PDF417 메타데이터 구성까지 모든 과정을 다루므로, 코드를 프로젝트에 바로 복사해 결과를 즉시 확인할 수 있습니다. + +## Prerequisites + +시작하기 전에 다음이 준비되어 있는지 확인하세요: + +- .NET 6.0 SDK 이상 (.NET Framework 4.7+에서도 작동합니다) +- Visual Studio 2022 (또는 C#을 지원하는 IDE) +- Aspose.BarCode for .NET 라이선스 (무료 평가판으로 평가 가능) +- C# 구문에 대한 기본적인 이해 + +> **Pro tip:** CLI를 통해 NuGet 패키지를 설치하면 버전 불일치를 방지할 수 있습니다: +> `dotnet add package Aspose.BarCode` + +## Step 1: Set up the project and import the library + +새 콘솔 애플리케이션을 만들고 필요한 `using` 지시문을 추가합니다. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**이 단계가 중요한 이유:** +`Aspose.BarCode.Generation` 네임스페이스는 `BarcodeGenerator` 클래스를 제공하며, 이는 Macro PDF417를 포함한 모든 바코드 유형을 생성하기 위한 진입점입니다. `System`을 가져오면 타임스탬프 메타데이터에 필요한 `DateTime`에 접근할 수 있습니다. + +## Step 2: Create a Macro PDF417 generator with custom text + +플레이스홀더 주석을 생성자 초기화 코드로 교체합니다. 이는 **create barcode custom text**를 보여주면서 올바른 인코딩 유형을 선택합니다. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**설명:** +- `EncodeTypes.MacroPdf417`는 Aspose에 매크로 기능(파일 분할, 체크섬 등)을 지원하는 PDF417 바코드를 생성하도록 지시합니다. +- `"Åspóse.Barcóde©"` 텍스트는 유니코드 문자가 완전히 지원됨을 보여주며, 국제화 애플리케이션에서 자주 필요합니다. + +## Step 3: Configure appearance and Macro PDF417 metadata + +바코드 차원을 미세 조정하고 분할 파일 처리를 위해 매크로 전용 필드를 설정합니다. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**이 설정이 중요한 이유:** + +| 설정 | 목적 | +|---------|---------| +| `XDimension.Pixels` | 시각적 밀도를 제어합니다; 2 px이면 선명하고 스캔 가능한 이미지가 됩니다. | +| `Columns` | 행당 데이터 열 수를 결정하여 바코드 크기에 영향을 줍니다. | +| `MacroPdf417FileID` | 모든 세그먼트에 걸쳐 논리 파일을 고유하게 식별합니다. | +| `MacroPdf417SegmentID` / `SegmentsCount` | 여러 바코드에서 원본 파일을 재구성할 수 있게 합니다. | +| `MacroPdf417FileName` | 다운스트림 처리용으로 바코드에 저장되는 사람이 읽을 수 있는 이름입니다. | +| `MacroPdf417Checksum` | CCITT‑16 CRC 알고리즘을 사용한 오류 감지를 제공합니다. | +| `MacroPdf417FileSize` | 디코더가 전체 파일이 수신되었는지 판단하는 데 도움을 줍니다. | +| `MacroPdf417TimeStamp` | 바코드 생성 시점을 기록하여 감사 추적에 유용합니다. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | 비즈니스 워크플로에서 사용할 수 있는 선택적 필드입니다. | +| `MacroPdf417Terminator` | 이 세그먼트가 마지막임을 나타냅니다 (`Set`). | + +## Step 4: Save the barcode as an image file + +마지막으로 바코드를 PNG 파일로 저장하여 다른 곳에서 보거나 삽입할 수 있게 합니다. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**보게 될 내용:** +`ExtPDF417Meta.png`라는 PNG 이미지에는 사용자 정의 텍스트와 위에서 설정한 모든 메타데이터 필드를 인코딩한 Macro PDF417 바코드가 포함됩니다. 이 이미지는 표준 뷰어로 열 수 있으며 PDF, 보고서 또는 웹 페이지에 삽입할 수 있습니다. + +## Full source code (copy‑paste ready) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Expected output + +프로그램을 실행하면 다음과 같이 출력됩니다: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +`ExtPDF417Meta.png`를 열면 모든 PDF417 리더에서 올바르게 스캔되는 깨끗한 Macro PDF417 바코드가 표시되며, 사용자 정의 텍스트 `"Åspóse.Barcóde©"`와 정의한 매크로 메타데이터가 보존됩니다. + +## Common questions and edge cases + +- **Can I generate a different image format?** + 예. `BarCodeImageFormat.Png`를 필요에 따라 `Jpeg`, `Bmp` 또는 `Gif`로 교체하면 됩니다. + +- **What if my data exceeds a single barcode?** + Macro PDF417는 분할을 위해 설계되었습니다. 각 부분에 대해 `MacroPdf417SegmentsCount`와 `MacroPdf417SegmentID`를 조정한 뒤 스캔 결과를 연결하면 됩니다. + +- **Is Unicode support guaranteed?** + Aspose.BarCode는 유니코드를 완전히 지원합니다. 문자 손상을 방지하려면 소스 파일을 UTF‑8 인코딩으로 저장하세요. + +- **Do I need a license for production?** + 라이선스 버전은 평가용 워터마크를 제거하고 전체 기능을 제공합니다. 평가판은 테스트와 학습에 사용할 수 있습니다. + +## Conclusion + +이제 Aspose.BarCode를 사용하여 Macro PDF417용 **generate barcode C#**, 풍부한 메타데이터와 함께 **how to generate pdf417**, **create barcode custom text**, 그리고 **generate barcode image file**을 생성하는 방법을 알게 되었습니다. 전체 실행 가능한 예제는 프로젝트 설정부터 최종 PNG 이미지 저장까지 필요한 모든 단계를 보여줍니다. + +### Next steps + +- `ErrorCorrectionLevel` 및 `CompactPdf417`와 같은 다른 PDF417 설정을 실험하여 더 작은 심볼을 만들어 보세요. +- Aspose.PDF를 사용해 생성된 바코드를 PDF 보고서에 통합하세요. +- 배치 생성 탐색: 파일 컬렉션을 순회하면서 분할된 Macro PDF417 바코드 시리즈를 생성하세요. + +코드를 자유롭게 자신의 워크플로에 맞게 조정하고, 바코드 생성이 C# 애플리케이션에 원활히 통합되도록 하세요. 즐거운 코딩 되세요! + +## What Should You Learn Next? + +다음 튜토리얼은 이 가이드에서 시연한 기술을 기반으로 하는 밀접한 관련 주제를 다룹니다. 각 리소스에는 완전한 작동 코드 예제와 단계별 설명이 포함되어 있어 추가 API 기능을 마스터하고 프로젝트에 다양한 구현 방식을 탐색하는 데 도움이 됩니다. + +- [Aspose.BarCode for .NET를 사용하여 사용자 지정 종횡비로 Aztec 바코드 생성 방법](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Aspose.BarCode를 사용한 바코드 이미지 생성 – Code 93](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Aspose.BarCode for .NET를 사용하여 1차원 Databar의 바코드 높이 생성 및 조정 방법](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/korean/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..ae4758558 --- /dev/null +++ b/barcode/korean/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: C#에서 PDF417 바코드를 빠르게 생성합니다. 압축 모드와 사용자 지정 설정을 사용하여 Aspose.BarCode로 PDF417 + 바코드를 생성하는 방법을 알아보세요. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: ko +lastmod: 2026-08-19 +og_description: Aspose.BarCode를 사용하여 C#에서 PDF417 바코드를 생성합니다. 이 튜토리얼에서는 컴팩트 모드에서 PDF417 + 바코드를 생성하고, X‑디멘션을 설정하며, PNG로 저장하는 방법을 보여줍니다. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: C#에서 PDF417 바코드 생성 – 단계별 가이드 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: C#에서 PDF417 바코드 생성 – 컴팩트 레이아웃 완전 가이드 +url: /ko/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C#에서 PDF417 바코드 생성 – 완전 가이드 + +.NET 애플리케이션에서 **PDF417 바코드 생성**이 필요하다면, 이 튜토리얼에서 정확한 방법을 보여줍니다. 간결하고 프로덕션 수준의 예제로, 컴팩트 PDF417 바코드를 만들고 X‑dimension을 커스터마이즈하며 결과를 PNG 이미지로 저장하는 과정을 확인할 수 있습니다. + +PDF417 바코드 생성은 티켓 정보, 선적 명세서, 신분증 등 대량의 데이터를 기계가 읽을 수 있는 형식으로 인코딩해야 할 때 흔히 사용됩니다. Aspose.BarCode를 사용하면 과정이 간단해지며, 코드는 .NET 6+ 또는 .NET Framework 4.7.2 이상에서 작동합니다. + +이 가이드에서 여러분은: + +* Aspose.BarCode NuGet 패키지를 설치합니다. +* 작은 열 수와 컴팩트(축소) 모드로 **PDF417 바코드 생성**을 수행하는 독립 실행형 C# 프로그램을 작성합니다. +* 바 너비(X‑dimension)를 조정하여 더 선명하게 렌더링합니다. +* 바코드를 PNG 파일로 저장합니다. +* 다양한 변형, 엣지 케이스 및 모범 사례 팁을 탐색합니다. + +## Prerequisites + +시작하기 전에 다음이 준비되어 있어야 합니다: + +* .NET 6 SDK가 설치된 Visual Studio 2022(또는 기타 C# IDE). +* **Aspose.BarCode** NuGet 패키지를 다운로드할 수 있는 인터넷 연결. +* PNG 파일을 저장할 폴더에 대한 쓰기 권한. + +추가 라이브러리는 필요하지 않으며, Aspose.BarCode가 이미지 인코딩을 내부적으로 처리합니다. + +## Step 1: Add the Aspose.BarCode package + +Visual Studio에서 프로젝트를 열고 솔루션을 마우스 오른쪽 버튼으로 클릭한 뒤 **Manage NuGet Packages**를 선택합니다. `Aspose.BarCode`를 검색하고 최신 안정 버전을 설치합니다. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** 패키지를 최신 상태로 유지하세요. 새로운 릴리스에는 성능 향상 및 최신 .NET 런타임 지원이 포함되는 경우가 많습니다. + +## Step 2: Create a minimal console application + +콘솔 프로젝트가 아직 없으면 새 C# 콘솔 프로젝트를 생성합니다: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +`Program.cs`의 내용을 아래 전체 예제로 교체합니다. 이 프로그램은 **C#에서 PDF417 바코드 생성** 전체 과정을 보여줍니다. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Why each line matters + +* **`EncodeTypes.Pdf417`** – PDF417 심볼을 선택합니다. 최대 약 1.1 KB의 데이터를 인코딩할 수 있습니다. +* **`XDimension.Pixels = 2`** – 기본 바 너비를 설정합니다. 값이 작을수록 바코드가 얇아지고, 값이 클수록 저해상도 장치에서 가독성이 향상됩니다. +* **`Pdf417.Columns = 3`** – 열 수를 제한하여 더 많은 행을 사용하도록 강제합니다. 결과적으로 바코드가 더 높지만 폭은 좁아집니다. +* **`Pdf417.Truncate = true`** – 컴팩트 모드를 활성화해 정지 패턴을 제거하고 이미지 크기를 줄이면서 데이터 무결성을 유지합니다. +* **`Save(..., BarCodeImageFormat.Png)`** – PNG 파일을 저장합니다. 필요에 따라 `Jpeg`, `Bmp`, `Svg` 등 다른 포맷도 선택할 수 있습니다. + +프로그램을 실행합니다: + +```bash +dotnet run +``` + +콘솔에 파일 위치가 출력되고, 해당 폴더에 `CompactPdf417.png`가 생성됩니다. PNG 파일을 열면 유니코드 문자열을 인코딩한 선명하고 컴팩트한 PDF417 바코드를 확인할 수 있습니다. + +## Step 3: Verify the barcode (optional but recommended) + +바코드가 정상적으로 읽히는지 확인하려면 스마트폰용 PDF417 스캐너 앱이나 데스크톱 디코더 라이브러리를 사용하세요. 인코딩된 텍스트는 원본 `data` 문자열과 특수 문자까지 정확히 일치해야 합니다. + +디코딩 문제가 발생하면: + +* `XDimension`을 3 또는 4 픽셀로 늘립니다. +* 열 수를 줄입니다(예: `Columns = 2`). +* `Truncate`를 비활성화(`Truncate = false`)하여 정지 패턴을 추가합니다. + +이러한 조정은 크기와 가독성 사이의 트레이드오프이며, 저해상도 프린터나 스캐너에 유용합니다. + +## Step 4: Explore common variations + +### 4️⃣ Generate a high‑density PDF417 for printing + +작은 라벨에 맞추려면 열 수를 늘리고 X‑dimension을 낮춥니다: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Change the output format to SVG for vector scaling + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +SVG 출력은 품질 손실 없이 확대·축소가 가능해 반응형 웹 페이지에 적합합니다. + +### 6️⃣ Encode binary data (e.g., a byte array) + +바이너리 페이로드를 포함해야 할 경우 먼저 Base64 문자열로 변환합니다: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +이제 바코드가 바이너리 정보를 담게 되며, 디코더는 Base64 변환을 역으로 수행해야 합니다. + +## Frequently asked questions + +| Question | Answer | +|----------|--------| +| **Can I generate PDF417 without Aspose?** | 예, ZXing.Net이나 Dynamsoft와 같은 다른 라이브러리도 존재하지만, Aspose.BarCode는 열 수, 축소 등 레이아웃 제어와 Unicode 처리에서 더 풍부한 기능을 제공합니다. | +| **What is the maximum data length?** | PDF417은 최대 1,108 바이트(≈ 1 KB)의 바이너리 데이터를 인코딩할 수 있습니다. 이를 초과하면 데이터를 여러 바코드로 나누는 방안을 고려하세요. | +| **Is compact mode compliant with standards?** | 축소된 PDF417은 ISO/IEC 15438 규격의 일부이며 널리 지원되지만, 대상 스캐너가 이를 명시적으로 지원하는지 확인해야 합니다. | +| **How do I change the background color?** | 저장하기 전에 `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` 및 `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;`을 설정합니다. | + +## Conclusion + +이제 Aspose.BarCode를 사용해 **C#에서 PDF417 바코드 생성** 방법, X‑dimension 미세 조정, 컴팩트 모드 활성화, PNG 이미지로 내보내는 전체 과정을 알게 되었습니다. 완전한 실행 예제를 어떤 .NET 프로젝트에도 복사해 사용할 수 있으며, 소개된 변형을 통해 인쇄, 웹, 바이너리 페이로드 등 다양한 시나리오에 맞게 바코드를 조정할 수 있습니다. + +다음 단계로 고려해 볼 수 있는 내용: + +* 이미지 요청 시점에 반환하는 ASP.NET Core API에 바코드 생성 로직을 통합합니다. +* 동일 라벨에 PDF417과 QR 코드를 함께 배치해 이중 포맷 스캔을 구현합니다. +* Aspose.BarCode `Reader` 클래스를 사용해 생성된 이미지를 프로그램matically 디코딩하고 데이터를 검증합니다. + +행복한 코딩 되시고, **PDF417 바코드 생성** 솔루션이 여러분의 애플리케이션에 제공하는 유연성을 마음껏 활용하세요! + +## What Should You Learn Next? + +다음 튜토리얼은 이 가이드에서 배운 기술을 기반으로 하며, 단계별 설명과 완전한 코드 예제를 포함하고 있어 추가 API 기능을 마스터하고 다양한 구현 방식을 탐색하는 데 도움이 됩니다. + +- [바코드 만들기 – Aspose.BarCode를 사용한 컴팩트 PDF417](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Aspose.BarCode를 사용한 보조 공간 맞춤 설정으로 바코드 이미지 생성](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [.NET용 Aspose.BarCode를 사용한 맞춤 종횡비 Aztec 바코드 생성](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/polish/net/compact-pdf417-encoding/_index.md b/barcode/polish/net/compact-pdf417-encoding/_index.md index 90d161b27..0bc013c3c 100644 --- a/barcode/polish/net/compact-pdf417-encoding/_index.md +++ b/barcode/polish/net/compact-pdf417-encoding/_index.md @@ -86,7 +86,9 @@ 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. +### [Generowanie kodu kreskowego PDF417 w C# – kompletny przewodnik z układem kompaktowym](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) + +### [Generowanie kodu kreskowego C# z Macro PDF417 – pełny przykład](./generate-barcode-c-with-macro-pdf417-full-example/) ## Najczęściej zadawane pytania @@ -116,4 +118,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/polish/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..4b468431e --- /dev/null +++ b/barcode/polish/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Generuj kod kreskowy w C# przy użyciu Aspose.BarCode, aby utworzyć Macro + PDF417 z niestandardowym tekstem i zapisać jako plik obrazu. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: pl +lastmod: 2026-08-19 +og_description: Generuj kod kreskowy w C# przy użyciu Aspose.BarCode, dowiedz się, + jak generować PDF417, dodaj własny tekst i zapisz plik obrazu kodu kreskowego. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Generowanie kodu kreskowego C# – przewodnik po Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Generowanie kodu kreskowego C# z Macro PDF417 – pełny przykład +url: /pl/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generowanie kodu kreskowego C# z Macro PDF417 – pełny przykład + +Jeśli potrzebujesz **generate barcode C#** dla formatu Macro PDF417, ten przewodnik pokazuje gotowe rozwiązanie do uruchomienia. Zobaczysz, jak **how to generate pdf417**, osadzić własny tekst i **generate barcode image file** w jednym, samodzielnym programie. + +Samouczek obejmuje wszystko, od instalacji biblioteki Aspose.BarCode po konfigurowanie metadanych Macro PDF417, dzięki czemu możesz skopiować kod bezpośrednio do swojego projektu i od razu zobaczyć wynik. + +## Wymagania wstępne + +- .NET 6.0 SDK lub nowszy (kod działa również z .NET Framework 4.7+) +- Visual Studio 2022 (lub dowolne IDE obsługujące C#) +- Licencja Aspose.BarCode for .NET (bezpłatna wersja próbna działa w celach oceny) +- Podstawowa znajomość składni C# + +> **Wskazówka:** Zainstaluj pakiet NuGet za pomocą CLI, aby uniknąć niezgodności wersji: +> `dotnet add package Aspose.BarCode` + +## Krok 1: Skonfiguruj projekt i zaimportuj bibliotekę + +Utwórz nową aplikację konsolową i dodaj wymagane dyrektywy `using`. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Dlaczego ten krok jest ważny:** +`Namespace` `Aspose.BarCode.Generation` udostępnia klasę `BarcodeGenerator`, która jest punktem wejścia do tworzenia dowolnego typu kodu kreskowego, w tym Macro PDF417. Importowanie `System` daje dostęp do `DateTime` potrzebnego do metadanych znacznika czasu. + +## Krok 2: Utwórz generator Macro PDF417 z własnym tekstem + +Zastąp komentarz zastępczy inicjalizacją generatora. To pokazuje **create barcode custom text**, jednocześnie wybierając właściwy typ kodowania. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Wyjaśnienie:** +- `EncodeTypes.MacroPdf417` informuje Aspose, aby wygenerował kod PDF417 obsługujący funkcje makro (segmentacja pliku, suma kontrolna itp.). +- Tekst `"Åspóse.Barcóde©"` pokazuje, że znaki Unicode są w pełni obsługiwane, co często jest wymagane w aplikacjach międzynarodowych. + +## Krok 3: Skonfiguruj wygląd i metadane Macro PDF417 + +Doprecyzuj wymiary kodu kreskowego i ustaw pola specyficzne dla makro, niezbędne do obsługi segmentowanych plików. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Dlaczego te ustawienia są ważne:** + +| Ustawienie | Cel | +|------------|-----| +| `XDimension.Pixels` | Kontroluje gęstość wizualną; 2 px zapewnia wyraźny, możliwy do zeskanowania obraz. | +| `Columns` | Określa liczbę kolumn danych w wierszu, wpływając na rozmiar kodu. | +| `MacroPdf417FileID` | Unikalnie identyfikuje logiczny plik we wszystkich segmentach. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Umożliwia odtworzenie oryginalnego pliku z wielu kodów. | +| `MacroPdf417FileName` | Czytelna dla człowieka nazwa przechowywana w kodzie kreskowym do dalszego przetwarzania. | +| `MacroPdf417Checksum` | Zapewnia wykrywanie błędów przy użyciu algorytmu CCITT‑16 CRC. | +| `MacroPdf417FileSize` | Pomaga dekoderowi określić, kiedy cały plik został odebrany. | +| `MacroPdf417TimeStamp` | Rejestruje moment generowania kodu, przydatny w ścieżkach audytu. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Opcjonalne pola, które mogą być używane w procesach biznesowych. | +| `MacroPdf417Terminator` | Wskazuje, że ten segment jest ostatni (`Set`). | + +## Krok 4: Zapisz kod kreskowy jako plik obrazu + +Na koniec zapisz kod kreskowy do pliku PNG, aby móc go wyświetlić lub osadzić w innym miejscu. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Co zobaczysz:** +Obraz PNG o nazwie `ExtPDF417Meta.png` zawierający kod Macro PDF417, który koduje własny tekst oraz wszystkie pola metadanych ustawione powyżej. Obraz można otworzyć w dowolnym standardowym przeglądarce lub wstawić do plików PDF, raportów czy stron internetowych. + +## Pełny kod źródłowy (gotowy do kopiowania) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Oczekiwany wynik + +Uruchomienie programu wypisuje: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Otworzenie `ExtPDF417Meta.png` pokazuje czysty kod Macro PDF417, który skanuje się poprawnie w każdym czytniku PDF417, zachowując własny tekst `"Åspóse.Barcóde©"` oraz zdefiniowane metadane makro. + +## Częste pytania i przypadki brzegowe + +- **Czy mogę wygenerować inny format obrazu?** + Tak. Zastąp `BarCodeImageFormat.Png` przez `Jpeg`, `Bmp` lub `Gif` w zależności od potrzeb. + +- **Co zrobić, jeśli moje dane przekraczają jeden kod kreskowy?** + Macro PDF417 jest zaprojektowany do segmentacji. Dostosuj `MacroPdf417SegmentsCount` i `MacroPdf417SegmentID` dla każdej części, a następnie połącz zeskanowane wyniki. + +- **Czy wsparcie Unicode jest gwarantowane?** + Aspose.BarCode w pełni obsługuje Unicode. Upewnij się, że plik źródłowy jest zapisany w kodowaniu UTF‑8, aby uniknąć uszkodzenia znaków. + +- **Czy potrzebna jest licencja do produkcji?** + Wersja licencjonowana usuwa znak wodny oceny i zapewnia pełną funkcjonalność. Wersja próbna działa do testów i nauki. + +## Podsumowanie + +Teraz wiesz, jak **generate barcode C#** dla Macro PDF417, **how to generate pdf417** z bogatymi metadanymi, **create barcode custom text** oraz **generate barcode image file** przy użyciu Aspose.BarCode. Pełny, działający przykład demonstruje każdy wymagany krok — od konfiguracji projektu po zapisanie ostatecznego obrazu PNG. + +### Kolejne kroki + +- Eksperymentuj z innymi ustawieniami PDF417, takimi jak `ErrorCorrectionLevel` i `CompactPdf417`, aby uzyskać mniejsze symbole. +- Zintegruj wygenerowany kod kreskowy w raporcie PDF przy użyciu Aspose.PDF. +- Zbadaj generowanie wsadowe: iteruj po kolekcji plików i twórz serię segmentowanych kodów Macro PDF417. + +Śmiało dostosuj kod do własnego przepływu pracy, aby generowanie kodów kreskowych stało się płynną częścią Twoich aplikacji C#. Powodzenia w kodowaniu! + +## Co powinieneś nauczyć się dalej? + +Poniższe samouczki obejmują ściśle powiązane tematy, które rozwijają techniki przedstawione w tym przewodniku. Każdy zasób zawiera kompletne działające przykłady kodu z krok po kroku wyjaśnieniami, aby pomóc Ci opanować dodatkowe funkcje API i odkrywać alternatywne podejścia implementacyjne w własnych projektach. + +- [Jak wygenerować kod Aztec z niestandardowym współczynnikiem proporcji przy użyciu Aspose.BarCode dla .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generowanie obrazu kodu kreskowego – Code 93 z Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Jak generować i dostosowywać wysokość kodu kreskowego One-Dimensional Databar przy użyciu Aspose.BarCode dla .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/polish/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..e3fdfd30d --- /dev/null +++ b/barcode/polish/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,252 @@ +--- +category: general +date: 2026-08-19 +description: Szybko generuj kod kreskowy PDF417 w C#. Dowiedz się, jak generować kod + kreskowy PDF417 w C# przy użyciu Aspose.BarCode w trybie kompaktowym i z własnymi + ustawieniami. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: pl +lastmod: 2026-08-19 +og_description: Generuj kod kreskowy PDF417 w C# za pomocą Aspose.BarCode. Ten samouczek + pokazuje, jak wygenerować kod kreskowy PDF417 w C# w trybie kompaktowym, ustawić + wymiar X i zapisać jako PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Generowanie kodu kreskowego PDF417 w C# – przewodnik krok po kroku +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Generowanie kodu kreskowego PDF417 w C# – kompletny przewodnik z kompaktowym + układem +url: /pl/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generowanie kodu kreskowego PDF417 w C# – kompletny przewodnik + +Jeśli potrzebujesz **wygenerować kod kreskowy PDF417** w aplikacji .NET, ten tutorial pokaże Ci dokładnie, jak to zrobić. Zobaczysz zwięzły, gotowy do produkcji przykład, który tworzy kompaktowy kod PDF417, dostosowuje wymiar X‑dimensji i zapisuje wynik jako obraz PNG. + +Generowanie kodu PDF417 jest powszechne, gdy trzeba zakodować duże ilości danych — takich jak informacje o bilecie, listy przewozowe czy dokumenty tożsamości — w formacie czytelnym maszynowo. Dzięki Aspose.BarCode proces jest prosty, a kod działa z .NET 6+ lub .NET Framework 4.7.2 i nowszymi. + +W tym przewodniku dowiesz się, jak: + +* Zainstalować pakiet NuGet Aspose.BarCode. +* Napisać samodzielny program w C#, który **generuje kod PDF417** z małą liczbą kolumn i w trybie kompaktowym (truncated). +* Dostosować szerokość kreski (X‑dimension) dla ostrzejszego renderowania. +* Zapisz kod kreskowy jako plik PNG. +* Poznać warianty, przypadki brzegowe i wskazówki najlepszych praktyk. + +## Wymagania wstępne + +Zanim rozpoczniesz, upewnij się, że masz: + +* Visual Studio 2022 (lub dowolne IDE C#) z zainstalowanym .NET 6 SDK. +* Dostęp do Internetu, aby pobrać pakiet **Aspose.BarCode** NuGet. +* Uprawnienia do zapisu w folderze, w którym zostanie zapisany plik PNG. + +Nie są potrzebne dodatkowe biblioteki; Aspose.BarCode obsługuje kodowanie obrazu wewnętrznie. + +## Krok 1: Dodaj pakiet Aspose.BarCode + +Otwórz projekt w Visual Studio, kliknij prawym przyciskiem myszy rozwiązanie i wybierz **Manage NuGet Packages**. Wyszukaj `Aspose.BarCode` i zainstaluj najnowszą stabilną wersję. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Porada:** Utrzymuj pakiet w aktualności. Nowe wydania często zawierają usprawnienia wydajności i wsparcie dla najnowszych środowisk .NET. + +## Krok 2: Utwórz minimalną aplikację konsolową + +Utwórz nowy projekt konsolowy C#, jeśli jeszcze go nie masz: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Zastąp zawartość pliku `Program.cs` pełnym przykładem poniżej. Program ten demonstruje **jak wygenerować kod PDF417 w C#** od początku do końca. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Dlaczego każda linia ma znaczenie + +* **`EncodeTypes.Pdf417`** – wybiera symbologię PDF417, która obsługuje do ~1,1 KB danych. +* **`XDimension.Pixels = 2`** – ustawia podstawową szerokość kreski. Mniejsze wartości sprawiają, że kod jest cieńszy; większe wartości poprawiają czytelność na urządzeniach o niskiej rozdzielczości. +* **`Pdf417.Columns = 3`** – ogranicza liczbę kolumn, wymuszając użycie większej liczby wierszy, co skutkuje wyższym, ale węższym kodem. +* **`Pdf417.Truncate = true`** – aktywuje tryb kompaktowy, usuwając wzorzec stop i zmniejszając obraz bez utraty integralności danych. +* **`Save(..., BarCodeImageFormat.Png)`** – zapisuje plik PNG. Możesz także wybrać `Jpeg`, `Bmp` lub `Svg` w zależności od dalszych potrzeb. + +Uruchom program: + +```bash +dotnet run +``` + +Powinieneś zobaczyć w konsoli komunikat potwierdzający lokalizację pliku, a w folderze znajdzie się `CompactPdf417.png`. Otwierając PNG zobaczysz wyraźny, kompaktowy kod PDF417, który koduje łańcuch Unicode. + +## Krok 3: Zweryfikuj kod kreskowy (opcjonalnie, ale zalecane) + +Aby upewnić się, że kod jest czytelny, możesz użyć dowolnej standardowej aplikacji skanującej PDF417 na smartfonie lub biblioteki dekodującej na komputerze. Zakodowany tekst powinien dokładnie odpowiadać oryginalnemu łańcuchowi `data`, łącznie ze znakami specjalnymi. + +Jeśli napotkasz problemy z dekodowaniem: + +* Zwiększ `XDimension` do 3 lub 4 pikseli. +* Zmniejsz liczbę kolumn (np. ustaw `Columns = 2`). +* Wyłącz `Truncate` (`Truncate = false`), aby dodać wzorzec stop. + +Te korekty wymieniają rozmiar na czytelność, co jest przydatne przy drukarkach lub skanerach o niskiej rozdzielczości. + +## Krok 4: Poznaj typowe warianty + +### 4️⃣ Generowanie kodu PDF417 o wysokiej gęstości do druku + +Jeśli potrzebujesz kodu, który zmieści się na małej etykiecie, zwiększ liczbę kolumn i obniż X‑dimension: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Zmiana formatu wyjściowego na SVG dla skalowania wektorowego + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +Wyjście SVG skaluje się bez utraty jakości, idealne dla responsywnych stron internetowych. + +### 6️⃣ Kodowanie danych binarnych (np. tablicy bajtów) + +Jeśli musisz osadzić ładunek binarny, najpierw przekształć go w łańcuch Base64: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Kod kreskowy teraz przenosi informacje binarne, a dekoder musi odwrócić krok Base64. + +## Najczęściej zadawane pytania + +| Pytanie | Odpowiedź | +|----------|--------| +| **Czy mogę generować PDF417 bez Aspose?** | Tak, istnieją inne biblioteki, takie jak ZXing.Net czy Dynamsoft, ale Aspose.BarCode oferuje bogatszą kontrolę układu (kolumny, przycinanie) oraz lepsze wsparcie Unicode. | +| **Jaka jest maksymalna długość danych?** | PDF417 może zakodować do 1 108 bajtów (≈ 1 KB) danych binarnych. Jeśli przekroczysz tę wartość, rozważ podzielenie danych na kilka kodów kreskowych. | +| **Czy tryb kompaktowy jest zgodny ze standardem?** | Skrócony PDF417 jest częścią specyfikacji ISO/IEC 15438 i jest szeroko wspierany, ale upewnij się, że docelowy skaner explicite go obsługuje. | +| **Jak zmienić kolor tła?** | Ustaw `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` oraz `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` przed zapisem. | + +## Zakończenie + +Teraz wiesz **jak generować kod PDF417 w C#** przy użyciu Aspose.BarCode, jak precyzyjnie dostroić X‑dimension, włączyć tryb kompaktowy i wyeksportować wynik jako obraz PNG. Pełny, gotowy do uruchomienia przykład możesz skopiować do dowolnego projektu .NET, a przedstawione warianty pozwolą Ci dostosować kod do druku, sieci czy scenariuszy z ładunkiem binarnym. + +Kolejne kroki, które możesz rozważyć: + +* Zintegrować generowanie kodu kreskowego w API ASP.NET Core, które zwraca obraz na żądanie. +* Połączyć PDF417 z kodami QR na tej samej etykiecie dla podwójnego skanowania. +* Skorzystać z klasy `Reader` Aspose.BarCode, aby programowo odczytać wygenerowany obraz i zweryfikować dane. + +Miłego kodowania i ciesz się elastycznością, jaką **generowanie kodu PDF417** daje Twoim aplikacjom! + +## Co powinieneś nauczyć się dalej? + +Poniższe tutoriale 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. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [How to Generate Barcode Image with Supplemental Space Customization using Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/portuguese/net/compact-pdf417-encoding/_index.md b/barcode/portuguese/net/compact-pdf417-encoding/_index.md index 9b00326c0..80554b274 100644 --- a/barcode/portuguese/net/compact-pdf417-encoding/_index.md +++ b/barcode/portuguese/net/compact-pdf417-encoding/_index.md @@ -85,6 +85,12 @@ 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. +### [Gerar código de barras PDF417 em C# – guia completo com layout compacto](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Aprenda a gerar códigos de barras PDF417 em C# com layout compacto, passo a passo e exemplos completos. + +### [Gerar código de barras C# com Macro PDF417 – exemplo completo](./generate-barcode-c-with-macro-pdf417-full-example/) +Exemplo completo de geração de código de barras Macro PDF417 em C# usando Aspose.BarCode para .NET. + ## Perguntas Frequentes **Q: Qual é a quantidade máxima de dados que posso armazenar em um código de barras Compact PDF417?** @@ -113,4 +119,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/portuguese/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..2b54309f6 --- /dev/null +++ b/barcode/portuguese/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: Gerar código de barras C# usando Aspose.BarCode para criar um Macro PDF417 + com texto personalizado e salvar como um arquivo de imagem. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: pt +lastmod: 2026-08-19 +og_description: Gere código de barras em C# com Aspose.BarCode, aprenda a gerar PDF417, + adicione texto personalizado e salve o arquivo de imagem do código de barras. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Gerar código de barras C# – Guia Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Gerar código de barras C# com Macro PDF417 – exemplo completo +url: /pt/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Gerar código de barras C# com Macro PDF417 – exemplo completo + +Se você precisa **gerar código de barras C#** no formato Macro PDF417, este guia mostra uma solução pronta‑para‑executar. Você verá **como gerar pdf417**, incorporar texto personalizado e **gerar arquivo de imagem do código de barras** em um único programa autônomo. + +O tutorial cobre tudo, desde a instalação da biblioteca Aspose.BarCode até a configuração dos metadados do Macro PDF417, para que você possa copiar o código diretamente para o seu projeto e ver o resultado imediatamente. + +## Pré‑requisitos + +Antes de começar, verifique se você tem: + +- .NET 6.0 SDK ou superior (o código também funciona com .NET Framework 4.7+) +- Visual Studio 2022 (ou qualquer IDE que suporte C#) +- Uma licença do Aspose.BarCode for .NET (a avaliação gratuita funciona para testes) +- Familiaridade básica com a sintaxe C# + +> **Dica profissional:** Instale o pacote NuGet via CLI para evitar incompatibilidades de versão: +> `dotnet add package Aspose.BarCode` + +## Etapa 1: Configurar o projeto e importar a biblioteca + +Crie um novo aplicativo de console e adicione as diretivas `using` necessárias. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Por que esta etapa é importante:** +O namespace `Aspose.BarCode.Generation` fornece a classe `BarcodeGenerator`, que é o ponto de entrada para criar qualquer tipo de código de barras, incluindo Macro PDF417. Importar `System` dá acesso ao `DateTime` para metadados de timestamp. + +## Etapa 2: Criar um gerador Macro PDF417 com texto personalizado + +Substitua o comentário marcador pelo código de inicialização do gerador. Isso demonstra **criar código de barras texto personalizado** ao mesmo tempo em que seleciona o tipo de codificação correto. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Explicação:** +- `EncodeTypes.MacroPdf417` indica ao Aspose que deve produzir um código PDF417 que suporta recursos de macro (segmentação de arquivo, checksum etc.). +- O texto `"Åspóse.Barcóde©"` mostra que caracteres Unicode são totalmente suportados, o que costuma ser necessário em aplicações internacionais. + +## Etapa 3: Configurar a aparência e os metadados do Macro PDF417 + +Ajuste finamente as dimensões do código de barras e defina os campos específicos da macro necessários para o tratamento de arquivos segmentados. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Por que essas configurações são importantes:** + +| Configuração | Finalidade | +|--------------|------------| +| `XDimension.Pixels` | Controla a densidade visual; 2 px produzem uma imagem clara e legível. | +| `Columns` | Determina quantas colunas de dados aparecem por linha, afetando o tamanho do código. | +| `MacroPdf417FileID` | Identifica de forma única o arquivo lógico entre todos os segmentos. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Permite a reconstrução do arquivo original a partir de múltiplos códigos de barras. | +| `MacroPdf417FileName` | Nome legível armazenado dentro do código para processamento posterior. | +| `MacroPdf417Checksum` | Fornece detecção de erros usando o algoritmo CRC‑16 CCITT. | +| `MacroPdf417FileSize` | Ajuda o decodificador a saber quando o arquivo completo foi recebido. | +| `MacroPdf417TimeStamp` | Registra quando o código de barras foi gerado, útil para auditoria. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Campos opcionais que podem ser usados em fluxos de trabalho empresariais. | +| `MacroPdf417Terminator` | Indica que este segmento é o final (`Set`). | + +## Etapa 4: Salvar o código de barras como arquivo de imagem + +Por fim, grave o código de barras em um arquivo PNG para que você possa visualizá‑lo ou incorporá‑lo em outro lugar. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**O que você verá:** +Uma imagem PNG chamada `ExtPDF417Meta.png` contendo um código de barras Macro PDF417 que codifica o texto personalizado e todos os campos de metadados definidos acima. A imagem pode ser aberta com qualquer visualizador padrão ou inserida em PDFs, relatórios ou páginas web. + +## Código‑fonte completo (pronto para copiar) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Saída esperada + +Ao executar o programa, ele imprime: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Abrir `ExtPDF417Meta.png` mostra um código de barras Macro PDF417 limpo que é escaneado corretamente por qualquer leitor PDF417, preservando o texto personalizado `"Åspóse.Barcóde©"` e os metadados de macro que você definiu. + +## Perguntas frequentes e casos de borda + +- **Posso gerar em outro formato de imagem?** + Sim. Substitua `BarCodeImageFormat.Png` por `Jpeg`, `Bmp` ou `Gif`, conforme necessário. + +- **E se meus dados excederem um único código de barras?** + O Macro PDF417 foi projetado para segmentação. Ajuste `MacroPdf417SegmentsCount` e `MacroPdf417SegmentID` para cada parte e, depois, concatene os resultados escaneados. + +- **O suporte a Unicode é garantido?** + Aspose.BarCode oferece suporte total a Unicode. Certifique‑se de que seu arquivo‑fonte esteja salvo com codificação UTF‑8 para evitar corrupção de caracteres. + +- **Preciso de licença para produção?** + Uma versão licenciada remove a marca d'água de avaliação e fornece funcionalidade completa. A avaliação funciona para testes e aprendizado. + +## Conclusão + +Agora você sabe como **gerar código de barras C#** para um Macro PDF417, **como gerar pdf417** com metadados avançados, **criar código de barras texto personalizado** e **gerar arquivo de imagem do código de barras** usando Aspose.BarCode. O exemplo completo e executável demonstra cada passo necessário — desde a configuração do projeto até a gravação da imagem PNG final. + +### Próximos passos + +- Experimente outras configurações do PDF417, como `ErrorCorrectionLevel` e `CompactPdf417`, para símbolos menores. +- Integre o código de barras gerado em um relatório PDF usando Aspose.PDF. +- Explore geração em lote: percorra uma coleção de arquivos e produza uma série de códigos de barras Macro PDF417 segmentados. + +Sinta‑se à vontade para adaptar o código ao seu fluxo de trabalho e tornar a geração de códigos de barras uma parte fluida das suas aplicações C#. Boa codificação! + +## 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 código completo e funcional com explicações passo a passo para ajudá‑lo a dominar recursos adicionais da API e explorar abordagens alternativas em seus próprios projetos. + +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generate barcode image – Code 93 with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [How to Generate and Adjust Barcode Height for One-Dimensional Databar using Aspose.BarCode for .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/portuguese/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..3a76a6ed3 --- /dev/null +++ b/barcode/portuguese/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,250 @@ +--- +category: general +date: 2026-08-19 +description: Gere código de barras PDF417 em C# rapidamente. Aprenda como gerar código + de barras PDF417 em C# usando Aspose.BarCode com modo compacto e configurações personalizadas. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: pt +lastmod: 2026-08-19 +og_description: Gere código de barras PDF417 em C# com Aspose.BarCode. Este tutorial + mostra como gerar código de barras PDF417 em C# no modo compacto, definir a dimensão + X e salvar como PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Gerar código de barras PDF417 em C# – guia passo a passo +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Gerar código de barras PDF417 em C# – guia completo com layout compacto +url: /pt/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Gerar código de barras PDF417 em C# – guia completo + +Se você precisa **gerar código de barras PDF417** em uma aplicação .NET, este tutorial mostra exatamente como fazer isso. Você verá um exemplo conciso, pronto para produção, que cria um código de barras PDF417 compacto, personaliza a dimensão X e salva o resultado como uma imagem PNG. + +Gerar um código de barras PDF417 é comum quando você tem que codificar grandes quantidades de dados — como informações de tickets, manifestos de envio ou documentos de identidade — em um formato legível por máquina. Usar Aspose.BarCode torna o processo simples, e o código funciona com .NET 6+ ou .NET Framework 4.7.2 e posteriores. + +Neste guia você vai: + +* Instalar o pacote NuGet Aspose.BarCode. +* Escrever um programa C# autônomo que **gere código de barras PDF417** com um pequeno número de colunas e modo compacto (truncado). +* Ajustar a largura da barra (dimensão X) para renderização mais nítida. +* Salvar o código de barras como um arquivo PNG. +* Explorar variações, casos de borda e dicas de boas práticas. + +## Pré‑requisitos + +Antes de começar, certifique‑se de que você tem: + +* Visual Studio 2022 (ou qualquer IDE C#) com .NET 6 SDK instalado. +* Acesso à internet para baixar o pacote NuGet **Aspose.BarCode**. +* Permissão de gravação em uma pasta onde o arquivo PNG será salvo. + +Nenhuma biblioteca adicional é necessária; Aspose.BarCode lida com a codificação de imagens internamente. + +## Etapa 1: Adicionar o pacote Aspose.BarCode + +Abra seu projeto no Visual Studio, clique com o botão direito na solução e selecione **Manage NuGet Packages**. Procure por `Aspose.BarCode` e instale a versão estável mais recente. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Dica profissional:** Mantenha o pacote atualizado. Novas versões costumam incluir melhorias de desempenho e suporte às runtimes .NET mais recentes. + +## Etapa 2: Criar um aplicativo console minimalista + +Crie um novo projeto console C# se ainda não tiver um: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Substitua o conteúdo de `Program.cs` pelo exemplo completo abaixo. Este programa demonstra **como gerar código de barras PDF417 C#** do início ao fim. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Por que cada linha importa + +* **`EncodeTypes.Pdf417`** – seleciona a simbologia PDF417, que suporta até ~1,1 KB de dados. +* **`XDimension.Pixels = 2`** – define a largura básica da barra. Valores menores deixam o código de barras mais fino; valores maiores melhoram a legibilidade em dispositivos de baixa resolução. +* **`Pdf417.Columns = 3`** – limita o número de colunas, forçando o gerador a usar mais linhas, o que resulta em um código de barras mais alto, porém mais estreito. +* **`Pdf417.Truncate = true`** – ativa o modo compacto, removendo o padrão de parada e reduzindo a imagem sem perder a integridade dos dados. +* **`Save(..., BarCodeImageFormat.Png)`** – grava um arquivo PNG. Você também pode escolher `Jpeg`, `Bmp` ou `Svg` conforme as necessidades posteriores. + +Execute o programa: + +```bash +dotnet run +``` + +Você deverá ver a saída no console confirmando o local do arquivo, e a pasta conterá `CompactPdf417.png`. Abrir o PNG mostrará um código de barras PDF417 compacto e nítido que codifica a string Unicode. + +## Etapa 3: Verificar o código de barras (opcional, mas recomendado) + +Para garantir que o código de barras seja legível, você pode usar qualquer aplicativo scanner PDF417 padrão em um smartphone ou uma biblioteca decodificadora de desktop. O texto codificado deve corresponder exatamente à string original `data`, incluindo os caracteres especiais. + +Se você encontrar problemas de decodificação: + +* Aumente o `XDimension` para 3 ou 4 pixels. +* Reduza o número de colunas (por exemplo, defina `Columns = 2`). +* Desative `Truncate` (`Truncate = false`) para adicionar o padrão de parada. + +Esses ajustes trocam tamanho por legibilidade, o que é útil para impressoras ou scanners de baixa resolução. + +## Etapa 4: Explorar variações comuns + +### 4️⃣ Gerar um PDF417 de alta densidade para impressão + +Se precisar de um código de barras que caiba em uma etiqueta pequena, aumente a contagem de colunas e diminua a dimensão X: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Alterar o formato de saída para SVG para dimensionamento vetorial + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +A saída SVG escala sem perda de qualidade, perfeita para páginas web responsivas. + +### 6️⃣ Codificar dados binários (ex.: um array de bytes) + +Se precisar incorporar payloads binários, converta‑os primeiro para uma string Base64: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +O código de barras agora transporta a informação binária, e o decodificador deve reverter a etapa Base64. + +## Perguntas frequentes + +| Pergunta | Resposta | +|----------|----------| +| **Posso gerar PDF417 sem Aspose?** | Sim, outras bibliotecas como ZXing.Net ou Dynamsoft existem, mas Aspose.BarCode oferece controle de layout mais rico (colunas, truncamento) e melhor tratamento de Unicode. | +| **Qual é o comprimento máximo de dados?** | PDF417 pode codificar até 1.108 bytes (≈ 1 KB) de dados binários. Se ultrapassar isso, considere dividir os dados em vários códigos de barras. | +| **O modo compacto está em conformidade com os padrões?** | PDF417 truncado faz parte da especificação ISO/IEC 15438 e é amplamente suportado, mas verifique se o scanner alvo o suporta explicitamente. | +| **Como altero a cor de fundo?** | Defina `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` e `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` antes de salvar. | + +## Conclusão + +Agora você sabe **como gerar código de barras PDF417 C#** usando Aspose.BarCode, como ajustar finamente a dimensão X, habilitar o modo compacto e exportar o resultado como uma imagem PNG. O exemplo completo e executável pode ser copiado para qualquer projeto .NET, e as variações mostradas permitem adaptar o código de barras para impressão, web ou cenários de payload binário. + +Próximos passos que você pode explorar: + +* Integrar a geração de código de barras em uma API ASP.NET Core que retorne a imagem sob demanda. +* Combinar PDF417 com códigos QR na mesma etiqueta para leitura de formato duplo. +* Usar a classe `Reader` do Aspose.BarCode para decodificar a imagem gerada e verificar os dados programaticamente. + +Boa codificação e aproveite a flexibilidade que as soluções de **gerar código de barras PDF417** trazem para suas aplicações! + +## 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 completos e funcionais com explicações passo a passo para ajudá‑lo a dominar recursos adicionais da API e explorar abordagens alternativas de implementação em seus próprios projetos. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [How to Generate Barcode Image with Supplemental Space Customization using Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/russian/net/compact-pdf417-encoding/_index.md b/barcode/russian/net/compact-pdf417-encoding/_index.md index 18a43fe66..f8e902b1e 100644 --- a/barcode/russian/net/compact-pdf417-encoding/_index.md +++ b/barcode/russian/net/compact-pdf417-encoding/_index.md @@ -84,6 +84,10 @@ Aspose.BarCode позволяет задать свойство `Pdf417ErrorCorr ## Руководства по Compact PDF417 Encoding ### [Creating Compact PDF417 Barcodes](./compact-pdf417-basic-configuration/) Узнайте, как генерировать Compact PDF417 штрих‑коды с помощью Aspose.BarCode для .NET. Полное руководство с пошаговыми инструкциями и примерами кода. +### [Generate PDF417 barcode in C# – complete guide with compact layout](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Подробный пример создания PDF417 штрих‑кода в C# с использованием компактного режима в Aspose.BarCode. +### [Генерация штрих‑кода C# с Macro PDF417 – полный пример](./generate-barcode-c-with-macro-pdf417-full-example/) +Полный пример создания штрих‑кода Macro PDF417 в C# с использованием Aspose.BarCode. ## Часто задаваемые вопросы @@ -113,4 +117,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/russian/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..bd7a2721c --- /dev/null +++ b/barcode/russian/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,252 @@ +--- +category: general +date: 2026-08-19 +description: Генерировать штрих‑код на C# с помощью Aspose.BarCode, создавая Macro + PDF417 с пользовательским текстом и сохраняя его в виде файла изображения. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: ru +lastmod: 2026-08-19 +og_description: Создавайте штрихкоды на C# с помощью Aspose.BarCode, изучайте, как + генерировать PDF417, добавляйте пользовательский текст и сохраняйте изображение + штрихкода. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Создание штрихкода C# – руководство по Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Создание штрихкода C# с Macro PDF417 – полный пример +url: /ru/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Генерация штрих‑кода C# с Macro PDF417 – полный пример + +Если вам нужно **generate barcode C#** для формата Macro PDF417, это руководство покажет готовое решение, готовое к запуску. Вы увидите, как **how to generate pdf417**, добавить пользовательский текст и **generate barcode image file** в одной автономной программе. + +В руководстве рассматривается всё: от установки библиотеки Aspose.BarCode до настройки метаданных Macro PDF417, так что вы можете скопировать код прямо в свой проект и сразу увидеть результат. + +## Prerequisites + +Перед началом убедитесь, что у вас есть: + +- .NET 6.0 SDK или новее (код также работает с .NET Framework 4.7+) +- Visual Studio 2022 (или любой IDE, поддерживающий C#) +- Лицензия Aspose.BarCode for .NET (бесплатная trial‑версия подходит для оценки) +- Базовое знакомство с синтаксисом C# + +> **Pro tip:** Установите пакет NuGet через CLI, чтобы избежать конфликтов версий: +> `dotnet add package Aspose.BarCode` + +## Step 1: Set up the project and import the library + +Создайте новое консольное приложение и добавьте необходимые директивы `using`. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Почему этот шаг важен:** +Пространство имён `Aspose.BarCode.Generation` предоставляет класс `BarcodeGenerator`, который является точкой входа для создания любого типа штрих‑кода, включая Macro PDF417. Импорт `System` даёт доступ к `DateTime` для метаданных временной метки. + +## Step 2: Create a Macro PDF417 generator with custom text + +Замените комментарий‑заполнитель инициализацией генератора. Это демонстрирует **create barcode custom text**, одновременно выбирая правильный тип кодирования. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Объяснение:** +- `EncodeTypes.MacroPdf417` указывает Aspose генерировать PDF417‑штрих‑код с поддержкой макро‑функций (разделение файла, контрольная сумма и т.д.). +- Текст `"Åspóse.Barcóde©"` показывает, что Unicode‑символы полностью поддерживаются, что часто требуется для международных приложений. + +## Step 3: Configure appearance and Macro PDF417 metadata + +Тонко настройте размеры штрих‑кода и задайте макро‑специфичные поля, необходимые для обработки сегментированных файлов. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Почему эти настройки важны:** + +| Параметр | Назначение | +|----------|------------| +| `XDimension.Pixels` | Управляет визуальной плотностью; 2 px дают чёткое, сканируемое изображение. | +| `Columns` | Определяет количество столбцов данных в строке, влияя на размер штрих‑кода. | +| `MacroPdf417FileID` | Уникально идентифицирует логический файл во всех сегментах. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Позволяют восстановить исходный файл из нескольких штрих‑кодов. | +| `MacroPdf417FileName` | Человекочитаемое имя, хранящееся внутри штрих‑кода для последующей обработки. | +| `MacroPdf417Checksum` | Обеспечивает обнаружение ошибок с помощью алгоритма CCITT‑16 CRC. | +| `MacroPdf417FileSize` | Помогает декодеру понять, когда получен весь файл. | +| `MacroPdf417TimeStamp` | Записывает время генерации штрих‑кода, полезно для аудита. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Необязательные поля, которые могут использоваться в бизнес‑процессах. | +| `MacroPdf417Terminator` | Указывает, что данный сегмент является последним (`Set`). | + +## Step 4: Save the barcode as an image file + +Наконец, сохраните штрих‑код в файл PNG, чтобы его можно было просмотреть или встроить в другое место. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Что вы увидите:** +Изображение PNG с именем `ExtPDF417Meta.png`, содержащее Macro PDF417‑штрих‑код, который кодирует пользовательский текст и все указанные метаданные. Изображение можно открыть любой стандартной программой‑просмотрщиком или вставить в PDF, отчёты или веб‑страницы. + +## Full source code (copy‑paste ready) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Expected output + +Запуск программы выводит: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Открытие `ExtPDF417Meta.png` показывает чистый Macro PDF417‑штрих‑код, который корректно сканируется любым PDF417‑ридером, сохраняя пользовательский текст `"Åspóse.Barcóde©"` и заданные макро‑метаданные. + +## Common questions and edge cases + +- **Можно ли генерировать другой формат изображения?** + Да. Замените `BarCodeImageFormat.Png` на `Jpeg`, `Bmp` или `Gif` по необходимости. + +- **Что делать, если мои данные превышают один штрих‑код?** + Macro PDF417 предназначен для сегментации. Настройте `MacroPdf417SegmentsCount` и `MacroPdf417SegmentID` для каждой части, затем объедините результаты сканирования. + +- **Гарантирована ли поддержка Unicode?** + Aspose.BarCode полностью поддерживает Unicode. Убедитесь, что ваш исходный файл сохранён в кодировке UTF‑8, чтобы избежать искажения символов. + +- **Нужна ли лицензия для продакшн‑использования?** + Лицензированная версия убирает водяной знак оценки и предоставляет полный набор функций. Триальная версия подходит для тестирования и обучения. + +## Conclusion + +Теперь вы знаете, как **generate barcode C#** для Macro PDF417, **how to generate pdf417** с богатыми метаданными, **create barcode custom text** и **generate barcode image file** с помощью Aspose.BarCode. Полный, готовый к запуску пример демонстрирует каждый необходимый шаг — от настройки проекта до сохранения финального PNG‑изображения. + +### Next steps + +- Поэкспериментируйте с другими параметрами PDF417, такими как `ErrorCorrectionLevel` и `CompactPdf417`, для получения более компактных символов. +- Интегрируйте сгенерированный штрих‑код в PDF‑отчёт с помощью Aspose.PDF. +- Изучите пакетную генерацию: пройдитесь по коллекции файлов и создайте серию сегментированных Macro PDF417‑штрих‑кодов. + +Применяйте код в своём рабочем процессе, и генерация штрих‑кодов станет бесшовной частью ваших C#‑приложений. Приятного кодинга! + +## What Should You Learn Next? + +Следующие руководства охватывают тесно связанные темы, расширяющие техники, продемонстрированные в этом руководстве. Каждый ресурс включает полностью рабочие примеры кода с пошаговыми объяснениями, чтобы помочь вам освоить дополнительные возможности API и исследовать альтернативные подходы в собственных проектах. + +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generate barcode image – Code 93 with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [How to Generate and Adjust Barcode Height for One-Dimensional Databar using Aspose.BarCode for .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/russian/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..ff805b7a1 --- /dev/null +++ b/barcode/russian/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: Быстро генерируйте штрих‑код PDF417 на C#. Узнайте, как генерировать + штрих‑код PDF417 в C# с помощью Aspose.BarCode в компактном режиме и с пользовательскими + настройками. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: ru +lastmod: 2026-08-19 +og_description: Создайте штрих‑код PDF417 на C# с помощью Aspose.BarCode. Этот учебник + показывает, как генерировать штрих‑код PDF417 на C# в компактном режиме, установить + X‑размер и сохранить в PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Создание штрих‑кода PDF417 на C# – пошаговое руководство +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Генерация штрихкода PDF417 в C# – полное руководство с компактным макетом +url: /ru/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Генерация PDF417 barcode в C# – полное руководство + +Если вам нужно **generate PDF417 barcode** в приложении .NET, этот учебник покажет, как это сделать. Вы увидите лаконичный, готовый к продакшну пример, который создает компактный PDF417 штрих‑код, настраивает X‑dimension и сохраняет результат в виде PNG‑изображения. + +Создание PDF417 штрих‑кода часто требуется, когда нужно закодировать большие объёмы данных — например, информацию о билетах, транспортных накладных или удостоверениях личности — в машинно‑читаемом формате. Использование Aspose.BarCode упрощает процесс, а код работает с .NET 6+ или .NET Framework 4.7.2 и новее. + +В этом руководстве вы: + +* Установить пакет NuGet Aspose.BarCode. +* Написать автономную программу на C#, которая **generates PDF417 barcode** с небольшим количеством столбцов и в компактном (усечённом) режиме. +* Отрегулировать ширину полос (X‑dimension) для более чёткого отображения. +* Сохранить штрих‑код в файл PNG. +* Исследовать варианты, граничные случаи и рекомендации лучших практик. + +## Предварительные требования + +Перед началом убедитесь, что у вас есть: + +* Visual Studio 2022 (или любой IDE для C#) с установленным .NET 6 SDK. +* Доступ к Интернету для загрузки пакета NuGet **Aspose.BarCode**. +* Права записи в папку, где будет сохраняться файл PNG. + +Дополнительные библиотеки не требуются; Aspose.BarCode обрабатывает кодирование изображения внутри. + +## Шаг 1: Добавьте пакет Aspose.BarCode + +Откройте ваш проект в Visual Studio, щёлкните правой кнопкой мыши по решению и выберите **Manage NuGet Packages**. Найдите `Aspose.BarCode` и установите последнюю стабильную версию. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** Держите пакет в актуальном состоянии. Новые версии часто включают улучшения производительности и поддержку последних .NET рантаймов. + +## Шаг 2: Создайте минимальное консольное приложение + +Создайте новый C# консольный проект, если у вас его ещё нет: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Замените содержимое `Program.cs` полным примером ниже. Эта программа демонстрирует **how to generate PDF417 barcode C#** от начала до конца. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Почему каждая строка важна + +* **`EncodeTypes.Pdf417`** – выбирает символьный набор PDF417, поддерживающий до ~1.1 KB данных. +* **`XDimension.Pixels = 2`** – задаёт базовую ширину полосы. Меньшие значения делают штрих‑код тоньше; большие значения повышают читаемость на устройствах с низким разрешением. +* **`Pdf417.Columns = 3`** – ограничивает количество столбцов, заставляя генератор использовать больше строк, что приводит к более высокому, но уже штрих‑коду. +* **`Pdf417.Truncate = true`** – активирует компактный режим, удаляя стоп‑шаблон и уменьшая изображение без потери целостности данных. +* **`Save(..., BarCodeImageFormat.Png)`** – сохраняет файл PNG. Вы также можете выбрать `Jpeg`, `Bmp` или `Svg` в зависимости от последующих требований. + +Запустите программу: + +```bash +dotnet run +``` + +Вы должны увидеть вывод в консоли, подтверждающий расположение файла, а в папке появится `CompactPdf417.png`. Открытие PNG покажет чёткий, компактный PDF417 штрих‑код, кодирующий Unicode‑строку. + +## Шаг 3: Проверьте штрих‑код (необязательно, но рекомендуется) + +Чтобы убедиться, что штрих‑код читается, вы можете использовать любое стандартное приложение‑сканер PDF417 на смартфоне или библиотеку декодера на ПК. Закодированный текст должен точно соответствовать исходной строке `data`, включая специальные символы. + +Если вы столкнётесь с проблемами декодирования: + +* Увеличьте `XDimension` до 3 или 4 пикселей. +* Уменьшите количество столбцов (например, установить `Columns = 2`). +* Отключите `Truncate` (`Truncate = false`), чтобы добавить стоп‑шаблон. + +Эти настройки меняют размер в пользу читаемости, что полезно для принтеров или сканеров с низким разрешением. + +## Шаг 4: Исследуйте распространённые варианты + +### 4️⃣ Сгенерировать высокоплотный PDF417 для печати + +Если вам нужен штрих‑код, который помещается на небольшой этикетке, увеличьте количество столбцов и уменьшите X‑dimension: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Изменить формат вывода на SVG для векторного масштабирования + +SVG вывод масштабируется без потери качества, идеально подходит для адаптивных веб‑страниц. + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +### 6️⃣ Кодировать бинарные данные (например, массив байтов) + +Если вам нужно внедрить бинарные полезные нагрузки, сначала преобразуйте их в строку Base64: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Теперь штрих‑код содержит бинарную информацию, а декодер должен выполнить обратное преобразование Base64. + +## Часто задаваемые вопросы + +| Question | Answer | +|----------|--------| +| **Могу ли я генерировать PDF417 без Aspose?** | Да, существуют другие библиотеки, такие как ZXing.Net или Dynamsoft, но Aspose.BarCode предоставляет более гибкое управление макетом (столбцы, усечение) и лучшую работу с Unicode. | +| **Какова максимальная длина данных?** | PDF417 может кодировать до 1 108 байт (≈ 1 KB) бинарных данных. Если вы превысите этот предел, рассмотрите возможность разбить данные на несколько штрих‑кодов. | +| **Соответствует ли компактный режим стандартам?** | Усечённый PDF417 является частью спецификации ISO/IEC 15438 и широко поддерживается, однако убедитесь, что ваш сканер явно поддерживает его. | +| **Как изменить цвет фона?** | Установите `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` и `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` перед сохранением. | + +## Заключение + +Теперь вы знаете **how to generate PDF417 barcode C#** с помощью Aspose.BarCode, как точно настроить X‑dimension, включить компактный режим и экспортировать результат в виде PNG‑изображения. Полный, готовый к запуску пример можно скопировать в любой проект .NET, а показанные варианты позволяют адаптировать штрих‑код для печати, веб‑использования или сценариев с бинарными полезными нагрузками. + +Следующие шаги, которые вы можете изучить: + +* Интегрировать генерацию штрих‑кода в ASP.NET Core API, который возвращает изображение по запросу. +* Скомбинировать PDF417 с QR‑кодами на одной этикетке для двойного сканирования. +* Использовать класс Aspose.BarCode `Reader` для декодирования сгенерированного изображения и программной проверки данных. + +Удачной разработки, и наслаждайтесь гибкостью, которую решения **generate PDF417 barcode** приносят в ваши приложения! + +## Что изучать дальше? + +Следующие учебники охватывают тесно связанные темы, построенные на техниках, продемонстрированных в этом руководстве. Каждый ресурс включает полные рабочие примеры кода с пошаговыми объяснениями, чтобы помочь вам освоить дополнительные возможности API и исследовать альтернативные подходы к реализации в ваших проектах. + +- [Как создать штрих‑код – Compact PDF417 с Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Как сгенерировать изображение штрих‑кода с настройкой дополнительного пространства с помощью Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [Как сгенерировать Aztec штрих‑код с пользовательским соотношением сторон с помощью Aspose.BarCode для .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/spanish/net/compact-pdf417-encoding/_index.md b/barcode/spanish/net/compact-pdf417-encoding/_index.md index 6c5e3bd09..92656dfc6 100644 --- a/barcode/spanish/net/compact-pdf417-encoding/_index.md +++ b/barcode/spanish/net/compact-pdf417-encoding/_index.md @@ -85,6 +85,10 @@ 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. +### [Generar código de barras PDF417 en C# – guía completa con diseño compacto](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Aprende a crear códigos de barras PDF417 en C# con diseño compacto usando Aspose.BarCode, paso a paso y con ejemplos. +### [Generar código de barras C# con Macro PDF417 – ejemplo completo](./generate-barcode-c-with-macro-pdf417-full-example/) +Aprende a crear un código de barras Macro PDF417 en C# con un ejemplo completo paso a paso. ## Preguntas frecuentes @@ -114,4 +118,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/spanish/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..5f8697d8d --- /dev/null +++ b/barcode/spanish/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Generar código de barras en C# usando Aspose.BarCode para crear un Macro + PDF417 con texto personalizado y guardarlo como archivo de imagen. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: es +lastmod: 2026-08-19 +og_description: Genera códigos de barras en C# con Aspose.BarCode, aprende a generar + PDF417, agrega texto personalizado y guarda el archivo de imagen del código de barras. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Generar código de barras C# – Guía Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Generar código de barras C# con Macro PDF417 – ejemplo completo +url: /es/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generar código de barras C# con Macro PDF417 – ejemplo completo + +Si necesitas **generar código de barras C#** para un formato Macro PDF417, esta guía te muestra una solución lista‑para‑ejecutar. Verás cómo **generar pdf417**, incrustar texto personalizado y **generar archivo de imagen de código de barras** en un único programa autónomo. + +El tutorial cubre todo, desde la instalación de la biblioteca Aspose.BarCode hasta la configuración de los metadatos de Macro PDF417, para que puedas copiar el código directamente en tu proyecto y ver el resultado de inmediato. + +## Requisitos previos + +- .NET 6.0 SDK o posterior (el código también funciona con .NET Framework 4.7+) +- Visual Studio 2022 (o cualquier IDE que soporte C#) +- Una licencia de Aspose.BarCode para .NET (la prueba gratuita funciona para evaluación) +- Familiaridad básica con la sintaxis de C# + +> **Consejo profesional:** Instala el paquete NuGet mediante la CLI para evitar incompatibilidades de versiones: +> `dotnet add package Aspose.BarCode` + +## Paso 1: Configurar el proyecto e importar la biblioteca + +Crea una nueva aplicación de consola y agrega las directivas `using` requeridas. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Por qué este paso es importante:** +El espacio de nombres `Aspose.BarCode.Generation` proporciona la clase `BarcodeGenerator`, que es el punto de entrada para crear cualquier tipo de código de barras, incluido Macro PDF417. Importar `System` te brinda acceso a `DateTime` para los metadatos de marca de tiempo. + +## Paso 2: Crear un generador Macro PDF417 con texto personalizado + +Reemplaza el comentario de marcador de posición con la inicialización del generador. Esto demuestra **crear texto personalizado de código de barras** mientras también seleccionas el tipo de codificación correcto. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Explicación:** +- `EncodeTypes.MacroPdf417` indica a Aspose que produzca un código de barras PDF417 que soporta funciones macro (segmentación de archivos, suma de verificación, etc.). +- El texto `"Åspóse.Barcóde©"` muestra que los caracteres Unicode son totalmente compatibles, lo cual a menudo se requiere para aplicaciones internacionales. + +## Paso 3: Configurar la apariencia y los metadatos de Macro PDF417 + +Ajusta finamente las dimensiones del código de barras y establece los campos específicos de macro requeridos para el manejo de archivos segmentados. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Por qué estas configuraciones son importantes:** + +| Configuración | Propósito | +|---------------|-----------| +| `XDimension.Pixels` | Controla la densidad visual; 2 px produce una imagen clara y escaneable. | +| `Columns` | Determina cuántas columnas de datos aparecen por fila, afectando el tamaño del código de barras. | +| `MacroPdf417FileID` | Identifica de forma única el archivo lógico a través de todos los segmentos. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Permite la reconstrucción del archivo original a partir de múltiples códigos de barras. | +| `MacroPdf417FileName` | Nombre legible por humanos almacenado dentro del código de barras para procesamiento posterior. | +| `MacroPdf417Checksum` | Proporciona detección de errores usando el algoritmo CCITT‑16 CRC. | +| `MacroPdf417FileSize` | Ayuda al decodificador a saber cuándo se ha recibido el archivo completo. | +| `MacroPdf417TimeStamp` | Registra cuándo se generó el código de barras, útil para auditorías. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Campos opcionales que pueden ser usados en flujos de trabajo empresariales. | +| `MacroPdf417Terminator` | Indica que este segmento es el final (`Set`). | + +## Paso 4: Guardar el código de barras como archivo de imagen + +Finalmente, escribe el código de barras en un archivo PNG para que puedas verlo o incrustarlo en otro lugar. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Lo que verás:** +Una imagen PNG llamada `ExtPDF417Meta.png` que contiene un código de barras Macro PDF417 que codifica el texto personalizado y todos los campos de metadatos que configuraste arriba. La imagen puede abrirse con cualquier visor estándar o insertarse en PDFs, informes o páginas web. + +## Código fuente completo (listo para copiar y pegar) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Salida esperada + +Ejecutar el programa imprime: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Abrir `ExtPDF417Meta.png` muestra un código de barras Macro PDF417 limpio que se escanea correctamente con cualquier lector PDF417, preservando el texto personalizado `"Åspóse.Barcóde©"` y los metadatos macro que definiste. + +## Preguntas comunes y casos límite + +- **¿Puedo generar un formato de imagen diferente?** + Sí. Reemplaza `BarCodeImageFormat.Png` con `Jpeg`, `Bmp` o `Gif` según sea necesario. + +- **¿Qué pasa si mis datos exceden un solo código de barras?** + Macro PDF417 está diseñado para segmentación. Ajusta `MacroPdf417SegmentsCount` y `MacroPdf417SegmentID` para cada parte, luego concatena los resultados escaneados. + +- **¿Se garantiza el soporte Unicode?** + Aspose.BarCode soporta Unicode completamente. Asegúrate de que tu archivo fuente esté guardado con codificación UTF‑8 para evitar la corrupción de caracteres. + +- **¿Necesito una licencia para producción?** + Una versión con licencia elimina la marca de agua de evaluación y brinda funcionalidad completa. La versión de prueba funciona para pruebas y aprendizaje. + +## Conclusión + +Ahora sabes cómo **generar código de barras C#** para un Macro PDF417, **cómo generar pdf417** con metadatos enriquecidos, **crear texto personalizado de código de barras**, y **generar archivo de imagen de código de barras** usando Aspose.BarCode. El ejemplo completo y ejecutable muestra cada paso necesario, desde la configuración del proyecto hasta guardar la imagen PNG final. + +### Próximos pasos + +- Experimenta con otras configuraciones de PDF417 como `ErrorCorrectionLevel` y `CompactPdf417` para símbolos más pequeños. +- Integra el código de barras generado en un informe PDF usando Aspose.PDF. +- Explora la generación por lotes: recorre una colección de archivos y produce una serie de códigos de barras Macro PDF417 segmentados. + +¡Siéntete libre de adaptar el código a tu propio flujo de trabajo, y que la generación de códigos de barras se convierta en una parte fluida de tus aplicaciones C#. ¡Feliz codificación! + +## ¿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 generar código de barras Aztec con relación de aspecto personalizada usando Aspose.BarCode para .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generar imagen de código de barras – Code 93 con Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Cómo generar y ajustar la altura del código de barras para One-Dimensional Databar usando Aspose.BarCode para .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/spanish/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..71f623c99 --- /dev/null +++ b/barcode/spanish/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: Genere códigos de barras PDF417 en C# rápidamente. Aprenda cómo generar + códigos de barras PDF417 en C# usando Aspose.BarCode con modo compacto y configuraciones + personalizadas. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: es +lastmod: 2026-08-19 +og_description: Genere códigos de barras PDF417 en C# con Aspose.BarCode. Este tutorial + muestra cómo generar códigos de barras PDF417 en C# en modo compacto, establecer + la dimensión X y guardarlos como PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Generar código de barras PDF417 en C# – guía paso a paso +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Generar código de barras PDF417 en C# – guía completa con diseño compacto +url: /es/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generar código de barras PDF417 en C# – guía completa + +Si necesitas **generar un código de barras PDF417** en una aplicación .NET, este tutorial te muestra exactamente cómo hacerlo. Verás un ejemplo conciso, listo para producción, que crea un código de barras PDF417 compacto, personaliza la dimensión X y guarda el resultado como una imagen PNG. + +Generar un código de barras PDF417 es común cuando tienes que codificar grandes cantidades de datos —como información de tickets, manifiestos de envío o documentos de identidad— en un formato legible por máquinas. Usar Aspose.BarCode hace que el proceso sea sencillo, y el código funciona con .NET 6+ o .NET Framework 4.7.2 y posteriores. + +En esta guía aprenderás a: + +* Instalar el paquete NuGet Aspose.BarCode. +* Escribir un programa C# autónomo que **genere un código de barras PDF417** con un número reducido de columnas y modo compacto (truncado). +* Ajustar el ancho de barra (dimensión X) para una renderización más nítida. +* Guardar el código de barras como un archivo PNG. +* Explorar variaciones, casos límite y consejos de buenas prácticas. + +## Requisitos previos + +Antes de comenzar, asegúrate de contar con: + +* Visual Studio 2022 (o cualquier IDE de C#) con el SDK de .NET 6 instalado. +* Acceso a Internet para descargar el paquete NuGet **Aspose.BarCode**. +* Permiso de escritura en una carpeta donde se guardará el archivo PNG. + +No se requieren bibliotecas adicionales; Aspose.BarCode maneja la codificación de imágenes internamente. + +## Paso 1: Añadir el paquete Aspose.BarCode + +Abre tu proyecto en Visual Studio, haz clic derecho en la solución y selecciona **Manage NuGet Packages**. Busca `Aspose.BarCode` e instala la versión estable más reciente. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Consejo profesional:** Mantén el paquete actualizado. Las nuevas versiones suelen incluir mejoras de rendimiento y soporte para los últimos runtimes de .NET. + +## Paso 2: Crear una aplicación de consola mínima + +Crea un nuevo proyecto de consola C# si aún no tienes uno: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Reemplaza el contenido de `Program.cs` con el ejemplo completo a continuación. Este programa demuestra **cómo generar un código de barras PDF417 en C#** de principio a fin. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Por qué cada línea es importante + +* **`EncodeTypes.Pdf417`** – selecciona la simbología PDF417, que soporta hasta ~1.1 KB de datos. +* **`XDimension.Pixels = 2`** – establece el ancho básico de la barra. Valores más pequeños hacen el código de barras más delgado; valores mayores mejoran la legibilidad en dispositivos de baja resolución. +* **`Pdf417.Columns = 3`** – limita el número de columnas, obligando al generador a usar más filas, lo que resulta en un código de barras más alto pero más estrecho. +* **`Pdf417.Truncate = true`** – activa el modo compacto, eliminando el patrón de parada y reduciendo la imagen sin perder la integridad de los datos. +* **`Save(..., BarCodeImageFormat.Png)`** – escribe un archivo PNG. También podrías elegir `Jpeg`, `Bmp` o `Svg` según las necesidades posteriores. + +Ejecuta el programa: + +```bash +dotnet run +``` + +Deberías ver en la consola la salida que confirma la ubicación del archivo, y la carpeta contendrá `CompactPdf417.png`. Al abrir el PNG verás un código de barras PDF417 claro y compacto que codifica la cadena Unicode. + +## Paso 3: Verificar el código de barras (opcional pero recomendado) + +Para asegurarte de que el código de barras sea legible, puedes usar cualquier aplicación escáner de PDF417 estándar en un smartphone o una biblioteca decodificadora de escritorio. El texto codificado debe coincidir exactamente con la cadena original `data`, incluidos los caracteres especiales. + +Si encuentras problemas de decodificación: + +* Aumenta `XDimension` a 3 o 4 píxeles. +* Reduce el número de columnas (p. ej., establece `Columns = 2`). +* Desactiva `Truncate` (`Truncate = false`) para añadir el patrón de parada. + +Estos ajustes intercambian tamaño por legibilidad, lo cual es útil para impresoras o escáneres de baja resolución. + +## Paso 4: Explorar variaciones comunes + +### 4️⃣ Generar un PDF417 de alta densidad para impresión + +Si necesitas un código de barras que quepa en una etiqueta pequeña, incrementa el número de columnas y disminuye la dimensión X: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Cambiar el formato de salida a SVG para escalado vectorial + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +La salida SVG se escala sin pérdida de calidad, perfecta para páginas web responsivas. + +### 6️⃣ Codificar datos binarios (p. ej., un arreglo de bytes) + +Si necesitas incrustar cargas binarias, conviértelos primero a una cadena Base64: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Ahora el código de barras transporta la información binaria, y el decodificador debe revertir el paso Base64. + +## Preguntas frecuentes + +| Pregunta | Respuesta | +|----------|-----------| +| **¿Puedo generar PDF417 sin Aspose?** | Sí, existen otras bibliotecas como ZXing.Net o Dynamsoft, pero Aspose.BarCode ofrece un control de diseño más rico (columnas, truncado) y mejor manejo de Unicode. | +| **¿Cuál es la longitud máxima de datos?** | PDF417 puede codificar hasta 1 108 bytes (≈ 1 KB) de datos binarios. Si superas este límite, considera dividir los datos en varios códigos de barras. | +| **¿El modo compacto cumple con los estándares?** | El PDF417 truncado forma parte de la especificación ISO/IEC 15438 y es ampliamente soportado, pero verifica que tu escáner objetivo lo admita explícitamente. | +| **¿Cómo cambio el color de fondo?** | Establece `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` y `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` antes de guardar. | + +## Conclusión + +Ahora sabes **cómo generar un código de barras PDF417 en C#** usando Aspose.BarCode, cómo afinar la dimensión X, habilitar el modo compacto y exportar el resultado como una imagen PNG. El ejemplo completo y ejecutable puede copiarse a cualquier proyecto .NET, y las variaciones mostradas te permiten adaptar el código de barras para impresión, web o escenarios de carga binaria. + +Próximos pasos que podrías explorar: + +* Integrar la generación de códigos de barras en una API ASP.NET Core que devuelva la imagen bajo demanda. +* Combinar PDF417 con códigos QR en la misma etiqueta para escaneo dual. +* Utilizar la clase `Reader` de Aspose.BarCode para decodificar la imagen generada y verificar los datos programáticamente. + +¡Feliz codificación y disfruta de la flexibilidad que aportan las soluciones para **generar códigos de barras PDF417** en tus aplicaciones! + +## ¿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. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [How to Generate Barcode Image with Supplemental Space Customization using Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/swedish/net/compact-pdf417-encoding/_index.md b/barcode/swedish/net/compact-pdf417-encoding/_index.md index cc613e6f8..7ee731a0b 100644 --- a/barcode/swedish/net/compact-pdf417-encoding/_index.md +++ b/barcode/swedish/net/compact-pdf417-encoding/_index.md @@ -85,6 +85,12 @@ 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. +### [Generera PDF417-streckkod i C# – komplett guide med kompakt layout](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Lär dig steg‑för‑steg hur du skapar PDF417‑streckkoder i C# med kompakt layout med Aspose.BarCode. + +### [Generera streckkod C# med Macro PDF417 – fullständigt exempel](./generate-barcode-c-with-macro-pdf417-full-example/) +Lär dig hur du skapar en fullständig Macro PDF417‑streckkod i C# med Aspose.BarCode. + ## Vanliga frågor **Q: Vad är den maximala mängden data jag kan lagra i en Compact PDF417‑streckkod?** @@ -113,4 +119,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/swedish/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..d56bc2fa4 --- /dev/null +++ b/barcode/swedish/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: Generera streckkod i C# med Aspose.BarCode för att skapa en Macro PDF417 + med anpassad text och spara den som en bildfil. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: sv +lastmod: 2026-08-19 +og_description: Generera streckkod i C# med Aspose.BarCode, lär dig hur du genererar + PDF417, lägg till anpassad text och spara streckkodens bildfil. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Generera streckkod C# – Macro PDF417‑guide +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Generera streckkod C# med Macro PDF417 – fullständigt exempel +url: /sv/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generera streckkod C# med Macro PDF417 – fullständigt exempel + +Om du behöver **generera streckkod C#** för ett Macro PDF417‑format, visar den här guiden en färdig‑att‑köra‑lösning. Du får se hur du **genererar pdf417**, bäddar in anpassad text och **genererar streckkod bildfil** i ett enda, självständigt program. + +Handledningen täcker allt från installation av Aspose.BarCode‑biblioteket till konfiguration av Macro PDF417‑metadata, så att du kan kopiera koden direkt in i ditt projekt och se resultatet omedelbart. + +## Förutsättningar + +- .NET 6.0 SDK eller senare (koden fungerar också med .NET Framework 4.7+) +- Visual Studio 2022 (eller någon IDE som stödjer C#) +- En Aspose.BarCode för .NET‑licens (den kostnadsfria provversionen fungerar för utvärdering) +- Grundläggande kunskap om C#‑syntax + +> **Proffstips:** Installera NuGet‑paketet via CLI för att undvika versionskonflikter: +> `dotnet add package Aspose.BarCode` + +## Steg 1: Ställ in projektet och importera biblioteket + +Skapa en ny konsolapplikation och lägg till de nödvändiga `using`‑direktiven. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Varför detta steg är viktigt:** +`Aspose.BarCode.Generation`‑namnutrymmet tillhandahåller `BarcodeGenerator`‑klassen, som är ingångspunkten för att skapa vilken streckkodstyp som helst, inklusive Macro PDF417. Genom att importera `System` får du tillgång till `DateTime` för tidsstämpel‑metadata. + +## Steg 2: Skapa en Macro PDF417‑generator med anpassad text + +Ersätt platshållarkommentaren med generatorns initiering. Detta demonstrerar **skapa streckkod anpassad text** samtidigt som rätt kodningstyp väljs. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Förklaring:** +- `EncodeTypes.MacroPdf417` talar om för Aspose att producera en PDF417‑streckkod som stödjer makro‑funktioner (filsegmentering, kontrollsumma osv.). +- Texten `"Åspóse.Barcóde©"` visar att Unicode‑tecken stöds fullt ut, vilket ofta krävs för internationella applikationer. + +## Steg 3: Konfigurera utseende och Macro PDF417‑metadata + +Finjustera streckkodens dimensioner och ange de makro‑specifika fälten som krävs för hantering av segmenterade filer. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Varför dessa inställningar är viktiga:** + +| Inställning | Syfte | +|-------------|-------| +| `XDimension.Pixels` | Styr den visuella densiteten; 2 px ger en klar, avläsbar bild. | +| `Columns` | Bestämmer hur många datakolumner som visas per rad, vilket påverkar streckkodens storlek. | +| `MacroPdf417FileID` | Identifierar den logiska filen unikt över alla segment. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Möjliggör återuppbyggnad av den ursprungliga filen från flera streckkoder. | +| `MacroPdf417FileName` | Mänskligt läsbart namn lagrat i streckkoden för efterföljande bearbetning. | +| `MacroPdf417Checksum` | Ger felupptäckt med CCITT‑16 CRC‑algoritmen. | +| `MacroPdf417FileSize` | Hjälper avkodaren att veta när hela filen har mottagits. | +| `MacroPdf417TimeStamp` | Registrerar när streckkoden genererades, användbart för revisionsspår. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Valfria fält som kan användas i affärsarbetsflöden. | +| `MacroPdf417Terminator` | Indikerar att detta segment är det sista (`Set`). | + +## Steg 4: Spara streckkoden som en bildfil + +Slutligen, skriv streckkoden till en PNG‑fil så att du kan visa eller bädda in den någon annanstans. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Vad du kommer att se:** +En PNG‑bild med namnet `ExtPDF417Meta.png` som innehåller en Macro PDF417‑streckkod som kodar den anpassade texten och alla metadatafält du angav ovan. Bilden kan öppnas med vilken standardvisare som helst eller infogas i PDF‑filer, rapporter eller webbsidor. + +## Fullständig källkod (klar för kopiering och inklistring) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Förväntat resultat + +När programmet körs skrivs: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +När du öppnar `ExtPDF417Meta.png` visas en ren Macro PDF417‑streckkod som skannas korrekt med vilken PDF417‑läsare som helst, och bevarar den anpassade texten `"Åspóse.Barcóde©"` samt den makro‑metadata du definierade. + +## Vanliga frågor och specialfall + +- **Kan jag generera ett annat bildformat?** + Ja. Ersätt `BarCodeImageFormat.Png` med `Jpeg`, `Bmp` eller `Gif` efter behov. + +- **Vad händer om mina data överskrider en enda streckkod?** + Macro PDF417 är designad för segmentering. Justera `MacroPdf417SegmentsCount` och `MacroPdf417SegmentID` för varje del, och sammanfoga sedan de skannade resultaten. + +- **Är Unicode‑stöd garanterat?** + Aspose.BarCode stödjer Unicode fullt ut. Se till att din källfil sparas med UTF‑8‑kodning för att undvika teckenkorruption. + +- **Behöver jag en licens för produktion?** + En licensierad version tar bort utvärderingsvattenstämpeln och ger full funktionalitet. Provanvändningen fungerar för testning och lärande. + +## Slutsats + +Du vet nu hur du **genererar streckkod C#** för en Macro PDF417, **genererar pdf417** med rik metadata, **skapar streckkod anpassad text** och **genererar streckkod bildfil** med Aspose.BarCode. Det kompletta, körbara exemplet demonstrerar varje nödvändigt steg — från projektuppsättning till att spara den slutliga PNG‑bilden. + +### Nästa steg + +- Experimentera med andra PDF417‑inställningar såsom `ErrorCorrectionLevel` och `CompactPdf417` för mindre symboler. +- Integrera den genererade streckkoden i en PDF‑rapport med Aspose.PDF. +- Utforska batch‑generering: loopa över en samling filer och producera en serie av segmenterade Macro PDF417‑streckkoder. + +Känn dig fri att anpassa koden för ditt eget arbetsflöde, och låt streckkodsgenereringen bli en sömlös del av dina C#‑applikationer. Lycka till med kodningen! + +## Vad bör du lära dig härnäst? + +Följande handledningar täcker närbesläktade ämnen som bygger på teknikerna som demonstrerats i 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 implementeringsmetoder i dina egna projekt. + +- [Hur man genererar Aztec‑streckkod med anpassat bildförhållande med Aspose.BarCode för .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generera streckkod bild – Code 93 med Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Hur man genererar och justerar streckkodshöjd för endimensionell Databar med Aspose.BarCode för .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/swedish/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..8d960d673 --- /dev/null +++ b/barcode/swedish/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,250 @@ +--- +category: general +date: 2026-08-19 +description: Generera PDF417‑streckkod i C# snabbt. Lär dig hur du genererar PDF417‑streckkod + i C# med Aspose.BarCode i kompakt läge och anpassade inställningar. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: sv +lastmod: 2026-08-19 +og_description: Generera PDF417‑streckkod i C# med Aspose.BarCode. Denna handledning + visar hur du genererar PDF417‑streckkod i C# i kompakt läge, ställer in X‑dimension + och sparar som PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Generera PDF417-streckkod i C# – steg‑för‑steg guide +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Generera PDF417-streckkod i C# – komplett guide med kompakt layout +url: /sv/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Generera PDF417-streckkod i C# – komplett guide + +Om du behöver **generera PDF417-streckkod** i en .NET-applikation visar den här handledningen exakt hur du gör det. Du får se ett koncist, produktionsklart exempel som skapar en kompakt PDF417-streckkod, anpassar X‑dimensionen och sparar resultatet som en PNG‑bild. + +Att generera en PDF417-streckkod är vanligt när du måste koda stora mängder data — såsom biljettinformation, fraktmanifest eller identitetshandlingar — i ett maskinläsbart format. Att använda Aspose.BarCode gör processen enkel, och koden fungerar med .NET 6+ eller .NET Framework 4.7.2 och senare. + +I den här guiden kommer du att: + +* Installera Aspose.BarCode NuGet‑paketet. +* Skriva ett fristående C#‑program som **genererar PDF417-streckkod** med ett litet kolumnantal och kompakt (avkortat) läge. +* Justera stapelbredden (X‑dimension) för skarpare återgivning. +* Spara streckkoden som en PNG‑fil. +* Utforska variationer, kantfall och bästa‑praxis‑tips. + +## Förutsättningar + +Innan du börjar, se till att du har: + +* Visual Studio 2022 (eller någon C#‑IDE) med .NET 6 SDK installerat. +* Internetåtkomst för att ladda ner **Aspose.BarCode**‑paketet från NuGet. +* Skrivbehörighet till en mapp där PNG‑filen ska sparas. + +Inga ytterligare bibliotek behövs; Aspose.BarCode hanterar bildkodning internt. + +## Steg 1: Lägg till Aspose.BarCode‑paketet + +Öppna ditt projekt i Visual Studio, högerklicka på lösningen och välj **Manage NuGet Packages**. Sök efter `Aspose.BarCode` och installera den senaste stabila versionen. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** Håll paketet uppdaterat. Nya versioner innehåller ofta prestandaförbättringar och stöd för de senaste .NET‑runtime‑versionerna. + +## Steg 2: Skapa en minimal konsolapplikation + +Skapa ett nytt C#‑konsolprojekt om du inte redan har ett: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Ersätt innehållet i `Program.cs` med hela exemplet nedan. Detta program demonstrerar **hur man genererar PDF417-streckkod i C#** från början till slut. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Varför varje rad är viktig + +* **`EncodeTypes.Pdf417`** – väljer PDF417‑symbologi, som stödjer upp till ~1,1 KB data. +* **`XDimension.Pixels = 2`** – anger grundbredden på staplarna. Mindre värden gör streckkoden tunnare; större värden förbättrar läsbarheten på lågupplösta enheter. +* **`Pdf417.Columns = 3`** – begränsar antalet kolumner, vilket tvingar generatorn att använda fler rader, vilket ger en högre men smalare streckkod. +* **`Pdf417.Truncate = true`** – aktiverar kompakt läge, tar bort stoppmönstret och minskar bilden utan att förlora dataintegritet. +* **`Save(..., BarCodeImageFormat.Png)`** – skriver en PNG‑fil. Du kan också välja `Jpeg`, `Bmp` eller `Svg` beroende på efterföljande behov. + +Kör programmet: + +```bash +dotnet run +``` + +Du bör se konsolutdata som bekräftar filens plats, och mappen kommer att innehålla `CompactPdf417.png`. När du öppnar PNG‑filen visas en tydlig, kompakt PDF417‑streckkod som kodar Unicode‑strängen. + +## Steg 3: Verifiera streckkoden (valfritt men rekommenderat) + +För att säkerställa att streckkoden är läsbar kan du använda någon standard‑PDF417‑skannerapp på en smartphone eller ett desktop‑avkodarbibliotek. Den kodade texten bör exakt matcha den ursprungliga `data`‑strängen, inklusive specialtecken. + +Om du stöter på avkodningsproblem: + +* Öka `XDimension` till 3 eller 4 pixlar. +* Minska antalet kolumner (t.ex. sätt `Columns = 2`). +* Inaktivera `Truncate` (`Truncate = false`) för att lägga till stoppmönstret. + +Dessa justeringar byter storlek mot läsbarhet, vilket är användbart för lågupplösta skrivare eller skannrar. + +## Steg 4: Utforska vanliga variationer + +### 4️⃣ Generera en högdensitets‑PDF417 för utskrift + +Om du behöver en streckkod som får plats på en liten etikett, öka kolumnantalet och sänk X‑dimensionen: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Ändra utdataformatet till SVG för vektorskalning + +SVG‑utdata skalar utan kvalitetsförlust, perfekt för responsiva webbplatser. + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +### 6️⃣ Koda binär data (t.ex. en byte‑array) + +Om du behöver bädda in binära nyttolaster, konvertera dem först till en Base64‑sträng: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Streckkoden bär nu den binära informationen, och avkodaren måste vända Base64‑steget. + +## Vanliga frågor + +| Fråga | Svar | +|----------|--------| +| **Kan jag generera PDF417 utan Aspose?** | Ja, andra bibliotek som ZXing.Net eller Dynamsoft finns, men Aspose.BarCode erbjuder rikare layoutkontroll (kolumner, avkortning) och bättre Unicode‑hantering. | +| **Vad är maximal datalängd?** | PDF417 kan koda upp till 1 108 byte (≈ 1 KB) binär data. Om du överskrider detta, överväg att dela upp data över flera streckkoder. | +| **Är kompakt läge standardkompatibelt?** | Avkortad PDF417 är en del av ISO/IEC 15438‑specifikationen och är brett stödjande, men verifiera att din målskanner explicit stödjer den. | +| **Hur ändrar jag bakgrundsfärgen?** | Sätt `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` och `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` innan du sparar. | + +## Slutsats + +Du vet nu **hur man genererar PDF417-streckkod i C#** med Aspose.BarCode, hur man finjusterar X‑dimensionen, aktiverar kompakt läge och exporterar resultatet som en PNG‑bild. Det kompletta, körbara exemplet kan kopieras in i vilket .NET‑projekt som helst, och de visade variationerna låter dig anpassa streckkoden för utskrift, webb eller binära nyttolastsscenarier. + +Kommande steg du kan utforska: + +* Integrera streckkodsgenereringen i ett ASP.NET Core‑API som returnerar bilden på begäran. +* Kombinera PDF417 med QR‑koder på samma etikett för dubbel‑formatsskanning. +* Använd Aspose.BarCode `Reader`‑klassen för att avkoda den genererade bilden och verifiera data programatiskt. + +Lycka till med kodningen, och njut av den flexibilitet som **generera PDF417-streckkod**‑lösningar ger dina applikationer! + +## Vad bör du lära dig härnäst? + +Följande handledningar täcker närliggande ämnen som bygger på teknikerna som demonstrerats i den här guiden. Varje resurs innehåller kompletta fungerande kodexempel med steg‑för‑steg‑förklaringar för att hjälpa dig bemästra ytterligare API‑funktioner och utforska alternativa implementationsmetoder i dina egna projekt. + +- [Hur man skapar streckkod – Kompakt PDF417 med Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Hur man genererar streckkodsbild med anpassning av extra utrymme med Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [Hur man genererar Aztec‑streckkod med anpassat bildförhållande med Aspose.BarCode för .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/thai/net/compact-pdf417-encoding/_index.md b/barcode/thai/net/compact-pdf417-encoding/_index.md index 642025381..0ad3d6260 100644 --- a/barcode/thai/net/compact-pdf417-encoding/_index.md +++ b/barcode/thai/net/compact-pdf417-encoding/_index.md @@ -84,6 +84,10 @@ Aspose.BarCode ให้คุณตั้งค่าคุณสมบัต ## บทแนะนำการเข้ารหัส Compact PDF417 ### [Creating Compact PDF417 Barcodes](./compact-pdf417-basic-configuration/) เรียนรู้วิธีสร้างบาร์โค้ด Compact PDF417 ด้วย Aspose.BarCode for .NET คู่มือครบถ้วนพร้อมขั้นตอนและตัวอย่างโค้ด +### [สร้างบาร์โค้ด PDF417 ด้วย C# – คู่มือเต็มรูปแบบพร้อมเลเอาต์กะทัดรัด](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +เรียนรู้วิธีสร้างบาร์โค้ด PDF417 ด้วย C# พร้อมการตั้งค่าแบบ Compact อย่างละเอียด +### [สร้างบาร์โค้ด C# ด้วย Macro PDF417 – ตัวอย่างเต็ม](./generate-barcode-c-with-macro-pdf417-full-example/) +เรียนรู้วิธีสร้างบาร์โค้ด Macro PDF417 ด้วย C# พร้อมตัวอย่างโค้ดเต็มรูปแบบ ## คำถามที่พบบ่อย @@ -113,4 +117,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/thai/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..9256a250c --- /dev/null +++ b/barcode/thai/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,250 @@ +--- +category: general +date: 2026-08-19 +description: สร้างบาร์โค้ดด้วย C# โดยใช้ Aspose.BarCode เพื่อสร้าง Macro PDF417 พร้อมข้อความที่กำหนดเองและบันทึกเป็นไฟล์รูปภาพ. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: th +lastmod: 2026-08-19 +og_description: สร้างบาร์โค้ดด้วย C# และ Aspose.BarCode, เรียนรู้วิธีสร้าง PDF417, + เพิ่มข้อความกำหนดเอง, และบันทึกไฟล์ภาพบาร์โค้ด +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: สร้างบาร์โค้ด C# – คู่มือ Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: สร้างบาร์โค้ด C# ด้วย Macro PDF417 – ตัวอย่างเต็ม +url: /th/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# สร้างบาร์โค้ด C# ด้วย Macro PDF417 – ตัวอย่างเต็ม + +หากคุณต้องการ **generate barcode C#** สำหรับรูปแบบ Macro PDF417 คู่มือนี้จะแสดงวิธีแก้ที่พร้อมใช้งาน คุณจะได้เห็นวิธี **how to generate pdf417**, ฝังข้อความกำหนดเอง, และ **generate barcode image file** ในโปรแกรมเดียวที่ทำงานอิสระ + +บทเรียนนี้ครอบคลุมทุกอย่างตั้งแต่การติดตั้งไลบรารี Aspose.BarCode ไปจนถึงการกำหนดค่าเมตาดาต้า Macro PDF417 เพื่อให้คุณสามารถคัดลอกโค้ดไปใส่ในโปรเจกต์ของคุณและเห็นผลลัพธ์ได้ทันที + +## ข้อกำหนดเบื้องต้น + +ก่อนเริ่มทำงาน โปรดตรวจสอบว่าคุณมี: + +- .NET 6.0 SDK หรือรุ่นที่ใหม่กว่า (โค้ดนี้ยังทำงานกับ .NET Framework 4.7+) +- Visual Studio 2022 (หรือ IDE ใด ๆ ที่รองรับ C#) +- ใบอนุญาต Aspose.BarCode for .NET (รุ่นทดลองฟรีใช้สำหรับการประเมินผล) +- ความคุ้นเคยพื้นฐานกับไวยากรณ์ C# + +> **Pro tip:** ติดตั้งแพ็กเกจ NuGet ผ่าน CLI เพื่อหลีกเลี่ยงความไม่ตรงกันของเวอร์ชัน: +> `dotnet add package Aspose.BarCode` + +## ขั้นตอนที่ 1: ตั้งค่าโปรเจกต์และนำเข้าไลบรารี + +สร้างแอปพลิเคชันคอนโซลใหม่และเพิ่ม `using` directives ที่จำเป็น + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**ทำไมขั้นตอนนี้สำคัญ:** +`Aspose.BarCode.Generation` namespace ให้คลาส `BarcodeGenerator` ซึ่งเป็นจุดเริ่มต้นสำหรับการสร้างบาร์โค้ดทุกประเภท รวมถึง Macro PDF417 การนำเข้า `System` จะทำให้คุณเข้าถึง `DateTime` สำหรับเมตาดาต้า timestamp + +## ขั้นตอนที่ 2: สร้างตัวสร้าง Macro PDF417 พร้อมข้อความกำหนดเอง + +แทนที่คอมเมนต์ตัวแทนด้วยการเริ่มต้นตัวสร้าง นี่เป็นการสาธิต **create barcode custom text** พร้อมกับเลือกประเภทการเข้ารหัสที่ถูกต้อง + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**คำอธิบาย:** +- `EncodeTypes.MacroPdf417` บอกให้ Aspose สร้างบาร์โค้ด PDF417 ที่รองรับคุณลักษณะ macro (การแบ่งไฟล์, checksum ฯลฯ) +- ข้อความ `"Åspóse.Barcóde©"` แสดงว่าอักขระ Unicode ได้รับการสนับสนุนเต็มที่ ซึ่งมักจำเป็นสำหรับแอปพลิเคชันระดับสากล + +## ขั้นตอนที่ 3: กำหนดลักษณะและเมตาดาต้า Macro PDF417 + +ปรับแต่งมิติของบาร์โค้ดและตั้งค่าฟิลด์เฉพาะ macro ที่จำเป็นสำหรับการจัดการไฟล์ที่แบ่งส่วน + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**ทำไมการตั้งค่าเหล่านี้ถึงสำคัญ:** + +| Setting | Purpose | +|---------|---------| +| `XDimension.Pixels` | ควบคุมความหนาแน่นของภาพ; 2 px ให้ภาพที่ชัดเจนและสแกนได้ | +| `Columns` | กำหนดจำนวนคอลัมน์ข้อมูลต่อแถว ส่งผลต่อขนาดของบาร์โค้ด | +| `MacroPdf417FileID` | ระบุไฟล์เชิงตรรกะอย่างเป็นเอกลักษณ์ในทุกส่วน | +| `MacroPdf417SegmentID` / `SegmentsCount` | ช่วยให้สามารถรวมไฟล์ต้นฉบับจากบาร์โค้ดหลายส่วนได้ | +| `MacroPdf417FileName` | ชื่อที่มนุษย์อ่านได้เก็บไว้ในบาร์โค้ดสำหรับการประมวลผลต่อ | +| `MacroPdf417Checksum` | ให้การตรวจจับข้อผิดพลาดด้วยอัลกอริทึม CCITT‑16 CRC | +| `MacroPdf417FileSize` | ช่วยตัวถอดรหัสรู้ว่าไฟล์ทั้งหมดได้รับครบหรือยัง | +| `MacroPdf417TimeStamp` | บันทึกเวลาที่บาร์โค้ดถูกสร้าง ใช้สำหรับติดตามการตรวจสอบ | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | ฟิลด์ทางเลือกที่สามารถใช้ในกระบวนการธุรกิจ | +| `MacroPdf417Terminator` | ระบุว่าช่วงนี้เป็นส่วนสุดท้าย (`Set`) | + +## ขั้นตอนที่ 4: บันทึกบาร์โค้ดเป็นไฟล์รูปภาพ + +สุดท้าย ให้เขียนบาร์โค้ดลงไฟล์ PNG เพื่อให้คุณสามารถดูหรือฝังไว้ที่อื่นได้ + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**สิ่งที่คุณจะเห็น:** +ภาพ PNG ชื่อ `ExtPDF417Meta.png` ที่บรรจุบาร์โค้ด Macro PDF417 ซึ่งเข้ารหัสข้อความกำหนดเองและฟิลด์เมตาดาต้าทั้งหมดที่คุณตั้งค่าไว้ ภาพนี้สามารถเปิดด้วยโปรแกรมดูมาตรฐานใดก็ได้ หรือแทรกลงใน PDF, รายงาน หรือหน้าเว็บ + +## โค้ดต้นฉบับเต็ม (พร้อมคัดลอก‑วาง) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### ผลลัพธ์ที่คาดหวัง + +การรันโปรแกรมจะแสดงผล: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +การเปิด `ExtPDF417Meta.png` จะเห็นบาร์โค้ด Macro PDF417 ที่สะอาดและสแกนได้อย่างถูกต้องด้วยเครื่องอ่าน PDF417 ใด ๆ โดยคงข้อความกำหนดเอง `"Åspóse.Barcóde©"` และเมตาดาต้า macro ที่คุณกำหนดไว้ + +## คำถามทั่วไปและกรณีขอบ + +- **Can I generate a different image format?** + ใช่. แทนที่ `BarCodeImageFormat.Png` ด้วย `Jpeg`, `Bmp` หรือ `Gif` ตามต้องการ + +- **What if my data exceeds a single barcode?** + Macro PDF417 ถูกออกแบบมาสำหรับการแบ่งส่วน ปรับ `MacroPdf417SegmentsCount` และ `MacroPdf417SegmentID` สำหรับแต่ละส่วน แล้วรวมผลลัพธ์ที่สแกนได้ + +- **Is Unicode support guaranteed?** + Aspose.BarCode รองรับ Unicode อย่างเต็มที่ ตรวจสอบให้ไฟล์ซอร์สของคุณบันทึกด้วยการเข้ารหัส UTF‑8 เพื่อหลีกเลี่ยงการเสียรูปอักขระ + +- **Do I need a license for production?** + เวอร์ชันที่มีใบอนุญาตจะลบลายน้ำการประเมินและให้ฟังก์ชันเต็ม รุ่นทดลองใช้สำหรับการทดสอบและเรียนรู้ + +## สรุป + +คุณได้เรียนรู้วิธี **generate barcode C#** สำหรับ Macro PDF417, **how to generate pdf417** พร้อมเมตาดาต้าครบถ้วน, **create barcode custom text**, และ **generate barcode image file** ด้วย Aspose.BarCode ตัวอย่างเต็มที่ทำงานได้แสดงขั้นตอนทั้งหมดตั้งแต่การตั้งค่าโปรเจกต์จนถึงการบันทึกภาพ PNG สุดท้าย + +### ขั้นตอนต่อไป + +- ทดลองตั้งค่า PDF417 อื่น ๆ เช่น `ErrorCorrectionLevel` และ `CompactPdf417` เพื่อให้สัญลักษณ์เล็กลง +- ผสานบาร์โค้ดที่สร้างลงในรายงาน PDF ด้วย Aspose.PDF +- สำรวจการสร้างแบบเป็นชุด: วนลูปผ่านคอลเลกชันของไฟล์และสร้างบาร์โค้ด Macro PDF417 ที่แบ่งส่วนหลายส่วน + +ปรับใช้โค้ดตามกระบวนการทำงานของคุณได้เลย ให้การสร้างบาร์โค้ดกลายเป็นส่วนที่ราบรื่นของแอปพลิเคชัน C# ของคุณ ขอให้เขียนโค้ดสนุก! + +## คุณควรเรียนรู้อะไรต่อไป? + +บทเรียนต่อไปนี้ครอบคลุมหัวข้อที่เกี่ยวข้องอย่างใกล้ชิดและต่อยอดจากเทคนิคที่แสดงในคู่มือนี้ แต่ละแหล่งข้อมูลมีตัวอย่างโค้ดทำงานครบถ้วนพร้อมคำอธิบายทีละขั้นตอน เพื่อช่วยให้คุณเชี่ยวชาญฟีเจอร์ API เพิ่มเติมและสำรวจวิธีการทำงานแบบอื่นในโปรเจกต์ของคุณ + +- [วิธีสร้างบาร์โค้ด Aztec ด้วยอัตราส่วนภาพกำหนดเองโดยใช้ Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [สร้างภาพบาร์โค้ด – Code 93 ด้วย Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [วิธีสร้างและปรับความสูงบาร์โค้ดสำหรับ One-Dimensional Databar โดยใช้ Aspose.BarCode for .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/thai/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..6be0b0dab --- /dev/null +++ b/barcode/thai/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,249 @@ +--- +category: general +date: 2026-08-19 +description: สร้างบาร์โค้ด PDF417 ด้วย C# อย่างรวดเร็ว เรียนรู้วิธีสร้างบาร์โค้ด PDF417 + ด้วย C# โดยใช้ Aspose.BarCode พร้อมโหมดคอมแพคและการตั้งค่าที่กำหนดเอง +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: th +lastmod: 2026-08-19 +og_description: สร้างบาร์โค้ด PDF417 ด้วย C# และ Aspose.BarCode บทเรียนนี้แสดงวิธีสร้างบาร์โค้ด + PDF417 ด้วย C# ในโหมดคอมแพคต์ ตั้งค่า X‑dimension และบันทึกเป็น PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: สร้างบาร์โค้ด PDF417 ด้วย C# – คู่มือทีละขั้นตอน +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: สร้างบาร์โค้ด PDF417 ด้วย C# – คู่มือครบถ้วนพร้อมการจัดวางแบบกะทัดรัด +url: /th/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# สร้างบาร์โค้ด PDF417 ด้วย C# – คู่มือฉบับสมบูรณ์ + +หากคุณต้องการ **สร้างบาร์โค้ด PDF417** ในแอปพลิเคชัน .NET นี้ คู่มือจะสาธิตขั้นตอนอย่างละเอียด คุณจะได้เห็นตัวอย่างสั้น ๆ ที่พร้อมใช้งานในสภาพแวดล้อมการผลิต ซึ่งสร้างบาร์โค้ด PDF417 แบบกะทัดรัด ปรับค่า X‑dimension และบันทึกผลลัพธ์เป็นไฟล์ PNG + +การสร้างบาร์โค้ด PDF417 เป็นเรื่องทั่วไปเมื่อคุณต้องเข้ารหัสข้อมูลจำนวนมาก—เช่น ข้อมูลตั๋ว, รายการจัดส่ง, หรือเอกสารประจำตัว—in a machine‑readable format. การใช้ Aspose.BarCode ทำให้กระบวนการง่ายขึ้น และโค้ดทำงานกับ .NET 6+ หรือ .NET Framework 4.7.2 ขึ้นไป + +ในคู่มือนี้คุณจะ: + +* ติดตั้งแพคเกจ NuGet ของ Aspose.BarCode +* เขียนโปรแกรม C# แบบ self‑contained ที่ **สร้างบาร์โค้ด PDF417** ด้วยจำนวนคอลัมน์น้อยและโหมดกะทัดรัด (truncated) +* ปรับความกว้างของบาร์ (X‑dimension) เพื่อให้การแสดงผลคมชัดขึ้น +* บันทึกบาร์โค้ดเป็นไฟล์ PNG +* สำรวจรูปแบบต่าง ๆ, กรณีขอบ, และเคล็ดลับปฏิบัติที่ดีที่สุด + +## ข้อกำหนดเบื้องต้น + +ก่อนเริ่มทำงาน โปรดตรวจสอบว่าคุณมี: + +* Visual Studio 2022 (หรือ IDE ของ C# ใดก็ได้) ที่ติดตั้ง .NET 6 SDK แล้ว +* การเชื่อมต่ออินเทอร์เน็ตเพื่อดาวน์โหลดแพคเกจ NuGet **Aspose.BarCode** +* สิทธิ์การเขียนในโฟลเดอร์ที่ไฟล์ PNG จะถูกบันทึก + +ไม่จำเป็นต้องใช้ไลบรารีเพิ่มเติม; Aspose.BarCode จัดการการเข้ารหัสภาพภายในเอง + +## ขั้นตอนที่ 1: เพิ่มแพคเกจ Aspose.BarCode + +เปิดโปรเจกต์ของคุณใน Visual Studio, คลิกขวาที่โซลูชัน, แล้วเลือก **Manage NuGet Packages** ค้นหา `Aspose.BarCode` และติดตั้งเวอร์ชัน stable ล่าสุด + +```bash +dotnet add package Aspose.BarCode +``` + +> **เคล็ดลับระดับมืออาชีพ:** ควรอัปเดตแพคเกจอยู่เสมอ รุ่นใหม่มักมีการปรับปรุงประสิทธิภาพและรองรับ .NET runtime ล่าสุด + +## ขั้นตอนที่ 2: สร้างแอปพลิเคชันคอนโซลขนาดเล็ก + +สร้างโปรเจกต์คอนโซล C# ใหม่หากคุณยังไม่มี + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +แทนที่เนื้อหาในไฟล์ `Program.cs` ด้วยตัวอย่างเต็มด้านล่าง โปรแกรมนี้แสดง **วิธีสร้างบาร์โค้ด PDF417 ด้วย C#** ตั้งแต่เริ่มต้นจนจบ + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### ทำไมแต่ละบรรทัดจึงสำคัญ + +* **`EncodeTypes.Pdf417`** – เลือกสัญลักษณ์ PDF417 ซึ่งรองรับข้อมูลได้สูงสุดประมาณ ~1.1 KB +* **`XDimension.Pixels = 2`** – กำหนดความกว้างพื้นฐานของบาร์ ค่าเล็กทำให้บาร์บาง; ค่ามากทำให้อ่านง่ายบนอุปกรณ์ความละเอียดต่ำ +* **`Pdf417.Columns = 3`** – จำกัดจำนวนคอลัมน์ ทำให้ตัวสร้างต้องใช้แถวมากขึ้น ส่งผลให้บาร์โค้ดสูงแต่แคบกว่า +* **`Pdf417.Truncate = true`** – เปิดโหมดกะทัดรัด, ลบรูปแบบหยุดและทำให้ภาพเล็กลงโดยไม่สูญเสียความสมบูรณ์ของข้อมูล +* **`Save(..., BarCodeImageFormat.Png)`** – บันทึกเป็นไฟล์ PNG คุณสามารถเลือก `Jpeg`, `Bmp`, หรือ `Svg` ตามความต้องการของระบบต่อไปได้ + +Run the program: + +```bash +dotnet run +``` + +คุณควรเห็นข้อความในคอนโซลที่ยืนยันตำแหน่งไฟล์ และโฟลเดอร์จะมีไฟล์ `CompactPdf417.png` การเปิดไฟล์ PNG จะเห็นบาร์โค้ด PDF417 แบบกะทัดรัดที่ชัดเจนซึ่งเข้ารหัสสตริง Unicode + +## ขั้นตอนที่ 3: ตรวจสอบบาร์โค้ด (ไม่บังคับแต่แนะนำ) + +เพื่อให้แน่ใจว่าบาร์โค้ดอ่านได้ คุณสามารถใช้แอปสแกน PDF417 มาตรฐานบนสมาร์ทโฟนหรือไลบรารีดีโคเดอร์บนเดสก์ท็อป ข้อความที่เข้ารหัสควรตรงกับสตริง `data` ดั้งเดิมอย่างสมบูรณ์ รวมถึงอักขระพิเศษ + +หากคุณพบปัญหาในการดีโคด: + +* เพิ่มค่า `XDimension` เป็น 3 หรือ 4 พิกเซล +* ลดจำนวนคอลัมน์ (เช่น ตั้งค่า `Columns = 2`) +* ปิดการใช้งาน `Truncate` (`Truncate = false`) เพื่อเพิ่มรูปแบบหยุด + +การปรับเหล่านี้เป็นการแลกเปลี่ยนระหว่างขนาดกับความอ่านง่าย ซึ่งมีประโยชน์สำหรับเครื่องพิมพ์หรือสแกนเนอร์ที่ความละเอียดต่ำ + +## ขั้นตอนที่ 4: สำรวจรูปแบบทั่วไป + +### 4️⃣ สร้าง PDF417 ความหนาแน่นสูงสำหรับการพิมพ์ + +หากคุณต้องการบาร์โค้ดที่พอดีกับป้ายเล็ก ๆ ให้เพิ่มจำนวนคอลัมน์และลดค่า X‑dimension: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ เปลี่ยนรูปแบบเอาต์พุตเป็น SVG เพื่อการสเกลแบบเวกเตอร์ + +ผลลัพธ์ SVG สามารถสเกลได้โดยไม่สูญเสียคุณภาพ เหมาะสำหรับหน้าเว็บที่ตอบสนองต่อขนาดหน้าจอ + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +### 6️⃣ เข้ารหัสข้อมูลไบนารี (เช่น byte array) + +หากคุณต้องการฝังข้อมูลไบนารี ให้แปลงเป็นสตริง Base64 ก่อน + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +บาร์โค้ดตอนนี้บรรจุข้อมูลไบนารี และดีโคเดอร์ต้องทำการแปลงกลับจาก Base64 + +## คำถามที่พบบ่อย + +| Question | Answer | +|----------|--------| +| **ฉันสามารถสร้าง PDF417 ได้โดยไม่ใช้ Aspose หรือไม่?** | ได้, มีไลบรารีอื่นเช่น ZXing.Net หรือ Dynamsoft ที่สามารถใช้ได้, แต่ Aspose.BarCode ให้การควบคุมการจัดวางที่หลากหลายกว่า (คอลัมน์, การตัด) และการจัดการ Unicode ที่ดีกว่า | +| **ความยาวข้อมูลสูงสุดคือเท่าไหร่?** | PDF417 สามารถเข้ารหัสข้อมูลไบนารีได้สูงสุด 1,108 ไบต์ (≈ 1 KB) หากเกินขนาดนี้ ควรพิจารณาแบ่งข้อมูลเป็นหลายบาร์โค้ด | +| **โหมดกะทัดรัดสอดคล้องกับมาตรฐานหรือไม่?** | Truncated PDF417 เป็นส่วนหนึ่งของสเปค ISO/IEC 15438 และได้รับการสนับสนุนอย่างกว้างขวาง, แต่ควรตรวจสอบว่าเครื่องสแกนของคุณรองรับอย่างชัดเจนหรือไม่ | +| **ฉันจะเปลี่ยนสีพื้นหลังได้อย่างไร?** | ตั้งค่า `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` และ `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` ก่อนบันทึก | + +## สรุป + +ตอนนี้คุณรู้ **วิธีสร้างบาร์โค้ด PDF417 ด้วย C#** โดยใช้ Aspose.BarCode, วิธีปรับ X‑dimension อย่างละเอียด, เปิดโหมดกะทัดรัด, และส่งออกผลลัพธ์เป็นภาพ PNG ตัวอย่างที่สมบูรณ์และสามารถรันได้สามารถคัดลอกไปใส่ในโปรเจกต์ .NET ใดก็ได้ และรูปแบบที่แสดงให้คุณปรับบาร์โค้ดสำหรับการพิมพ์, เว็บ, หรือกรณีข้อมูลไบนารี + +ขั้นตอนต่อไปที่คุณอาจสำรวจ: + +* ผสานการสร้างบาร์โค้ดเข้ากับ ASP.NET Core API ที่ให้บริการภาพตามความต้องการ +* รวม PDF417 กับ QR code บนป้ายเดียวเพื่อการสแกนแบบสองรูปแบบ +* ใช้คลาส `Reader` ของ Aspose.BarCode เพื่อดีโคดภาพที่สร้างและตรวจสอบข้อมูลโดยโปรแกรม + +ขอให้สนุกกับการเขียนโค้ด และเพลิดเพลินกับความยืดหยุ่นที่โซลูชัน **การสร้างบาร์โค้ด PDF417** มอบให้กับแอปพลิเคชันของคุณ! + +## สิ่งที่คุณควรเรียนต่อไป + +บทแนะนำต่อไปนี้ครอบคลุมหัวข้อที่เกี่ยวข้องอย่างใกล้ชิดและต่อยอดจากเทคนิคที่แสดงในคู่มือนี้ แต่ละแหล่งข้อมูลมีตัวอย่างโค้ดทำงานครบถ้วนพร้อมคำอธิบายทีละขั้นตอน เพื่อช่วยคุณเชี่ยวชาญฟีเจอร์ API เพิ่มเติมและสำรวจแนวทางการนำไปใช้แบบอื่นในโปรเจกต์ของคุณ + +- [วิธีสร้างบาร์โค้ด – PDF417 กะทัดรัดด้วย Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [วิธีสร้างภาพบาร์โค้ดพร้อมการปรับแต่งพื้นที่เสริมโดยใช้ Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [วิธีสร้างบาร์โค้ด Aztec ด้วยอัตราส่วนภาพที่กำหนดเองโดยใช้ Aspose.BarCode สำหรับ .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/turkish/net/compact-pdf417-encoding/_index.md b/barcode/turkish/net/compact-pdf417-encoding/_index.md index ea67f016b..1bf45d6c3 100644 --- a/barcode/turkish/net/compact-pdf417-encoding/_index.md +++ b/barcode/turkish/net/compact-pdf417-encoding/_index.md @@ -81,7 +81,8 @@ Temellerin ötesinde, iş akışınızı hızlandıracak bazı pratik ipuçları ## Kompakt PDF417 Kodlama Eğitimleri ### [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 PDF417 barkodu oluşturma – kompakt düzenli tam rehber](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +### [C# ile Macro PDF417 Barkod Oluşturma – tam örnek](./generate-barcode-c-with-macro-pdf417-full-example/) ## Sıkça Sorulan Sorular @@ -111,4 +112,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/turkish/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..ccddcde78 --- /dev/null +++ b/barcode/turkish/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: Aspose.BarCode kullanarak C# ile bir Macro PDF417 barkod oluşturun, özel + metin ekleyin ve görüntü dosyası olarak kaydedin. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: tr +lastmod: 2026-08-19 +og_description: Aspose.BarCode ile C#’ta barkod oluşturun, PDF417 nasıl oluşturulacağını + öğrenin, özel metin ekleyin ve barkod görüntü dosyasını kaydedin. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Barkod Oluşturma C# – Macro PDF417 Rehberi +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Macro PDF417 ile C#'ta barkod oluşturma – tam örnek +url: /tr/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Macro PDF417 ile C# Barcode Oluşturma – tam örnek + +Eğer **generate barcode C#** ihtiyacınız varsa ve Macro PDF417 formatı kullanmak istiyorsanız, bu rehber hazır‑çalıştır bir çözüm sunar. **how to generate pdf417**, özel metin eklemeyi ve **generate barcode image file** tek bir, bağımsız programda nasıl yapacağınızı göreceksiniz. + +Bu öğretici, Aspose.BarCode kütüphanesinin kurulumu부터 Macro PDF417 meta verilerinin yapılandırılmasına kadar her şeyi kapsar; böylece kodu doğrudan projenize kopyalayıp sonucu hemen görebilirsiniz. + +## Önkoşullar + +Başlamadan önce aşağıdakilere sahip olduğunuzdan emin olun: + +- .NET 6.0 SDK veya daha yeni bir sürüm (kod .NET Framework 4.7+ ile de çalışır) +- Visual Studio 2022 (veya C# destekleyen herhangi bir IDE) +- Aspose.BarCode for .NET lisansı (ücretsiz deneme sürümü değerlendirme amaçlı kullanılabilir) +- C# sözdizimi konusunda temel bilgi + +> **Pro tip:** Sürüm uyumsuzluklarını önlemek için NuGet paketini CLI üzerinden kurun: +> `dotnet add package Aspose.BarCode` + +## Adım 1: Projeyi oluşturun ve kütüphaneyi içe aktarın + +Yeni bir konsol uygulaması oluşturun ve gerekli `using` yönergelerini ekleyin. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Bu adımın önemi:** +`Aspose.BarCode.Generation` ad alanı, Macro PDF417 dahil olmak üzere herhangi bir barkod türü oluşturmak için giriş noktası olan `BarcodeGenerator` sınıfını sağlar. `System` içe aktarımı, zaman damgası meta verisi için `DateTime` erişimi sunar. + +## Adım 2: Özel metinle bir Macro PDF417 oluşturucu oluşturun + +Yer tutucu yorumu, oluşturucu başlatmasıyla değiştirin. Bu, **create barcode custom text** gösterirken doğru kodlama tipini de seçer. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Açıklama:** +- `EncodeTypes.MacroPdf417` Aspose’a, makro özelliklerini (dosya bölümlendirme, kontrol toplamı vb.) destekleyen bir PDF417 barkodu üretmesini söyler. +- `"Åspóse.Barcóde©"` metni, Unicode karakterlerin tam olarak desteklendiğini gösterir; bu, uluslararası uygulamalarda sıkça gerekir. + +## Adım 3: Görünümü ve Macro PDF417 meta verilerini yapılandırın + +Barkod boyutlarını ince ayar yapın ve bölümlenmiş dosya işleme için gereken makro‑özel alanları ayarlayın. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Bu ayarların önemi:** + +| Setting | Purpose | +|---------|---------| +| `XDimension.Pixels` | Görsel yoğunluğu kontrol eder; 2 px net ve taranabilir bir görüntü sağlar. | +| `Columns` | Satır başına düşen veri sütunu sayısını belirler, barkod boyutunu etkiler. | +| `MacroPdf417FileID` | Tüm segmentlerde mantıksal dosyayı benzersiz şekilde tanımlar. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Birden fazla barkoddan orijinal dosyanın yeniden oluşturulmasını sağlar. | +| `MacroPdf417FileName` | Barkod içinde saklanan, sonraki işlemler için okunabilir dosya adıdır. | +| `MacroPdf417Checksum` | CCITT‑16 CRC algoritmasıyla hata tespiti sağlar. | +| `MacroPdf417FileSize` | Çözücünün tüm dosyanın alınıp alınmadığını bilmesine yardımcı olur. | +| `MacroPdf417TimeStamp` | Barkodun ne zaman üretildiğini kaydeder; denetim izleri için faydalıdır. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | İş akışlarında kullanılabilecek isteğe bağlı alanlardır. | +| `MacroPdf417Terminator` | Bu segmentin son segment olduğunu gösterir (`Set`). | + +## Adım 4: Barkodu bir görüntü dosyası olarak kaydedin + +Son olarak barkodu bir PNG dosyasına yazın; böylece başka bir yerde görüntüleyebilir veya gömebilirsiniz. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Gördükleriniz:** +`ExtPDF417Meta.png` adlı bir PNG görüntüsü, özel metni ve yukarıda ayarladığınız tüm meta veri alanlarını kodlayan bir Macro PDF417 barkodu içerir. Görüntü, herhangi bir standart görüntüleyiciyle açılabilir veya PDF, rapor, web sayfası gibi yerlere eklenebilir. + +## Tam kaynak kodu (kopyala‑yapıştır hazır) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Beklenen çıktı + +Program çalıştırıldığında şu satırları yazdırır: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +`ExtPDF417Meta.png` dosyasını açtığınızda, `"Åspóse.Barcóde©"` özel metnini ve tanımladığınız makro meta verilerini koruyan, herhangi bir PDF417 okuyucu ile doğru şekilde taranabilen temiz bir Macro PDF417 barkodu görürsünüz. + +## Yaygın sorular ve kenar durumları + +- **Farklı bir görüntü formatı üretebilir miyim?** + Evet. `BarCodeImageFormat.Png` yerine ihtiyacınıza göre `Jpeg`, `Bmp` veya `Gif` kullanabilirsiniz. + +- **Verilerim tek bir barkodu aşıyorsa ne yapmalıyım?** + Macro PDF417 bölümlendirme için tasarlanmıştır. Her parça için `MacroPdf417SegmentsCount` ve `MacroPdf417SegmentID` değerlerini ayarlayın, ardından taranan sonuçları birleştirin. + +- **Unicode desteği garanti mi?** + Aspose.BarCode Unicode’u tam olarak destekler. Karakter bozulmasını önlemek için kaynak dosyanızın UTF‑8 kodlamalı olduğundan emin olun. + +- **Üretim ortamında lisansa ihtiyacım var mı?** + Lisanslı sürüm değerlendirme filigranını kaldırır ve tam işlevselliği sunar. Deneme sürümü test ve öğrenme amaçlı kullanılabilir. + +## Sonuç + +Artık **generate barcode C#** için Macro PDF417, **how to generate pdf417** ile zengin meta veriler, **create barcode custom text** ve **generate barcode image file** oluşturmayı Aspose.BarCode kullanarak biliyorsunuz. Tam, çalıştırılabilir örnek, proje kurulumundan son PNG dosyasının kaydedilmesine kadar gereken tüm adımları gösteriyor. + +### Sonraki adımlar + +- `ErrorCorrectionLevel` ve `CompactPdf417` gibi diğer PDF417 ayarlarıyla daha küçük semboller deneyin. +- Üretilen barkodu Aspose.PDF ile bir PDF raporuna entegre edin. +- Toplu üretim keşfedin: bir dosya koleksiyonu üzerinde döngü kurarak bir dizi bölümlenmiş Macro PDF417 barkodu oluşturun. + +Kodunuzu kendi iş akışınıza uyarlamaktan çekinmeyin ve barkod üretiminin C# uygulamalarınızın sorunsuz bir parçası olmasını sağlayın. İyi kodlamalar! + +## Bir Sonraki Öğrenmeniz Gerekenler + +Aşağıdaki öğreticiler, bu rehberde gösterilen tekniklere dayanarak yakından ilgili konuları kapsar. Her kaynak, ek API özelliklerini öğrenmenize ve projelerinizde alternatif uygulama yaklaşımlarını keşfetmenize yardımcı olacak tam çalışan kod örnekleri ve adım‑adım açıklamalar içerir. + +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Generate barcode image – Code 93 with Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [How to Generate and Adjust Barcode Height for One-Dimensional Databar using Aspose.BarCode for .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/turkish/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..4553454e0 --- /dev/null +++ b/barcode/turkish/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,250 @@ +--- +category: general +date: 2026-08-19 +description: C#'ta PDF417 barkodu hızlı bir şekilde oluşturun. Aspose.BarCode kullanarak + kompakt mod ve özel ayarlarla C#'ta PDF417 barkodu nasıl oluşturacağınızı öğrenin. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: tr +lastmod: 2026-08-19 +og_description: Aspose.BarCode ile C#'ta PDF417 barkod oluşturun. Bu öğreticide, PDF417 + barkodunu C#'ta kompakt modda nasıl oluşturacağınızı, X‑boyutunu nasıl ayarlayacağınızı + ve PNG olarak nasıl kaydedeceğinizi gösterir. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: C#'te PDF417 barkod oluşturma – adım adım rehber +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: C#'ta PDF417 barkodu oluşturma – kompakt düzenli tam rehber +url: /tr/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# C#'ta PDF417 barkod oluşturma – tam kılavuz + +Bir .NET uygulamasında **PDF417 barkod oluşturmanız** gerekiyorsa, bu öğretici tam olarak nasıl yapılacağını gösterir. Kısa, üretim‑hazır bir örnek göreceksiniz; bu örnek kompakt bir PDF417 barkod oluşturur, X‑boyutunu özelleştirir ve sonucu PNG görüntüsü olarak kaydeder. + +Büyük miktarda veriyi—örneğin bilet bilgileri, nakliye manifestoları veya kimlik belgeleri—makine‑okunabilir bir formatta kodlamanız gerektiğinde PDF417 barkod oluşturmak yaygındır. Aspose.BarCode kullanmak süreci basitleştirir ve kod .NET 6+ veya .NET Framework 4.7.2 ve üzeriyle çalışır. + +Bu rehberde şunları yapacaksınız: + +* Aspose.BarCode NuGet paketini kurun. +* Küçük sütun sayısı ve kompakt (kısaltılmış) mod ile **PDF417 barkod oluştur** bir bağımsız C# programı yazın. +* Daha keskin görüntüleme için çubuk genişliğini (X‑boyutu) ayarlayın. +* Barkodu PNG dosyası olarak kaydedin. +* Çeşitli varyasyonları, kenar durumlarını ve en iyi uygulama ipuçlarını keşfedin. + +## Önkoşullar + +Başlamadan önce şunların olduğundan emin olun: + +* Visual Studio 2022 (veya herhangi bir C# IDE) ve .NET 6 SDK yüklü. +* Aspose.BarCode NuGet paketini indirmek için internet erişimi. +* PNG dosyasının kaydedileceği klasöre yazma izni. + +Ek bir kütüphane gerekmez; Aspose.BarCode görüntü kodlamasını dahili olarak yönetir. + +## Adım 1: Aspose.BarCode paketini ekleyin + +Projenizi Visual Studio'da açın, çözüme sağ‑tıklayın ve **Manage NuGet Packages** seçeneğini seçin. `Aspose.BarCode` paketini aratın ve en son kararlı sürümü kurun. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro ipucu:** Paketi güncel tutun. Yeni sürümler genellikle performans iyileştirmeleri ve en yeni .NET çalışma zamanları desteği içerir. + +## Adım 2: Minimal bir konsol uygulaması oluşturun + +Henüz bir projeniz yoksa yeni bir C# konsol projesi oluşturun: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +`Program.cs` dosyasının içeriğini aşağıdaki tam örnekle değiştirin. Bu program **C#'ta PDF417 barkod nasıl oluşturulur** konusunu baştan sona gösterir. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Her satırın önemi + +* **`EncodeTypes.Pdf417`** – PDF417 sembolünü seçer; bu semboloji yaklaşık ~1.1 KB veri destekler. +* **`XDimension.Pixels = 2`** – temel çubuk genişliğini ayarlar. Daha küçük değerler barkodu ince yapar; daha büyük değerler düşük çözünürlüklü cihazlarda okunabilirliği artırır. +* **`Pdf417.Columns = 3`** – sütun sayısını sınırlar, jeneratörü daha fazla satır kullanmaya zorlar; bu da daha uzun ama daha dar bir barkod oluşturur. +* **`Pdf417.Truncate = true`** – kompakt modu etkinleştirir, durdurma desenini kaldırır ve görüntüyü veri bütünlüğünü kaybetmeden küçültür. +* **`Save(..., BarCodeImageFormat.Png)`** – bir PNG dosyası yazar. İhtiyaca göre `Jpeg`, `Bmp` veya `Svg` de seçilebilir. + +Programı çalıştırın: + +```bash +dotnet run +``` + +Konsolda dosya konumunu onaylayan bir çıktı görmelisiniz ve klasörde `CompactPdf417.png` dosyası bulunacaktır. PNG'yi açtığınızda Unicode dizesini kodlayan net, kompakt bir PDF417 barkod göreceksiniz. + +## Adım 3: Barkodu doğrulayın (isteğe bağlı ancak önerilir) + +Barkodun okunabilir olduğundan emin olmak için bir akıllı telefondaki herhangi bir standart PDF417 tarayıcı uygulamasını veya masaüstü bir çözücü kütüphanesini kullanabilirsiniz. Kodlanmış metin, özel karakterler dahil, orijinal `data` dizesiyle tam olarak aynı olmalıdır. + +Eğer çözümleme sorunlarıyla karşılaşırsanız: + +* `XDimension` değerini 3 veya 4 piksele yükseltin. +* Sütun sayısını azaltın (ör. `Columns = 2` olarak ayarlayın). +* `Truncate` özelliğini devre dışı bırakın (`Truncate = false`) ve durdurma desenini ekleyin. + +Bu ayarlamalar boyutu okunabilirlik karşılığında değiştirir; düşük çözünürlüklü yazıcılar veya tarayıcılar için faydalıdır. + +## Adım 4: Yaygın varyasyonları keşfedin + +### 4️⃣ Yazdırma için yüksek yoğunluklu PDF417 oluşturma + +Küçük bir etikete sığacak bir barkod gerekiyorsa, sütun sayısını artırın ve X‑boyutunu düşürün: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Vektör ölçekleme için çıktı formatını SVG'ye değiştirin + +SVG çıktısı kalite kaybı olmadan ölçeklenir; duyarlı web sayfaları için mükemmeldir. + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +### 6️⃣ İkili veriyi kodlayın (ör. bir byte dizisi) + +İkili yükleri gömmek gerekiyorsa, önce bunları Base64 dizesine dönüştürün: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Barkod artık ikili bilgiyi taşır ve çözücü Base64 adımını tersine çevirmelidir. + +## Sıkça Sorulan Sorular + +| Soru | Cevap | +|------|-------| +| **Aspose olmadan PDF417 oluşturabilir miyim?** | Evet, ZXing.Net veya Dynamsoft gibi başka kütüphaneler de mevcut, ancak Aspose.BarCode daha zengin yerleşim kontrolü (sütunlar, kısaltma) ve daha iyi Unicode işleme sunar. | +| **Maksimum veri uzunluğu nedir?** | PDF417, 1,108 bayt (≈ 1 KB) ikili veri kodlayabilir. Bu sınırı aşarsanız, veriyi birden fazla barkoda bölmeyi düşünün. | +| **Kompakt mod standartlara uygun mu?** | Kısaltılmış PDF417, ISO/IEC 15438 spesifikasyonunun bir parçasıdır ve geniş çapta desteklenir, ancak hedef tarayıcınızın bunu açıkça desteklediğinden emin olun. | +| **Arka plan rengini nasıl değiştiririm?** | Kaydetmeden önce `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` ve `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` olarak ayarlayın. | + +## Sonuç + +Artık Aspose.BarCode kullanarak **C#'ta PDF417 barkod nasıl oluşturulur** bildiğinize, X‑boyutunu nasıl ince ayarlayacağınıza, kompakt modu nasıl etkinleştireceğinize ve sonucu PNG görüntüsü olarak dışa aktaracağınıza sahipsiniz. Tam, çalıştırılabilir örnek herhangi bir .NET projesine kopyalanabilir ve gösterilen varyasyonlar barkodu yazdırma, web veya ikili yük senaryolarına uyarlamanızı sağlar. + +İleride keşfedebileceğiniz adımlar: + +* Barkod oluşturmayı, isteğe bağlı olarak görüntüyü döndüren bir ASP.NET Core API'sine entegre edin. +* Aynı etiket üzerinde PDF417'yi QR kodlarıyla birleştirerek çift‑format taramayı sağlayın. +* Aspose.BarCode `Reader` sınıfını kullanarak oluşturulan görüntüyü çözün ve veriyi programatik olarak doğrulayın. + +Kodlamaktan keyif alın ve **PDF417 barkod oluşturma** çözümlerinin uygulamalarınıza getirdiği esnekliğin tadını çıkarın! + +## Sonra Ne Öğrenmelisiniz? + +Aşağıdaki öğreticiler, bu rehberde gösterilen tekniklere dayanarak yakından ilgili konuları kapsar. Her kaynak, ek API özelliklerini öğrenmenize ve kendi projelerinizde alternatif uygulama yaklaşımlarını keşfetmenize yardımcı olmak için adım adım açıklamalar içeren tam çalışan kod örnekleri sunar. + +- [How to Create Barcode – Compact PDF417 with Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [How to Generate Barcode Image with Supplemental Space Customization using Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [How to generate Aztec barcode with custom aspect ratio using Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file diff --git a/barcode/vietnamese/net/compact-pdf417-encoding/_index.md b/barcode/vietnamese/net/compact-pdf417-encoding/_index.md index 8c0240726..c4d5a2a61 100644 --- a/barcode/vietnamese/net/compact-pdf417-encoding/_index.md +++ b/barcode/vietnamese/net/compact-pdf417-encoding/_index.md @@ -85,6 +85,12 @@ 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 PDF417 trong C# – hướng dẫn đầy đủ với bố cục gọn](./generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/) +Hướng dẫn chi tiết cách tạo mã vạch PDF417 bằng C# với bố cục gọn, sử dụng Aspose.BarCode. + +### [Tạo mã vạch C# với Macro PDF417 – ví dụ đầy đủ](./generate-barcode-c-with-macro-pdf417-full-example/) +Ví dụ đầy đủ về cách tạo mã vạch Macro PDF417 bằng C# sử dụng Aspose.BarCode. + ## 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 +117,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/generate-barcode-c-with-macro-pdf417-full-example/_index.md b/barcode/vietnamese/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md new file mode 100644 index 000000000..6a21b5315 --- /dev/null +++ b/barcode/vietnamese/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/_index.md @@ -0,0 +1,251 @@ +--- +category: general +date: 2026-08-19 +description: Tạo mã vạch C# bằng Aspose.BarCode để tạo Macro PDF417 với văn bản tùy + chỉnh và lưu dưới dạng tệp hình ảnh. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate barcode C# +- how to generate pdf417 +- create barcode custom text +- generate barcode image file +language: vi +lastmod: 2026-08-19 +og_description: Tạo mã vạch C# với Aspose.BarCode, tìm hiểu cách tạo PDF417, thêm + văn bản tùy chỉnh và lưu tệp hình ảnh mã vạch. +og_image_alt: Screenshot of a Macro PDF417 barcode generated with C# +og_title: Tạo mã vạch C# – Hướng dẫn Macro PDF417 +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate barcode C# using Aspose.BarCode to create a Macro PDF417 with + custom text and save as an image file. + headline: Generate barcode C# with Macro PDF417 – full example + type: TechArticle +- questions: + - answer: Yes. Replace `BarCodeImageFormat.Png` with `Jpeg`, `Bmp`, or `Gif` as + needed. + question: Can I generate a different image format? + - answer: Macro PDF417 is designed for segmentation. Adjust `MacroPdf417SegmentsCount` + and `MacroPdf417SegmentID` for each part, then concatenate the scanned results. + question: What if my data exceeds a single barcode? + - answer: Aspose.BarCode fully supports Unicode. Ensure your source file is saved + with UTF‑8 encoding to avoid character corruption. + question: Is Unicode support guaranteed? + - answer: A licensed version removes the evaluation watermark and provides full + functionality. The trial works for testing and learning. + question: Do I need a license for production? + type: FAQPage +tags: +- barcode +- C# +- Aspose +title: Tạo mã vạch C# với Macro PDF417 – ví dụ đầy đủ +url: /vi/net/compact-pdf417-encoding/generate-barcode-c-with-macro-pdf417-full-example/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Tạo mã vạch C# với Macro PDF417 – ví dụ đầy đủ + +Nếu bạn cần **tạo mã vạch C#** cho định dạng Macro PDF417, hướng dẫn này sẽ cung cấp cho bạn một giải pháp sẵn sàng chạy. Bạn sẽ thấy cách **tạo pdf417**, nhúng văn bản tùy chỉnh, và **tạo file ảnh mã vạch** trong một chương trình tự chứa duy nhất. + +Bài học bao gồm mọi thứ từ cài đặt thư viện Aspose.BarCode đến cấu hình siêu dữ liệu Macro PDF417, vì vậy bạn có thể sao chép mã trực tiếp vào dự án và thấy kết quả ngay lập tức. + +## Yêu cầu trước + +Trước khi bắt đầu, hãy chắc chắn rằng bạn có: + +- .NET 6.0 SDK hoặc mới hơn (mã cũng hoạt động với .NET Framework 4.7+) +- Visual Studio 2022 (hoặc bất kỳ IDE nào hỗ trợ C#) +- Giấy phép Aspose.BarCode for .NET (bản dùng thử miễn phí đủ cho việc đánh giá) +- Kiến thức cơ bản về cú pháp C# + +> **Mẹo chuyên nghiệp:** Cài đặt gói NuGet qua CLI để tránh xung đột phiên bản: +> `dotnet add package Aspose.BarCode` + +## Bước 1: Thiết lập dự án và nhập thư viện + +Tạo một ứng dụng console mới và thêm các chỉ thị `using` cần thiết. + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // The full barcode generation logic starts in the next step. + } + } +} +``` + +**Tại sao bước này quan trọng:** +Namespace `Aspose.BarCode.Generation` cung cấp lớp `BarcodeGenerator`, là điểm vào để tạo bất kỳ loại mã vạch nào, bao gồm Macro PDF417. Nhập `System` cho phép bạn truy cập `DateTime` để thêm siêu dữ liệu thời gian. + +## Bước 2: Tạo trình tạo Macro PDF417 với văn bản tùy chỉnh + +Thay thế chú thích placeholder bằng việc khởi tạo trình tạo. Điều này minh họa **tạo mã vạch văn bản tùy chỉnh** đồng thời chọn kiểu mã hoá đúng. + +```csharp +// Step 2: Initialize a barcode generator for Macro PDF417 with custom text. +BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, // Choose Macro PDF417 as the symbology + "Åspóse.Barcóde©"); // Custom text can contain Unicode characters +``` + +**Giải thích:** +- `EncodeTypes.MacroPdf417` báo cho Aspose tạo mã vạch PDF417 hỗ trợ các tính năng macro (phân đoạn tệp, checksum, v.v.). +- Văn bản `"Åspóse.Barcóde©"` cho thấy các ký tự Unicode được hỗ trợ hoàn toàn, thường cần cho các ứng dụng quốc tế. + +## Bước 3: Cấu hình giao diện và siêu dữ liệu Macro PDF417 + +Tinh chỉnh kích thước mã vạch và đặt các trường đặc thù cho macro cần thiết cho việc xử lý tệp phân đoạn. + +```csharp +// Appearance: set the narrow bar width to 2 pixels. +barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + +// PDF417 specific settings +barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; // Number of columns per row +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; // Unique file identifier +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; // Current segment number +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; // Total number of segments +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; // Logical file name +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; // CCITT‑16 CRC checksum +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; // Approximate file size in bytes +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; +barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; +``` + +**Tại sao các thiết lập này quan trọng:** + +| Cài đặt | Mục đích | +|---------|----------| +| `XDimension.Pixels` | Kiểm soát mật độ hình ảnh; 2 px tạo ra hình ảnh rõ ràng, dễ quét. | +| `Columns` | Xác định số cột dữ liệu xuất hiện trên mỗi hàng, ảnh hưởng đến kích thước mã vạch. | +| `MacroPdf417FileID` | Định danh duy nhất tệp logic trên tất cả các đoạn. | +| `MacroPdf417SegmentID` / `SegmentsCount` | Cho phép tái tạo tệp gốc từ nhiều mã vạch. | +| `MacroPdf417FileName` | Tên đọc được lưu trong mã vạch để xử lý tiếp theo. | +| `MacroPdf417Checksum` | Cung cấp phát hiện lỗi bằng thuật toán CRC CCITT‑16. | +| `MacroPdf417FileSize` | Giúp bộ giải mã biết khi nào đã nhận đủ toàn bộ tệp. | +| `MacroPdf417TimeStamp` | Ghi lại thời điểm mã vạch được tạo, hữu ích cho truy vết. | +| `MacroPdf417Addressee` / `MacroPdf417Sender` | Các trường tùy chọn có thể được dùng trong quy trình kinh doanh. | +| `MacroPdf417Terminator` | Chỉ ra rằng đoạn này là đoạn cuối cùng (`Set`). | + +## Bước 4: Lưu mã vạch dưới dạng file ảnh + +Cuối cùng, ghi mã vạch ra file PNG để bạn có thể xem hoặc nhúng vào nơi khác. + +```csharp +// Step 4: Save the generated barcode image to a file. +string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; // Adjust the folder as needed +barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + +Console.WriteLine($"Barcode saved to {outputPath}"); +``` + +**Bạn sẽ thấy:** +Một ảnh PNG có tên `ExtPDF417Meta.png` chứa mã vạch Macro PDF417 mã hoá văn bản tùy chỉnh và tất cả các trường siêu dữ liệu bạn đã thiết lập ở trên. Ảnh có thể mở bằng bất kỳ trình xem tiêu chuẩn nào hoặc chèn vào PDF, báo cáo, hoặc trang web. + +## Mã nguồn đầy đủ (sẵn sàng sao chép) + +```csharp +using Aspose.BarCode.Generation; +using System; + +namespace BarcodeDemo +{ + class Program + { + static void Main() + { + // Initialize generator with custom Unicode text. + BarcodeGenerator barcodeGenerator = new BarcodeGenerator( + EncodeTypes.MacroPdf417, + "Åspóse.Barcóde©"); + + // Appearance settings. + barcodeGenerator.Parameters.Barcode.XDimension.Pixels = 2; + barcodeGenerator.Parameters.Barcode.Pdf417.Columns = 5; + + // Macro PDF417 metadata. + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileID = 12345678; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentID = 12; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417SegmentsCount = 20; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileName = "file01"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Checksum = 1234; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417FileSize = 400_000; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417TimeStamp = new DateTime(2019, 11, 1); + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Addressee = "street"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Sender = "aspose"; + barcodeGenerator.Parameters.Barcode.Pdf417.MacroPdf417Terminator = Pdf417MacroTerminator.Set; + + // Save the barcode image. + string outputPath = @"C:\Barcodes\ExtPDF417Meta.png"; + barcodeGenerator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"Barcode saved to {outputPath}"); + } + } +} +``` + +### Kết quả mong đợi + +Chạy chương trình sẽ in ra: + +``` +Barcode saved to C:\Barcodes\ExtPDF417Meta.png +``` + +Mở `ExtPDF417Meta.png` sẽ hiển thị một mã vạch Macro PDF417 sạch sẽ, quét đúng với bất kỳ trình đọc PDF417 nào, giữ nguyên văn bản tùy chỉnh `"Åspóse.Barcóde©"` và siêu dữ liệu macro bạn đã định nghĩa. + +## Các câu hỏi thường gặp và trường hợp đặc biệt + +- **Tôi có thể tạo định dạng ảnh khác không?** + Có. Thay `BarCodeImageFormat.Png` bằng `Jpeg`, `Bmp`, hoặc `Gif` tùy nhu cầu. + +- **Nếu dữ liệu của tôi vượt quá một mã vạch thì sao?** + Macro PDF417 được thiết kế cho phân đoạn. Điều chỉnh `MacroPdf417SegmentsCount` và `MacroPdf417SegmentID` cho mỗi phần, sau đó nối các kết quả quét lại. + +- **Unicode có được hỗ trợ chắc chắn không?** + Aspose.BarCode hỗ trợ Unicode hoàn toàn. Đảm bảo file nguồn của bạn được lưu với mã hoá UTF‑8 để tránh hỏng ký tự. + +- **Tôi có cần giấy phép cho môi trường production không?** + Phiên bản có giấy phép loại bỏ watermark đánh giá và cung cấp đầy đủ chức năng. Bản dùng thử đủ cho việc thử nghiệm và học tập. + +## Kết luận + +Bây giờ bạn đã biết cách **tạo mã vạch C#** cho Macro PDF417, **tạo pdf417** với siêu dữ liệu phong phú, **tạo mã vạch văn bản tùy chỉnh**, và **tạo file ảnh mã vạch** bằng Aspose.BarCode. Ví dụ hoàn chỉnh, có thể chạy ngay này minh họa mọi bước cần thiết—from thiết lập dự án đến lưu ảnh PNG cuối cùng. + +### Các bước tiếp theo + +- Thử nghiệm các thiết lập PDF417 khác như `ErrorCorrectionLevel` và `CompactPdf417` để có ký hiệu nhỏ hơn. +- Tích hợp mã vạch đã tạo vào báo cáo PDF bằng Aspose.PDF. +- Khám phá tạo hàng loạt: lặp qua một tập hợp tệp và tạo một loạt mã vạch Macro PDF417 phân đoạn. + +Hãy tự do điều chỉnh mã cho quy trình của bạn, và để việc tạo mã vạch trở thành một phần liền mạch trong các ứng dụng C# của bạn. Chúc lập trình vui! + +## Bạn nên học gì tiếp theo? + +Các hướng dẫn sau đây đề cập đến các chủ đề liên quan chặt chẽ, xây dựng trên các kỹ thuật được trình bày trong hướng dẫn này. Mỗi tài nguyên bao gồm các ví dụ mã hoàn chỉnh với giải thích từng bước để giúp bạn làm chủ các tính năng API bổ sung và khám phá các cách triển khai thay thế trong dự án của mình. + +- [Cách tạo mã vạch Aztec với tỷ lệ khung tùy chỉnh bằng Aspose.BarCode for .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) +- [Tạo ảnh mã vạch – Code 93 với Aspose.BarCode](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-code-93-configuration/) +- [Cách tạo và điều chỉnh chiều cao mã vạch One-Dimensional Databar bằng Aspose.BarCode for .NET](/barcode/english/net/one-dimensional-barcode-types/one-dimensional-databar-barcode-height-adjustment/) + +{{< /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/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md b/barcode/vietnamese/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md new file mode 100644 index 000000000..5600cef95 --- /dev/null +++ b/barcode/vietnamese/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/_index.md @@ -0,0 +1,250 @@ +--- +category: general +date: 2026-08-19 +description: Tạo mã vạch PDF417 trong C# nhanh chóng. Tìm hiểu cách tạo mã vạch PDF417 + bằng C# sử dụng Aspose.BarCode với chế độ compact và các cài đặt tùy chỉnh. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- generate pdf417 barcode +- how to generate pdf417 barcode c# +- Aspose.BarCode PDF417 +- compact PDF417 barcode +- barcode X‑dimension +language: vi +lastmod: 2026-08-19 +og_description: Tạo mã vạch PDF417 trong C# với Aspose.BarCode. Hướng dẫn này cho + thấy cách tạo mã vạch PDF417 bằng C# ở chế độ compact, thiết lập kích thước X và + lưu dưới dạng PNG. +og_image_alt: Screenshot of a compact PDF417 barcode saved as PNG +og_title: Tạo mã vạch PDF417 trong C# – hướng dẫn từng bước +schemas: +- author: Aspose + dateModified: '2026-08-19' + description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + headline: Generate PDF417 barcode in C# – complete guide with compact layout + type: TechArticle +- description: Generate PDF417 barcode in C# quickly. Learn how to generate PDF417 + barcode C# using Aspose.BarCode with compact mode and custom settings. + name: Generate PDF417 barcode in C# – complete guide with compact layout + steps: + - name: Why each line matters + text: '* **`EncodeTypes.Pdf417`** – selects the PDF417 symbology, which supports + up to ~1.1 KB of data. * **`XDimension.Pixels = 2`** – sets the basic bar width. + Smaller values make the barcode thinner; larger values improve readability on + low‑resolution devices. * **`Pdf417.Columns = 3`** – limits the num' + - name: 4️⃣ Generate a high‑density PDF417 for printing + text: 'If you need a barcode that fits on a small label, increase the column count + and lower the X‑dimension:' + - name: 5️⃣ Change the output format to SVG for vector scaling + text: '```csharp generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); + ```' + - name: 6️⃣ Encode binary data (e.g., a byte array) + text: 'If you need to embed binary payloads, convert them to a Base64 string first:' + type: HowTo +tags: +- barcode +- C# +- Aspose +title: Tạo mã vạch PDF417 trong C# – hướng dẫn đầy đủ với bố cục gọn +url: /vi/net/compact-pdf417-encoding/generate-pdf417-barcode-in-c-complete-guide-with-compact-lay/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# Tạo mã vạch PDF417 trong C# – hướng dẫn đầy đủ + +Nếu bạn cần **generate PDF417 barcode** trong một ứng dụng .NET, hướng dẫn này sẽ cho bạn thấy cách thực hiện chính xác. Bạn sẽ thấy một ví dụ ngắn gọn, sẵn sàng cho môi trường sản xuất, tạo ra một mã vạch PDF417 dạng compact, tùy chỉnh X‑dimension, và lưu kết quả dưới dạng ảnh PNG. + +Việc tạo PDF417 barcode thường gặp khi bạn phải mã hoá một lượng lớn dữ liệu—như thông tin vé, manifest vận chuyển, hoặc tài liệu nhận dạng—ở định dạng có thể đọc được bằng máy. Sử dụng Aspose.BarCode giúp quá trình trở nên đơn giản, và mã hoạt động với .NET 6+ hoặc .NET Framework 4.7.2 trở lên. + +Trong hướng dẫn này bạn sẽ: + +* Cài đặt gói NuGet Aspose.BarCode. +* Viết một chương trình C# tự chứa mà **generates PDF417 barcode** với số cột nhỏ và chế độ compact (truncated). +* Điều chỉnh độ rộng thanh (X‑dimension) để hiển thị sắc nét hơn. +* Lưu mã vạch dưới dạng file PNG. +* Khám phá các biến thể, trường hợp biên và các mẹo thực hành tốt nhất. + +## Yêu cầu trước + +Trước khi bắt đầu, hãy chắc chắn rằng bạn có: + +* Visual Studio 2022 (hoặc bất kỳ IDE C# nào) với .NET 6 SDK đã được cài đặt. +* Kết nối Internet để tải gói NuGet **Aspose.BarCode**. +* Quyền ghi vào thư mục nơi file PNG sẽ được lưu. + +Không cần thư viện bổ sung; Aspose.BarCode xử lý việc mã hoá hình ảnh nội bộ. + +## Bước 1: Thêm gói Aspose.BarCode + +Mở dự án của bạn trong Visual Studio, nhấp chuột phải vào solution và chọn **Manage NuGet Packages**. Tìm kiếm `Aspose.BarCode` và cài đặt phiên bản ổn định mới nhất. + +```bash +dotnet add package Aspose.BarCode +``` + +> **Pro tip:** Giữ gói luôn cập nhật. Các bản phát hành mới thường bao gồm cải thiện hiệu năng và hỗ trợ các runtime .NET mới nhất. + +## Bước 2: Tạo ứng dụng console tối thiểu + +Tạo một dự án console C# mới nếu bạn chưa có: + +```bash +dotnet new console -n Pdf417Demo +cd Pdf417Demo +``` + +Thay thế nội dung của `Program.cs` bằng ví dụ đầy đủ dưới đây. Chương trình này minh họa **how to generate PDF417 barcode C#** từ đầu đến cuối. + +```csharp +using System; +using Aspose.BarCode.Generation; +using Aspose.BarCode.BarCodeImageFormat; + +namespace Pdf417Demo +{ + class Program + { + static void Main(string[] args) + { + // ----------------------------------------------------------------- + // 1️⃣ Define the data you want to encode. + // ----------------------------------------------------------------- + // The string can contain Unicode characters; Aspose.BarCode handles + // encoding automatically. Here we use characters with diacritics to + // prove Unicode support. + string data = "Åspóse.Barcóde©"; + + // ----------------------------------------------------------------- + // 2️⃣ Initialise the BarcodeGenerator for PDF417. + // ----------------------------------------------------------------- + // EncodeTypes.Pdf417 tells the library which symbology to use. + // The constructor also accepts the data to encode. + BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Pdf417, data); + + // ----------------------------------------------------------------- + // 3️⃣ Configure visual parameters. + // ----------------------------------------------------------------- + // • XDimension controls the bar width in pixels. A value of 2 gives + // a clear, readable barcode on most screens. + // • Columns define how many data columns the barcode will use. + // Fewer columns produce a more compact image but increase the + // number of rows. + // • Truncate enables “compact mode”, which removes the trailing + // stop pattern and reduces the overall size. + generator.Parameters.Barcode.XDimension.Pixels = 2; + generator.Parameters.Barcode.Pdf417.Columns = 3; + generator.Parameters.Barcode.Pdf417.Truncate = true; // compact mode + + // ----------------------------------------------------------------- + // 4️⃣ Choose the output format and save the image. + // ----------------------------------------------------------------- + // BarCodeImageFormat.Png yields a lossless PNG file that works + // well for web, print, and further image processing. + string outputPath = "CompactPdf417.png"; + generator.Save(outputPath, BarCodeImageFormat.Png); + + Console.WriteLine($"PDF417 barcode saved to: {outputPath}"); + } + } +} +``` + +### Tại sao mỗi dòng lại quan trọng + +* **`EncodeTypes.Pdf417`** – chọn ký hiệu PDF417, hỗ trợ tới khoảng ~1.1 KB dữ liệu. +* **`XDimension.Pixels = 2`** – đặt độ rộng thanh cơ bản. Giá trị nhỏ hơn làm mã vạch mỏng hơn; giá trị lớn hơn cải thiện khả năng đọc trên thiết bị độ phân giải thấp. +* **`Pdf417.Columns = 3`** – giới hạn số cột, buộc trình tạo sử dụng nhiều hàng hơn, dẫn đến mã vạch cao hơn nhưng hẹp hơn. +* **`Pdf417.Truncate = true`** – kích hoạt chế độ compact, loại bỏ mẫu dừng và thu nhỏ hình ảnh mà không mất tính toàn vẹn dữ liệu. +* **`Save(..., BarCodeImageFormat.Png)`** – ghi file PNG. Bạn cũng có thể chọn `Jpeg`, `Bmp`, hoặc `Svg` tùy theo nhu cầu downstream. + +Run the program: + +```bash +dotnet run +``` + +Bạn sẽ thấy đầu ra console xác nhận vị trí file, và thư mục sẽ chứa `CompactPdf417.png`. Mở file PNG sẽ hiển thị một mã vạch PDF417 dạng compact, rõ ràng, mã hoá chuỗi Unicode. + +## Bước 3: Xác minh mã vạch (tùy chọn nhưng được khuyến nghị) + +Để đảm bảo mã vạch có thể đọc được, bạn có thể sử dụng bất kỳ ứng dụng scanner PDF417 tiêu chuẩn nào trên điện thoại thông minh hoặc thư viện giải mã trên máy tính để bàn. Văn bản đã mã hoá phải khớp chính xác với chuỗi `data` gốc, bao gồm cả các ký tự đặc biệt. + +Nếu bạn gặp vấn đề giải mã: + +* Tăng `XDimension` lên 3 hoặc 4 pixel. +* Giảm số cột (ví dụ, đặt `Columns = 2`). +* Vô hiệu hoá `Truncate` (`Truncate = false`) để thêm mẫu dừng. + +Các điều chỉnh này đổi kích thước sang khả năng đọc, hữu ích cho máy in hoặc máy quét độ phân giải thấp. + +## Bước 4: Khám phá các biến thể phổ biến + +### 4️⃣ Tạo PDF417 mật độ cao cho việc in + +Nếu bạn cần một mã vạch vừa vào nhãn nhỏ, tăng số cột và giảm X‑dimension: + +```csharp +generator.Parameters.Barcode.XDimension.Pixels = 1; +generator.Parameters.Barcode.Pdf417.Columns = 6; +generator.Parameters.Barcode.Pdf417.Truncate = false; // keep full pattern +``` + +### 5️⃣ Thay đổi định dạng xuất ra SVG để mở rộng vector + +Đầu ra SVG mở rộng mà không mất chất lượng, hoàn hảo cho các trang web đáp ứng. + +```csharp +generator.Save("CompactPdf417.svg", BarCodeImageFormat.Svg); +``` + +### 6️⃣ Mã hoá dữ liệu nhị phân (ví dụ, một mảng byte) + +Nếu bạn cần nhúng tải trọng nhị phân, trước tiên chuyển chúng thành chuỗi Base64: + +```csharp +byte[] payload = new byte[] { 0x01, 0xFF, 0xA5 }; +string base64 = Convert.ToBase64String(payload); +generator = new BarcodeGenerator(EncodeTypes.Pdf417, base64); +``` + +Mã vạch bây giờ mang thông tin nhị phân, và bộ giải mã phải đảo ngược bước Base64. + +## Câu hỏi thường gặp + +| Question | Answer | +|----------|--------| +| **Có thể tạo PDF417 mà không dùng Aspose không?** | Có, có các thư viện khác như ZXing.Net hoặc Dynamsoft, nhưng Aspose.BarCode cung cấp kiểm soát bố cục phong phú hơn (cột, truncation) và xử lý Unicode tốt hơn. | +| **Độ dài dữ liệu tối đa là bao nhiêu?** | PDF417 có thể mã hoá tới 1.108 byte (≈ 1 KB) dữ liệu nhị phân. Nếu vượt quá, hãy cân nhắc chia dữ liệu thành nhiều mã vạch. | +| **Chế độ compact có tuân thủ tiêu chuẩn không?** | Truncated PDF417 là một phần của tiêu chuẩn ISO/IEC 15438 và được hỗ trợ rộng rãi, nhưng hãy xác minh rằng máy quét mục tiêu của bạn hỗ trợ rõ ràng chế độ này. | +| **Làm sao để thay đổi màu nền?** | Đặt `generator.Parameters.Barcode.BackColor = System.Drawing.Color.White;` và `generator.Parameters.Barcode.ForeColor = System.Drawing.Color.Black;` trước khi lưu. | + +## Kết luận + +Bây giờ bạn đã biết **how to generate PDF417 barcode C#** bằng Aspose.BarCode, cách tinh chỉnh X‑dimension, bật chế độ compact, và xuất kết quả dưới dạng ảnh PNG. Ví dụ hoàn chỉnh, có thể chạy được có thể sao chép vào bất kỳ dự án .NET nào, và các biến thể được trình bày cho phép bạn điều chỉnh mã vạch cho các trường hợp in ấn, web, hoặc tải trọng nhị phân. + +Bước tiếp theo bạn có thể khám phá: + +* Tích hợp việc tạo mã vạch vào API ASP.NET Core trả về hình ảnh theo yêu cầu. +* Kết hợp PDF417 với mã QR trên cùng một nhãn để quét đa định dạng. +* Sử dụng lớp `Reader` của Aspose.BarCode để giải mã hình ảnh đã tạo và xác minh dữ liệu bằng chương trình. + +Chúc lập trình vui vẻ, và tận hưởng sự linh hoạt mà các giải pháp **generate PDF417 barcode** mang lại cho ứng dụng của bạn! + +## Bạn nên học gì tiếp theo? + +Các hướng dẫn sau đây bao gồm các chủ đề liên quan chặt chẽ, xây dựng trên các kỹ thuật được trình bày trong hướng dẫn này. Mỗi tài nguyên bao gồm các ví dụ mã đầy đủ, hoạt động với giải thích từng bước để giúp bạn nắm vững các tính năng API bổ sung và khám phá các cách triển khai thay thế trong dự án của mình. + +- [Cách tạo Barcode – Compact PDF417 với Aspose.BarCode](/barcode/english/net/compact-pdf417-encoding/compact-pdf417-basic-configuration/) +- [Cách tạo ảnh Barcode với tùy chỉnh không gian bổ sung bằng Aspose.BarCode](/barcode/english/net/supplemental-barcode-data/supplemental-barcode-space-customization/) +- [Cách tạo barcode Aztec với tỷ lệ khung tùy chỉnh bằng Aspose.BarCode cho .NET](/barcode/english/net/aztec-barcode-encoding/aztec-aspect-ratio-customization/) + +{{< /blocks/products/pf/tutorial-page-section >}} +{{< /blocks/products/pf/main-container >}} +{{< /blocks/products/pf/main-wrap-class >}} +{{< blocks/products/products-backtop-button >}} \ No newline at end of file