c1BarCode and c1PrintDocument not playing like they used to

Posted by: glenn on 8 January 2018, 12:11 am EST

    • Post Options:
    • Link

    Posted 8 January 2018, 12:11 am EST

    The code below I have used in the past with earlier versions of c1Barcode.

    With the latest version bc.x, bc.y work just fine but bc.Height, bc.Width can be changed and nothing happens. I get this tiny little unreadable barcode.

    Code Below:

    Dim bc As New RenderImage

    Dim doc as C1PrintDocument

    bc.X = 0.2

    bc.Y = 3.2

    bc.Height = “0.5in”

    bc.Width = “1.75in”

    bc.Image = c1Barcode.Image

    doc.Body.Children.Add(bc)

  • Posted 9 January 2018, 1:22 am EST

    Hello Glenn,

    Please refer the attached sample making use of the code snippet that you have shared, showing the barcode image size varying wrt the assigned value for Height and Width.

    For Height=4in and Width=5in, see the size of the barcode image increasing with the latest build, as shown in the attached video.

    Kindly modify the sample as per your requirement and if the issue persists, share a screenshot/small video showing the issue along with the modified sample.

    Best Regards,

    Esha

    C1PrintDoc Test.zip

  • Posted 10 January 2018, 4:35 pm EST

    Ok I was able to alter my code on my Label using your example, thank you.

    Working with my second label I am using a Vertical bar code and I’ve tried a number of things to try to fix it but no luck.

    The code below is the code you sent me with a few modifications My end goal is to have the vertical bar code be about .25" tall and have it extend 1.8" (vertically) on the 2x4" label.

    The vertical is what I am interested in the horizontal is for reference.

    Imports C1.C1Preview

    Imports C1.C1Report

    Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Dim text As New RenderText(“C1PrintDocument Test”)

    text.Style.TextAlignHorz = AlignHorzEnum.Left

    text.Style.FontSize = 12

    text.Style.FontBold = True

    C1PrintDocument1.Body.Children.Add(text)

        'Label Size
        With C1PrintDocument1.PageLayout.PageSettings
            .TopMargin = 0.1
            .BottomMargin = 0.1
            .LeftMargin = 0.1
            .RightMargin = 0.1
            .PaperKind = Drawing.Printing.PaperKind.Custom
            .Height = 4
            .Width = 2
            .Landscape = True
        End With
    
        'Vertical Label *************************************************************************************
    
        Dim c As New C1.Win.BarCode.C1BarCode
    
        c.CodeType = C1.BarCode.CodeType.Ansi39x
        c.Text = 9999999
        c.BarDirection = C1.BarCode.BarCodeDirection.BottomToTop 'changed ***********************************
    
        Dim bc As New RenderImage
        bc.X = 3.6
        bc.Y = 0.1
        bc.Width = ".25in"
        bc.Height = "1.8in"
        bc.Image = c.Image
        C1PrintDocument1.Body.Children.Add(bc)
    
        'Horizontal Label *************************************************************************************
    
        Dim c2 As New C1.Win.BarCode.C1BarCode
    
        c2.CodeType = C1.BarCode.CodeType.Ansi39x
        c2.Text = 9999999
    
        Dim bc2 As New RenderImage
        bc2.X = 0.1
        bc2.Y = 1
        bc2.Width = "1.8in"
        bc2.Height = ".25in"
    
        bc2.Image = c2.Image
        C1PrintDocument1.Body.Children.Add(bc2)
    
        'Dim barcode As New RenderBarCode(BarCodeEnum.Ansi39)
        'barcode.X = 1.5
        'barcode.Y = 2.5
        'barcode.Height = "0.5in"
        'barcode.Width = "1.75in"
        'C1PrintDocument1.Body.Children.Add(barcode)
        C1PrintPreviewControl1.Document = C1PrintDocument1
    End Sub
    

    End Class

  • Posted 11 January 2018, 2:50 am EST

    Hello Glenn,

    If you read the description of the Height and Width properties of RenderImage, you would see that they take “absolute” values for the measures. Thus, entering the values in points is not possible. Please refer the documentation link showing the same:

    http://help.grapecity.com/componentone/NetHelp/c1report/webframe.html#C1.C1Report.4~C1.C1Preview.RenderImage_members.html

    You may want to set them to the nearest absolute values in order to obtain the barcode somewhat close to the desired size.

    Best Regards,

    Esha

  • Posted 15 August 2022, 5:25 pm EST - Updated 3 October 2022, 10:17 pm EST

    Hello Esha

    Is it possible that when the image from C1BarCode is displayed in C1PrintDocument it will be sharp ie. in the same way as it is displayed in the C1BarCode component itself (like in the sample …\ComponentOne Samples\WinForms\v4.8\C1.Win.Barcode\CS).

    Here is the image in C1PrintDocument also with zoom

    Here is the image in the C1BarCode also with zoom

  • Posted 16 August 2022, 3:20 am EST - Updated 3 October 2022, 10:17 pm EST

    Hi,

    You can render high quality Barcodes on C1PrintDocument through RenderBarCode instead of RenderImage. (see code snippet)

    
            Dim barcode As New RenderBarCode(BarCodeEnum.Ansi39)
            barcode.X = 1.5
            barcode.Y = 2.5
            barcode.ShowText = True
            barcode.Text = "12324562662"
            barcode.Height = 1
            C1PrintDocument1.Body.Children.Add(barcode)
    
    

    Refer image of Barcode on PrintDocument:

    Please refer the attached sample for the same: C1PrintDocument_C1Barcode.zip

    Best Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels