Print ID card using Plastic Card Printer in VB.net

  • Thread starter Thread starter Raman
  • Start date Start date
R

Raman

Hello friends,

I want to print an ID card. I have one Windows Form that contains front

and back side. The printer is printing both front and back side at a
time. I am trying to send both sides at a time. But it is printing
front side on one card and back side on second card. I want to print
both sides in a same card.


Thanks in advance.


Regards,


Raman.
 
Hello Raman,

Perhaps you should contact the manufacturer of that printer.

Best Regards,

HKSHK
 
We would need way more info then that about it... whats the printer mfg?
model? have you contacted them about it?
 
Yes, i have contacted about it.

Manufacture : Dualys
Printer specification : Module for dual sided printing
Integrated ribbon saver for monochrome
printing
printer speed : 150 cards/hour
resolution : 300 dpi

It is operated as printing both sides at a time. It takes automatically
when u send 2 pages for printing. I have send a word document with 2
pages. It takes first page as a front end and second page as back end.
What is my problem is i have designed a windows form. It contains 2
frames one is for front side another for back. I want to send both
frames at a time to printer when a button is clicked
 
Hello Raman,

Did you send both sides with one print job? I would expect that if you
send both sides separately that it takes it as 2 cards.

Best Regards,

HKSHK
 
Hello HKSHK,

Please help me out from this problem

I have 2 frames in windows form. From that i have created 2 bitmap
images.
When i call use this function only back side is printed and card is
strucked in the printer. But two pages are send to printer. but second
image is overwritted on frirst image. So second page does not contain
any thing.

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e
As Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
e.Graphics.DrawImage(Me.Print_ImageF, 0, 0)
e.HasMorePages=True
e.Graphics.DrawImage(Me.Print_ImageB, 0, 0)
End Sub

or

When i use this function both front side and back side is printed. but
both are printed in different card.
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnPrint.Click

page=1 ' Vriable to represent which page
For i = 1 To 2
PrintDocument1.Print() 'Print the document
page = page + 1
Next
End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e
As Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage

If page = 1 Then
e.Graphics.DrawImage(Me.Print_ImageF, 0, 0)
ElseIf page = 2 Then
e.Graphics.DrawImage(Me.Print_ImageB, 0, 0)
End If

End Sub




I have created these two images by following coding in btnPrint_Click
function. It is created before the print command is called.

'We make the form look pritty befor its picture
Application.DoEvents()
Me.Refresh()
Application.DoEvents()
'Get a Graphics Object from the form
Dim FormGF As Graphics = gbFront.CreateGraphics
'Create a bitmap from that graphics
Dim iFront As New Bitmap(gbFront.Width, gbFront.Height,
FormGF)
'Create a Graphics object in memory from that bitmap
Dim memGFront As Graphics = Graphics.FromImage(iFront)

'get the IntPtr's of the graphics
Dim HDC1 As IntPtr = FormGF.GetHdc
Dim HDC2 As IntPtr = memGFront.GetHdc
'get the picture
BitBlt(HDC2, 0, 0, gbFront.ClientRectangle.Width,
gbFront.ClientRectangle.Height, HDC1, 0, 0, 13369376)
'Clone the bitmap so we can dispose this one
Me.Print_ImageF = iFront.Clone()
'Clean Up
FormGF.ReleaseHdc(HDC1)
memGFront.ReleaseHdc(HDC2)
FormGF.Dispose()
memGFront.Dispose()
iFront.Dispose()

Dim FormGB As Graphics = gbBack.CreateGraphics
Dim iBack As New Bitmap(gbBack.Width, gbBack.Height,
FormGB)
Dim memGBack As Graphics = Graphics.FromImage(iBack)

Dim HDC3 As IntPtr = FormGB.GetHdc
Dim HDC4 As IntPtr = memGBack.GetHdc
'get the picture
BitBlt(HDC4, 0, 0, gbBack.ClientRectangle.Width,
gbBack.ClientRectangle.Height, HDC3, 0, 0, 13369376)
'Clone the bitmap so we can dispose this one
Me.Print_ImageB = iBack.Clone()
'Clean Up
FormGB.ReleaseHdc(HDC3)
memGBack.ReleaseHdc(HDC4)
FormGB.Dispose()
memGBack.Dispose()
iBack.Dispose()
 
Back
Top