cross-posted from: https://lemmy.sdf.org/post/59173863

PDF layers can be created such that they display on the screen but are withheld when printing. This code should disable the OCG layers from printing:

\usepackage[printocg=never]{ocgx2}

When compiling a doc with the above and printing this way:

lp $mypdf

The layers still print. It’s unclear if latexpdf is failing to generate the PDF correctly (i.e. a bug in the ocgx2 pkg), or if the lp command is failing to treat the PDF correctly. It’s worth noting that the ocgx2 documentation is non-existent/minimal. It seems to be a fork of ocgx which extends ocg-p. The ocgx docs state generally that ocg-p options are supported.