Menu

PDF417 .NET Control C# Tutorial


How to use our PDF417 .NET control from Microsoft C#.

 


1. Install our PDF417 .NET Control and start Microsoft Visual Studio. Create a new project after that.

Start Microsoft Visual Studio and create a new project.



2. Register PDF417 .NET Control in your application. Open Toolbox for that.

Register PDF417 .NET Control in your application.



3. Right-click to open the context menu and select Customize Toolbox.

Customize Toolbox



4. Switch to the .NET Framework Components tab and click the Browse button. Then select the file Barcodes.PDF417.dll.

select the file Barcodes.PDF417.dll



5. Now the PDF417 .NET Control is present on the Windows Forms tab. You can put it on the form.

Put PDF417 .NET Control to form



6. Adjust the properties of the PDF417 .NET Control.

Adjust the PDF417 .NET properties



7. Place the code for using the control.

The following code saves the PDF417 image to an image file. The PDF417 barcode will have x-dimension equal to 2 pixels.
double w, h;
pdF417Control1.GetPDF417Size( 2, 1, 1, Barcodes.PDF417.Dimensions.dmPixels,
    Barcodes.PDF417.Dimensions.dmPixels, out w, out h );
pdF417Control1.SaveToImageFile( w, h, "c:\\PDF417.bmp", 96,
    Barcodes.PDF417.Dimensions.dmPixels );
Copies the PDF417 bar code image to the clipboard.
pdF417Control1.CopyToClipboard( 400, 200 );
The PDF417 barcode can be displayed in any Graphics object or Device Context (HDC).
Graphics gr = this.CreateGraphics();
pdF417Control1.DrawPDF417ToSize( 0, 0, 400, 200,
    Barcodes.PDF417.Dimensions.dmPixels, gr );
This code allows you to print the PDF417 barcode on the printer.
private void button4_Click(object sender, System.EventArgs e)
{
				try
  {
    PrintDocument pd = new PrintDocument();
    pd.PrintPage += new PrintPageEventHandler( this.OnPrintBarcodePage );
    pd.Print();
  }  
				catch( Exception ex ) 
  {
    MessageBox.Show( ex.Message );
  }
}
// The OnPrintBarcodePage event is raised for each page to be printed.
private void OnPrintBarcodePage(object sender, PrintPageEventArgs ev) 
{
				double wMM, hMM;
  pdF417Control1.GetPDF417Size( 0.5, (int)ev.Graphics.DpiX, (int)ev.Graphics.DpiY,
    Barcodes.PDF417.Dimensions.dmMM,
    Barcodes.PDF417.Dimensions.dmMM,
				out wMM, out hMM );
				// print a PDF417 barcode
  pdF417Control1.DrawPDF417ToSize(10, 10, wMM, hMM, 
    Barcodes.PDF417.Dimensions.dmMM, ev.Graphics );
}
		

The installation package contains the entire example of how to use our PDF417 .NET Control. The example is written in MS C#.