2015-10-13

Unraveling a zebra

I don't have a good image to put with that title, so this will have to do :-)

As you know, I am working on a new printer for printing  SIM cards, i.e plastic cards (on a Matica printer) as the old printer (Zebra) is not really up to the job.

The problem is one that software engineers have from time to time, and it is very much the "1, 2, many" counting problem.

In software, coding for one thing is easy, coding for 2 is a lot more work and coding for many is what you should be doing.

I have a zebra-print.c file. It is great. It prints on the Zebra printer, but its functionality has got overloaded and tied in to the Zebra printing function.

It does two main things. (1) is compile a number of separate files that provide colour, black, UV, and inhibit "layers" of print for two sides of a card and make a single print job to the zebra. (2) is actually print the card.

Having coded all of that I realised I needed a way to show what a card would look like. So I made the last step create a BMP image to include on web pages. This is used on our main web site, SIM ordering page, internal staff management pages for printing SIMs, router programming cards, my ID card printing site, and so on. It was a minor change to add this as the main code had to create the various layers for the Zebra - making a BMP, even scaled down, was a simple final step.

Now, I have a new printer. I could take the zebra-print.c and rework to drive the new printer, but that means copying code, which is never good.

So what I plan to do is make separate tools - one that compiles images and postscript to make card images, i.e. the BMPs to display a card in 1/4 and 1/2 scales for web sites, but also makes a raw image format for printing. Then a separate tool to print on the Matica from that raw image. The idea is I can easily (if I can be bothered) make one to take a raw image for the Zebra.

Just to add to the fun, whilst a plastic card is 3⅜" x 2⅛" so 1012½ by 637½ pixels, the Zebra over prints to 1024 x 640, and the Matica over prints to 1036 x 664.

So the plan is for the new tool to centre whatever it is given and hence handle 1024x640 source data if necessary.

Update: CardArt code and Matica printer driver code all working nicely, and our systems all changed over. Yay! I am not sure I want to re-live the nightmare that is BMP files ever again.

1 comment:

Comments are moderated purely to filter out obvious spam, but it means they may not show immediately.

Fencing

Bit of fun... We usually put up some Christmas lights on the house - some fairy lights on the metal fencing at the front, but a pain as mean...