Bug 234079

Summary: okular fails to print the pdf document
Product: [Applications] okular Reporter: anton <benderamp>
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: problem document

Description anton 2010-04-11 19:14:11 UTC
Version:            (using KDE 4.4.2)
OS:                Linux
Installed from:    openSUSE RPMs

Okular fails to print the pdf document (see attachment) - neither print preview, nor printing worked. When tried to call print preview, it locked for about 5 minutes (the window did repaint, but ui controls were not accessible), then showed dialog with message like "failed to generate print preview". When tried to print directly it also hanged for long time, then became fine without error message, but nothing printed.

Acrobat reader handled this document just fine.
Comment 1 anton 2010-04-11 19:15:24 UTC
Created attachment 42692 [details]
problem document
Comment 2 Albert Astals Cid 2010-04-11 19:21:33 UTC
Which poppler version do you have?
Comment 3 anton 2010-04-11 20:45:00 UTC
rpm -qi libpoppler5
Name        : libpoppler5                  Relocations: (not relocatable)
Version     : 0.12.3                            Vendor: openSUSE
Release     : 1.1.1                         Build Date: Wed 03 Feb 2010 

also tried to open the dialog again - the system became unresponsive for long time and I had to kill okular before the dialog appeared.

hm.. tried another document which is very simple - single page with text - which was created earlier with "print to pfd" kde print dialog feature - the page preview dialog also does not open and okular windows is also locked.

I have opensuse 11.2 with kde 4.4.2 from opensuse factory.
Comment 4 anton 2010-04-11 21:47:16 UTC
ok, I have made a bit more experiments.

1. For the 2nd issue with simple pdf file. The thing is that I had the system configured to print all documents to remote cups server and the server was down during this time. I have reconfigured system to use local cups server and for the simple document now when try to preview it receive error message "Could not open file:///tmp/kde-benderamp/okularQ25542.ps". This is the problem (1st - preview does not work, 2nd - when cups server is down ocular hanges), but it seems it might be not related to the original issue, so dismiss this comment - then receive print preview dialog with grey rectangle as contents.

2. For the original issue - I have 1st receved it when the remote cups server was available and acrobat reader printed the document just file to this remote printer. Now with using local cups server the problem with attached document repeats exactly as describe, so it is not related to cups server and also it seems that the attached document makes sense.
Comment 5 Albert Astals Cid 2010-04-12 02:03:16 UTC
Well, this pdf takes a while converting to ps (that is needed for printing) takes 1 minute here in a newish machine, but at the end itworks for me with poppler 0.12.0 and 0.12.4, can you please try this?

pdftops ~/yourpdf.pdf
and then
gs ~/yourpdf.ps
and wait and press Enter to change pages and check if everything displays fine?
Comment 6 anton 2010-04-14 00:56:43 UTC
>pdftops ~/yourpdf.pdf

this gave me a ps file of about 650 mb (vs 260 kb of the original pdf)

>pdftops ~/yourpdf.pdf

showed it generally fine.

And actually today I found that I had 0 bytes in my /tmp dir and when I made disk usage report from krusader, I have found 650 mb ps file in my /tmp/kde-user directory, so I think that lack of free space in /tmp was the reason why the preview finally did not show up.

So, though I still don't think that preview of 260kb pdf file which looks rather simple (and was originally created in inkscape) should require to create 650 mb ps file even in tmp (especially after seeing how fine adobe acrobat reader handles this document), I see that generally this is not okular problem (though probably it could use some other method of generating preview directly from pdf, but don't know exactly how all this staff works and if it is possible at all).

For this bug report - I think that it shows that generating preview for some documents might require rather long period of time and at the end it might fail, so it would be much better if ocular did show preview window immediately after calling it from menu and ps preview file generation process could be shown as progress bar inside this window (generation process could be run in background thread) - working 'cancel' button which could terminate this process if it takes too long could also give much help. Locking okular window for unpredictable period of time is just not good.


For the issue with simple pdf file (when the reason of long delay was unavailable network printer) - I can open separate bug report, but the desired solution would also be similar as for this one:
- show all long-running jobs required for generating preview (generate preview itself + search network printers) in background thread shown as progress-bar on the preview window.
- unavailable network printer should not be a reason to refuse to show print preview window with generated preview (or do we need to get some printer-specific data like default page size/layout in order to generate the preview?).
Comment 7 Albert Astals Cid 2010-04-14 20:48:17 UTC
Well, you might want to file a bug in the poppler bugzilla about generating a file too big, in any case that's not a bug in okular side.

Obviously no, you can not print preview a pdf without converting it to ps, because the linux printing system only understands ps files, so you want to preview the converted thing.

Feel free to open a wish asking for the printing not to be blocking for the graphical interface.

You gave lots opinions on what you would like, and we apreciate that, but this bug is "okular fails to print", so let's center on that, can you check if giving enough space in your /tmp fixes the problem about printing not working?
Comment 8 anton 2010-04-14 21:20:19 UTC
>can you check if giving enough space in your /tmp fixes the problem about printing not working?

no, this did not fix the issue. I have freed enogh space in tmp - while okular being locked, free space was descreasing (tmp ps file had been created), then error dialog appeared "Could not print the document. Please report to bugs.kde.org" and the free space returned back (tmp ps file was deleted). I have also tried to convert original pdf file to ps and open it with okular - preview failed to show with same message.
Comment 9 Albert Astals Cid 2010-04-14 21:43:02 UTC
Oh, you should have started saying you got exactly that popup dialog, do you have insalled on of this programs? lpr-cups, lpr.cups, lpr or lp?
Comment 10 anton 2010-04-14 21:47:33 UTC
I have /usr/bin/lpr from package cups-client-1.3.11-4.1.x86_64
Comment 11 Albert Astals Cid 2010-04-14 22:00:04 UTC
If you enable all kde debug areas when running kdebugdialog (type okular on the top), run okular from the shell and try to print, do you get a debug line like

Executing lpr with arguments someargumentshere

?
Comment 12 anton 2010-04-14 22:23:39 UTC
Ok, this works now.

I have opened krusader in /tmp/kde-user directory and saw that while generating preview it first created okular-xxx.ps file with 650mb in size (whis was ok), then when this finished it started to create another "qt_temp.e26039" file with same size (which failed because I still did not have enough space for the 2nd file of same size) - so for generating preview for this file I needed not 650mb, but 1.1 gb free space in /tmp. Afer freeing even more space, the preview was shown fine. Thank's for help.
Comment 13 Albert Astals Cid 2010-04-14 23:36:32 UTC
I've removed the need for a double copy and will try to make that error message a bit better.
Comment 14 anton 2010-04-15 09:37:22 UTC
>Feel free to open a wish asking for the printing not to be blocking for the
graphical interface.

Opened separate bug report here:
https://bugs.kde.org/show_bug.cgi?id=234419

thank's