Sign UpSign Up   Sign InSign In Welcome Guest,
Live Chat Live Chat

Barcode image with exact width and height

Last post 07-05-2009, 7:22 PM by saqib.razzaq. 1 replies.
Sort Posts: Previous Next
  •  07-02-2009, 6:05 AM 186577

    Barcode image with exact width and height .NET

    I was trying to create barcodes  (incluing the codetext lables) with a fixed  width and height.

    I required the barcode image size

    height 2.4 cms

    width 6.9 cms

    Dim bb As Aspose.BarCode.BarCodeBuilder

    bb = New Aspose.BarCode.BarCodeBuilder

    bb.BorderVisible = True

    bb.ImageUnit = System.Drawing.GraphicsUnit.Millimeter

    bb.ImageWidth = 69.0F

    bb.ImageHeight = 24.0F

    bb.SymbologyType = Aspose.BarCode.Symbology.Code128

    bb.Resolution = New Resolution(400.0F, 400.0F, ResolutionMode.Customized)

    bb.ImageQuality = ImageQualityMode.AntiAlias

    bb.CodeText = strAssetTag

    bb.CaptionBelow.Visible = True

    bb.CaptionAbove.Visible = True

    Dim captionCa As Caption = New Caption()

    captionCa.Text = strEqpModel

    captionCa.TextAlign = System.Drawing.StringAlignment.Center

    captionCa.Visible = True

    bb.CaptionAbove = captionCa

    'bb.print()

    Dim ms As System.IO.MemoryStream

    ms = New System.IO.MemoryStream

    bb.BarCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp)

    ''saving as a image to memory stream - then adding to a dataset and later binding to a crystalreport/viewer

    'even while printing sizes are different.

    ' I expect the image size 6.9 cms width and 2.4 cms height.. but is actually 6.5 cms and 2.2 cms

     

     
  •  07-05-2009, 7:22 PM 186938 in reply to 186577

    Re: Barcode image with exact width and height .NET

    Hi,

    Thanks for considering Aspose.

    You need to set BarCodeBuilder.AutoSize property to false to have customized image size. Please add the following lines to your code and you will get the image according to your desired size.

    bb.AutoSize = False

    bb.BarHeight = 10.0F


    Best Regards,
    Saqib Razzaq
    Support Developer, Aspose Sialkot Team
    http://www.aspose.com
    Your File Format Experts
     
View as RSS news feed in XML