Class BarcodeGenerator
İsim alanı : Aspose.BarCode.Generation Toplama: Aspose.BarCode.dll (25.4.0)
BarcodeGenerator backend barcode görüntüleri oluşturmak için.
Desteklenen semboller: 1D: Codabar, Code11, Code128, Code39, Code39FullASCII Code93, EAN13, Ean8, Interleaved2of5, MSI, Standard2off5, UPCA, UPCE, ISBN, GS1Code128 Postnet, Planet EN14, SCC14, SSCC18, ITF14, SingapurPost … 2D : Aztec, DataMatrix, PDf417, QR kodu …
[XmlSerialization(Name = "Aspose.BarCode.Generator")]
public sealed class BarcodeGenerator : IDisposable
Inheritance
Implements
mirasçı üyeleri
object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Bu örnek, bir çubuk kodu görüntüsünü nasıl oluşturacağınızı ve kaydeteceğinizi gösterir.
using(var generator = new BarcodeGenerator(EncodeTypes.Code128))
{
generator.CodeText = "123ABC";
generator.Save("code128.png");
}
Constructors
BarcodeGenerator(BaseEncodeType)
Bir Barcode Generator örneği oluşturur.
public BarcodeGenerator(BaseEncodeType type)
Parameters
type
BaseEncodeType
Bir sembolü ayarlamak için Aspose.BarCode.Generation.EncodeTypes sınıfını kullanın.
BarcodeGenerator(BaseEncodeType, Çerçeve)
Bir Barcode Generator örneği oluşturur.
public BarcodeGenerator(BaseEncodeType type, string codeText)
Parameters
type
BaseEncodeType
Bir sembolü ayarlamak için Aspose.BarCode.Generation.EncodeTypes sınıfını kullanın.
codeText
string
Yazıyı şifrelemek için.
Properties
BarcodeType
Barkod sembolü türü.
[XmlSerialization(Type = XmlSerializationType.Element)]
public BaseEncodeType BarcodeType { get; set; }
Mülkiyet Değer
CodeText
Yazıyı şifrelemek için.
[XmlSerialization(Type = XmlSerializationType.Element)]
public string CodeText { get; set; }
Mülkiyet Değer
Parameters
Generasyon Parametreleri
[XmlSerialization(Type = XmlSerializationType.Element)]
public BaseGenerationParameters Parameters { get; }
Mülkiyet Değer
Methods
Dispose()
public void Dispose()
ExportToXml(Sırt)
BarCode özelliklerini belirtilen xml dosyasına ihraç edin
public bool ExportToXml(string xmlFile)
Parameters
xmlFile
string
Dosya için adı
Returns
İster ihracat olursa olsun başarıyla tamamlanmıştır.
Returns True Başarılı olsaydı; False Otherwise
ExportToXml(Stream)
BarCode özelliklerini belirtilen xml akışına ihraç edin
public bool ExportToXml(Stream xml)
Parameters
xml
Stream
xml akışı
Returns
İster ihracat olursa olsun başarıyla tamamlanmıştır.
Returns True Başarılı olsaydı; False Otherwise
GenerateBarCodeImage()
Barkod görüntüsünü mevcut ayarlar altında oluşturun.
public Bitmap GenerateBarCodeImage()
Returns
Bitmap
Barkod görüntüsü. görüntüle System.Drawing.Bitmap.
Examples
Bu örnek, bir çubuk kodu görüntüsünü nasıl oluşturacağınızı ve kaydeteceğinizi gösterir.
using(var generator = new BarcodeGenerator(EncodeTypes.Code128))
{
Bitmap barcode = generator.GenerateBarCodeImage();
barcode.Save("test.png");
}
ImportFromXml(Sırt)
Belirlenen xml dosyasından BarCode özelliklerini ithal eder ve BarcodeGenerator örneği oluşturur.
public static BarcodeGenerator ImportFromXml(string xmlFile)
Parameters
xmlFile
string
Dosya için adı
Returns
BarcodeGeneratör Örnekleri
ImportFromXml(Stream)
BarCode özelliklerini belirtilen xml akımından ithal eder ve BarcodeGenerator örneği oluşturur.
public static BarcodeGenerator ImportFromXml(Stream xml)
Parameters
xml
Stream
xml akışı
Returns
BarcodeGeneratör Örnekleri
Save(Çıkış, BarCodeImageFormat)
Barkod görüntüsünü belirli bir biçimde aktarmak için kaydedin.
public void Save(Stream stream, BarCodeImageFormat format)
Parameters
stream
Stream
çıkış sistemi.IO.Stream
format
BarCodeImageFormat
Çıkış görüntüsünün dosya biçimini belirler.
Save(Çerçeve, BarCodeImageFormat)
Çizgi kod görüntüsünü belirli bir dosyaya özel bir biçimde kaydedin.
public void Save(string filename, BarCodeImageFormat format)
Parameters
filename
string
Kurtarmak için bir yol.
format
BarCodeImageFormat
Çıkış görüntüsünün dosya biçimini belirler.
Save(Sırt)
Barkod görüntüsünü belirli bir dosyaya kaydedin.
public void Save(string filename)
Parameters
filename
string
Kurtarmak için bir yol.
SetCodeText(byte[])
Codetext’i byte sırası olarak ayarlayın.
public void SetCodeText(byte[] codeBytes)
Parameters
codeBytes
byte
[…]
Codetext’in değişiklikleri
SetCodeText(Çerçeve, Kodlama)
Kod metni byte sipariş işareti (BOM) ile kodlayın, belirtilen kodlama kullanarak: örneğin UTF8, UTF16, UTF32, vb..1D bar kodları Encoding.ASCII veya ISO/IEC 8859-1 - Encoding.GetEncoding(28591). 2D bar kodları Encoding.UTF8 kullanmalıdır.
public void SetCodeText(string codeText, Encoding encoding)
Parameters
codeText
string
CodeText Çerçeve
encoding
Encoding
Kullanılan kodlama
Examples
Bu örnek 1D ve 2D çubuk kodları ile SetCodeText nasıl kullanılacağını gösterir
//Encode codetext of 1D barcodes with 7-bit ASCII encoding, byte order mark (BOM) is absent
using (BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128))
{
gen.SetCodeText("123ABCD", Encoding.ASCII);
gen.Save("barcode.png", BarCodeImageFormat.Png);
}
//Encode codetext of 1D barcodes with 8-bit ISO/IEC 8859-1 encoding, byte order mark (BOM) is absent
using (BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128))
{
gen.SetCodeText("123ABCD", Encoding.GetEncoding(28591));
gen.Save("barcode.png", BarCodeImageFormat.Png);
}
//Encode codetext of 2D barcodes with UTF8 encoding with byte order mark (BOM)
using (BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128))
{
gen.SetCodeText("123ABCD", Encoding.UTF8);
gen.Save("barcode.png", BarCodeImageFormat.Png);
}
SetCodeText(Çerçeve, Kodlama, Bool)
Seçmeli byte sipariş işareti (BOM) yerleştirme ile kodlama metni, belirli kodlama kullanılarak: örneğin UTF8, UTF16, UTF32, vb..1D bar kodları Encoding.ASCII veya ISO/IEC 8859-1 - Encoding.GetEncoding(28591). 2D bar kodları Encoding.UTF8 kullanmalıdır.
public void SetCodeText(string codeText, Encoding encoding, bool insertBOM)
Parameters
codeText
string
CodeText Çerçeve
encoding
Encoding
Kullanılan kodlama
insertBOM
bool
Bayrak, kodlama byte sipariş işareti (BOM) girmesini gösterir.Bu durumda, kodlama byte sipariş işareti (BOM) girmesini gerektirir: örneğin UTF8,UTF16, UTF32, e.t.c. ve bayrak doğru ayarlanır, BOM eklenir, bayrak yanlış ayarlanırsa, BOM yerleştirme göz ardı edilir.
Examples
Bu örnek 1D ve 2D çubuk kodları ile SetCodeText nasıl kullanılacağını gösterir
//Encode codetext of 1D barcodes with 7-bit ASCII encoding, byte order mark (BOM) is absent
using (BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128))
{
gen.SetCodeText("123ABCD", Encoding.ASCII, true);
gen.Save("barcode.png", BarCodeImageFormat.Png);
}
//Encode codetext of 1D barcodes with 8-bit ISO/IEC 8859-1 encoding, byte order mark (BOM) is absent
using (BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128))
{
gen.SetCodeText("123ABCD", Encoding.GetEncoding(28591), true);
gen.Save("barcode.png", BarCodeImageFormat.Png);
}
//Encode codetext of 2D barcodes with UTF8 encoding with byte order mark (BOM)
using (BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128))
{
gen.SetCodeText("123ABCD", Encoding.UTF8, true);
gen.Save("barcode.png", BarCodeImageFormat.Png);
}
//Encode codetext of 2D barcodes with UTF8 encoding without byte order mark (BOM)
using (BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128))
{
gen.SetCodeText("123ABCD", Encoding.UTF8, false);
gen.Save("barcode.png", BarCodeImageFormat.Png);
}