Free Support Forum - aspose.com

Aspose Barcode image generation help

Good afternoon,

I have purchase Aspose.Total and am trying to use the Aspose.Barcode package to generate a Code39 barcode. My label size is 3" x 2" for a thermolabel printer capable of printing at 300DPI. I am trying to maximize the font size for the top and bottom captions while fitting in the constraints of the label. I am unsure on how to manipulate the parameters to achieve this. It seems when I exceed a certain font size (to run past the label size), it gets pushed down to the next line instead of writing beyond the barcode. Is there a solution for this? My generation code:

        //Set Aspose License
        Aspose.BarCode.License license = new Aspose.BarCode.License();
        license.SetLicense("Aspose.Total.lic");

        //license.SetLicense("c:\\download\\Aspose.Total.lic");

        //Split up the property tag code from the shelf code
        //string[] splitbarcode = dtBarCodebyShelf.Rows[i]["barcode"].ToString().Trim().Split(',');
        //Array.Resize(ref splitbarcode, splitbarcode.Length + 1);
        BarcodeGenerator ptagbarcodegenerator = new BarcodeGenerator(EncodeTypes.Code39Standard, splitbarcode[0]);

        ptagbarcodegenerator.Parameters.Resolution = 300;

        // Set barcode height
        ptagbarcodegenerator.Parameters.Barcode.BarHeight.Millimeters = 8.0f;

        //Barcode density
        //For Zebra DS8178 Scanner
        //xDimension upper range: 9.85 mil = 0.00985 inch
        //xDimension lower range: 3 mil = 0.003 inch
        ptagbarcodegenerator.Parameters.Barcode.XDimension.Inches = 0.008f;

        //Set Top Label visibility and text/text options
        ptagbarcodegenerator.Parameters.CaptionAbove.Visible = true;

        //Set Above Caption Text
        ptagbarcodegenerator.Parameters.CaptionAbove.Text = "XXXX XX XXXXXXX XXXXXXX";

        //Set Above Caption Font Size. 6 will fit, 10 causes the caption to wrap underneath
        ptagbarcodegenerator.Parameters.CaptionAbove.Font.Size.Point = 10;

        //Set above caption alignment
        ptagbarcodegenerator.Parameters.CaptionAbove.Alignment = TextAlignment.Center;

        //Set above caption Font
        ptagbarcodegenerator.Parameters.CaptionAbove.Font.FamilyName = "Arial";

        //Turn off encoded code text
        ptagbarcodegenerator.Parameters.Barcode.CodeTextParameters.Location = CodeLocation.None;

        //Turn on bottom label visibility
        ptagbarcodegenerator.Parameters.CaptionBelow.Visible = true;

        //Set bottom label text
        ptagbarcodegenerator.Parameters.CaptionBelow.Text = "Property Tag #: " + splitbarcode[0] + Environment.NewLine + "Shelf #: " + splitbarcode[1];

        //Set bottom label text alignment
        ptagbarcodegenerator.Parameters.CaptionBelow.Alignment = TextAlignment.Center;

        //Set bottom label text font
        ptagbarcodegenerator.Parameters.CaptionBelow.Font.FamilyName = "Arial";

        //Set bottom label font size. 6 will fit, 10 causes the caption to wrap underneath
        ptagbarcodegenerator.Parameters.CaptionBelow.Font.Size.Point = 10;

        ptagbarcodegenerator.Save("c:\\download\\barcode_" + splitbarcode[0] + ".png", BarCodeImageFormat.Png);

If you want to write exceed text (captions) in nowrap mode, currently there is not property for this and text in codetext field and both captions wraps to next line.

But if you want addition of this property i can discuss this on our technical meeting and inform you about results.

So there is no workaround or property for what I ask?

I think this would be a good addition in a future release of Aspose.Barcode.

@taltal045,
We are afraid that no workaround is available and also there is no plan yet to implement it.