command_line.rst 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. 命令行
  2. ========
  3. .. code:: bash
  4. magic-pdf --help
  5. Usage: magic-pdf [OPTIONS]
  6. Options:
  7. -v, --version display the version and exit
  8. -p, --path PATH local pdf filepath or directory [required]
  9. -o, --output-dir PATH output local directory [required]
  10. -m, --method [ocr|txt|auto] the method for parsing pdf. ocr: using ocr
  11. technique to extract information from pdf. txt:
  12. suitable for the text-based pdf only and
  13. outperform ocr. auto: automatically choose the
  14. best method for parsing pdf from ocr and txt.
  15. without method specified, auto will be used by
  16. default.
  17. -l, --lang TEXT Input the languages in the pdf (if known) to
  18. improve OCR accuracy. Optional. You should
  19. input "Abbreviation" with language form url: ht
  20. tps://paddlepaddle.github.io/PaddleOCR/en/ppocr
  21. /blog/multi_languages.html#5-support-languages-
  22. and-abbreviations
  23. -d, --debug BOOLEAN Enables detailed debugging information during
  24. the execution of the CLI commands.
  25. -s, --start INTEGER The starting page for PDF parsing, beginning
  26. from 0.
  27. -e, --end INTEGER The ending page for PDF parsing, beginning from
  28. 0.
  29. --help Show this message and exit.
  30. ## show version
  31. magic-pdf -v
  32. ## command line example
  33. magic-pdf -p {some_pdf} -o {some_output_dir} -m auto
  34. ``{some_pdf}`` 可以是单个 PDF 文件或者一个包含多个 PDF 文件的目录。 解析的结果文件存放在目录 ``{some_output_dir}`` 下。 生成的结果文件列表如下所示:
  35. .. code:: text
  36. ├── some_pdf.md # markdown 文件
  37. ├── images # 存放图片目录
  38. ├── some_pdf_layout.pdf # layout 绘图 (包含layout阅读顺序)
  39. ├── some_pdf_middle.json # minerU 中间处理结果
  40. ├── some_pdf_model.json # 模型推理结果
  41. ├── some_pdf_origin.pdf # 原 pdf 文件
  42. ├── some_pdf_spans.pdf # 最小粒度的bbox位置信息绘图
  43. └── some_pdf_content_list.json # 按阅读顺序排列的富文本json
  44. .. admonition:: Tip
  45. :class: tip
  46. 欲知更多有关结果文件的信息,请参考 :doc:`../tutorial/output_file_description`