Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Every 2nd print to HP Laserjet prints raw postscript - leftover character in print? #17

Open
vsessink opened this issue Feb 2, 2024 · 8 comments
Assignees

Comments

@vsessink
Copy link

vsessink commented Feb 2, 2024

Every 2nd print to my old but trusted HP Laserjet P2055dn prints raw postscript.
To reproduce it, I first removed every snap instance of cups and the hplip printer app, just to make sure they weren't interfering; afterwards, I installed them:

snap remove cups --purge
snap remove hplip-printer-app --purge
snap install cups --edge # installs cups (edge) 2.4.7-5
snap install hplip-printer-app --edge # installs hplip-printer-app (edge) 3.22.10-3

I'm installing a printer with http://localhost:8000
Name HP LaserJet P2055dn
Device: HP LaserJet P2055dn Network hp2055dn HPLIP (HP)
Driver Name: Auto-Detect Driver
[Add Printer]

This gives me a "Hp LaserJet P2055 Postscript" printer.

Now I turn off my printer (just to make sure there are no leftover print jobs), and turn it on again. I'm waiting a minute or so. I'm clicking "Print Test Page" and a nicely formatted test page will come out of the printer. Turning off the printer again. Waiting 60 seconds, printing another test page: prints fine.

Leaving the printer on will, however, print garbage (i.e. raw postscript). You'll have to push the "cancel" button on the printer to stop it from spitting out empty sheets of paper. After that, the next Test Page will print correctly.

Wild guesses: this looks like there is a leftover character somewhere at the end of the print job. But then again, as far as I know my printers, the Laserjet would then indicate it were busy with another print job. Simply using "echo hello|nc 9100" will print a page with "hello", then afterwards, the next Test Page will come out unharmed. Even trying the "hello" twice, the hello's match, i.e. it's not as if there is a spurious line feed somewhere in the system. Then again, these are all wild guesses, so take 'm with a grain of salt.

@vsessink
Copy link
Author

vsessink commented Feb 2, 2024

As a sidenote: the same happens when I add the HP LJ P2055dn to the ps-printer-app.

@vsessink
Copy link
Author

vsessink commented Feb 2, 2024

tcpdump shows:

·%-12345X@PJL
@PJL JOB NAME = "Test Page" DISPLAY = "4 valentyn Test Page"
@PJL SET USERNAME = "valentyn"
%%@PJL ENTER LANGUAGE = PostScript 
%!PS-Adobe-3.0
%%Invocation: gs -q -dNOPAUSE -dBATCH -dSAFER -dNOMEDIAATTRS -sstdout=? -sDEVICE=ps2write -dShowAcroForm -sOUTPUTFILE=? -sProcessColorModel=DeviceGray -sColorConversionStrategy=Gray -dLanguageLevel=2 -r600 -dCompressFonts=false -dNoT3CCITT -dNOINTERPOLATE ?
%%+ ? -f ?
%%HiResBoundingBox: 0 0 595.00 842.00
%%Creator: GPL Ghostscript 9550 (ps2write)
%%LanguageLevel: 2

Tried to find the code in Cups and/or hplip but couldn't. The Printer PPD file simply says:

*Protocols: TBCP PJL
*JCLBegin: "<1B>%-12345X@PJL JOB<0A>"
*JCLToPSInterpreter: "@PJL ENTER LANGUAGE = PostScript <0A>"
*JCLEnd: "<1B>%-12345X@PJL EOJ <0A><1B>%-12345X"

@x-zvf
Copy link

x-zvf commented Mar 20, 2024

@vsessink I have the same printer and the same issue. I worked around it by using PCL3 instead of the "recommended" PostScript

@vsessink
Copy link
Author

vsessink commented Jul 8, 2024

Hmm. Weird. At the end of ppd-emit.c there is a

  ppdEmit(ppd, fp, PPD_ORDER_JCL);
  fputs(ppd->jcl_ps, fp);

that seemed a bit weird - although I don't understand the exact code path yet. However, exchanging these two lines, i.e.

  fputs(ppd->jcl_ps, fp);
  ppdEmit(ppd, fp, PPD_ORDER_JCL);

made the output much better:

@PJL SET USERNAME = "valentyn"
@PJL ENTER LANGUAGE = PostScript
%%%!PS-Adobe-3.0

Note the three % signs, that's one extra as far as I know. But the PJL suddenly is good. But the code has been like this for ages - it was like this 9 years ago. So what's happening here? I'll ask the mailing list.

@michaelrsweet
Copy link
Member

I'll need to look at the PPD in question to see what is different about it...

@michaelrsweet michaelrsweet self-assigned this Jul 11, 2024
@vsessink
Copy link
Author

@vsessink
Copy link
Author

That's with the comments. I'll install a clean one right away.

@vsessink
Copy link
Author

I just did a simple /usr/lib/cups/driver/postscript-hp cat 'postscript-hp:0/ppd/hplip/HP/hp-laserjet_p2055_series-ps.ppd'|gzip >pdrv.ppd.gz from package printer-driver-postscript-hp Version: 3.22.10+dfsg0-2 on Debian12. I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants