none
VB2005如何沉默地打印已经存在的PDF文件? RRS feed

答案

  • 在winform下用process调用win32api是可以实现的.但是只能打到默认打印机

    Code Snippet

    Imports System.Diagnostics
    Public Class Form1

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim startinfo As New ProcessStartInfo()
            startinfo.UseShellExecute = True
            startinfo.Verb = "Print"
            startinfo.CreateNoWindow = False
            'startinfo.WindowStyle = ProcessWindowStyle.Hidden
            If (DialogResult.OK = Me.OpenFileDialog1.ShowDialog()) Then
                startinfo.FileName = Me.OpenFileDialog1.FileName
                Dim processInstance = New Process()
                processInstance.StartInfo = startinfo
                processInstance.Start()

            End If

        End Sub
    End Class

     

     

    2008年5月13日 9:20
    版主