views:

444

answers:

1

Hi all,

I hope somebody can help. TextRenderingHint.SingleBitPerPixel is apparently not turning off antialiasing when printing a barcode from .net.

Here's a snippet of the code that actually renders the barcode:

    graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;

    graphics.DrawString(
        barCodeText,
        humanReadableFont,
        Brushes.Black,
        currentXPosition,
        currentYPosition,
        StringFormat.GenericTypographic);

To allow close examination of the output during debugging I'm printing to a .tiff format file through the "Microsoft Office Document Image Writer" printer. When zoomed in on the .tiff the antialiasing is clearly visible as a gray halo around the black barcode bars.

Similarly, when printing to the actual printer (BOCA ticket printer in HP Laser Jet emulation mode) the barcode bleeds/appears bolder than expected.

I know the barcode is syntactically correct because at larger point sizes it scans OK. I also know the printer is capable of printing legible barcodes at least as small as what I'm requesting because in it's native 'FGL' mode it prints legible barcodes even smaller than mine.

The fonts I'm using are "Code 128AB" and "Code 128AB HR" by Elfring Fonts Inc.

thanks

Joachim

A: 

OK, it ended up there were two problems going on here:

1) The manufacturer of the barcode font didn't design the font to be printed as small as I was trying to print. I'm no font expert, so I take their word for that. But I'm not completely convinced as the printer I was printing to could accurately print barcodes smaller than this using it's 'demo' mode.

2) The 'halo' effect I was seeing was actually Windows' "Picture and Fax Viewer" trying to make things pretty for me. When I tried different software the bars were crisp and clear.

Joachim Chapman