Unix-based systems not using CUPS

Chris Sherlock chris.sherlock79 at gmail.com
Wed Apr 5 21:27:24 UTC 2017

Sent from my iPhone
> On 4 Apr 2017, at 9:46 am, Khaled Hosny <khaledhosny at eglug.org> wrote:

>> On Tue, Apr 04, 2017 at 09:31:55AM +1000, Chris Sherlock wrote:
>> However, now that CUPS is pretty much standardised on mostly everything - including, it appears, on an increasing number of *BSD
>> systems - is psprint still required for systems that are sticking with lpr?
> My understanding (and I may pretty much be wrong, the code is convoluted to death) is that most of psprint deals with printing using PostScript and when printing with PDF most of it is skipped. PDF printing is the default and not even easy to change in recent versions, but that looks like a bug. I believe we can kill PostScript printing and most of psprint with it and nothing of value will be lost.
> Regards,
> Khaled

Thanks Khaled, appreciate the feedback.

I've started a private branch around Unix printing, see https://cgit.freedesktop.org/libreoffice/core/log/?h=private/tbsdy/printinfomgr

I've changed over to use the standard template library for locking and condition variables in CUPSManager.

I also was looking at the way that PrintInfoManager gets created - it's using what I think is an unnecessary singleton pattern, given the printing system needs to be available all the time it occurs to me that the only benefit this brings is lazy loading the instance, but is the overhead really so bad that this shouldn't be created when we instantiate SalData? 

I've added the following commit to have it instantiate in SalData and destroy itself when SalData is destroyed:


Basically, this takes the creation out of the hands of the class PrinterInfoManager and puts it the hands of SalData. In essence, the SalData constructor becomes a factory method and makes PrinterInfoManager use an RAII idiom.

Another, possibly controversial change I'm proposing is to collapse the PrinterInfo class into the JobData class - see https://cgit.freedesktop.org/libreoffice/core/commit/?h=private/tbsdy/printinfomgr&id=d5d67b92282d9b4b28099671d439854981760911

I don't see any real need to have a PrinterInfo class, because that just seems to hold the defaults of a printer configuration, which is actually just what you set on JobData. I honest don't see how PrinterInfo added anything to the architecture.

I've jotted down a few notes in Unix printing in VCL, figured I might as well share them here - feel free to comment if I've got something wrong.

Unix Printing in LibreOffice
There are none to many printers available to print to
Print jobs can be sent to many different types of printers
Print jobs can be sent to a class of printers (CUPS), and one of the printers in the class will print the print job
Each printer is defined by a printer description - a PPD
A user sends a print job to a print queue
A print queue can send jobs to a printer, but can have many printers to choose from (class or group)
Each queue can have multiple jobs which it must send to a printer for printing

Print Manager
add a printer queue
To add a printer queue a printer description must first be provided
If no printer description has ever been provided, then it must be provided to the the print manager which then adds it to its printers collection (installs the printer description)
remove a printer queue
Spools print jobs to a queue
Cancels print jobs and removes spooled print jobs from queues
Pauses printing
Uninstalls a printer description (is this necessary?)
Allows configuring printer options for that alter the way a job is printed - done either by a default printer configuration, or changed on a job by job basis
Detects the status of a print queue (e.g. error from printer, etc)
The available printer capabilities and features of a printer are defined in its printer description (e.g. print quality, how it handles colour, available printer trays, collation, number of copies to print, etc)

Note: On LibreOffice, if a Unix system does not have CUPS installed then it falls back to a built in system called psprint.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20170406/68ca15e3/attachment.html>

More information about the LibreOffice mailing list