HALLOGRAM PUBLISHING
SHOPPING CARTSITE MAPCONTACT USPRODUCTS
HOMEBARCODESDEVELOPER TOOLSUSER TOOLSTRAINING
PDF417 Fonts and Encoder

.NET DLL and Forms Control

The .NET DLL and Forms Control is included in the directory named "Dotnet DLL and Forms Control" in the ZIP file. It contains a simple project that performs the steps 1 and 2 below. It can also be used as a graphics object as described below.

An example using the Encoder to obtain the data that when printed with our PDF417 Font, will create a correct barcode:

    Step1: In your project, add a reference to the DLL and place the import statement in the declarations section of your project. For example:
    Imports IDAutomation.Windows.Forms.PDF417Barcode

    Step2: The following code will obtain the data to encode and place it in the TextBox. This data, when printed with our PDF417 Font, will create a correct barcode:
    Dim NewBarcodeAs PDF417Barcode = New PDF417Barcode()
    TextBox2.Text = NewBarcode.FontEncoder(TextBox1.Text, 0, 0, 0, False, PDF417Barcode.PDF417Modes.Text, True)

Printing from the control without using the font:

  • NOTE: If you are printing with the Picture method, be sure to call RefreshPrinterDPI() if you switch printers in your application. It is recommended that you call RefreshPrinterDPI() before each print job. We do not recommend calling RefreshPrinterDPI() every time the barcode itself is printed though, because it takes about .5 seconds to execute.
  • Before can use PrintDocument, you need to import System.Drawing and System.Drawing.Printing.
  • This is a simple example of how we can print the barcode using VB.NET:
    Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrint.Click
        Dim prndoc As PrintDocument = New PrintDocument()
        prndoc.DocumentName = "Printing a Barcode"
        AddHandler prndoc.PrintPage, New System.Drawing.Printing.PrintPageEventHandler(AddressOf PrintDocumentOnPrintPage)
        prndoc.Print()
    End Sub
    Private Sub PrintDocumentOnPrintPage(ByVal sender As Object, ByVal ppea As PrintPageEventArgs)
        Dim grfx As System.Drawing.Graphics = ppea.Graphics
        Dim myImage As System.Drawing.Imaging.Metafile
        grfx.PageUnit = GraphicsUnit.Millimeter
        grfx.PageScale = 1.0F
        grfx.DrawString(Me.Text, Me.Font, Brushes.Black, 0, 0)
        IDAutomation.Windows.Forms.PDF417Barcode.RefreshPrinterDPI()  'Normally you should only call RefreshPrinterDPI for each print job.
        myImage = IDAutomation.Windows.Forms.PDF417Barcode.Picture
        grfx.DrawImage(myImage, 0, 20)
    End Sub
  • This is a simple example of how we can send the barcode metafile to a PictureBox in VB .NET:
    Private Sub cmdDisplayMetafile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDisplayMetafile.Click
        Dim myImage As System.Drawing.Imaging.Metafile
        myImage = IDAutomation.Windows.Forms.PDF417Barcode.Picture
        PictureBox1.Refresh()
        Dim grfx As System.Drawing.Graphics = PictureBox1.CreateGraphics()
        grfx.DrawImage(myImage, 0, 0)
        grfx.Dispose()
        myImage = Nothing
        grfx = Nothing
    End Sub
  • This is a simple example of how we can print the barcode using C#.NET:
    private void cmdPrint_Click(object sender, System.EventArgs e)
    {
        PrintDocument prndoc = new PrintDocument();
        prndoc.DocumentName = "Printing a Barcode";
        prndoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintDocumentOnPrintPage );
        prndoc.Print();
    }
    private void PrintDocumentOnPrintPage(object sender, PrintPageEventArgs ppea )
    {
        Graphics grfx = ppea.Graphics;
        System.Drawing.Imaging.Metafile myImage;
        grfx.DrawString(this.Text, this.Font, Brushes.Black, 0, 0);
        IDAutomation.Windows.Forms.PDF417Barcode.RefreshPrinterDPI()  //Normally you should only call RefreshPrinterDPI for each print job.
        myImage = IDAutomation.Windows.Forms.PDF417Barcode.Picture;
        grfx.DrawImage(myImage, 0, 40);
        return;
    }

