linux – Remove invisible elements from pdf

My question is quite similar to Remove text from pdf

but instead of a specific string, I would like to remove any element that is hidden, or colored white (hidden with extra steps) (or empty I suppose)

does anyone know how to do this? Ideally in the terminal.