How to Generate POSTNET and PLANET Barcodes for Postal and Mailing Automation in .NET
What Are POSTNET and PLANET Barcodes?
POSTNET and PLANET are USPS postal barcodes used for mail sorting, tracking, and direct marketing. POSTNET encodes ZIP codes (5, 9, or 11 digits); PLANET is used for mail tracking and customer response, encoding up to 12 digits. Both are optimized for high-speed postal automation.
Quick Start (Minimal Example)
using Aspose.BarCode.Generation;
var generator = new BarcodeGenerator(EncodeTypes.Postnet, "12345");
generator.Save("postnet-mail.png", BarCodeImageFormat.Png);
Table of Contents
- Introduction
- What Are POSTNET and PLANET Barcodes?
- Quick Start (Minimal Example)
- Prerequisites
- Step-by-Step Implementation
- Customizing Barcode Appearance
- Supported Output Formats
- Troubleshooting & Common Issues
- FAQs
- Use Cases and Applications
- Best Practices
- Related Articles
- Conclusion
Introduction
This guide covers how to generate POSTNET and PLANET barcodes for postal, mail sorting, and direct marketing workflows using Aspose.BarCode for .NET. Features complete C# code and mailing best practices.
Prerequisites
- Visual Studio 2019 or later
- .NET 6.0+ or .NET Framework 4.6.2+
- Aspose.BarCode for .NET (NuGet)
- Basic C# knowledge
PM> Install-Package Aspose.BarCode
Step-by-Step Implementation
POSTNET Example:
using Aspose.BarCode.Generation;
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Postnet, "12345");
gen.Save("postnet-mail.png", BarCodeImageFormat.Png);
PLANET Example:
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Planet, "012345678901");
gen.Save("planet-mail.png", BarCodeImageFormat.Png);
Customizing Barcode Appearance
- Bar Height/Width:
csgen.Parameters.Barcode.BarHeight.Pixels = 60; gen.Parameters.Barcode.XDimension.Pixels = 2;
- Color/Background:
csgen.Parameters.Barcode.BarColor = Color.SaddleBrown; gen.Parameters.Barcode.BackColor = Color.White;
- Caption:
csgen.Parameters.CaptionBelow\.Visible = true;
Supported Output Formats
- PNG, JPEG, BMP – Standard print and digital mail
- TIFF – High-res/archival
- SVG, EMF – Vector for bulk mailers
Troubleshooting & Common Issues
Barcode not scanning?
- Check digit length, all-numeric input, proper contrast, and USPS format requirements.
Wrong code length?
- Use 5, 6, 9, or 11 digits for POSTNET; 12 digits for PLANET.
Barcode too dense/small?
- Adjust BarHeight and XDimension.
FAQs
Q: Can I use POSTNET for all US mail? A: POSTNET is legacy for ZIPs; Intelligent Mail is now standard, but POSTNET is still accepted for many mailers.
Q: Can I batch-generate barcodes for direct marketing? A: Yes, loop through your mailing list and generate each barcode in code.
Use Cases and Applications
- USPS ZIP and mail sorting (POSTNET)
- Direct mail campaigns and tracking
- Customer response mailers (PLANET)
- High-speed automation for postal facilities
Best Practices: Quick Reference Table
Tip | Do | Don’t |
---|---|---|
Code Length | POSTNET: 5/6/9/11; PLANET: 12 | Wrong/extra digits |
Output Format | SVG/PNG for print/digital | Low-res JPG for envelopes |
Bar Color | Dark on white | Light bars on colored paper |
Caption | Show below for reference | Hide on bulk mailers |
Conclusion
POSTNET and PLANET barcodes remain key for US postal automation and direct marketing. Aspose.BarCode for .NET delivers full USPS compatibility and high-volume workflow support. See the Aspose.BarCode API Reference for more options and postal barcode standards.