Apache OpenOffice (AOO) Bugzilla – Issue 100186
printing from command line doesn't renumerate printers
Last modified: 2013-01-29 21:40:12 UTC
example: add new printer oowriter -pt NEWPRINTERNAME document.odt prints to default printer instead of to the new printer. Fix: open oowriter, go file->print.. then cancel. then oowriter -pt NEWPRINTERNAME document.odt works this might only happen if open office is already open before you add the new printer and then issue the oowriter -pt command.
The list of available printers is read only once during OOo's life time, that is true. The reason is that reading that list can - unfortunately - take from a few 10 milliseconds over multiple seconds on networked systems to indefinetly on misconfigured systems (actually printer discovery is run an own thread because it can take so arduously long). Even more unfortunate there is no method of getting informed when the printer list has changed. Printing on Unix still is a rather sub par affair still. That being said we could of course get the printer list every time we need a new printer object, however I'm not sure I want to do that for the time penalties involved.
I'm not sure how the printer discovery is done in OO. but running lpstat -p never takes long. But what if it is changed so if printing from the command line, and a printer that is not recognized yet is selected that it will then scan for new printers. If the printer is still not found, rather than print to the default it should return an error # and message. Also, it does appear to be checking on the printers whenever I go to file->print.
Again; currently the list of available printers on unix systems is read only once during OOo's life time, however often you print, select File->Print or whatever. That lpstat -p runs fast for you is nice, but there have been many people for whom it didn't. However I think the idea of printing an error message if the printer given on the command line does not exist is a splendid idea. @cd: the latter would be a framework issue ?
After some testing I have come to the conclusion that the printer scan is *NOT* only done once. If i have oowriter open. Add a printer, Go file->print. The new printer shows up. If i then delete it. and go back. The printer is gone. I think the assumption that the printer list is only read once needs to be re-assessed.
That means you did either not test on Linux as described or you "added" a printer by using the spadmin tool (basically an OOo internal "printer"). The latter would indeed be updated occasionally on Unix systems. System printers on Unix however are read only once.