我的应用程序中需要条形码打印模块,但无法弄清楚如何正确打印条形码.看起来它的分辨率太低了.我正在使用Zen Barcode.正如您可以看到每张附照片,顶部条形码是从打印机的软件打印出来的,证明打印机没问题,底部图片是从我的代码中打印出来的:
[WPF]
[C#]
private void printJob() { // use printer we need SetDefaultPrinter("Brother QL-700"); //draw barcodes BarcodeDraw bc = BarcodeDrawFactory.Code128WithChecksum; Bitmap serial_bitmap = (Bitmap)bc.Draw(serial, 20); ImageConverter ic = new ImageConverter(); //generate bitmap serial_bcode1.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(serial_bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); var dlg = new PrintDialog(); //print main label dlg.PrintTicket.CopyCount = 1; // number of copies dlg.PrintTicket.PageOrientation = PageOrientation.Landscape; dlg.PrintVisual(_printSerialBcode, "Barcode"); //change default printer to original one SetDefaultPrinter(defaultPrinter); }