打印机不打印unicode文本 [英] printer not print unicode text

查看:150
本文介绍了打印机不打印unicode文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码从visual basic6打印unicode数据(通过使用MSForm2对象)但无法从打印机获取任何输出..请帮助



< pre lang =vb> StopPrinting = False
On 错误 GoTo errhandler

cmd1.PrinterDefault = True
cmd1.CancelError = True

' 设置标志
cmd1.Flags = cdlPDReturnDC + cdlPDNoPageNums
cmd1.ShowPrinter
Printer.FontName = Jameel Noori Nastaleeq
Printer.Print TextBox1.Text
Printer.EndDoc
退出 Sub
errhandler:
选择 案例错误
案例 32755 ' 对话框已取消
MsgBox < span class =code-string> 您取消了对话框
Case 其他
MsgBox 意外错误。错误& Err& & 错误
结束 如果



我还使用了其他代码,但没有来自打印机的响应:仅限空白纸。

 私人 声明 功能 TextOutW  Lib    gdi32.dll ByVal  hdc 作为  ByVal  x < span class =code-keyword>作为  ByVal  Y 作为  ByVal  lpString 作为 字符串 ByVal  nCount 作为 作为  

私有 Sub cmdPrint_Click()
Dim x 作为
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 用于初始化 - 获取hdc
x = TextOutW(打印机) .hdc, 160 100 ,StrConv(str,vbUnicode),Len(str))
Printer.EndDoc
结束 Sub





第一个例子中使用的Jameel Noori Nastaliq字体确实已正确安装。



没有人能解决我的问题

解决方案

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

 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.

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

解决方案

这篇关于打印机不打印unicode文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