I need to remove all text information from pdf file. So the file I wanna get should be like scan: only images wrapped as pdf, no texts that u can copy or select. Now I'm using ghostscript command:
import os
...
os.system(f"gs -o {output_path} -sDEVICE=pdfwrite -dFILTERTEXT {input_path}")
unfortunately, with some documents it removes not only text layer but real pixels of characters!!! And sometimes I cannot see any text pictures on the page, it's not what I need
Is there some stable and fast solution with python or pip utils? It will be wonderful if I can solve this with PyMuPDF (fitz) but I couldn't find anything about it