Click here to Skip to main content
15,911,531 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VB6 DataGrid Bookmark Error Pin
Eddy Vluggen25-Jun-13 9:59
professionalEddy Vluggen25-Jun-13 9:59 
AnswerHow to detect UTF-8-based encoded strings Pin
diegosendra24-Jun-13 9:33
diegosendra24-Jun-13 9:33 
SuggestionRe: How to detect UTF-8-based encoded strings Pin
Richard Deeming24-Jun-13 9:51
mveRichard Deeming24-Jun-13 9:51 
GeneralRe: How to detect UTF-8-based encoded strings Pin
diegosendra24-Jun-13 10:30
diegosendra24-Jun-13 10:30 
GeneralRe: How to detect UTF-8-based encoded strings Pin
Roy Heil24-Jun-13 11:08
professionalRoy Heil24-Jun-13 11:08 
GeneralRe: How to detect UTF-8-based encoded strings Pin
diegosendra24-Jun-13 11:15
diegosendra24-Jun-13 11:15 
GeneralRe: How to detect UTF-8-based encoded strings Pin
Richard MacCutchan24-Jun-13 20:33
mveRichard MacCutchan24-Jun-13 20:33 
QuestionCombine Printjobs Pin
tolarion24-Jun-13 2:23
tolarion24-Jun-13 2:23 
Hi ...
I have a problem to address the stapler of a HP9000 printer. I need a single print job, but the SDK i use produces individual jobs for each format that i use.

I'm already stopped the que with System.Printing, then read the que and trie to get the stream of each job and copy theme into a single job.

