打印机不打印unicode文本 [英] printer not print unicode text
问题描述
我正在使用以下代码从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屋!