Same code is not working in different application

hello all…
I am using the code provided by Aspose and its working fine in independent web application…
but when i am implementing the same code in my existing web application then its not working as per need.
I am using printer of “Zebra” company…the same code in independent application prints the correct barcode but when i am using that in my other existing application then the alignment of printing is also changed and it leaves one or two lable blanks after each printed barcode…

The code i am using is listed below…
The file used in this code contains some nos…of which i need to generate barcode…Ex.(108,109)
Imports Aspose.BarCode
Imports System.Collections
Imports System.Drawing.Printing
Imports System.Drawing.Imaging
Imports System.IO
Imports System.IO.StreamReader
Partial Class Barcode
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim objStreamReader As StreamReader
Dim str As String = “”

Dim document1 As New PrintDocument
AddHandler document1.PrintPage, New PrintPageEventHandler(AddressOf Me.printDoc_PrintPage)
Try
If File.Exists(“E:\temp.doc”) Then
objStreamReader = New StreamReader(“E:\temp.doc”)
While Not objStreamReader.EndOfStream

str = objStreamReader.ReadLine()
str = “0000000” + str
str = Right(str, 8)
Me.SetDefaultBarCode(str)

document1.Print()

End While

objStreamReader.Close()
File.Delete(“E:\temp.doc”)
End If

Catch exception1 As InvalidPrinterException
'MsgBox(“Invalid printer or printer not found!”, MsgBoxStyle.OkOnly)
End Try

End Sub

Private Sub SetDefaultBarCode(ByVal strBarcode As String)
Me.BarCodeWebControl1.CaptionAbove.Visible = False
Me.BarCodeWebControl1.CaptionBelow.Visible = False
Me.BarCodeWebControl1.BorderVisible = False

Me.BarCodeWebControl1.CodeText = strBarcode
Me.BarCodeWebControl1.SymbologyType = Aspose.BarCode.Symbology.Code128
Me.BarCodeWebControl1.GraphicsUnit = Drawing.GraphicsUnit.Millimeter

Me.BarCodeWebControl1.xDimension = 0.2
Me.BarCodeWebControl1.yDimension = 2
Me.BarCodeWebControl1.BarHeight = 6

Dim font1 As New Drawing.Font(Drawing.FontFamily.GenericSerif, 8.0!)

Me.BarCodeWebControl1.CodeTextFont = font1
Me.BarCodeWebControl1.BackColor = Drawing.Color.White
Me.BarCodeWebControl1.ForeColor = Drawing.Color.Black
Me.BarCodeWebControl1.CodeColor = Drawing.Color.Black
Me.BarCodeWebControl1.BorderColor = Drawing.Color.Black
Me.BarCodeWebControl1.SymbologyType = Symbology.Code128

Me.BarCodeWebControl1.RotationAngleF = RotationAngle.ZeroDegree
'Me.BarCodeWebControl1.CodeLocation = CodeLocation.Below
Me.BarCodeWebControl1.ImageQuality = ImageQualityMode.Default

'Me.BarCodeWebControl1.CodeLocation = CodeLocation.None

End Sub

Private Sub printDoc_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
e.Graphics.DrawImage(Me.BarCodeWebControl1.BarCodeImage, 0, 0)
End Sub


please provide me such solution that can work in any application…

Thanks a lot…

Hi Chandresh,

Thanks for considering Aspose.

The BarCode control is implemented as a control and it should work the same way in existing or new web applications. Could you please double check that you are using the exact same control settings/code or is there anything else that is causing printing problems?

Hi,
I am damn sure the code is same in both the application.
I also checked it again.
I can understand what the problem is ?
Can you provide me another simple code that can work anywhere…?
I just need an example or demo code that can work in any web application…
Please let me have some unique solution ASAP.
Thanks a lot…

Hello,

Could you please help to provide more details for debugging?

1. what code text you send to barrcode? Please print out the value.

Me.BarCodeWebControl1.CodeText = strBarcode

2. Please save the barcode image locally. You can call the save method to do this.

Thanks,

Thanks…
The code text i am sending is just a numeric value like…00000012,00000013,etc…
I dont want the image of barcode…i want to print it directly…can it be possible or not ??

Hi Chandresh,

Could you please post the screenshots of the 2 applications (new and existing). You can also send me through forum “Contact” --> “Send saqib.razzaq an email”.

Hi
The code that i am using is already posted in the starting of the forum.
And i am using only that much of code to generate barcode and to print it.
My problem is with printing…
I am using lable printer of “Zebra” company.
but the problem is when i am using the same code in my other application it is leaving the some space after printing.
Means after printing one barcode label it is leaving 2 labels blank…
And this is done in my other existing application only while if i use same code independently its working fine.
I am afraid of this problem…
Shall i need to do any changes regarding printer settings in application code?
And if yes then what type of changes i have to make…
My limitation is i can not provide you the screen shot of my application.
and i damn sure about the code that i am using same for both the application.
Please check this out ASAP.
Thanks…

Hi,

I understand your situation, but its really hard for us to find out such problem without looking into the details. Its a custom control implemented in a dll. It will behave the same way in new and existing applications.

You are using it in web application and printing the barcodes. May be there is some issue with HTML margins, fonts, CSS etc.