I'm not too sure what you mean. I've changed the code considerably since
I've last posted it (trying to figure out what is happening). Installed new
print drivers and messed with settings on the printer with our own hardware
support (Direct printing instead of spooling the print jobs)
It's just a huge enigma to me. Even after the application hasn't been
printing for over two hours now the spoolersv.exe process stands at
1,140,324 K in task manager. the users printed about 700 single page tiff
files today. Here is the code that printed the images.
Private Sub PagePrintFuncti on(ByVal sender As Object, ByVal e As
PrintPageEventA rgs)
Static Dim PageNumber As Integer = 0
Try
ImageToPrint.Se lectActiveFrame (FrameDimension .Page, PageNumber)
PageNumber += 1
e.Graphics.Draw Image(ImageToPr int, New RectangleF(0, 0,
(e.PageSettings .PaperSize.Widt h - 40), (e.PageSettings .PaperSize.Heig ht -
50)))
If PageNumber < ImagePages Then
e.HasMorePages = True
Else
e.HasMorePages = False
e.Graphics.Disp ose()
PageNumber = 0
End If
Catch ex As Exception
General.WriteTo EventLog("PageP rintFunction" & vbCrLf &
ex.ToString, "Print Class", EventLogEntryTy pe.Error)
Throw ex
End Try
End Sub
Public Function PrintImage(ByVa l SourceFile As String) As Boolean
Try
ImageToPrint = FromFile(Source File)
ImagePages = ImageToPrint.Ge tFrameCount(Fra meDimension.Pag e())
Catch ex As Exception
General.WriteTo EventLog("Getti ng Image Frames: " & vbCrLf &
ex.ToString, "Print Class", EventLogEntryTy pe.Error)
End Try
Try
Using PDocument As New PrintDocument
PDocument.Print erSettings.Prin terName = PrinterName
PDocument.Docum entName = SourceFile
AddHandler PDocument.Print Page, AddressOf PagePrintFuncti on
PDocument.Print ()
End Using
Catch ex As Exception
General.WriteTo EventLog("Print Document: " & vbCrLf &
ex.ToString, "Print Class", EventLogEntryTy pe.Error)
Return False
End Try
Return True
End Function
Public Sub PrintFolderCont ents()
Dim ExtensionFilter As String = "*." & Filter
Dim FileNameList As String() = Directory.GetFi les(Folder,
ExtensionFilter )
Try
General.WriteTo EventLog("Start ing to print " & Folder, "Print
Class", EventLogEntryTy pe.Information)
FileNameList = Directory.GetFi les(Folder, ExtensionFilter )
Array.Sort(File NameList)
If _ToggleArchiveB it Then
turnOffSwapFile Bits(FileNameLi st)
End If
Catch ex As Exception
General.WriteTo EventLog(ex.ToS tring, "Print Class",
EventLogEntryTy pe.Error)
End Try
Try
For i As Integer = 0 To FileNameList.Le ngth - 1
If PrintImage(File NameList(i)) Then
If _ToggleArchiveB it Then
turnOnAttribute Bit(FileNameLis t(i))
End If
Else
General.WriteTo EventLog("File " & FileNameList(i) & "
did not properly Print.", "Print Class", EventLogEntryTy pe.Warning)
End If
Next
Catch ex As Exception
General.WriteTo EventLog(ex.ToS tring, "Print Class",
EventLogEntryTy pe.Error)
Finally
If Not ImageToPrint Is Nothing Then
ImageToPrint.Di spose()
End If
End Try
End Sub
The speed at which the jobs are pushed into the printer is less then optimal
as well.
"Michael D. Ober" <obermd.@.alum. mit.edu.nospamw rote in message
news:eL******** ******@TK2MSFTN GP02.phx.gbl...
This actually sounds like a bug in the Printimage function. Does this
function close each print job properly. By this I mean are the spool
files closed once they have been created. I have seen image processing
programs not properly close the images when they are done with them.
Mike Ober.
"Scott M" <sc*****@nospam .nospamwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>The Printimage function gets called 500 times for tiffs that have about
10 - 30 pages in each. I haven't installed the service on any other
machines to see if it will konk out the server there, either.
I really stinks to have to restart the spooler and to restart the machine
after only printing 100 tiffs.
And as far as other software, Jeff. What do you suggest? This is a
server side process for a production orientated environment so I can't
have much downtime.
Thanks
Scott
""Jeffrey Tan[MSFT]"" <je***@online.m icrosoft.comwro te in message
news:zP******* *******@TK2MSFT NGXA01.phx.gbl. ..
>>Hi Scott,
Thanks for your post!
Does your tif file have 500 frames or do you have 500 files in a
directory
for printing?
ShaneO's reply seems make sense, you may give it try and feedback the
result here.
Regarding this issue, I recommend you try to use some existing softwares
that can read these tif files for printing, can this problem be
reproduced?
I suspect it may be a bug of spooler process since your code snippet is
really simple.
Anyway, I will wait for your feedback. Thanks.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
============= =============== =============== =======
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professiona l working with you may need further investigation to reach
the
most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best
handled working with a dedicated Microsoft Support Engineer by
contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
============= =============== =============== =======
This posting is provided "AS IS" with no warranties, and confers no
rights.