Bug 321046 - printing some pdfs results in "undefinedresult" error due to "awidthshow" command
Summary: printing some pdfs results in "undefinedresult" error due to "awidthshow" com...
Status: RESOLVED NOT A BUG
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 0.16.3
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-11 22:16 UTC by wxl
Modified: 2014-02-11 11:02 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
example PDF causing the offending command (35.31 KB, application/pdf)
2013-10-29 06:35 UTC, roland
Details
PS created by pdftops (168.32 KB, application/postscript)
2013-10-29 06:37 UTC, roland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wxl 2013-06-11 22:16:40 UTC
The attached file is an example of a file then when printed in 0.16, fails with the following error (printed out with a particular printed PDF-- it prints the logo and the 5 lines underneath it but nothing else):

ERROR:
undefinedresult
OFFENDING COMMAND:
awidthshow
STACK
S
0
0
32
0
0
-mark-
-mark-
-mark-

Reproducible: Always

Steps to Reproduce:
1. Open up attached document in Okular 0.16.3
2. Go to File > Print
3. Print to HP LaserJet 4050
Actual Results:  
The incomplete PDF prints, along with an error page.

Expected Results:  
It should have printed the whole PDF with no errors.

This is with a HP LaserJet 4050 (using the recommended HP LaserJet 4050 Series Postscript driver), FYI.

Printing to a different printer works fine. 

However, if I use an old version of Okular (0.14) I can print to either printer, including the LaserJet, without any trouble. 

According to the printer test page, both the machines running 0.14 and 0.16 are using the same printer driver: HP4050_5.PPD though one has version "PPD-VERSION-STRING" and the others is "" (so they're both equally null?), so I don't think there's any issue with the driver.

That being said, I'm discinclined to believe that the printer or the driver is the issue, thus why I'm reporting an Okular bug.
Comment 1 Albert Astals Cid 2013-06-11 22:36:21 UTC
You say printing to a different printer works, so it seems that other printer understands our postscript and the first one not.

You can get the postscript file we print (or very similar) by running pdftops and then try sending that to the printer with lpr or similar.

The printer will probably complain again.

Then you should open the .ps file with gs and see if it works.

If it works, not sure what we can do since our postscript would seem to be valid.

And yes, i know you say it used to work, well we (actually poppler) may have changed the postscript code we generate to print, but if it's still valid it's not our fault your printer does not understand it.

Of course you can always use the rasterize "Force Rasterization" option that will  print "an image" and it should work better, but it'll be of lower quality.
Comment 2 roland 2013-10-28 21:29:07 UTC
I have exactly the same problem with Okular 0.16.5 and a HP 4050 N. It appears with almost every PDF file.
Comment 3 Albert Astals Cid 2013-10-28 23:05:43 UTC
The original reporter never answered on my comment, you are not answering either, do you want to try to help or shall i just close the bug?
Comment 4 wxl 2013-10-28 23:14:06 UTC
i never replied because i deleted the darn pdf and couldn't re-create it. so if roland can post up an example, i'll do more testing!
Comment 5 roland 2013-10-29 06:35:45 UTC
Created attachment 83192 [details]
example PDF causing the offending command

This PDF is not printable by okular on a HP 4050 N.
Comment 6 roland 2013-10-29 06:37:01 UTC
Created attachment 83193 [details]
PS created by pdftops

This PS was obtained from the example PDF by pdftops
Comment 7 roland 2013-10-29 06:40:19 UTC
I just uploaded one of PDFs causing the offending command and the PS obtained by pdftops. When I try to open the PostScript with gs I see an error message as well:

roland@vernita:~/$ gs resultate.ps 
GPL Ghostscript 9.05 (2012-02-08)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
%%BoundingBox: 26 51 571 790
%%HiResBoundingBox: 26.189999 51.173998 570.563983 789.731976
>>showpage, press <return> to continue<<

The postscript file does not show.

Hope this helps in tracking down the problem. Please let me know, if I can help with anything else.
Comment 8 wxl 2013-10-29 17:08:47 UTC
Using roland's pdf, I have problems still with:
* okular 0.16.5  (4:4.10.5-0ubuntu0.1 according to Canonical— a reference to the KDE version)
* libpoppler28 0.20.5 (0.20.5-1ubuntu3)
* GPL Ghostscript 9.07 (2013-02-14) (9.07~dfsg2-0ubuntu3.1)

pdftops produces the ps fine and gs has no problem displaying the ps. printing the ps with lp fails. 

so sounds like the problem is the printer driver then?
Comment 9 Albert Astals Cid 2013-10-29 19:30:08 UTC
@roland i don't see any error in that gs output, are you sure it did not open a window? Take into account that gs windows usually make window managers unhappy so it may be behind somewhere or minimized

@roland If you send the ps file with lp/lpr to the printer, does it work?

@wxl, yes, i'd say so, i can print that pdf/ps fine here
Comment 10 wxl 2013-10-29 21:53:48 UTC
what's weird is the complaint about awidthshow. it's not even in the ps!
Comment 11 roland 2013-10-29 22:12:49 UTC
(In reply to comment #9)
> @roland i don't see any error in that gs output, are you sure it did not
> open a window? Take into account that gs windows usually make window
> managers unhappy so it may be behind somewhere or minimized

I just tried it again: no window opens with gs.

> @roland If you send the ps file with lp/lpr to the printer, does it work?

No, it produces the same error as the PDF.
Comment 12 wxl 2013-10-29 22:47:22 UTC
@roland, not sure you're on an ubuntu release but if you are, you may want to add some info to this bug i filed against the cups package: https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1246119
Comment 13 Albert Astals Cid 2013-10-29 22:52:38 UTC
Well, if lp/lpr can't print, it's not an okular bug. Closing as invalid, thanks for the investigation.
Comment 14 Mark van Rossum 2014-02-11 11:02:40 UTC
It is a pity there is a regression like this. Although it might be down to the printer firmware, it is an often used HP printer. Furthermore, other software like acroread and evince do not cause problems... 

Anyway, here is a workaround:
you can define an additional printer cue as a pcl. In my case 
HP LaserJet 4100 Foomatic/pxlmono
This will work fine. Or use acroread  -toPostScript as the pdf->PS converter.