<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><div><br><br>Sent from my iPhone</div><blockquote type="cite">On 4 Apr 2017, at 9:46 am, Khaled Hosny <<a href="mailto:khaledhosny@eglug.org">khaledhosny@eglug.org</a>> wrote:</blockquote><br></div><blockquote type="cite"><div><span>On Tue, Apr 04, 2017 at 09:31:55AM +1000, Chris Sherlock wrote:</span><br><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>However, now that CUPS is pretty much standardised on mostly </span>everything - including, it appears, on an increasing number of *BSD</blockquote><blockquote type="cite"><span>systems - is psprint still required for systems that are sticking with </span>lpr?</blockquote><span></span><br><span>My understanding (and I may pretty much be wrong, the code is convoluted </span><span>to death) is that most of psprint deals with printing using PostScript </span><span>and when printing with PDF most of it is skipped. PDF printing is the </span><span>default and not even easy to change in recent versions, but that looks </span><span>like a bug. I believe we can kill PostScript printing and most of </span><span>psprint with it and nothing of value will be lost.</span><br><span></span><br><span>Regards,</span><br><span>Khaled</span><br></div></blockquote><br><div>Thanks Khaled, appreciate the feedback.</div><div><br></div><div>I've started a private branch around Unix printing, see <a href="https://cgit.freedesktop.org/libreoffice/core/log/?h=private/tbsdy/printinfomgr">https://cgit.freedesktop.org/libreoffice/core/log/?h=private/tbsdy/printinfomgr</a></div><div><br></div><div>I've changed over to use the standard template library for locking and condition variables in CUPSManager.</div><div><br></div><div>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? </div><div><br></div><div>I've added the following commit to have it instantiate in SalData and destroy itself when SalData is destroyed:</div><div><br></div><div><a href="https://cgit.freedesktop.org/libreoffice/core/commit/?h=private/tbsdy/printinfomgr&id=3e5bca1893f08b9372c1e0ab96a32aabf989acd4">https://cgit.freedesktop.org/libreoffice/core/commit/?h=private/tbsdy/printinfomgr&id=3e5bca1893f08b9372c1e0ab96a32aabf989acd4</a></div><div><br></div><div>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.</div><div><br></div><div>Another, possibly controversial change I'm proposing is to collapse the PrinterInfo class into the JobData class - see <a href="https://cgit.freedesktop.org/libreoffice/core/commit/?h=private/tbsdy/printinfomgr&id=d5d67b92282d9b4b28099671d439854981760911">https://cgit.freedesktop.org/libreoffice/core/commit/?h=private/tbsdy/printinfomgr&id=d5d67b92282d9b4b28099671d439854981760911</a></div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div><p style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: '.SFUIText-Bold'; font-weight: bold; font-size: 17pt;">Unix Printing in LibreOffice</span></p>
<p style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: '.SFUIText'; font-size: 17pt; text-decoration: underline;">Concepts</span></p>
<ul>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">There are none to many printers available to print to</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">Print jobs can be sent to many different types of printers</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">Print jobs can be sent to a class of printers (CUPS), and one of the printers in the class will print the print job</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">Each printer is defined by a printer description - a PPD</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">A user sends a print job to a print queue</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">A print queue can send jobs to a printer, but can have many printers to choose from (class or group)</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">Each queue can have multiple jobs which it must send to a printer for printing</span></li>
</ul>
<p style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69); min-height: 20.3px;"><span style="font-family: '.SFUIText'; font-size: 17pt; text-decoration: underline;"></span><br></p>
<p style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: '.SFUIText'; font-size: 17pt; text-decoration: underline;">Print Manager</span></p>
<ul>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">add a printer queue</span></li>
<ul style="list-style-type: disc">
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">To add a printer queue a printer description must first be provided</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">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 (</span><span style="font-family: '.SFUIText-Italic'; font-style: italic; font-size: 17pt;">installs </span><span style="font-family: '.SFUIText'; font-size: 17pt;">the printer description)</span></li>
</ul>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">remove a printer queue</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">Spools print jobs to a queue</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">Cancels print jobs and removes spooled print jobs from queues</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">Pauses printing</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">Uninstalls a printer description (is this necessary?)</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">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</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">Detects the status of a print queue (e.g. error from printer, etc)</span></li>
<li style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: Menlo-Regular; font-size: 10pt;"></span><span style="font-family: '.SFUIText'; font-size: 17pt;">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)</span></li>
</ul>
<p style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69); min-height: 20.3px;"><span style="font-family: '.SFUIText'; font-size: 17pt;"></span><br></p>
<p style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: '.SFUIText'; font-size: 17pt;">Note: On LibreOffice, if a Unix system does not have CUPS installed then it falls back to a built in system called psprint.</span></p><p style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: '.SFUIText'; font-size: 17pt;"><br></span></p><p style="margin: 0px; line-height: normal; font-family: '.SF UI Text'; color: rgb(69, 69, 69);"><span style="font-family: '.SFUIText'; font-size: 17pt;">Chris</span></p></div></body></html>