Saving a barcode image

Barcode images should NOT be saved by attempting to save the image directly from a PictureBox. This will result in the image being saved with screen resolution – which is rarely suitable for barcodes.

To save an image for subsequent printing the developer should use sBarcode(hDpi,vDpi,filename) – in which case hDpi and vDpi are the target horizontal and vertical resolutions of the target printer and filename is the full pathname of the file to be created.

For example, to save an image for printing on a 600 dpi printer:

 

    Private Sub saveBarcode(string graphicfilename)
        Dim filename As String = “C:\fread.png”
        Dim I,hres,vres As Integer
        Abcnet1.Caption = Data.Text
        hres = 600
        vres = 600
        Abcnet1.sBarcode(i, i).Save(filename)

    End Sub

Note that when printing images saved in this way the printer’s PageUnit should be set to GraphicsUnit.Pixel, or the image size scaled appropriately.

 

More:

Licensing the component