Unfortunately, the stream is not readable.
VB
Private Sub CombineJobsInPrintQue(ByVal Printer As String)
        Try
            Dim serverName As String = Printer.Remove(Printer.LastIndexOf("\"))
            Dim printerName As String = Printer.Remove(0, Printer.LastIndexOf("\") + 1)
            Dim ps As New PrintServer(serverName, PrintSystemDesiredAccess.AdministrateServer)
            Dim queue As New PrintQueue(ps, printerName, PrintSystemDesiredAccess.AdministratePrinter)


            Dim Jobs As PrintJobInfoCollection = queue.GetPrintJobInfoCollection
            Dim Job As PrintSystemJobInfo
            Dim s As PrintSystemJobInfo = queue.AddJob("NewJob")
            Dim myStreamWrite As System.IO.Stream = s.JobStream
          
            Dim x As Integer = 0
            For Each Job In Jobs
                Try      
                    Job.Refresh()
		    Dim myStreamRead As System.IO.Stream = Job.JobStream
                    Dim buffer(Job.JobSize) As Byte
                    myStreamRead.Read(buffer, 0, Job.JobSize)
                    myStreamWrite.Write(buffer, x, Job.JobSize)

                    x += Job.JobSize
                    Job.Cancel()
                Catch ex As Exception
                    ERRlog("CopyJob", ex)
                End Try
            Next
            myStreamWrite.Close()
        
        Catch e As Exception
            ERRlog("CombineJobsInPrintQue", e)
        End Try
    End Sub



Job.JobStream == nothing!
Apparently I can not merge the jobs this way ...

Now I have considered whether there is any other way to combine the jobs from the Que. But reading from the SPL file and then write to the Que does not work, the SPL-File is EMF coded and the data are not in RAW format. The job is generated but always ignored when printing.

VB
Private Sub CombineJobsTest(ByVal Printer As String)
        Try
            Dim serverName As String = Printer.Remove(Printer.LastIndexOf("\"))
            Dim printerName As String = Printer.Remove(0, Printer.LastIndexOf("\") + 1)
            Dim ps As New PrintServer(serverName, PrintSystemDesiredAccess.AdministrateServer)
            Dim queue As New PrintQueue(ps, printerName, PrintSystemDesiredAccess.AdministratePrinter)

            Dim Jobs As PrintJobInfoCollection = queue.GetPrintJobInfoCollection
            Dim Job As PrintSystemJobInfo
            Dim MyNewJob As PrintSystemJobInfo = queue.AddJob("Neu")

            Dim myStreamWrite As System.IO.Stream = MyNewJob.JobStream
            Dim myStreamRead As System.IO.Stream = New IO.FileStream("D:\Share\Temp\FP00119.SPL", IO.FileMode.Open)
	    Dim myStreamRead2 As System.IO.Stream = New IO.FileStream("D:\Share\Temp\FP00120.SPL", IO.FileMode.Open)

            Dim length As Integer = myStreamRead.Length + myStreamRead2.Length
            Dim buffer(Job.JobSize) As Byte
	    myStreamRead.Read(buffer, 0, myStreamRead.Length)
	    myStreamRead2.Read(buffer, myStreamRead.Length, myStreamRead2.Length)
	    myStreamWrite.Write(buffer, 0, length)
	    myStreamWrite.Close()      

        Catch e As Exception
            ERRlog("CombineJobsTest", e) 
        End Try
    End Sub



I'm still considering whether you can possibly tell the HP9000 in PCL6 !COLLECT ALL JOBS and then !STAPLE ALL JOBS ... but unfortunately I have not found this anywhere.

Somehow it must be possible to combine the jobs ... I hope someone here has a good idea ...

Thanks and regards
AnswerRe: Combine Printjobs Pin
Dave Kreskowiak24-Jun-13 4:05
mveDave Kreskowiak24-Jun-13 4:05 
GeneralRe: Combine Printjobs Pin
tolarion24-Jun-13 4:46
tolarion24-Jun-13 4:46 
GeneralRe: Combine Printjobs Pin
Dave Kreskowiak24-Jun-13 7:16
mveDave Kreskowiak24-Jun-13 7:16 
GeneralRe: Combine Printjobs Pin
tolarion24-Jun-13 10:02
tolarion24-Jun-13 10:02 
GeneralRe: Combine Printjobs Pin
Dave Kreskowiak24-Jun-13 11:58
mveDave Kreskowiak24-Jun-13 11:58 
GeneralRe: Combine Printjobs Pin
tolarion24-Jun-13 12:24
tolarion24-Jun-13 12:24 
GeneralRe: Combine Printjobs Pin
Dave Kreskowiak24-Jun-13 15:39
mveDave Kreskowiak24-Jun-13 15:39 
GeneralRe: Combine Printjobs Pin
tolarion24-Jun-13 22:50
tolarion24-Jun-13 22:50 
AnswerRe: Combine Printjobs Pin
tolarion25-Jun-13 0:59
tolarion25-Jun-13 0:59 
AnswerRe: Combine Printjobs Pin
Eddy Vluggen25-Jun-13 10:02
professionalEddy Vluggen25-Jun-13 10:02 
GeneralRe: Combine Printjobs Pin
tolarion25-Jun-13 10:20
tolarion25-Jun-13 10:20 
GeneralRe: Combine Printjobs Pin
Eddy Vluggen26-Jun-13 6:42
professionalEddy Vluggen26-Jun-13 6:42 
QuestionMonitoring Socket with AutoResetEvent Pin
Dominick Marciano23-Jun-13 16:17
professionalDominick Marciano23-Jun-13 16:17 
AnswerRe: Monitoring Socket with AutoResetEvent Pin
Dave Kreskowiak24-Jun-13 2:19
mveDave Kreskowiak24-Jun-13 2:19 
GeneralRe: Monitoring Socket with AutoResetEvent Pin
Dominick Marciano25-Jun-13 20:10
professionalDominick Marciano25-Jun-13 20:10 
GeneralRe: Monitoring Socket with AutoResetEvent Pin
Dave Kreskowiak26-Jun-13 2:18
mveDave Kreskowiak26-Jun-13 2:18 
QuestionI am a Beginner, could you help please?. Pin
Member 1011870620-Jun-13 7:10
Member 1011870620-Jun-13 7:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.