We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Barcode not printing

Thread ID:

Created:

Updated:

Platform:

Replies:

124890 Jul 6,2016 10:01 AM Jul 8,2016 01:19 AM Windows Forms 3
loading
Tags: SfBarcode
Cernat Catalin
Asked On July 6, 2016 10:01 AM

Hello!

I have this code:

Private Sub BuildCode()
    Dim barcode As String = TextBox1.Text + "%" + TextBox2.Text + "&" + TextBox6.Text + "*"
    'TextBox3.Text = barcode
    SfBarcode1.Text = barcode
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    BMP = New Bitmap(GroupBox1.Width, GroupBox1.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
    'BMP.SetResolution(300, 300)
    GroupBox1.DrawToBitmap(BMP, New Rectangle(0, 0, GroupBox1.Width, GroupBox1.Height))
    Dim pd As New PrintDocument
    Dim pdialog As New PrintDialog
    AddHandler pd.PrintPage, (Sub(s, args)
                                  args.Graphics.DrawImage(BMP, 0, 0)
                                  args.HasMorePages = False
                              End Sub)
    pdialog.ShowDialog()
    pd.PrinterSettings.PrinterName = pdialog.PrinterSettings.PrinterName
    pd.Print()
End Sub

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
    BuildCode()
End Sub

When I assing value to syncfusion barcode control, it builds fine, it shows the barcode on form, but when I print instead of barcode is nothing. If i assign the value to a textbox control with a Code128 font it prints just fine. 

What could it be?


Chinnu Muniyappan [Syncfusion]
Replied On July 7, 2016 08:24 AM

Hi Cernat, 

Thank you for contacting Syncfusion support. 

We have created a workaround sample for exporting the barcode as image and inserting the image to the group box and print the group box control for your reference, please refer the below code snippet and sample for more details. 

       'initialize the barcode control 
        Dim barcode As SfBarcode = New SfBarcode() 
 
        'set the barcode symbology type 
        barcode.Symbology = BarcodeSymbolType.Code128A 
 
        'set the input text 
        barcode.Text = TextBox1.Text 
        
        'export the barcode control as image 
        PictureBox1.Image = barcode.ToImage(PictureBox1.Size) 
 
Sample link: 

Could you please try this and let us know whether this meet your actual requirement. 

Regards, 
Chinnu 


Cernat Catalin
Replied On July 7, 2016 08:44 AM

Thanks alot for your kind reply, but ToImage is not a member of SfBarcode, the compiler says.

What could be wrong?

Chinnu Muniyappan [Syncfusion]
Replied On July 8, 2016 01:19 AM

Hi Cernat, 

Thank you for your update. 

The barcode to image conversion support is available in our latest versions (14.2.0.26) only, could you please update to our latest versions and get this support. 
   

Regards, 
Chinnu

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;