I was having trouble printing, too, but the other answer here didn't work for me. I did notice a comment suggesting a similar question.
Unfortunately the command line
sudo snap connect firefox:cups-control
did not immediately help me, either.
HOWEVER I was able to successfully activate printing using this procedure:
- Open the Ubuntu Software Center application.
- Search for Firefox and choose it (note it says "Installed" next to it).
- Click the Permissions button.
- Confirm that its Printing permission is set to ":cups-control".
On my system, Printing had been set to "(disconnected)." After I changed it to ":cups-control" my printers were visible in the Print dialog in Firefox.
UPDATE: In recent versions of Ubuntu (22.04 "Jammy" or later?), you can also change the application settings using the GNOME Settings menu. On my system, the "Print documents" permission is set to "core:cups-control" in Settings --> Applications --> Firefox Web Browser