uB-04 Form SDK
Print Data onto UB-04 Forms
I don’t have to deal with PDF documents anymore. That’s save us a heap of time.
Quickly create and send UB-04 form data to your printers. Purchase a license here.
Main Features
- Just initialize simple fields and call Print()
- Ability to set X and Y offset positions to handle different printer settings
- Ability to modify field height, width, alignment, position and data before data is sent to the printer
- Add Date, Phone, Price and Text form fields
- Create your own custom fields
- Ability to print to named printers
- Integrates with .Net PrintDialog, PageSetupDialog, PrintPreviewDialog
- Removes the need to have any PDF components
Print Form Data
To print data on a UB-04 form first initialize the form fields using the UB04FormData class then print them using theUB04Form class
Initialize Form Fields
Next print it using the UB04Form class.
Printing Fields
Note that the printing offsets may need to be slightly adjusted in the sample below. See the Setting Printing Offsets topic in the help files to adjust your printer offsets correctly.
Creating a Custom Form Field
By default, the following fields are available; TextField, PriceField, PhoneField and UB04Date. Custom fields can be created easily. Just derive from the FormField class and override the GetText() method.
The Code
public class MyCustomField : FormField
{
public MyCustomField(string name)
: base(name)
{
}
public MyCustomField(string name, decimal? data, double x, double y, double width, double height)
: base(name, x, y, width, height)
{
Data = data;
}
public decimal? Data
{
get;
set;
}
public override string GetText()
{
if (Data != null && Data.HasValue)
{
return Data.Value.ToString("F2");
}
return null;
}
}
Dynamically modify data before Printing
Form fields can be modified before being sent to the printer. Field coordinates, width, heights and alignment ( vertical and horizontal ) are modifiable.
The Code
ubForm.BeforePrint += ubForm_BeforePrint;
private void ubForm_BeforePrint(object sender, FormEventArgs e)
{ //e.Cells has all fields that will be send to printer.
//The field properties can be modified
e.Cells[0].X = 12;
e.Cells[0].Y = 13;
e.Cells[1].Width = 3;
e.Cells[1].Height = 0.5;
}
UB04Form comes FREE with a license of RDPCrystal EDI Library. However it can be purchased separately in our online store.