Bug 113417 - printer instance not visisble to non-kde-apps
Summary: printer instance not visisble to non-kde-apps
Status: CLOSED NOT A BUG
Alias: None
Product: kdeprint
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KDEPrint Devel Mailinglist
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-27 10:08 UTC by arne anka
Modified: 2008-12-31 19:03 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
differences between same file printed with opera directly and with opera through kprinter (3.33 KB, text/plain)
2005-09-30 06:46 UTC, Cristian Tibirna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description arne anka 2005-09-27 10:08:05 UTC
Version:           unknown (using KDE 3.4.2, Debian Package 4:3.4.2-4 (testing/unstable))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.13

i use opera as browser -- alle printers created through "Add Printer/Class" are shown, but not additional instances. while kde-applications in their printer dropdown-list show the instances too, in opera they're not available.
yes, i tried setting "kprinter" as printer instead and get the kprinter-dialog with the instances in the dropdown -- but despite of a file to print in the files list i only get "nothing to print".
Comment 1 Michael Goffioul 2005-09-27 10:16:18 UTC
Printer instances are CUPS-specific. If a non-KDE application does not show them in its built-in print dialog (I'm not talking about kprinter here), then it's not kdeprint's fault. OTOH, the other "nothing to print" problem is probably related to kdeprint.
Comment 2 arne anka 2005-09-27 11:37:23 UTC
hm, the first part should thus be classified as "resolved wontfix". regarding the second part ("nothing to print") i was not sure whether it is kprinter related. should i file  a new bugreport?
Comment 3 Michael Goffioul 2005-09-27 11:44:26 UTC
Can determine how Opera makes use of an external program to print:
1) piping the PS data to the program
2) calling the program with a temporary PS file

Some useful options to test with kprinter:
--stdin: makes kprinter read PS data from its standard input (piping)
-c: kprinter makes a copy of the given file, useful to avoid that the calling application removes the file to print before kprinter has sent it to CUPS
Comment 4 arne anka 2005-09-27 12:22:04 UTC
both work.
is it a workaround or an acceptable solution?
Comment 5 Michael Goffioul 2005-09-27 13:03:37 UTC
These are *solutions* in the sense that these options are specifically there to cope with the various possibilities:

case 1: the calling app pipes the PS to kprinter; in that case, when using kprinter without any option, you shouldn't see the "Files" tab in the main dialog; if it's not the case, you can force it using --stdin option

case 2: the calling app calls kprinter with a temporary file; in that case, you should see the "Files" tab in the main print dialog; however, the common problem is that the temporary file gets deleted by the client before kprinter sends it to CUPS (because the sending process takes place in another process); in that case, the -c option forces kprinter to make a copy of the file, solving that problem
Comment 6 arne anka 2005-09-27 13:46:12 UTC
if using -c there's no "files" tab -- but it prints anyway.
Comment 7 Michael Goffioul 2005-09-27 13:58:56 UTC
The -c flag shouldn't have an effect in this case, as it looks like data is coming from stdin. If it does not work without the "-c" flag, then there's something wrong in the kprinter logical and/or a problem with how Opera calls the external print program.

Cristian: there's something to check here.
Comment 8 Cristian Tibirna 2005-09-27 14:13:23 UTC
My reading of the comment #4 was: "using either one of --stdin or -c makes printing from work". Michael reads it as "only using both --stdin or -c at the same time works". Arne, could you please specify?
Comment 9 arne anka 2005-09-27 14:20:08 UTC
kprinter --stdin -> works
kprinter -c -> works

kprinter --stdin -c -> does not work

all clarity obfuscated?
Comment 10 Cristian Tibirna 2005-09-29 06:32:34 UTC
Hmm... I can't reproduce this. Do:

1) echo "hello" | kprinter --stdin -c
2) choose "Print to File (PDF)" (or PS)
3) accept conversion of mimetype text and generally say "OK" to everything kprinter requests
4) an output like 

[ 1 pages * 1 copy ] left in /tmp/kde-ctibirna/kdeprint_XOAckVO7
[1] Wrote 1 pages, 450398 bytes

should appear
5) visualize the ~/print.pdf or ~/print.ps file that you should by now obtain

Does it contain the word "hello" ?

Thanks

Comment 11 arne anka 2005-09-29 08:56:12 UTC
> Does it contain the word "hello" ?

yes. 
but in cooperation with opera it's not functional.
i get the progress-information of opera ("printing page X") and then it's over.

