Skip to main content
All docs
V26.1
  • PostNetOptionsBuilder Class

    Builds an PostNetOptions object. Chain builder methods to configure barcode settings, then call the Build method to create the options object.

    Namespace: DevExpress.Docs.Barcode

    Assembly: DevExpress.Docs.Core.v26.1.dll

    Declaration

    public class PostNetOptionsBuilder :
        BarcodeOptionsBuilder<PostNetOptions, PostNetOptionsBuilder>

    The following members return PostNetOptionsBuilder objects:

    Remarks

    The following code snippet creates a PostNet barcode with 9 digits and specifies its options:

    DevExpress Barcode Generator - PostNet barcode

    using DevExpress.Docs.Barcode;
    using DevExpress.Drawing;
    using System.Drawing;
    
    var postNetCode = PostNetOptionsBuilder.Create()
        .WithBackColor(Color.LightGray)
        .WithShowText(false)
        .WithPadding(5)
        .WithBorderWidth(1)
        .WithBorderColor(Color.Blue)
        .Build();
    
    var filePath = Path.GetFullPath("postnet_barcode.png");
    
    using var stream = new FileStream(filePath, FileMode.Create);
    using var generator = new BarcodeGenerator(postNetCode);
    generator.Export("123456789", stream, DXImageFormat.Png);
    
    See Also