Bug 293625

Summary: okular prints empty pages from pdf files
Product: [Applications] okular Reporter: Ralf Habacker <ralf.habacker>
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED UPSTREAM    
Severity: major CC: aacid, abulak, auxsvr, cruzki123, cunio, ole.langbehn, poletti.marco, ps_ml, qubodup, ray.foulkes, sqn14
Priority: NOR    
Version: 0.16.2   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Blank when printed

Description Ralf Habacker 2012-02-08 11:53:38 UTC
Version:           unspecified (using KDE 4.8.0) 
OS:                MS Windows

Printing pdf documents with okular version 0.14 on windows creates the exact number of pages the pdf document has unfortunally without any content. 

Print preview also shows empty pages after requiring a long time rendering the pages.


Reproducible: Always

Steps to Reproduce:
open okular
load pdf file 
create print view or try to print

Actual Results:  
print preview shows empty pages 
printer creates empty pages

Expected Results:  
print preview should have pagew with content
printer should print pages with content


Printing png files works without any problems, so the assumption is that this depends on okulars pdf engine.
Comment 1 Cruz Enrique 2012-08-13 13:56:30 UTC
It happen also to me in Gentoo with kde SC 4.9.0. Printing pdfs with gimp works perfectly and do not have any problem printing any other filetypes.
Comment 2 Ole Langbehn 2012-08-17 07:00:55 UTC
I'm hit too on gentoo, okular 0.15.0, kde 4.9.00.

Downgrading to okular 0.14.3 or 0.13.3 produces the same results.

I don't know if it's related, but okular prints these log messages when opening the print preview:

invalidfont -10
okular(26752)/okular (Spectre) GSRendererThread::run: Generated image does not match wanted size: [0x0] vs requested [90x127]
QImage::scaled: Image is a null image
invalidfont -10
okular(26752)/okular (Spectre) GSRendererThread::run: Generated image does not match wanted size: [0x0] vs requested [561x793]
QImage::scaled: Image is a null image
invalidfont -10
okular(26752)/okular (Spectre) GSRendererThread::run: Generated image does not match wanted size: [0x0] vs requested [80x113]
QImage::scaled: Image is a null image
Comment 3 Ray Foulkes 2012-12-03 09:27:33 UTC
On Kubuntu 12.04 with Okular Version 0.14.3 the symptoms are slightly different. On LinuxJournal 224 (a 111 page 14 megabyte pdf file)  I cannot "print to pdf file" any pages. All are blank, even when trying to print a single page. To a real printer it managed to print up to page 17 of 111 pages then output many blank sheets. When I run Okular from a terminal I get the output below on the terminal. I tested conversion to Postscript using:
pdftops -f 38 -l 41 dlj224.pdf dlj224.ps
and that worked ok.
I cannot give you the offending file since it is copyright, but you may have it already yourself. 
Note Okular works well for me for small files. This may be related to file size. Here is the output from Okular when trying to print page 5 of 111 of dlj224 to a .pdf file:

Image::scaled: Image is a null image
Error: /typecheck in definefont
Operand stack:
   F7303_0   --dict:9/10(L)--   Font
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1866   2   4   %oparray_pop
Dictionary stack:
   --dict:1164/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--   --dict:72/75(L)--
Current allocation mode is local
Current file position is 1383150
GPL Ghostscript 9.05: Unrecoverable error, exit code 1
Comment 4 Ray Foulkes 2012-12-03 09:29:45 UTC
On Kubuntu 12.04 with Okular Version 0.14.3 the symptoms are slightly different. On LinuxJournal 224 (a 111 page 14 megabyte pdf file)  I cannot "print to pdf file" any pages. All are blank, even when trying to print a single page. To a real printer it managed to print up to page 17 of 111 pages then output many blank sheets. When I run Okular from a terminal I get the output below on the terminal. I tested conversion to Postscript using:
pdftops -f 38 -l 41 dlj224.pdf dlj224.ps
and that worked ok.
I cannot give you the offending file since it is copyright, but you may have it already yourself. 
Note Okular works well for me for small files. This may be related to file size. Here is the output from Okular when trying to print page 5 of 111 of dlj224 to a .pdf file:

Image::scaled: Image is a null image
Error: /typecheck in definefont
Operand stack:
   F7303_0   --dict:9/10(L)--   Font
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1866   2   4   %oparray_pop
Dictionary stack:
   --dict:1164/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--   --dict:72/75(L)--
Current allocation mode is local
Current file position is 1383150
GPL Ghostscript 9.05: Unrecoverable error, exit code 1


So the problem is not directly related to Windows....
Comment 5 Ray Foulkes 2012-12-03 09:30:50 UTC
oops grovelling apologies for posting twice, I thought I was making an edit - sorry.
Comment 6 auxsvr 2013-02-20 23:04:19 UTC
One PDF file has the same problem here and okular output includes some lines with 

GPL Ghostscript 9.05: Error: Font Renderer Plugin ( FreeType ) return code = -1
syntaxerror -18

 If I use gs to rewrite the file with

gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf ex1.pdf