Dynamically placing the control on a form:

  • This is how the barcode can be created on the form with code. The code in the printing example above may be used to print the image instead of sending it to a picturebox.

    Dim NewBarcode As IDAutomation.Windows.Forms.LinearBarCode.Barcode = New Barcode()
    NewBarcode.Size = New System.Drawing.Size(148, 64)
    NewBarcode.Location = New System.Drawing.Point(176, 7)
    NewBarcode.Name = "NewBarcode"
    Me.Controls.AddRange(New System.Windows.Forms.Control() {NewBarcode})
    NewBarcode.DataToEncode = "999928829"
    NewBarcode.RefreshImage()
    PictureBox1.Image = NewBarcode.Picture

Using the DLL to create a barcode image without installing it on a form:

  • If you wish to only create an instance of the barcode object, the RefreshImage() method must be called to update the image before printing. The code in the printing example above may be used to print the image instead of sending it to a picturebox.
  • Dim NewBarcode As IDAutomation.Windows.Forms.LinearBarCode.Barcode = New Barcode()
    NewBarcode.DataToEncode = "999928829"
    NewBarcode.RefreshImage()
    PictureBox1.Image = NewBarcode.Picture

Creating JPEG, TIFF, BMP, PNG or other graphic files:

  • Since our control uses the .NET framework to perform image conversion, you may create a barcode image in any format that .NET supports in System.Drawing.Imaging.ImageFormat. Remember to set the DPI when creating images as in the example below. If you are creating barcodes for the web browser, you should use 96 DPI.
  • IDAutomation.Windows.Forms.PDF417Barcode.Resolution = Barcode.Resolutions.Custom
    IDAutomation.Windows.Forms.PDF417Barcode.ResolutionCustomDPI = 300
    IDAutomation.Windows.Forms.PDF417Barcode.XDimensionCM = 0.03
    IDAutomation.Windows.Forms.PDF417Barcode.RefreshImage()
    IDAutomation.Windows.Forms.PDF417Barcode.SaveImageAs("SavedBarcode300DPI.Jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)
    IDAutomation.Windows.Forms.PDF417Barcode.Resolution = Barcode.Resolutions.Printer

Copying barcodes to the clipboard:

  • Use the BMPPicture property to obtain an image that can be sent to the clipboard. You may also use the Picture method, however, it will only paste from the clipboard accurately into applications when using the 1.1 version of the .NET Framework.
  • Dim datobj As New System.Windows.Forms.DataObject()
    Dim MyBitmap As New System.Drawing.Bitmap(DataMatrix1.BMPPicture)
    datobj.SetData(System.Windows.Forms.DataFormats.Bitmap, MyBitmap)
    System.Windows.Forms.Clipboard.SetDataObject(datobj)
    MyBitmap = Nothing
    datobj = Nothing


Return to the PDF417 Fonts and Encoder Main Page
PDF417 Fonts and Encoder Specs
PDF417 Java class library
Licensing Agreement

Price List & Order Form


Home || Shopping Cart || Site Map || Newsletter/Blog
Search HALLoGRAM || Request More Information
CALL TOLL FREE 1-866-340-3404

SEARCH
14,500+ PRODUCTS:

Order PDF417 Fonts and Encoder

SIMILAR PRODUCTS
  • Barcode Software
  • Codabar Fonts
  • Code 39 Barcode Font Adv Pkg
  • EZ Fonts Pkg for Win
  • Complete Barcode Font Pkg
  • TrueType Barcode Font Pkg
  • Data Matrix Font and Encoder

  • COMPLEMENTARY
  • Barcode Scanners
  • Barcode Terminals
  • Barcode Printers
  • Barcode Verifiers

  • PRODUCTS FOR
  • MS-Access
  • C/C++
  • dBASE
  • Delphi
  • FoxPro/VFP
  • Java
  • Oracle
  • Paradox
  • PowerBuilder
  • Visual Basic
  • Visual Objects

     

    Books About Bar Coding:

  • Understanding Bar Code
  • The Bar Code Book
  • Behind Bars

  • Developer Training Videos

  • Copyright ©2003 HALLoGRAM Publishing, Aurora CO. All Rights Reserved
    All products mentioned in this site are trademarks of their respective owners
    Prices are subject to change without notice
    dmcakegrim