Centering PDF_417 Barcodes and Unstable Width/Height
Closed this issue · 1 comments
sjdean commented
We're using a page width of 385, and using a barcode width of 345 and offset of 20, doesn't quite center the barcode.
It seems that the encoding options Width and Height is the canvas size as opposed to the rendered barcode size. This therefore leads to even stranger things, where if we remove the Height, the barcode shows as half width (around 150px), but the resultant bitmap is full size at 345.
Is there a way to either:
Get the rendered size of the barcode as opposed to the canvas size?
Get the renderer to center the barcode in the canvas?
Get the renderer to obey the width options?
Output a cropped barcode canvas if it cannot utilise the full space?
var barcode = new BarcodeWriter
{
Format = BarcodeFormat.PDF_417,
Options = new EncodingOptions {Width = 345, Height = 166}
};
var data = "some-random-guid";
var barcodeBitmap = barcode.Write(data);
sjdean commented
Adding NoPadding = true to the encoding options resolves