BarCode for WPF | ComponentOne
In This Topic
    Save BarCode as Image
    In This Topic

    The BarCode control supports the export to image format functionality. You can save the image of the BarCode and use it for other purposes, like copy the image to clipboard, assign the image to a picture control or utilize the image in office productivity applications like Microsoft Office, WordPad etc. The C1BarCode class provides the Save(System.IO.Stream stream, C1.WPF.BarCode.ImageFormat imgFormat) method that can be used to save the image of the barcode in image formats such as BMP, PNG and JPEG. The Save method accepts two parameters, stream, where the barcode will be saved, and imgFormat, which stands for the format of the barcode image.

    C#
    Copy Code
    barCode.Save(stream, (ImageFormat)Enum.Parse(typeof(ImageFormat), fileExtension, true));
    stream.WriteTo(fstream);