import pymupdf4llm import pathlib md_text = pymupdf4llm.to_markdown("/Users/niro/Documents/SL Clinical Assistant/Obs/abc.pdf") # now work with the markdown text, e.g. store as a UTF8-encoded file pathlib.Path("output_obs.md").write_bytes(md_text.encode())