Patroni
Patroni

Reputation: 23

Label printing is blurry - wpf

i´m trying to print a barcode on a argox os-214 that i create using this framework http://barcoderender.codeplex.com/ but is always blurry, can´t read using a scanner.

I already tried some other solutions, but i still dont get it, and if using the "Bartender" the printer software, work´s just fine. The label size is 40mmX60mm and is set up in windows printing. follow the prototype code:

    public MainWindow()
    {
      InitializeComponent();
      Code39BarcodeDraw code39 = BarcodeDrawFactory.Code39WithChecksum;
      pcImage.Source = GetImageStream(code39.Draw("1234567", 13));
    }

    public static BitmapSource GetImageStream(System.Drawing.Image myImage)
    {
      var bitmap = new Bitmap(myImage);
      IntPtr bmpPt = bitmap.GetHbitmap();
      BitmapSource bitmapSource =
       System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
             bmpPt,
             IntPtr.Zero,
             Int32Rect.Empty,
             BitmapSizeOptions.FromEmptyOptions());

      bitmapSource.Freeze();

      return bitmapSource;
    }

    private void btnPrint_Click(object sender, RoutedEventArgs e)
    {
      PrintDialog dlg = new PrintDialog();
      bool? result = dlg.ShowDialog();

      if (result.HasValue && result.Value) {
        pcImage.Measure(new System.Windows.Size(dlg.PrintableAreaWidth, dlg.PrintableAreaHeight));
        pcImage.Arrange(new Rect(new System.Windows.Point(0, 0), pcImage.DesiredSize));

        dlg.PrintVisual(pcImage, "Print a Large Image");
      }
    }
  }

This is just a image component... Well, any help would be appreciate. Thanks in advance. The printer have 203dpi, and it´s wpf. Label with the blurry code

Upvotes: 1

Views: 1033

Answers (1)

Patroni
Patroni

Reputation: 23

Well, i forgot about this... But if this could help someone... To print to argox 214-os or other seagull barcode printers you need some default layout like this file (.prn) for example: barcode.prn

n
M0500
O0220
V0
f220
D
L
D11
A2
1a52050007900551063
121100000280089Preco R$ 39,9
121100000490068REGM OGB T-M
Q0001
E

where the first seven lines

n
M0500
O0220
V0
f220
D
L
D11
A2

are always the same-

I'm using this layout

Barcode

(it´s an old printer, just for test, so i know it seems "blurry"...) and then the next lines you can see

this if for the barcode 1a5205000790055 + my code(1063)

this for label with the price 121100000280089 + my string with price (Preco R$ 39,9)

and so on...

And I´m printing like this

  Printer printer = new Printer(); (RawPrinter library)

  printer.PrintRawFile(dlg.PrintQueue.FullName, Directory.GetCurrentDirectory() + "\\code39.prn", false);

Oh, you could find RawPrint on nuget...Install-Package RawPrint -Version 0.2.0

Or forget all this and try BARTENDER DESIGNER just create your label design and export to prn file, but remember to use a printer font, if you use a windows font, will create a prn file with a lot of unwanted characters.

Upvotes: 1

Related Questions