Version: (using KDE KDE 3.1.3) Installed from: Compiled From Sources Compiler: gcc 3.2.1 OS: Linux (I report this bug on behalf of my friend who has a real PS printer. I have a non-PS printer myself.) Currently, kghostview uses gs to convert PDF files to PostScript before printing. If a PDF file has a specific paper size set for one of its pages with a /MediaBox key, then gs will interpret that and insert a corresponding "setpagedevice" into the output PS file. The problem is that some scanning programs out of our control (like ScanWizard 5) produce PDF files with a /MediaBox equal to the size of the scanned area, not to the entire scanned page size. Such bad PDF files are also found on the web. The resulting PS files with a non-standard paper size print happily on non-PS printers with gs, but don't print on real PS printers. Instead the following page appears e.g on Lexmark Optra C710: =============================================== ERROR: configurationerror OFFENDING COMMAND: setpagedevice ERRORINFO: Key = /PageSize Value = arraytype STACK: dicttype =============================================== The minimal PDF file showing this problem can be obtained by doing a ps2pdf on the following PS file: ----------------------------------------------- %!Adobe-PS << /PageSize [ 515 743 ] >> setpagedevice /Helvetica findfont 28 scalefont setfont 0 setgray 50 50 moveto (Test page) show showpage ----------------------------------------------- This behaviour is in fact documented in PostScript Language Reference Manual, 3rd ed., p. 434. Some workarounds that might be useful: 1) Add -sPAPERSIZE=... -dFIXEDMEDIA to gs options when printing. The "setpagedevice" command will still appear in the resulting PS file, but with arguments specifying a standard paper size. The page will print, but will not be centered. 2) Or (untested) add the following command somwhere at the beginning of the PS file produced by GS: << /Policy << /PageSize 3 >> >> setpagedevice as described in PLRM, 3rd ed., p. 434. I haven't found PS files with nonstandard paper size on the web, but this report applies to them also. Since we don't do a ps2ps on them, we must invent a different workaround. Yes, I know that it's a bug in software that produces such PDF files, not in kghostview, but they are out of our control.
Created attachment 11091 [details] pdf file with non standard paper size (here the standard is A4) i can confirm this bug. Just try to print out the pdf file. I'm using SuSE 9.1 and the SuSE KDE 3.4 rpms installed. I have kghostview 0.20 installed. I get the same error message. I also tried to print to a postscript file, and then tried to use kprinter print.ps and got the same error, therefore the postscript generation doesn't seem to work. printing this file from xpdf works well.
Can you confirm whether or not this bug applies with Okular?
Sorry, I am not a KDE user anymore, but I will test this if you recommend a KDE-based LiveCD or LiveDVD that supports printing.
Hi Alexander, thanks for your offer. There are lots of KDE-based LiveCD, KUbuntu being one of them http://www.kubuntu.org/getkubuntu I understand that printing should work on the LiveCD but actually I have never tried it. Thanks a lot for the offer to give it a try :-)
I have done the following on a Kubuntu 12.04 LiveCD: 1. Installed a Generic PostScript printer on socket://127.0.0.1:9100 2. Created a test PDF file following my own instructions dated 2003-09-13 17:09:29 UTC 3. Started nc -l 127.0.0.1 9100 > dump.ps 4. Printed the test PDF file using Okular 5. Examined the dump.ps file using "less", with the following criteria: either the setpagedevice command should be redefined in the prolog, or there should be no "<< /PageSize [ 515 743 ] >> setpagedevice" line on the result. 6. Repeated the test using the original bad ps file. The offending setpagedevice instruction is not in the resulting ps file when printing a pdf from Okular. Additionally, when printing a pdf, Okular inserts this, effectively redefining setpagedevice: /pdfSetup { 3 1 roll 2 array astore /setpagedevice where { pop 3 dict begin /PageSize exch def /ImagingBBox null def { /Duplex true def } if currentdict end setpagedevice } { pop pop } ifelse } def This is called as follows: 595 842 false pdfSetup i.e. the original clearly-incompatible page size is not mentioned at all. Or you may want to punt it and say that it is a bug in CUPS, because "printing" the bad ps file using lpr would fail due to setpagedevice. I think I have a PostScript network printer near here (it is just not configured on my box because there is another, non-PostScript, printer closer to my desk), will test more and report the results.
OK, tested with an HP laserJet 3055 configured as a generic PostScript printer. The default paper size is set to A4 in CUPS, and the Properties dialog in KDE also shows A4 as the desired paper size for the printer. 1. Printing test.ps (the file between the "---" markers in the original bug submission) using Okular results in the printer asking for the proper paper - i.e. the bug is still there for PS. 2. Printing test.pdf generated by "ps2pdf test.ps" using Okular just works on A4 paper - i.e. no bug for PDF. 3. Printing either test.ps or test.pdf using lpr results in the printer asking for the proper paper.
So the bug still applies. Thanks!
Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved.