Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using following code to print unicode data from visual basic6 ( through using MSForm2 object ) but Fail to get any output from printer..please Help

VB
 StopPrinting = False
On Error GoTo errhandler
    
    cmd1.PrinterDefault = True
    cmd1.CancelError = True

    ' Set flags
    cmd1.Flags = cdlPDReturnDC + cdlPDNoPageNums
    cmd1.ShowPrinter
Printer.FontName = "Jameel Noori Nastaleeq"
    Printer.Print  TextBox1.Text
    Printer.EndDoc
    Exit Sub
errhandler:
    Select Case Err
    Case 32755 '  Dialog Cancelled
        MsgBox "you cancelled the dialog box"
    Case Else
        MsgBox "Unexpected error. Err " & Err & " : " & Error
End if

I have also used another code but no response from printer : still blank paper only.
VB
Private Declare Function TextOutW Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal Y As Long, ByVal lpString As String, ByVal nCount As Long) As Long

Private Sub cmdPrint_Click()
    Dim x As Long
    Dim str As String

    str = txturdu.Text
    Printer.ScaleMode = 6
    Printer.FontName = "@Arial Unicode MS"
    Printer.FontSize = 9
    Printer.CurrentX = 150
    Printer.CurrentY = 100
    Printer.Print " " 'for initializing - to get the hdc
    x = TextOutW(Printer.hdc, 160, 100, StrConv(str, vbUnicode), Len(str))
    Printer.EndDoc
End Sub


The Jameel Noori Nastaliq font used in the first example is indeed correctly installed.

Nobody have solution about my problem
Posted
Updated 13-Mar-14 1:15am
v15
Comments
Richard MacCutchan 11-Mar-14 4:59am    
What does "but Fail" mean?
Bernhard Hiller 11-Mar-14 5:08am    
Is that "Jameel Noori Nastaleeq" font available on the printer? Really, did you check that?
And I do not understand the line "Printer.Print Get_Unicode; TextBox1.Text" (it's not vb.net, but vb6...)
Rage 13-Mar-14 7:06am    
What is the value of x in the second example ?
Sergey Alexandrovich Kryukov 13-Mar-14 8:56am    
What do you mean by "VB", exactly?
—SA
Rage 13-Mar-14 10:24am    
I once asked my boss the same question. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900