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

Aspose BarCode: Dynamically generate image content

Last post 06-23-2009, 10:13 PM by chrisherring. 1 replies.
Sort Posts: Previous Next
  •  06-23-2009, 9:35 PM 185199

    Aspose BarCode: Dynamically generate image content .NET

    I just purchased the Aspose BarCode library for dotnet. For my application, it is not really feasible to imbed the webControl in an aspx page. I would like to set up a web app that dynamically generates bar code content for static html pages. Let's say I have an existing application which writes out the following HTML:

    <div class="Barcode"><img src="MyBarCode.aspx?code=1234"/></div>

    Can you please advise how I could create MyBarCode.aspx so that it outputs the image data for  the img tag?

    Thanks

    This message was posted using Page2Forum from Save Barcode Image to Streams [ .NET ] - Aspose.BarCode for .NET and Java
     
  •  06-23-2009, 10:13 PM 185201 in reply to 185199

    Re: Aspose BarCode: Dynamically generate image content

    I did some reading and came up with this: it works alright.

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here
            Dim lic As New Aspose.BarCode.License
            lic.SetLicense(CsiCom.ConfigSettings.licenseFilePath + "Aspose.BarCode.lic")

            Response.Clear()
            If Request.QueryString("code") <> "" Then
                Dim bb As New Aspose.BarCode.BarCodeBuilder
                bb.CodeText = Request.QueryString("code")
                bb.ImageWidth = 255
                bb.ImageHeight = 50
                bb.BarHeight = 40
                bb.CaptionBelow.Visible = True
                bb.GraphicsUnit = GraphicsUnit.Pixel
                bb.SymbologyType = Aspose.BarCode.Symbology.Code39Standard

                Response.ContentType = "image/jpeg"
                bb.BarCodeImage.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
            End If
            Response.End()
          
        End Sub
     
View as RSS news feed in XML