Question : Printing PDF and phys. Printer by one Printqueue

Hi,

is there any chance to print  O N E  Printjob simultaneos on an PDF-FileCreator and physical Printer?
THX

Answer : Printing PDF and phys. Printer by one Printqueue

may be it' s too fomral to work with 2 Applications.

So I wrote some (freeware :) ) vb.net code and solve my problem.

thanks a lot
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
Imports System.IO
Imports System.Text
Imports System.Threading
Module Module1

    Sub Main()
        'Print_Document("C:\0930308.PDF")
        Dir_Watch()
    End Sub

    Private Sub Print_Document(ByVal strDocpath As String)
        Dim p As New Process
        p.StartInfo.FileName = strDocpath
        p.StartInfo.Verb = "print"
        p.StartInfo.CreateNoWindow = True
        p.Start()
    End Sub
    Public Sub Dir_Watch()

        Dim watcher As New FileSystemWatcher()
        'Dim Watch_Path As String = "C:\WATCH"

        watcher.Path = "C:\WATCH"

        If Not IO.Directory.Exists(watcher.Path) Then
            IO.Directory.CreateDirectory(watcher.Path)
        End If


        watcher.Filter = "*.pdf"
        watcher.IncludeSubdirectories = False

        AddHandler watcher.Created, AddressOf doIt

        watcher.EnableRaisingEvents = True

        Dim msg As String = "Printapplication 1.01 @C ..." & vbLf & _
        vbLf & "PDF Datei in das Verzeichnis C:\WATCHER kopieren" & vbLf & _
        "Datei wird dann auf dem Windows Standarddrucker gedruckt und anschl. umbenannt" & vbLf & _
        vbLf & "mit  Taste das Programm beenden " & vbLf



        Console.WriteLine(msg)

        Console.ReadLine()



    End Sub
    Sub doit(ByVal source As Object, ByVal e As FileSystemEventArgs)
        Print_Document(e.FullPath)
        If IO.File.Exists(e.FullPath) Then
            Dim newfile As String = RandomString(8, False) & ".PRINTED"
            Dim newfile_fullpath As String = "c:\watcher\" & newfile ' & ".PRINTED"
            'IO.File.Move(e.FullPath, "c:\watcher\" & newfile_fullpath)
            Dim fi As New FileInfo(e.FullPath)

            Threading.Thread.Sleep(10000)
            fi.MoveTo("C:\WATCH\" & newfile)

        End If
    End Sub
    Private Function RandomString(ByVal size As Integer, ByVal lowerCase As Boolean) As String
        Dim builder As New StringBuilder()
        Dim random As New Random()
        Dim ch As Char
        Dim i As Integer
        For i = 0 To size - 1
            ch = Convert.ToChar(Convert.ToInt32((26 * random.NextDouble() + 65)))
            builder.Append(ch)
        Next
        If lowerCase Then
            Return builder.ToString().ToLower()
        End If
        Return builder.ToString()
    End Function 'RandomString 

End Module
Random Solutions  
 
programming4us programming4us