You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong media limits for A4 paper using HP OfficeJet 7740 Pro due ignoring duplicated sizes in ppdCacheCreateWithPPD() #29
To Reproduce
Steps to reproduce the behavior:
Print A4 pages with the HP OfficeJet 7740 Pro.
Media has wrong offset as the printer thinks the paper has media limits of: 0.42 x 0.42 to 27.52 x 35.14 cm
Expected behavior
Print normal A4 pages
System Information:
OS and its version: latest Arch Linux, above linked bug is on Ubuntu 23.04
please follow https://github.com/OpenPrinting/cups/blob/master/REPORTING_ISSUES.md and provide the necessary information - like CUPS debug2 logs when you print and try to reproduce via CUPS CLI. Especially it would be interesting to see how the printer behaves with everywhere driver without hplip PPD.
You can install it (if you have IPP enabled on your printer - the Ubuntu reporter has it, but Idk about you - please enable it if you don't):
$ lpadmin -p <arbitrary name for the printer> -v ipp://<printer-ip>/ipp/print -m everywhere -E && sleep 3 && ls -lah /etc/cups/ppd/<chosen printer name>.ppd
If the ppd file exists, IPP Everywhere installation went ok and you can try print A4 via it.
EDIT:
Of course I forgot to escape < > again...
EDIT2: @zdohnal Line with 3 backticks before and after a block of code lines and no escaping needed, or 1 backtick before and after a piece of code in the middle of a line
I tried to run lpadmin -p -v ipp://192.168.178.21/print -m everywhere -E && sleep 3 && ls -lah /etc/cups/ppd/.ppd but this does not work. What do I need to change?
I'm sorry, I didn't realize markdown removed some parts of the command... and from the other files I see you either don't have mDNS working on your machine, or you have disabled IPP on the printer (because I don't see a temporary queue for your printer in lpstat -e - Ubuntu reporter had implicitclass printer there, which indicates the printer works via IPP), thus the command lpadmin might not work if you disabled IPP - you can check if everything is ok for IPP Everywhere by:
if it fails with the error "Host is down", check IPP support in your printer, enable it and try again. If the result is [FAIL], your printer does not support properly IPP Everywhere and you can ignore the lpadmin command.
The command should like like this, if your printer's IP is 192.168.178.21 and you choose to name your destination 'test'
$ lpadmin -p test -v ipp://192.168.178.21/ipp/print -m everywhere -E && sleep 3 && ls -lah /etc/cups/ppd/test.ppd
and then try to reproduce the issue with this printer.
lp -d HP_OfficeJet_Pro_7740_series_F712A4 <some A4 document>
produced a document with wrong page dimensions and wrong padding/borders, same for the other command as well unfortunately
The interesting part is -scupsPageSizeName=11x14 which seems like 11x14in from the driver - it looks like universal filter from cups-fillters guesses incorrect size - @tillkamppeter would you mind looking into it?
and ppdCacheCreateWithPPD() (which code is taken from CUPS, but it was not used in filters previously AFAIK, thus this didn't happen) ignores any additional size options which have the same sizes - however, the thrown away option A4 is as a default one, causing the filter to use the first size from the available list - 11x15.
@piratenpanda can you try to remove/comment out with *% the first line I mentioned and reinstall the printer with changed file like this:
$ sudo lpadmin -p HP_OfficeJet_Pro_7740_series_F712A4 -v socket://192.168.178.21 -P <path to the changed file> -E
and see if it helps?
@michaelrsweet@tillkamppeter it looks like HPLIP thought /cupsInteger makes a difference in CUPS and let the driver to have two size options with the same size, but I don't see this keyword parsed in the function - is it a driver issue to depend on it? And is it correct behavior to drop any duplicated size options from PPD?
changed the title [-]Wrong media limits for A4 paper using HP OfficeJet 7740 Pro[/-][+]Wrong media limits for A4 paper using HP OfficeJet 7740 Pro due ignoring duplicated sizes in ppdCacheCreateWithPPD()[/+]on Nov 28, 2023
Yeah I'm not sure what they are trying to do but it isn't right, even for regular PPDs. Both use the same commands and the cupsInteger0 value (26) is the PCL media size value for A4... Probably the right fix is to exclude any sizes that use a non-standard name for a standard size.
Thinking about it deeper - what if the HPLIP (or any other) filter does depend on using non-standard size name? In such cases we might need to keep all the sizes, even the duplicate ones... WDYT? @tillkamppeter@michaelrsweet
Letting ppd-cache.c keep duplicate sizes would preserve the non-standard names which some sizes got in addition, but is it conforming with IPP standards to have duplicate page sizes in the list?
We can also have:
Non-duplicate paper sizes with non-standard name
The default page size's name is non-standard, as the only incarnation of that size has a non-standard name, or the incarnation with non-standard name is selected as default
All incarnations of a given size have non-standard names
By replacing all entries of each page size by one entry with standard name and changing the default page sizes name to the standard nameof the size referenced by it should solve all the above problems.
Only if the driver needs the non-standard names one needs to somehow preserve them, for example by keeping the duplicate sizes ...
Finally, I have a solution. For now, it was easier to remove the line in the ppd file. Here is the diff:
# diff /etc/cups/ppd/OfficeJet_Pro_7740.ppd.O /etc/cups/ppd/OfficeJet_Pro_7740.ppd
2c2
< *%%%% PPD file for HP Officejet Pro 7740 Series with CUPS.
---
> *%%%% PPD file for HP Officejet Pro 7740 Series with CUPS. (Pivert Edit)
279d278
< *PageSize IndexCardA4/Index Card A4 8.27x11.69in : "<</cupsInteger0 26/PageSize[595.44 841.68]/ImagingBBox null>>setpagedevice"
Activity
zdohnal commentedon Nov 24, 2023
Hi,
please follow https://github.com/OpenPrinting/cups/blob/master/REPORTING_ISSUES.md and provide the necessary information - like CUPS debug2 logs when you print and try to reproduce via CUPS CLI. Especially it would be interesting to see how the printer behaves with everywhere driver without hplip PPD.
You can install it (if you have IPP enabled on your printer - the Ubuntu reporter has it, but Idk about you - please enable it if you don't):
If the ppd file exists, IPP Everywhere installation went ok and you can try print A4 via it.
EDIT:
Of course I forgot to escape
< >again...EDIT2:
@zdohnal Line with 3 backticks before and after a block of code lines and no escaping needed, or 1 backtick before and after a piece of code in the middle of a line
piratenpanda commentedon Nov 25, 2023
error_log.txt
log.txt
lpstat-e.txt
lpstat-t.txt
lpstat-v.txt
PPD: HP_OfficeJet_Pro_7740_series_F712A4.zip
d0031-001.txt
I tried to run
lpadmin -p -v ipp://192.168.178.21/print -m everywhere -E && sleep 3 && ls -lah /etc/cups/ppd/.ppdbut this does not work. What do I need to change?zdohnal commentedon Nov 27, 2023
I'm sorry, I didn't realize markdown removed some parts of the command... and from the other files I see you either don't have mDNS working on your machine, or you have disabled IPP on the printer (because I don't see a temporary queue for your printer in lpstat -e - Ubuntu reporter had implicitclass printer there, which indicates the printer works via IPP), thus the command lpadmin might not work if you disabled IPP - you can check if everything is ok for IPP Everywhere by:
if it fails with the error "Host is down", check IPP support in your printer, enable it and try again. If the result is [FAIL], your printer does not support properly IPP Everywhere and you can ignore the lpadmin command.
The command should like like this, if your printer's IP is 192.168.178.21 and you choose to name your destination 'test'
and then try to reproduce the issue with this printer.
==================================================================================
From the error_log I see you printed a test page and there are no settings regarding page size:
AFAIK if there are no settings from application, printer's default (may de server default or driver default) should be applied by scheduler or filter.
Can you attach .txt file with outputs from
lpoptions -p HP_OfficeJet_Pro_7740_series_F712A4 -land
lpoptions -p HP_OfficeJet_Pro_7740_series_F712A4?What application did you use for printing the test page?
Can you try to print a normal A4 page, once without settings and then with settings? f.e.:
lp -d HP_OfficeJet_Pro_7740_series_F712A4 <some A4 document>and
lp -d HP_OfficeJet_Pro_7740_series_F712A4 -o PageSize=A4 <some A4 document>Do those two work? Printing test page uses a different filter functions, which can influence the output.
In any case, thank you for information!
piratenpanda commentedon Nov 27, 2023
Thanks for the reply. Here is some more:
printer-attributes.txt
Creating the test printer worked fine and printing a test page has the proper page dimensions. Everything looks fine.
lpoptions-l.txt
lpoptions.txt
lp -d HP_OfficeJet_Pro_7740_series_F712A4 <some A4 document>produced a document with wrong page dimensions and wrong padding/borders, same for the other command as well unfortunately
zdohnal commentedon Nov 27, 2023
I've looked deeper into the error_log to find any possible page size related logging and I found an interesting log:
The interesting part is
-scupsPageSizeName=11x14which seems like11x14infrom the driver - it looks like universal filter from cups-fillters guesses incorrect size - @tillkamppeter would you mind looking into it?piratenpanda commentedon Nov 27, 2023
As a quick note: I made myself an Ubuntu LTS stick and printing from that works just fine. So maybe this bug got introduced later.
zdohnal commentedon Nov 28, 2023
Ok, I found out the reason why it behaves this way - the HPLIP PPD has two size options with the same length and width:
and
ppdCacheCreateWithPPD()(which code is taken from CUPS, but it was not used in filters previously AFAIK, thus this didn't happen) ignores any additional size options which have the same sizes - however, the thrown away option A4 is as a default one, causing the filter to use the first size from the available list -11x15.@piratenpanda can you try to remove/comment out with
*%the first line I mentioned and reinstall the printer with changed file like this:and see if it helps?
@michaelrsweet @tillkamppeter it looks like HPLIP thought
/cupsIntegermakes a difference in CUPS and let the driver to have two size options with the same size, but I don't see this keyword parsed in the function - is it a driver issue to depend on it? And is it correct behavior to drop any duplicated size options from PPD?piratenpanda commentedon Nov 28, 2023
With the changed ppd it works just fine
[-]Wrong media limits for A4 paper using HP OfficeJet 7740 Pro[/-][+]Wrong media limits for A4 paper using HP OfficeJet 7740 Pro due ignoring duplicated sizes in ppdCacheCreateWithPPD()[/+]zdohnal commentedon Nov 28, 2023
Moving to libppd - since the code which is in use and causes the issue lives there, but the possible fix will have to happen in CUPS as well.
michaelrsweet commentedon Nov 28, 2023
Yeah I'm not sure what they are trying to do but it isn't right, even for regular PPDs. Both use the same commands and the cupsInteger0 value (26) is the PCL media size value for A4... Probably the right fix is to exclude any sizes that use a non-standard name for a standard size.
ppd-cache.c: Use PPD size name from CUPS if size is standardized
zdohnal commentedon Nov 29, 2023
Thinking about it deeper - what if the HPLIP (or any other) filter does depend on using non-standard size name? In such cases we might need to keep all the sizes, even the duplicate ones... WDYT? @tillkamppeter @michaelrsweet
zdohnal commentedon Nov 29, 2023
In case my idea is not useful, I've created PR for Mike's suggestion - use always standard name if the size is standardized.
tillkamppeter commentedon Dec 2, 2023
Letting
ppd-cache.ckeep duplicate sizes would preserve the non-standard names which some sizes got in addition, but is it conforming with IPP standards to have duplicate page sizes in the list?We can also have:
By replacing all entries of each page size by one entry with standard name and changing the default page sizes name to the standard nameof the size referenced by it should solve all the above problems.
Only if the driver needs the non-standard names one needs to somehow preserve them, for example by keeping the duplicate sizes ...
ppd-cache.c: Use 0.5mm for delta when comparing sizes
ppd-cache.c: Use 0.5mm for delta when comparing sizes (#46)
ppd-cache.c: Use 0.5mm for delta when comparing sizes (fixes OpenPrin…
Use 0.5mm for all deltas (fixes OpenPrinting#29)
vijay-prema commentedon Dec 6, 2024
Thank you for this. After years of working just fine, I suddenly ran into the issue on Ubuntu, and the comment out suggestion in the PPD fixed it
Pivert commentedon Jan 7, 2025
Hi,
Finally, I have a solution. For now, it was easier to remove the line in the ppd file. Here is the diff:
Thanks for the tip !