Printed barcode is not clear (WPF)

I need a barcode print module in my application, but cannot figure out how to print barcodes correctly. It seems that the resolution is too low. I am using Zen Barcode . As you can see in the attached photo, the top bar code is printed from the printer software, confirming that the printer is in order, printed from my code from bottom to bottom:

[WPF]

<Grid x:Name="_printSerialBcode" Margin="9" Visibility="Visible"> <Image x:Name="serial_bcode1" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="2"/> </Grid> 

[WITH#]

  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); } 

Test barcodes

+5
source share
2 answers

as Don recommended, I used the Font Font, a lot easier and better! I am using IDAutomation

0
source

how did you decide that? I also have the same problem you are facing

0
source

Source: https://habr.com/ru/post/1239913/


All Articles