i suggest you install opera (it's free available) and test yourself -- would be nice to see if it's single issue on my computer or a general issue wirh opera and kprinter.
Comment 12 Michael Goffioul 2005-09-29 09:40:13 UTC
Side note: -c and --stdin shouldn't have effect on each other. They are part of 2 separate logical paths in the kprinter process. There's something strange here.
Comment 13 Cristian Tibirna 2005-09-30 06:46:11 UTC
Created attachment 12775 [details]
differences between same file printed with opera directly and with opera through kprinter
Comment 14 Cristian Tibirna 2005-09-30 06:48:58 UTC
Very strange! See below.

Arne? Did you manage to print anything with kprinter from opera? I mean, succesfully put it in a ps file or on paper?

I tried:
> --stdin alone, -c alone (both make kprinter dialog appear, without the "Files" tab, as expected), 

> no options at all, --stdin with -c and --stdin -c -o (for any combination kprinter doesn't even appear, nothing happens, which is weird, it more looks like kprinter is never launched...)

What intrigues me is that loading this very simple file:

<html><body>test</body></html>

and trying to print it to a ps file with opera's own print-to-file option and, alternatively, with kprinter --c, I obtain two quite similar PS files, but the one obtained from kprinter is can't be parsed at all by ghostscript (plenty of errors) and it contains slight differences that I attach here above.

I start to think there is something bogus in opera and I would invite you to report this bug (give the bugs.kde.org URL too if you want) to the opera team.

Comment 15 Michael Goffioul 2005-09-30 09:32:33 UTC
Strange, indeed. When printing to PS file from kprinter, it actually does nothing, it just copy the incoming PS data to the given location. Something to try is to use a script like this as print program in opera:

#!/bin/sh
exec cat > /tmp/test.ps

With this, you should be able to at least check the PS coming from Opera and see whether it's bogus.

Michael.
Comment 16 Cristian Tibirna 2005-09-30 14:37:10 UTC
I tried that already. It doesn't do anything. No file created.

Plus:
http://list.opera.com/pipermail/opera-linux/2005-April/008882.html
(it basically says it doesn't work with lpr either)

Sorry, as long as the printing dialog in opera says that the printing program has to read stdin and 'cat > test.ps' doesn't do anything, I will have to consider that this is a bug in opera. Since the code is closed I can't even try to begin to look further, please notify opera developers.
Comment 17 arne anka 2005-09-30 15:45:32 UTC
#14
> no options at all, 
surprising -- with no option at least the kprinter dialog shows up.
no problem to file  a bug-report -- but what should i say? atm i lost track of the issues _you're_ experiencing (my issue is solved by using --stdin _or_ -c :-).
the behaviour reported in the link in #16 did i never experience (although i use opera since 5.x continuously).
Comment 18 Cristian Tibirna 2005-09-30 16:45:06 UTC
Yes, sorry. Without options, kprinter shows up but it shows it will try to print a temporary file called "%20" (which is the url encoding for a space, like " ").

I think you should report to opera that 'cat > /tmp/test.ps' given as a printing program doesn't do anything.

I'm surprised that you get correct ps files with 'kprinter --stdin'.

Thanks a lot.
Comment 19 Michael Goffioul 2005-09-30 16:53:39 UTC
Well, it doesn't suprise me that much. From all the discussions and test, it appears to me that there's a communication problem between Opera and the child print process. This has as result to mess up the STDIN detection mechanism of kprinter: if kprinter detects something on stdin, it assumes data coming from stdin, otherwise it assumes being called with a file to print; however it's not the case, so it ends up in a state where it should read from stdin, but its internal flags are not correctly set.
When using the --stdin option, this bypasses the detection mechanism and set the flags correctly, resulting in a pritn success. At leats that's my interpretation.

Michael.
Comment 20 Cristian Tibirna 2005-09-30 16:58:06 UTC
My surprise comes from the fact that Arne seems to print correctly with kprinter --stdin while I only get corrupted postscript (see the diff).
Comment 21 arne anka 2005-09-30 17:10:33 UTC
following #19 it seems to be at least partially to be a kprinter issue?
regarding #20: i stopped wondering a while ago -- the network-printers they got here are really weird, albeit supposed to understand postscript (oki 20something).
Comment 22 Dave Gilbert 2006-01-01 16:25:39 UTC
I've got to say that I believe the right answer here is not to use printer instances; yes you can bodge it by forcing everything through kprinter, but it seems to me that CUPS is just too broken in the way it does instances.
Comment 23 John Layt 2008-12-31 19:03:49 UTC
Closing old Resolved status bug.