Issue 121855 - Need option to change printing default from PDF to postscript
Summary: Need option to change printing default from PDF to postscript
Status: CONFIRMED
Alias: None
Product: General
Classification: Code
Component: ui (show other issues)
Version: 3.4.1
Hardware: All Linux, all
: P3 Major (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-05 17:12 UTC by crxssi
Modified: 2013-03-11 21:40 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Tools->Options from LibreOffice showing PDF printing control (61.63 KB, image/png)
2013-03-05 17:12 UTC, crxssi
no flags Details
Sample psprint.conf (1.22 KB, application/octet-stream)
2013-03-08 23:47 UTC, Ariel Constenla-Haile
no flags Details
Spool file generated by OpenOffice (53.05 KB, application/postscript)
2013-03-08 23:50 UTC, Ariel Constenla-Haile
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description crxssi 2013-03-05 17:12:54 UTC
Created attachment 80378 [details]
Tools->Options from LibreOffice showing PDF printing control

We would very much like to upgrade from OpenOffice 3.2.1 to something newer.  Unfortunately, newer versions all have critical issues on our systems with the new print dialog and also PDF printing (which is the topic of other reports, not this one).

3.4.1 has fixed enough of the issues since 3.2.1 that we could actually use it, but only if we use PS (postscript) printing instead of the newer PDF printing.  It is not practical that we try to rely on users to manually change to PS for every new document, so we are seeking an option that would allow the user or sysadmin to set it as the default for all new documents.

Ironically, LibreOffice has such an option, and I am attaching a screenshot of it.  But we can't use LO, since they have even more critical bugs than 3.4.1 (so we have been "trapped").

Even a way to set the default without it being tools-> options would be acceptable- such as an environment variable or a config file.

I am not sure if this would be considered an "issue type" of "defect" or "enhancement".  It is an enhancement, but only as a workaround for existing defects.
Comment 1 Ariel Constenla-Haile 2013-03-08 21:50:45 UTC
Did you try setting a printer with /opt/openoffice.org3/program/spadmin ?

Select a PDF converter and change the command:

instead of -sDEVICE=pdfwrite
use -sDEVICE=ps2write
Comment 2 Ariel Constenla-Haile 2013-03-08 21:51:18 UTC
RFE
Comment 3 crxssi 2013-03-08 22:01:25 UTC
(In reply to comment #1)
> Did you try setting a printer with /opt/openoffice.org3/program/spadmin ?

Yep, that is one of the first things I tried.  spadmin won't allow any changes to the printers at all.  Well, it lets one change anything you like, but then when one looks at it again, it goes right back to the CUPS defaults.  So this won't help.
 
> Select a PDF converter and change the command:
> instead of -sDEVICE=pdfwrite use -sDEVICE=ps2write

That sounds interesting, but spadmin won't allow such changes (at least I don't think so, I didn't try that one specifically).  Even if it did work, it would not be practical here- we have 35+ printers and I am sure there would be other issues with paper and such.  Plus it would end up with a list of 70 printers, half with duplicate names, etc.

Thanks for the idea of a workaround, though.  I wish there was some quick thing I could do like set some secret environment variable or edit some config file to force postscript printing.
Comment 4 Ariel Constenla-Haile 2013-03-08 23:47:05 UTC
(In reply to comment #3)
> That sounds interesting, but spadmin won't allow such changes (at least I
> don't think so, I didn't try that one specifically).  Even if it did work,
> it would not be practical here- we have 35+ printers and I am sure there
> would be other issues with paper and such.  Plus it would end up with a list
> of 70 printers, half with duplicate names, etc.
> 
> Thanks for the idea of a workaround, though.  I wish there was some quick
> thing I could do like set some secret environment variable or edit some
> config file to force postscript printing.

You can set a per user configuration file in <openoffice_user_dir>/psprint/psprint.conf

You will need the name of the printers, as spadmin knows them; it will a one time job, even if you have 35 printers...

In the configuration, you have to set 

PSLevel=3
PDFDevice=0

and make sure that 

Features=

does not have Features=pdf=

With these 3 settings, you make OpenOffice send the print job in PostScript format, instead of PDF (this is want you want, if I got it right).
Comment 5 Ariel Constenla-Haile 2013-03-08 23:47:51 UTC
Created attachment 80385 [details]
Sample psprint.conf
Comment 6 Ariel Constenla-Haile 2013-03-08 23:50:39 UTC
Created attachment 80386 [details]
Spool file generated by OpenOffice

With the settings in that configuration file, OpenOffice sends print jobs in PostScript format.
Open the file in text editor, it starts with

%!PS-Adobe-3.0
Comment 7 Ariel Constenla-Haile 2013-03-08 23:54:27 UTC
For the record, if someone wants to implement the "PostScript set by configuration option", the original commit that introduced the change was http://hg.services.openoffice.org/OOO340/rev/000a98555fa9 while fixing bug 113802

In case hg.services dies:

pdfprint: #i94173# #i113802# send print jobs in PDF instead of PostScript
author	Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>
	Mon Aug 16 20:31:58 2010 +0200 (2010-08-16)
changeset 272525	000a98555fa9
parent 272524 	7e845c0e424d
child 272526 	0f6a41247f18
Comment 8 crxssi 2013-03-09 01:04:19 UTC
(In reply to comment #4)
> You can set a per user configuration file in
> <openoffice_user_dir>/psprint/psprint.conf

After LOTS of testing and experimentation, here are my results.  You can, actually, do it globally, by editing basis-link/share/psprint/psprint.conf manually.  Seems spadmin just won't.

There are a minimum of three fields needed to specify and match a printer for this purpose.  The example below is a printer named "is" in CUPS:

[is]
Printer=CUPS:is/is
PSLevel=

"PSLevel" chooses the answer to the "Printer Language Type" field.  However, it does not work as expected:

PSLevel=     = PDF
PSLevel=0    = PDF
PSLevel=1    = PostScript Level 1
PSLevel=2    = PostScript Level 2
PSLevel=3    = <blank>
PSLevel=4    = <blank>

Unfortunately, as my luck would have it, there is no acceptable option.  We must have postscript level 3 or allow it to use the printer default (which is postscript level 3).

In OpenOffice 3.2.1 the choices are:
------------------------------------
from driver              <---DEFAULT
1
2

In OpenOffice 3.4.1 the choices are:
------------------------------------
PostScript (Level from driver)
PostScript Level 1        <--- optional default with psprint.conf
PostScript Level 2        <--- optional default with psprint.conf
PostScript Level 3
PDF                       <---DEFAULT (without custom psprint.conf)

In LibreOffice 4.0.0 the choices are:
------------------------------------
Automatic : Postscript (Level from driver) <---DEFAULT (if PDF unset in options)
Postscript (Level from driver)
PostScript Level 1
PostScript Level 2
PostScript Level 3
PDF

This is so frustrating!  You gave me a workaround that almost works and then stops me on something silly!!!!  Even so, I REALLY have appreciated your assistance.
Comment 9 Ariel Constenla-Haile 2013-03-09 01:23:02 UTC
(In reply to comment #8)
> (In reply to comment #4)
> > You can set a per user configuration file in
> > <openoffice_user_dir>/psprint/psprint.conf
> 
> After LOTS of testing and experimentation, here are my results.  You can,
> actually, do it globally, by editing basis-link/share/psprint/psprint.conf
> manually.  Seems spadmin just won't.

Don't use spadmin with the current stable releases, it is broken, you will get the 

PDFDevice=0

but the PostScript level is always 0

PSLevel=0

This bug is fixed on trunk (where the development towards 4.0 takes place), you can try a build from 

http://ci.apache.org/projects/openoffice/ 

you have to choose 

Linux 32bit Nightly (openoffice-linux32-nightly) or
Linux 64bit Nightly (openoffice-linux64-nightly)

and download the package that has "arc" in its name, instead of deb/rpm. This tar file has a self contained installation, simply untar and use spadmin to generate the right configuration files; the user directory is inside the installation, it won't overwrite your default user dir. in ~/.openoffice.org/3/user

Note 1: the system requirements for the 64 bits package is higher than the one for the current stable release

Note 2: I tried the following, and worked

- configure the printers in spadmin from trunk/to be 4.0
- copy the generated file in the default 3.4.1 installation

Now OpenOffice sends the job in PostScript format.
The spadmin dialog from 3.4.1 will still be broken after this change, so don't use it at all.
Comment 10 Ariel Constenla-Haile 2013-03-09 01:27:49 UTC
(In reply to comment #9)
> - configure the printers in spadmin from trunk/to be 4.0
> - copy the generated file in the default 3.4.1 installation

here I meant the *user* directory, not /opt/openoffice.org/basis3.4/share/psprint/
Comment 11 crxssi 2013-03-09 03:21:55 UTC
(In reply to comment #9)
> PSLevel=0
> 
> This bug is fixed on trunk (where the development towards 4.0 takes place),
> you can try a build from [...]

My interpretation of what you said is:  Download a development version and run it just to create a working psprint.conf file which I can then remove from that configuration and copy to the users' directories on the 3.4.1 installation.

If that is correct, I don't think I can use that as a workaround because I have over 150 users on the machine.  I have need to set up a global psprint.conf, instead, that will affect all users at once.  I might be able to somehow copy a model directory to each user, but just adding one new printer on my system would become a nightmare of complexity.

* I have proven that the global/system-wide psprint.conf file is being honored and can be edited.  It just has that problem where I can't set PS level 2 or "default".

* The psprint.conf file is just a text file.  Can you tell me what about the "trunk" version file is different from the 3.4.1 file?  Knowing that, I should be able to edit the global file to obtain the same results without having to install a "trunk" version, right?

NEW INFORMATION.....
I also discovered that I don't have to specify any printers AT ALL in the globalbasis-link/share/psprint/psprint.conf file!  There is a variable under "[__Global_Printer_Defaults__]"  called  "PSLevel" and that will automatically change EVERY printer for OpenOffice, even when none are listed in the psprint.conf file :)    Only problem- it has the same bug, 0 = PDF, and 3 = <blank> :(

But to make matters even more interesting, I tested printing to a file with this "blank" entry (with PSLevel=3) and guess what.... it is creating postscript level 3, identical [checked with diff] to a file created to "print to file" with it manually set to "postscript level 3"  :)   But that leads to another concern- if I try to use this as a workaround, any new documents created would have a print language set to <blank> saved in them and I am not sure how future versions of Open/Libre Office will deal with that (or older versions even).  I will have to test more.
Comment 12 Ariel Constenla-Haile 2013-03-09 04:13:32 UTC
(In reply to comment #11)
> * I have proven that the global/system-wide psprint.conf file is being
> honored and can be edited.  It just has that problem where I can't set PS
> level 2 or "default".

You are right. Simply add

[__Global_Printer_Defaults__]
PSLevel=3
PDFDevice=0

and the jobs will be sent in PostScript to cups.

I tested it, and worked with 3.4.1, even thought the spadmin dialog does not get it right.
On the development version I have, OpenOffice can let the file sent to cups. If you want to verify yourself, you'll have to modify the cupsd configuration to log at level debug2.

All the following works on my cups version and is run as root, paths point to my system's paths, modify to adapt them to yours:

vim /etc/cups/cupsd.conf

edit the line with  LogLevel

LogLevel debug2

restart cupsd.
Tail the log file:

Print with the OpenOffice that has the modified configuration file, and in the log grep add_file or filetype and you'll find:

D [09/Mar/2013:00:52:59 -0300] [Job 344] Request file type is application/postscript.
d [09/Mar/2013:00:52:59 -0300] add_file(con=0x7f6189575310[22], job=344, filetype=application/postscript, compression=0)

This shows the file type is PostScript.
Print with any application that sends the jobs in PDF, you'll find:

D [09/Mar/2013:00:55:50 -0300] [Job 345] Auto-typing file...
D [09/Mar/2013:00:55:50 -0300] [Job 345] Request file type is application/pdf.
d [09/Mar/2013:00:55:50 -0300] add_file(con=0x7f618957a560[23], job=345, filetype=application/pdf, compression=0)



> NEW INFORMATION.....
> I also discovered that I don't have to specify any printers AT ALL in the
> globalbasis-link/share/psprint/psprint.conf file!  There is a variable under
> "[__Global_Printer_Defaults__]"  called  "PSLevel" and that will
> automatically change EVERY printer for OpenOffice, even when none are listed
> in the psprint.conf file :)    Only problem- it has the same bug, 0 = PDF,
> and 3 = <blank> :(

where do you see the bug? in the spadmin dialog? it is broken, so don't trust him, try with the cupsd log.

> But that
> leads to another concern- if I try to use this as a workaround, any new
> documents created would have a print language set to <blank> saved in them

Here I don't get you. What do you mean by "print language set to <blank>"?
Are you talking about OO documents, or about the file sent to cups?
Comment 13 crxssi 2013-03-09 13:03:22 UTC
(In reply to comment #12)
> > Only problem- it has the same bug, 0 = PDF, and 3 = <blank> :(
> 
> where do you see the bug? in the spadmin dialog? 

No.  I am hand editing the global psprint.conf file.  When PSLevel=3 is set in the file, when you go into OpenOffice and look at the printer settings "Printer Language Type", it is blank (set to nothing).  However, it actually outputs postscript level 3, so one would expect it to show "PostScript Level 3".

> > But that
> > leads to another concern- if I try to use this as a workaround, any new
> > documents created would have a print language set to <blank> saved in them
> 
> Here I don't get you. What do you mean by "print language set to <blank>"?
> Are you talking about OO documents, or about the file sent to cups?

The OO documents- see the explanation, above. It is strange that something like "print language" would be saved with the document, but it is.  So I have to be concerned that we are not "contaminating" the documents with a strange setting that will cause problems later. Even before testing, I am cautiously optimistic now :)  Thanks.
Comment 14 crxssi 2013-03-11 15:26:19 UTC
(In reply to comment #13)

> But that
> leads to another concern- if I try to use this as a workaround, any new
> documents created would have a print language set to <blank> saved in them
> and I am not sure how future versions of Open/Libre Office will deal with
> that (or older versions even).  I will have to test more.

I have performed some additional testing.  I have PSLevel=3 globally set in psprint.conf and that sets the language level to <blank> in Open Office 3.4.1 when you look at printer settings.

I then created and saved a new document in 3.4.1 (as configured, above).  If I open that test document in  OO 3.2.1, it will still show language level as <blank> and print with Postscript level 3.  If I open that test document in LibreOffice 4.0.0, it will show language level = "Postscript Level 3" (!!!) and print in Postscript level 3.

It looks like this method can be used as a safe (yet complex) workaround to force turning off PDF printing, although it is not "clean."  I am not sure if there are any other problems, yet, but I will move forward and see what happens.  I will report back to this thread if I find out any new information.

Would be a lot easier if there was an option to turn off PDF printing in options :)
Comment 15 Ariel Constenla-Haile 2013-03-11 21:40:03 UTC
(In reply to comment #14)
> It looks like this method can be used as a safe (yet complex) workaround to
> force turning off PDF printing, although it is not "clean."  I am not sure
> if there are any other problems, yet, but I will move forward and see what
> happens.  I will report back to this thread if I find out any new
> information.
> 
> Would be a lot easier if there was an option to turn off PDF printing in
> options :)

I agree with you. Also note that the original developer in charge of this code thought that the "Device" tab page was the solution for the UI issue, not a configuration option in the Options dialog: 
Bug 113802 - Need UI switch to choose whether to print PDF or PostScript files

The bug with that tab page is fixed on trunk. But a general, system administrator-friendly, way of setting this globally should be available, besides the configuration <openoffice_user_dir>/psprint/psprint.conf

The drawback of psprint.conf is that you cannot create an extension and install it in all your workstations. With an OO registry configuration solution, you can create an extension with these configuration settings.

Leaving the bug as RFE (request for enhancement), as there are alternative solutions already (psprint.conf and the "Device" tab page fixed on trunk).