Tue Dec 15, 2015 10:07 am
I'm not sure sending you the entire application will help but here is the code we are using to generate a barcode image for printing/print previewing which is where the problem is:
Spire.Barcode.BarcodeSettings bcs = new Spire.Barcode.BarcodeSettings();
transactionItem = 0;
while ((yPos < e.MarginBounds.Height) && (transactionItem < STs.Count))
{
xPos = e.MarginBounds.Left;
// Reel number, attributes, then the barcode between the dates specified and highlight any ERP outages.
Spire.Barcode.BarCodeGenerator bcg = new Spire.Barcode.BarCodeGenerator(bcs);
switch (STs[transactionItem].Type)
{
case StockTransaction.StockTransactionTypeCode.ConsumeReel:
case StockTransaction.StockTransactionTypeCode.ConsumeDuplicateReel:
try
{
bcs.Data = STs[transactionItem].ReelNumber;
bci = bcg.GenerateImage();
e.Graphics.DrawImage(bci, xPos, yPos);
yPos += bci.Height + 10;
xPos = e.MarginBounds.Left + bci.Width + 20;
}
catch
{
// Output a dummy barcode with manual text!
e.Graphics.DrawString("Unable to print this barcode", printFont, printBrush, xPos, yPos);
yPos += (int)e.Graphics.MeasureString($"Unable to print this barcode for primary production order {STs[transactionItem].PrimaryWorksOrderNumber}", printFont).Height;
}
break;