{"id":27937,"library":"magic-pdf","title":"magic-pdf","description":"A practical tool for converting PDF to Markdown, part of the MinerU project by OpenDataLab. Current version is 1.3.12, requires Python >=3.10, <3.14. The package is actively maintained with frequent releases.","status":"active","version":"1.3.12","language":"python","source_language":"en","source_url":"https://github.com/opendatalab/MinerU","tags":["pdf","markdown","conversion","mineru"],"install":[{"cmd":"pip install magic-pdf","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Common mistake: importing 'magic-pdf' with hyphen (invalid Python syntax). Use underscore.","wrong":"import magic_pdf as pdf","symbol":"magic_pdf","correct":"import magic_pdf"},{"note":"parse_pdf is directly under magic_pdf, not a submodule.","wrong":"from magic_pdf.pipeline import parse_pdf","symbol":"parse_pdf","correct":"from magic_pdf import parse_pdf"}],"quickstart":{"code":"import magic_pdf\nresult = magic_pdf.parse_pdf('sample.pdf', output_dir='./output')\nprint(result['markdown'])","lang":"python","description":"Convert a PDF to Markdown and print the result."},"warnings":[{"fix":"Use 'pip install magic-pdf' and 'import magic_pdf'.","message":"The package name on PyPI is 'magic-pdf', but the import uses underscore: 'magic_pdf'.","severity":"gotcha","affected_versions":"all"},{"fix":"Access result['markdown'] for v1.3.0+, or result['text'] for older versions.","message":"Version 1.3.0 changed the output structure: the Markdown content is now under 'markdown' key instead of 'text'.","severity":"breaking","affected_versions":">=1.3.0,<1.3.0"},{"fix":"Use 'parse_pdf' instead of 'parse'.","message":"The function 'magic_pdf.parse' was deprecated in v1.3.0 in favor of 'magic_pdf.parse_pdf'.","severity":"deprecated","affected_versions":"<1.3.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run 'pip install magic-pdf' and use 'import magic_pdf'.","cause":"Package not installed or imported with wrong name (hyphen instead of underscore).","error":"ModuleNotFoundError: No module named 'magic_pdf'"},{"fix":"Use 'magic_pdf.parse_pdf()' instead.","cause":"Using deprecated function name 'parse' after v1.3.0.","error":"AttributeError: module 'magic_pdf' has no attribute 'parse'"},{"fix":"Check version: if <1.3.0 use result['text'], else use result['markdown'].","cause":"Accessing 'markdown' key on result from older version (<1.3.0).","error":"KeyError: 'markdown'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}