Linked by Thom Holwerda on Thu 10th Jun 2010 12:53 UTC
Linux This is a problem I've been dealing with for a while now. I have a Lexmark printer which I've bought without checking for compatibility with Linux (I bought it when I was still using Windows), and as it turns out, this printer is not supported in Linux. I switched to Linux on my main desktop full-time late last year, so instead of to my desktop, I hooked this printer up to my bedroom Windows 7 media server/HTPC, and whenever I need to print, I just drop the file in question on this machine, and print form there. I need a better solution. Update: As it turns out, Lexmark has recently started releasing Linux drivers (good stuff). Still, the problem at hand stands, as there might still be other printers that suffer from the same problem.
Thread beginning with comment 429513
To read all comments associated with this story, please click here.
Member since:

Here Thom, I have a present for you. True, it's a dirty hack that I threw together just now but it does provide some basic functionality. Basically, create the directory C:\Queue and share it. then run the following VB.NET hack on your system. Whenever you print in Linux you can just print to file and save the .PDF output to the share \\yourserver\queue and the program will send it to the default printer. there are many limitations but I'm sure it could be cleaned up:

Imports System.Diagnostics
Imports System.IO

Module modBasicQueue

Sub Main()
'******************************Written by Matt Paulauskas*********************************
'****************************************2010************************ *********************

Const qd = "C:\Queue\"
Console.WriteLine("Waiting for file to print")

Do '//continuous file check/print/delete loop
If Directory.GetFiles(qd).Count > 0 Then '//Check for files...if found send to printer and delete
For Each qFile As String In Directory.GetFiles(qd) '// iterate through files
Dim psi As New ProcessStartInfo
With psi
.Verb = "print"
.WindowStyle = ProcessWindowStyle.Hidden
.FileName = qFile
.UseShellExecute = True
.Arguments = "/silent"
End With

'// Display file being printed
Console.WriteLine("Printing: " & qFile)
Dim proc As New Process
proc.StartInfo = psi
'//clean up after file has been printed
Catch ex As Exception
'//file was probably locked by the app resonsible for printing it
'//Sleep the thread for 20ms and try again
GoTo TryAgain
End Try

'//Clean up running process
Catch ex As Exception

End Try
Catch ex As Exception
Console.WriteLine("Print Operation: " & ex.Message)
End Try
End If '//end file check
Threading.Thread.Sleep(1000) '//pause before next check
End Sub

End Module

Reply Score: 6

sorpigal Member since:

This is an interesting approach but to make it seamless it would be better to set up a print-to-file printer that automatically saves to the share, thus avoiding the need to copy.

Reply Parent Score: 2