then the print preview of out.pdf appears fine in okular without the "syntaxerror -18" message. The main difference between the two files is that the one that works does not have the Mathematica1 fonts embedded, even though both render fine until print preview.
Comment 7 auxsvr 2013-02-20 23:06:12 UTC
This is on openSUSE 12.1, KDE 4.9.5. This is not confined on KDE-Windows!
Comment 8 Patrick Spendrin 2013-05-04 19:49:08 UTC
Works better in 4.10.2 on Windows (it shows the preview), even if generating the print preview still needs *ages*...
Comment 9 Robi 2013-05-04 19:51:36 UTC
Definetely not a KDE-Windows only problem;
I was hit by this as well, running Gentoo (amd64) and KDE 4.10.2, Okular v. 0.16.2
Comment 10 Jekyll Wu 2013-06-28 10:26:51 UTC
reassign to the okular product since the problem(s) doesn't seem to be windows specific according to recent comments.
Comment 11 Ole Langbehn 2013-06-28 18:04:28 UTC
If anyone needs anything in order to fix this, I'm still seeing this on gentoo linux, kde 4.10.4, and am willing to provide anything you need.
Comment 12 Albert Astals Cid 2013-06-29 12:06:59 UTC
Give us a PDF file that doesn't print
Comment 13 Robi 2013-07-03 21:33:37 UTC
Has this bug something to do with bug 319426 ?
Comment 14 Ole Langbehn 2013-07-12 14:15:27 UTC
I have a pdf file that does not print on 4.10.5.

Since this is an invoice with sensitive information, I am not attaching it to this bug report. But I'm willing to hand this to a developer via mail. Hope this helps.
Comment 15 Ole Langbehn 2013-07-12 14:20:22 UTC
Some more info:

Upon opening the print preview of pdfs that can't be printed, the preview is broken and stdout spits out:

invalidfont -10
okular(8671)/okular (Spectre) GSRendererThread::run: Generated image does not match wanted size: [0x0] vs requested [90x127]
QImage::scaled: Image is a null image
invalidfont -10
okular(8671)/okular (Spectre) GSRendererThread::run: Generated image does not match wanted size: [0x0] vs requested [561x793]
QImage::scaled: Image is a null image
invalidfont -10
okular(8671)/okular (Spectre) GSRendererThread::run: Generated image does not match wanted size: [0x0] vs requested [561x793]
QImage::scaled: Image is a null image
invalidfont -10
okular(8671)/okular (Spectre) GSRendererThread::run: Generated image does not match wanted size: [0x0] vs requested [80x113]
QImage::scaled: Image is a null image

This does not happen with pdfs that can be printed.
Comment 16 Jacek Pawlyta 2013-07-15 13:34:00 UTC
This is not only windows problem,
I use
Okular Version 0.16.5
Using KDE Development Platform 4.10.5
on Fedora 19 x86_64 and I have the same problem
Comment 17 Albert Astals Cid 2013-07-15 13:40:49 UTC
Does
LANG=C okular myfile.pdf
solve the problem?
Comment 18 Ole Langbehn 2013-07-15 13:45:52 UTC
No, same as before
Comment 19 Jacek Pawlyta 2013-07-15 13:50:00 UTC
This is not only Windows problem
I use Okular Version 0.16.5 on  KDE Development Platform 4.10.5 and Fedora 19 x86_64 and I see the same problem.

Unfortunately I can't send you the problematic pdf file because it contain some confident information. I checked that it was created using Nitro Reader 3  (3. 5. 0. 25) and uses Arial, Arial Bold fonts (replaced by Liberation Sans) as well as embedded ArialMT.

Hope it helps resolve the problem.
Comment 20 Albert Astals Cid 2013-07-15 13:51:17 UTC
Can you confirm that running
pdftops myfile.pdf
and then running
gs myfile.ps
does make gs complain?
Comment 21 Ole Langbehn 2013-07-15 13:58:35 UTC
(In reply to comment #20)
> Can you confirm that running
> pdftops myfile.pdf
> and then running
> gs myfile.ps
> does make gs complain?

15:54:52 ole@leo ~/projects/administration/belege-2013/ER $ gs myfile.ps 
GPL Ghostscript 9.07 (2013-02-14)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusSanL-Bold.
Can't find (or can't open) font file NimbusSanL-Bold.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusSanL-Bold.
Can't find (or can't open) font file NimbusSanL-Bold.
Querying operating system for font files...
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusSanL-Bold.
Can't find (or can't open) font file NimbusSanL-Bold.
Didn't find this font on the system!
Unable to substitute for font.
Error: /invalidfont in /findfont
Operand stack:
   F47_0   1   1   --nostringval--   Helvetica-Bold
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1900   1   3   %oparray_pop   1899   1   3   %oparray_pop   1883   1   3   %oparray_pop   1771   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1852   5   4   %oparray_pop
Dictionary stack:
   --dict:1168/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--   --dict:67/75(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 12570
GPL Ghostscript 9.07: Unrecoverable error, exit code 1
Comment 22 Albert Astals Cid 2013-07-15 14:48:03 UTC
So basically the poppler library (code we use to handle pdf) doesn't produce a correct ps file, so it can't be printed, please open a bug report at https://bugs.freedesktop.org against poppler
Comment 23 abulak 2014-03-02 11:11:33 UTC
For those of You who get the 
"Can't find (or can't open) font file /usr/share/ghostscript/..." 
You're using infinality, aren't You? ;-)
( If not, then something else blocks Type 1 fonts on Your system.)

Try this: 
http://www.infinality.net/forum/viewtopic.php?f=2&t=238&sid=770ee767def695dbaf74ef90d88c7887&start=10

(note that it requires that You move the Font folder every Ghostscript update)
Comment 24 qubodup 2015-10-09 14:53:29 UTC
Created attachment 94915 [details]
Blank when printed

PDF file that produces blank pages when I try to print page 1 only or when I try to print all pages on a OKI B410.
Comment 25 qubodup 2015-10-09 17:27:53 UTC
re: comment #24 - It printed some PDF files just moments before the issue. Chromium and epdfview couldn't print pages either. I updated the system (no relevant libraries were updated apparently) just in case and rebooted. Then Okular could print the mentioned file. Sorry for not testing first.