I bought a HP Envy 4504. Overall I am happy with it. This is how I configure it so I can use with Linux.

This mini howto applies to ArchLinux, void linux and Centos/RedHat distributions.

Installation

Archlinux:

cups, hplip, python2, sane

Centos:

cups, hplip, hplip-gui, sane

Some optional dependancies may be needed.

void linux:

hplip-gui

And for scanning, install:

simple-scan and/or xsane

Configuration Arch Linux and Centos/RedHat

sudo systemctl enable cups
sudo systemctl start cups
sudo hp-setup

hp-setup -i Select “Network”, and “Advanced Options -> Manual Discovery” Printer: npr1 PPD File:

/usr/share/ppd/HP/hp-envy_4500_series.ppd

Uncoment hpaio from /etc/sane/dll.conf.

void linux configuration

These are void linux specific settings:

enable cups:

ln -s /etc/sv/cupsd /var/service

uncompress PPD file (otherwise it is not recognized)

gunzip /usr/share/ppd/HP/hp-envy_4500_series.ppd.gz

We need to hack the install /usr/share/hplip/prnt/cups.py so that it runs:

--- cups.py.orig	2019-02-05 22:44:34.000000000 +0100
+++ cups.py	2019-02-19 11:45:00.793904202 +0100
@@ -324,14 +324,17 @@
                         except AttributeError: # happens on some boxes with provider: style ppds (foomatic: etc)
                             path = ppd
                         else:
-                            if not os.path.exists(path):
-                                try:
-                                    path = os.path.join(cups_ppd_path, ppd)
-                                except AttributeError:
-                                    path = ppd
-                                else:
-                                    if not os.path.exists(path):
-                                        path = ppd # foomatic: or some other driver
+                            log.debug(cups_ppd_path)
+                            log.debug(ppd)
+                            #if not os.path.exists(path):
+                            #    try:
+                            #        path = os.path.join(cups_ppd_path, ppd)
+                            #    except AttributeError:
+                            #        path = ppd
+                            #    else:
+                            #        if not os.path.exists(path):
+                            #            path = ppd # foomatic: or some other driver
+                            path = ppd # foomatic: or some other driver
 
                     ppds[path] = desc
                     #log.debug("%s: %s" % (path, desc))

Add printer (run with sudo):

print_host=npr1
hp-setup $print_host

For scanning, uncoment hpaio from /etc/sane/dll.conf.

Tweaks

Some commands:

cupsenable printer
lpstat -p
lpadmin -p PrinterName -E

Also since it is a WIFI printer normally it will go into sleep/power save mode. This means if you then try to print from cups it will fail (printer is asleep). Subsequent prints should work but now cupsd has flagged the printer as paused. To prevent this you should configure the default ErrorPolicy in /etc/cups/cupsd.conf by adding in the top scope:

ErrorPolicy retry-job

References: superuser.com