Spludlow Web Header

Drawing & Printing with Spludlow


Draw & Print Section Contents

Drawing System Drawing System Description
Printing Printing
Fonts Fonts in the Spludlow Framework
PDF PDF files in the Spludlow Framework
Place Placing PDF and bitmap into Documents
CMYK CMYK Colours in PDF files
Bar Codes Bar Codes
Weird Systems Weird Systems Document examples

Battery Bar Code Labels example

Rechargeable batteries should be kept in sets and “conditioned” every 10 charges, also nice to know how many charge cycles they have had.

Creating a simple application will make this easy, first thing is to create some bar code labels for the batteries to each one can have an ID.

       /// <summary>

       /// Print 4 columns by 28 rows of 35mm x 10mm labels

       /// </summary>

       private static void BatteryBarCodeSheet(int firstId)

       {

              Spludlow.Printing.PrintDoc doc = new Spludlow.Printing.PrintDoc("A4");

 

              int id = firstId;

 

              for (int col = 0; col < 4; ++col)

              {

                     for (int row = 0; row < 28; ++row)

                     {

                           float x = 35 + (col * 35);

                           float y = (doc.Height / 2.0F - 140.0F) + (row * 10);

 

                           doc.Rectangle(x, y, 35, 10, 0.4F, Color.Gray, Color.Empty);

                           doc.BarCode(id.ToString(), "Code128C", x + 5, y, 25, 7.5F);

                           doc.Text(id.ToString(), "Arial, 5", x + 5, y + 7.5F);

 

                           ++id;

                     }

              }

 

              //     Red Lines to show existing labels on sheet

              doc.Line(0, doc.Height / 2, doc.Width, doc.Height / 2, 0.1F, Color.Red);

              doc.Line(doc.Width / 3, 0, doc.Width / 3, doc.Height, 0.1F, Color.Red);

              doc.Line(doc.Width / 3 * 2, 0, doc.Width / 3 * 2, doc.Height, 0.1F, Color.Red);

 

              // Print to dummy printer for viewing on Intranet Print Page

              // Can re-print to actual printer when it looks right

              Spludlow.Printing.Printer.Print(doc);

       }

Make it fit to whatever your label sheets look like by changing the maths.

Took longer to make the cuts with a knife and ruler that it did to write the code.

When happy with the layout using the Intranet Print page to view, it can be printed to a sheet.

The red lines didn’t quiet line up to the label sheets I had lying around so I tweaked the alignment with the Intranet config page by adding the following:

                <add key="Spludlow.PrintMargin.Canon L120.P" value="3, 4" />

 


 
 
 
 
 
 
 
 
 
Spludlow Web Footer