BabelDOC 0.5.11__tar.gz → 0.5.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. {babeldoc-0.5.11 → babeldoc-0.5.13}/PKG-INFO +1 -1
  2. babeldoc-0.5.13/babeldoc/__init__.py +1 -0
  3. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/babeldoc_exception/BabelDOCException.py +6 -0
  4. babeldoc-0.5.13/babeldoc/const.py +95 -0
  5. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/rpc_doclayout6.py +21 -16
  6. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/frontend/il_creater.py +1 -1
  7. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/detect_scanned_file.py +3 -0
  8. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/il_translator.py +62 -0
  9. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/il_translator_llm_only.py +13 -4
  10. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/layout_parser.py +51 -35
  11. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/styles_and_formulas.py +8 -0
  12. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/utils/extract_char.py +10 -0
  13. babeldoc-0.5.13/babeldoc/format/pdf/document_il/utils/mupdf_helper.py +42 -0
  14. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/utils/style_helper.py +4 -0
  15. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/high_level.py +3 -1
  16. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/main.py +25 -3
  17. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/pdfinterp.py +1 -0
  18. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/translator/translator.py +31 -17
  19. {babeldoc-0.5.11 → babeldoc-0.5.13}/pyproject.toml +2 -2
  20. babeldoc-0.5.11/babeldoc/__init__.py +0 -1
  21. babeldoc-0.5.11/babeldoc/const.py +0 -41
  22. babeldoc-0.5.11/babeldoc/format/pdf/document_il/utils/mupdf_helper.py +0 -10
  23. {babeldoc-0.5.11 → babeldoc-0.5.13}/.cursorignore +0 -0
  24. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -0
  25. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -0
  26. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/PULL_REQUEST_TEMPLATE/pr_form.yml +0 -0
  27. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  28. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/dependabot.yml +0 -0
  29. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/labels.yml +0 -0
  30. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/release-drafter.yml +0 -0
  31. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/workflows/codeql.yml +0 -0
  32. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/workflows/docs.yml +0 -0
  33. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/workflows/labeler.yml +0 -0
  34. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/workflows/lint.yml +0 -0
  35. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/workflows/pr-lint.yml +0 -0
  36. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/workflows/publish-to-pypi.yml +0 -0
  37. {babeldoc-0.5.11 → babeldoc-0.5.13}/.github/workflows/test.yml +0 -0
  38. {babeldoc-0.5.11 → babeldoc-0.5.13}/.gitignore +0 -0
  39. {babeldoc-0.5.11 → babeldoc-0.5.13}/.pre-commit-config.yaml +0 -0
  40. {babeldoc-0.5.11 → babeldoc-0.5.13}/LICENSE +0 -0
  41. {babeldoc-0.5.11 → babeldoc-0.5.13}/README.md +0 -0
  42. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/assets/assets.py +0 -0
  43. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/assets/embedding_assets_metadata.py +0 -0
  44. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/asynchronize/__init__.py +0 -0
  45. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/babeldoc_exception/__init__.py +0 -0
  46. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/README.md +0 -0
  47. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/__init__.py +0 -0
  48. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/base_doclayout.py +0 -0
  49. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/doclayout.py +0 -0
  50. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/rpc_doclayout.py +0 -0
  51. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/rpc_doclayout2.py +0 -0
  52. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/rpc_doclayout3.py +0 -0
  53. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/rpc_doclayout4.py +0 -0
  54. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/rpc_doclayout5.py +0 -0
  55. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/rpc_doclayout7.py +0 -0
  56. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/docvision/table_detection/rapidocr.py +0 -0
  57. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/__init__.py +0 -0
  58. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/__init__.py +0 -0
  59. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/babelpdf/base14.py +0 -0
  60. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/babelpdf/cidfont.py +0 -0
  61. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/babelpdf/encoding.py +0 -0
  62. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/babelpdf/utils.py +0 -0
  63. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/babelpdf/win_core.py +0 -0
  64. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/converter.py +0 -0
  65. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/__init__.py +0 -0
  66. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/backend/__init__.py +0 -0
  67. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/backend/pdf_creater.py +0 -0
  68. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/frontend/__init__.py +0 -0
  69. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/il_version_1.py +0 -0
  70. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/il_version_1.rnc +0 -0
  71. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/il_version_1.rng +0 -0
  72. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/il_version_1.xsd +0 -0
  73. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/__init__.py +0 -0
  74. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/add_debug_information.py +0 -0
  75. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/automatic_term_extractor.py +0 -0
  76. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/paragraph_finder.py +0 -0
  77. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/remove_descent.py +0 -0
  78. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/table_parser.py +0 -0
  79. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/midend/typesetting.py +0 -0
  80. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/utils/__init__.py +0 -0
  81. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/utils/fontmap.py +0 -0
  82. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/utils/formular_helper.py +0 -0
  83. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/utils/layout_helper.py +0 -0
  84. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/utils/matrix_helper.py +0 -0
  85. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/utils/paragraph_helper.py +0 -0
  86. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/utils/spatial_analyzer.py +0 -0
  87. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/utils/zstd_helper.py +0 -0
  88. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/document_il/xml_converter.py +0 -0
  89. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/pdfinterp.py +0 -0
  90. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/result_merger.py +0 -0
  91. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/split_manager.py +0 -0
  92. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/format/pdf/translation_config.py +0 -0
  93. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/glossary.py +0 -0
  94. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/LICENSE +0 -0
  95. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/__init__.py +0 -0
  96. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/_saslprep.py +0 -0
  97. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/arcfour.py +0 -0
  98. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/ascii85.py +0 -0
  99. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/casting.py +0 -0
  100. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/ccitt.py +0 -0
  101. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/78-EUC-H.pickle.gz +0 -0
  102. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/78-EUC-V.pickle.gz +0 -0
  103. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/78-H.pickle.gz +0 -0
  104. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/78-RKSJ-H.pickle.gz +0 -0
  105. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/78-RKSJ-V.pickle.gz +0 -0
  106. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/78-V.pickle.gz +0 -0
  107. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/78ms-RKSJ-H.pickle.gz +0 -0
  108. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/78ms-RKSJ-V.pickle.gz +0 -0
  109. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/83pv-RKSJ-H.pickle.gz +0 -0
  110. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/83pv-RKSJ-V.pickle.gz +0 -0
  111. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/90ms-RKSJ-H.pickle.gz +0 -0
  112. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/90ms-RKSJ-V.pickle.gz +0 -0
  113. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/90msp-RKSJ-H.pickle.gz +0 -0
  114. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/90msp-RKSJ-V.pickle.gz +0 -0
  115. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/90pv-RKSJ-H.pickle.gz +0 -0
  116. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/90pv-RKSJ-V.pickle.gz +0 -0
  117. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Add-H.pickle.gz +0 -0
  118. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Add-RKSJ-H.pickle.gz +0 -0
  119. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Add-RKSJ-V.pickle.gz +0 -0
  120. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Add-V.pickle.gz +0 -0
  121. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/B5-H.pickle.gz +0 -0
  122. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/B5-V.pickle.gz +0 -0
  123. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/B5pc-H.pickle.gz +0 -0
  124. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/B5pc-V.pickle.gz +0 -0
  125. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/CNS-EUC-H.pickle.gz +0 -0
  126. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/CNS-EUC-V.pickle.gz +0 -0
  127. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/CNS1-H.pickle.gz +0 -0
  128. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/CNS1-V.pickle.gz +0 -0
  129. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/CNS2-H.pickle.gz +0 -0
  130. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/CNS2-V.pickle.gz +0 -0
  131. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/ETHK-B5-H.pickle.gz +0 -0
  132. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/ETHK-B5-V.pickle.gz +0 -0
  133. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/ETen-B5-H.pickle.gz +0 -0
  134. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/ETen-B5-V.pickle.gz +0 -0
  135. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/ETenms-B5-H.pickle.gz +0 -0
  136. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/ETenms-B5-V.pickle.gz +0 -0
  137. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/EUC-H.pickle.gz +0 -0
  138. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/EUC-V.pickle.gz +0 -0
  139. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Ext-H.pickle.gz +0 -0
  140. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Ext-RKSJ-H.pickle.gz +0 -0
  141. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Ext-RKSJ-V.pickle.gz +0 -0
  142. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Ext-V.pickle.gz +0 -0
  143. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GB-EUC-H.pickle.gz +0 -0
  144. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GB-EUC-V.pickle.gz +0 -0
  145. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GB-H.pickle.gz +0 -0
  146. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GB-V.pickle.gz +0 -0
  147. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBK-EUC-H.pickle.gz +0 -0
  148. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBK-EUC-V.pickle.gz +0 -0
  149. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBK2K-H.pickle.gz +0 -0
  150. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBK2K-V.pickle.gz +0 -0
  151. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBKp-EUC-H.pickle.gz +0 -0
  152. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBKp-EUC-V.pickle.gz +0 -0
  153. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBT-EUC-H.pickle.gz +0 -0
  154. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBT-EUC-V.pickle.gz +0 -0
  155. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBT-H.pickle.gz +0 -0
  156. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBT-V.pickle.gz +0 -0
  157. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBTpc-EUC-H.pickle.gz +0 -0
  158. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBTpc-EUC-V.pickle.gz +0 -0
  159. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBpc-EUC-H.pickle.gz +0 -0
  160. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/GBpc-EUC-V.pickle.gz +0 -0
  161. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/H.pickle.gz +0 -0
  162. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKdla-B5-H.pickle.gz +0 -0
  163. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKdla-B5-V.pickle.gz +0 -0
  164. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKdlb-B5-H.pickle.gz +0 -0
  165. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKdlb-B5-V.pickle.gz +0 -0
  166. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKgccs-B5-H.pickle.gz +0 -0
  167. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKgccs-B5-V.pickle.gz +0 -0
  168. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKm314-B5-H.pickle.gz +0 -0
  169. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKm314-B5-V.pickle.gz +0 -0
  170. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKm471-B5-H.pickle.gz +0 -0
  171. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKm471-B5-V.pickle.gz +0 -0
  172. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKscs-B5-H.pickle.gz +0 -0
  173. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/HKscs-B5-V.pickle.gz +0 -0
  174. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Hankaku-H.pickle.gz +0 -0
  175. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Hankaku-V.pickle.gz +0 -0
  176. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Hiragana-H.pickle.gz +0 -0
  177. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Hiragana-V.pickle.gz +0 -0
  178. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSC-EUC-H.pickle.gz +0 -0
  179. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSC-EUC-V.pickle.gz +0 -0
  180. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSC-H.pickle.gz +0 -0
  181. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSC-Johab-H.pickle.gz +0 -0
  182. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSC-Johab-V.pickle.gz +0 -0
  183. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSC-V.pickle.gz +0 -0
  184. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSCms-UHC-H.pickle.gz +0 -0
  185. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSCms-UHC-HW-H.pickle.gz +0 -0
  186. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSCms-UHC-HW-V.pickle.gz +0 -0
  187. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSCms-UHC-V.pickle.gz +0 -0
  188. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSCpc-EUC-H.pickle.gz +0 -0
  189. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/KSCpc-EUC-V.pickle.gz +0 -0
  190. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Katakana-H.pickle.gz +0 -0
  191. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Katakana-V.pickle.gz +0 -0
  192. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/NWP-H.pickle.gz +0 -0
  193. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/NWP-V.pickle.gz +0 -0
  194. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/README.txt +0 -0
  195. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/RKSJ-H.pickle.gz +0 -0
  196. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/RKSJ-V.pickle.gz +0 -0
  197. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Roman-H.pickle.gz +0 -0
  198. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/Roman-V.pickle.gz +0 -0
  199. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniCNS-UCS2-H.pickle.gz +0 -0
  200. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniCNS-UCS2-V.pickle.gz +0 -0
  201. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniCNS-UTF16-H.pickle.gz +0 -0
  202. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniCNS-UTF16-V.pickle.gz +0 -0
  203. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniCNS-UTF32-H.pickle.gz +0 -0
  204. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniCNS-UTF32-V.pickle.gz +0 -0
  205. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniCNS-UTF8-H.pickle.gz +0 -0
  206. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniCNS-UTF8-V.pickle.gz +0 -0
  207. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniGB-UCS2-H.pickle.gz +0 -0
  208. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniGB-UCS2-V.pickle.gz +0 -0
  209. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniGB-UTF16-H.pickle.gz +0 -0
  210. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniGB-UTF16-V.pickle.gz +0 -0
  211. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniGB-UTF32-H.pickle.gz +0 -0
  212. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniGB-UTF32-V.pickle.gz +0 -0
  213. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniGB-UTF8-H.pickle.gz +0 -0
  214. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniGB-UTF8-V.pickle.gz +0 -0
  215. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS-UCS2-H.pickle.gz +0 -0
  216. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-H.pickle.gz +0 -0
  217. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-V.pickle.gz +0 -0
  218. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS-UCS2-V.pickle.gz +0 -0
  219. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS-UTF16-H.pickle.gz +0 -0
  220. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS-UTF16-V.pickle.gz +0 -0
  221. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS-UTF32-H.pickle.gz +0 -0
  222. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS-UTF32-V.pickle.gz +0 -0
  223. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS-UTF8-H.pickle.gz +0 -0
  224. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS-UTF8-V.pickle.gz +0 -0
  225. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-H.pickle.gz +0 -0
  226. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-V.pickle.gz +0 -0
  227. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-H.pickle.gz +0 -0
  228. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-V.pickle.gz +0 -0
  229. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-H.pickle.gz +0 -0
  230. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-V.pickle.gz +0 -0
  231. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-H.pickle.gz +0 -0
  232. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-V.pickle.gz +0 -0
  233. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-H.pickle.gz +0 -0
  234. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-V.pickle.gz +0 -0
  235. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniKS-UCS2-H.pickle.gz +0 -0
  236. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniKS-UCS2-V.pickle.gz +0 -0
  237. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniKS-UTF16-H.pickle.gz +0 -0
  238. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniKS-UTF16-V.pickle.gz +0 -0
  239. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniKS-UTF32-H.pickle.gz +0 -0
  240. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniKS-UTF32-V.pickle.gz +0 -0
  241. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniKS-UTF8-H.pickle.gz +0 -0
  242. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/UniKS-UTF8-V.pickle.gz +0 -0
  243. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/V.pickle.gz +0 -0
  244. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/WP-Symbol-H.pickle.gz +0 -0
  245. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/WP-Symbol-V.pickle.gz +0 -0
  246. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/to-unicode-Adobe-CNS1.pickle.gz +0 -0
  247. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/to-unicode-Adobe-GB1.pickle.gz +0 -0
  248. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/to-unicode-Adobe-Japan1.pickle.gz +0 -0
  249. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmap/to-unicode-Adobe-Korea1.pickle.gz +0 -0
  250. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/cmapdb.py +0 -0
  251. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/converter.py +0 -0
  252. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/data_structures.py +0 -0
  253. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/encodingdb.py +0 -0
  254. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/fontmetrics.py +0 -0
  255. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/glyphlist.py +0 -0
  256. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/high_level.py +0 -0
  257. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/image.py +0 -0
  258. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/jbig2.py +0 -0
  259. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/latin_enc.py +0 -0
  260. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/layout.py +0 -0
  261. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/lzw.py +0 -0
  262. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/pdfcolor.py +0 -0
  263. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/pdfdevice.py +0 -0
  264. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/pdfdocument.py +0 -0
  265. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/pdfexceptions.py +0 -0
  266. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/pdffont.py +0 -0
  267. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/pdfpage.py +0 -0
  268. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/pdfparser.py +0 -0
  269. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/pdftypes.py +0 -0
  270. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/psexceptions.py +0 -0
  271. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/psparser.py +0 -0
  272. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/py.typed +0 -0
  273. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/runlength.py +0 -0
  274. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/settings.py +0 -0
  275. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/pdfminer/utils.py +0 -0
  276. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/progress_monitor.py +0 -0
  277. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/tools/generate_font_metadata.py +0 -0
  278. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/tools/italic_assistance.py +0 -0
  279. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/tools/italic_recognize_tool.py +0 -0
  280. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/translator/__init__.py +0 -0
  281. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/translator/cache.py +0 -0
  282. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/utils/__init__.py +0 -0
  283. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/utils/atomic_integer.py +0 -0
  284. {babeldoc-0.5.11 → babeldoc-0.5.13}/babeldoc/utils/priority_thread_pool_executor.py +0 -0
  285. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/CODE_OF_CONDUCT.md +0 -0
  286. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/CONTRIBUTING.md +0 -0
  287. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/CONTRIBUTOR_REWARD.md +0 -0
  288. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/ImplementationDetails/AsyncTranslate/AsyncTranslate.md +0 -0
  289. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/ImplementationDetails/ILTranslator/ILTranslator.md +0 -0
  290. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/ImplementationDetails/PDFCreation/PDFCreation.md +0 -0
  291. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/ImplementationDetails/PDFParsing/PDFParsing.md +0 -0
  292. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/ImplementationDetails/ParagraphFinding/ParagraphFinding.md +0 -0
  293. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/ImplementationDetails/README.md +0 -0
  294. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/ImplementationDetails/StylesAndFormulas/StylesAndFormulas.md +0 -0
  295. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/ImplementationDetails/Typesetting/Typesetting.md +0 -0
  296. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/README.md +0 -0
  297. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/deploy.sh +0 -0
  298. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/example/demo_glossary.csv +0 -0
  299. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-banner.png +0 -0
  300. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.png +0 -0
  301. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.svg +0 -0
  302. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-big-logo-with-transparent-background.png +0 -0
  303. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-big-logo-with-transparent-background.svg +0 -0
  304. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-big-logo.png +0 -0
  305. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-contributor_reward_example.png +0 -0
  306. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-preview.gif +0 -0
  307. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-small-logo-with-transparent-background.png +0 -0
  308. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-small-logo-with-transparent-background.svg +0 -0
  309. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/images/babeldoc-small-logo.png +0 -0
  310. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/index.md +0 -0
  311. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/intro-to-pdf-object.md +0 -0
  312. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/requirements.txt +0 -0
  313. {babeldoc-0.5.11 → babeldoc-0.5.13}/docs/supported_languages.md +0 -0
  314. {babeldoc-0.5.11 → babeldoc-0.5.13}/mkdocs.yml +0 -0
  315. {babeldoc-0.5.11 → babeldoc-0.5.13}/tests/test_translation_cache_cleanup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: BabelDOC
3
- Version: 0.5.11
3
+ Version: 0.5.13
4
4
  Summary: Yet Another Document Translator
5
5
  Project-URL: Homepage, https://github.com/funstory-ai/BabelDOC
6
6
  Project-URL: Issues, https://github.com/funstory-ai/BabelDOC/issues
@@ -0,0 +1 @@
1
+ __version__ = "0.5.13"
@@ -11,3 +11,9 @@ class ExtractTextError(Exception):
11
11
  class InputFileGeneratedByBabelDOCError(Exception):
12
12
  def __init__(self, message):
13
13
  super().__init__(message)
14
+
15
+
16
+ class ContentFilterError(Exception):
17
+ def __init__(self, message):
18
+ super().__init__(message)
19
+ self.message = message
@@ -0,0 +1,95 @@
1
+ import itertools
2
+ import multiprocessing as mp
3
+ import os
4
+ import shutil
5
+ import subprocess
6
+ import threading
7
+ from pathlib import Path
8
+
9
+ __version__ = "0.5.13"
10
+
11
+ CACHE_FOLDER = Path.home() / ".cache" / "babeldoc"
12
+
13
+
14
+ def get_cache_file_path(filename: str, sub_folder: str | None = None) -> Path:
15
+ if sub_folder is not None:
16
+ sub_folder = sub_folder.strip("/")
17
+ sub_folder_path = CACHE_FOLDER / sub_folder
18
+ sub_folder_path.mkdir(parents=True, exist_ok=True)
19
+ return sub_folder_path / filename
20
+ return CACHE_FOLDER / filename
21
+
22
+
23
+ try:
24
+ git_path = shutil.which("git")
25
+ if git_path is None:
26
+ raise FileNotFoundError("git executable not found")
27
+ two_parent = Path(__file__).resolve().parent.parent
28
+ md_ = two_parent / "docs" / "README.md"
29
+ if two_parent.name == "site-packages" or not md_.exists():
30
+ raise FileNotFoundError("not in git repo")
31
+ WATERMARK_VERSION = (
32
+ subprocess.check_output( # noqa: S603
33
+ [git_path, "describe", "--always"],
34
+ cwd=Path(__file__).resolve().parent,
35
+ )
36
+ .strip()
37
+ .decode()
38
+ )
39
+ except (OSError, FileNotFoundError, subprocess.CalledProcessError):
40
+ WATERMARK_VERSION = f"v{__version__}"
41
+
42
+ TIKTOKEN_CACHE_FOLDER = CACHE_FOLDER / "tiktoken"
43
+ TIKTOKEN_CACHE_FOLDER.mkdir(parents=True, exist_ok=True)
44
+ os.environ["TIKTOKEN_CACHE_DIR"] = str(TIKTOKEN_CACHE_FOLDER)
45
+
46
+
47
+ _process_pool = None
48
+ _process_pool_lock = threading.Lock()
49
+ _ENABLE_PROCESS_POOL = False
50
+
51
+
52
+ def enable_process_pool():
53
+ # Development and Testing ONLY API
54
+ global _ENABLE_PROCESS_POOL
55
+ _ENABLE_PROCESS_POOL = True
56
+
57
+
58
+ # macos & windows use spawn mode
59
+ # linux use forkserver mode
60
+
61
+
62
+ def get_process_pool():
63
+ if not _ENABLE_PROCESS_POOL:
64
+ return None
65
+ global _process_pool
66
+ with _process_pool_lock:
67
+ if _process_pool is None:
68
+ # Create pool only in main process
69
+ if mp.current_process().name != "MainProcess":
70
+ return None
71
+
72
+ _process_pool = mp.Pool()
73
+ return _process_pool
74
+
75
+
76
+ def close_process_pool():
77
+ if not _ENABLE_PROCESS_POOL:
78
+ return None
79
+ global _process_pool
80
+ with _process_pool_lock:
81
+ if _process_pool:
82
+ _process_pool.close()
83
+ _process_pool.join()
84
+ _process_pool = None
85
+
86
+
87
+ def batched(iterable, n, *, strict=False):
88
+ # batched('ABCDEFG', 3) → ABC DEF G
89
+ if n < 1:
90
+ raise ValueError("n must be at least one")
91
+ iterator = iter(iterable)
92
+ while batch := tuple(itertools.islice(iterator, n)):
93
+ if strict and len(batch) != n:
94
+ raise ValueError("batched(): incomplete batch")
95
+ yield batch
@@ -28,7 +28,9 @@ from babeldoc.format.pdf.document_il.utils.extract_char import (
28
28
  )
29
29
  from babeldoc.format.pdf.document_il.utils.fontmap import FontMapper
30
30
  from babeldoc.format.pdf.document_il.utils.layout_helper import SPACE_REGEX
31
- from babeldoc.format.pdf.document_il.utils.mupdf_helper import get_no_rotation_img
31
+ from babeldoc.format.pdf.document_il.utils.mupdf_helper import (
32
+ get_no_rotation_img_multiprocess,
33
+ )
32
34
 
33
35
  logger = logging.getLogger(__name__)
34
36
  DPI = 150
@@ -141,7 +143,7 @@ def predict_layout(
141
143
  f"{host}/inference",
142
144
  json=request_data,
143
145
  headers={"Accept": "application/json", "Content-Type": "application/json"},
144
- timeout=1800,
146
+ timeout=30,
145
147
  follow_redirects=True,
146
148
  )
147
149
 
@@ -233,7 +235,7 @@ def predict_layout2(
233
235
  "Content-Type": "application/msgpack",
234
236
  "Accept": "application/msgpack",
235
237
  },
236
- timeout=480,
238
+ timeout=30,
237
239
  follow_redirects=True,
238
240
  )
239
241
 
@@ -569,18 +571,19 @@ class RpcDocLayoutModel(DocLayoutModel):
569
571
 
570
572
  return results
571
573
 
572
- def predict_page(
573
- self, page, mupdf_doc: pymupdf.Document, translate_config, save_debug_image
574
- ):
574
+ def predict_page(self, page, pdf_bytes: Path, translate_config, save_debug_image):
575
575
  translate_config.raise_if_cancelled()
576
- with self.lock:
577
- # pix = mupdf_doc[page.page_number].get_pixmap(dpi=72)
578
- pix = get_no_rotation_img(mupdf_doc[page.page_number], dpi=DPI)
579
- image = np.frombuffer(pix.samples, np.uint8).reshape(
580
- pix.height,
581
- pix.width,
582
- 3,
583
- )[:, :, ::-1]
576
+ # doc = pymupdf.open(io.BytesIO(pdf_bytes))
577
+ # with self.lock:
578
+ # pix = mupdf_doc[page.page_number].get_pixmap(dpi=72)
579
+ image = get_no_rotation_img_multiprocess(
580
+ pdf_bytes.as_posix(), page.page_number, dpi=DPI
581
+ )
582
+ # image = np.frombuffer(pix.samples, np.uint8).reshape(
583
+ # pix.height,
584
+ # pix.width,
585
+ # 3,
586
+ # )[:, :, ::-1]
584
587
  char_boxes = convert_page_to_char_boxes(page)
585
588
  lines = process_page_chars_to_lines(char_boxes)
586
589
  predict_result = self.predict_image(image, 800, lines)
@@ -594,11 +597,13 @@ class RpcDocLayoutModel(DocLayoutModel):
594
597
  translate_config,
595
598
  save_debug_image,
596
599
  ):
597
- with ThreadPoolExecutor(max_workers=32) as executor:
600
+ layout_temp_path = translate_config.get_working_file_path("layout.temp.pdf")
601
+ mupdf_doc.save(layout_temp_path.as_posix())
602
+ with ThreadPoolExecutor(max_workers=8) as executor:
598
603
  yield from executor.map(
599
604
  self.predict_page,
600
605
  pages,
601
- (mupdf_doc for _ in range(len(pages))),
606
+ (layout_temp_path for _ in range(len(pages))),
602
607
  (translate_config for _ in range(len(pages))),
603
608
  (save_debug_image for _ in range(len(pages))),
604
609
  )
@@ -955,7 +955,7 @@ class ILCreater:
955
955
  )
956
956
  return
957
957
 
958
- if char_bounding_box:
958
+ if char_bounding_box and len(char_bounding_box) == 4:
959
959
  x_min, y_min, x_max, y_max = char_bounding_box
960
960
  factor = 1 / 1000 * pdf_style.font_size
961
961
  x_min = x_min * factor
@@ -9,6 +9,7 @@ from skimage.metrics import structural_similarity
9
9
  from babeldoc.babeldoc_exception.BabelDOCException import ScannedPDFError
10
10
  from babeldoc.format.pdf.document_il import il_version_1
11
11
  from babeldoc.format.pdf.document_il.backend.pdf_creater import PDFCreater
12
+ from babeldoc.format.pdf.document_il.utils.style_helper import BLACK
12
13
  from babeldoc.format.pdf.document_il.utils.style_helper import GREEN
13
14
  from babeldoc.format.pdf.translation_config import TranslationConfig
14
15
 
@@ -143,6 +144,8 @@ class DetectScannedFile:
143
144
  for page in docs.page:
144
145
  for char in page.pdf_character:
145
146
  char.render_order = None
147
+ if not char.debug_info:
148
+ char.pdf_style.graphic_state = BLACK
146
149
 
147
150
  def detect_page_is_scanned(
148
151
  self, page: il_version_1.Page, pdf: pymupdf.Document, pdf_creater: PDFCreater
@@ -4,12 +4,16 @@ import copy
4
4
  import json
5
5
  import logging
6
6
  import re
7
+ import threading
7
8
  from pathlib import Path
8
9
 
9
10
  import tiktoken
10
11
  from tqdm import tqdm
11
12
 
13
+ import babeldoc.format.pdf.document_il.il_version_1 as il_version_1
14
+ from babeldoc.babeldoc_exception.BabelDOCException import ContentFilterError
12
15
  from babeldoc.format.pdf.document_il import Document
16
+ from babeldoc.format.pdf.document_il import GraphicState
13
17
  from babeldoc.format.pdf.document_il import Page
14
18
  from babeldoc.format.pdf.document_il import PdfFont
15
19
  from babeldoc.format.pdf.document_il import PdfFormula
@@ -34,6 +38,7 @@ from babeldoc.format.pdf.document_il.utils.paragraph_helper import (
34
38
  from babeldoc.format.pdf.document_il.utils.paragraph_helper import (
35
39
  is_pure_numeric_paragraph,
36
40
  )
41
+ from babeldoc.format.pdf.document_il.utils.style_helper import GRAY80
37
42
  from babeldoc.format.pdf.translation_config import TranslationConfig
38
43
  from babeldoc.translator.translator import BaseTranslator
39
44
  from babeldoc.utils.priority_thread_pool_executor import PriorityThreadPoolExecutor
@@ -307,6 +312,8 @@ class ILTranslator:
307
312
  self.support_llm_translate = False
308
313
 
309
314
  self.use_as_fallback = False
315
+ self.add_content_filter_hint_lock = threading.Lock()
316
+ self.docs = None
310
317
 
311
318
  def calc_token_count(self, text: str) -> int:
312
319
  try:
@@ -315,6 +322,7 @@ class ILTranslator:
315
322
  return 0
316
323
 
317
324
  def translate(self, docs: Document):
325
+ self.docs = docs
318
326
  tracker = DocumentTranslateTracker()
319
327
 
320
328
  if not self.translation_config.shared_context_cross_split_part.first_paragraph:
@@ -390,6 +398,7 @@ class ILTranslator:
390
398
  executor.submit(
391
399
  self.translate_paragraph,
392
400
  paragraph,
401
+ page,
393
402
  pbar,
394
403
  tracker.new_paragraph(),
395
404
  page_font_map,
@@ -985,9 +994,58 @@ Now, please carefully read the following text to be translated and directly outp
985
994
 
986
995
  return final_input
987
996
 
997
+ def add_content_filter_hint(self, page: Page, paragraph: PdfParagraph):
998
+ with self.add_content_filter_hint_lock:
999
+ new_box = il_version_1.Box(
1000
+ x=paragraph.box.x,
1001
+ y=paragraph.box.y2,
1002
+ x2=paragraph.box.x2,
1003
+ y2=paragraph.box.y2 + 1.1,
1004
+ )
1005
+ page.pdf_paragraph.append(
1006
+ self._create_text(
1007
+ "翻译服务检测到内容可能包含不安全或敏感内容,请您避免翻译敏感内容,感谢您的配合。",
1008
+ GRAY80,
1009
+ new_box,
1010
+ 1,
1011
+ )
1012
+ )
1013
+ logger.info("success add content filter hint")
1014
+
1015
+ def _create_text(
1016
+ self,
1017
+ text: str,
1018
+ color: GraphicState,
1019
+ box: il_version_1.Box,
1020
+ font_size: float = 4,
1021
+ ):
1022
+ style = il_version_1.PdfStyle(
1023
+ font_id="base",
1024
+ font_size=font_size,
1025
+ graphic_state=color,
1026
+ )
1027
+ return il_version_1.PdfParagraph(
1028
+ first_line_indent=False,
1029
+ box=box,
1030
+ vertical=False,
1031
+ pdf_style=style,
1032
+ unicode=text,
1033
+ pdf_paragraph_composition=[
1034
+ il_version_1.PdfParagraphComposition(
1035
+ pdf_same_style_unicode_characters=il_version_1.PdfSameStyleUnicodeCharacters(
1036
+ unicode=text,
1037
+ pdf_style=style,
1038
+ debug_info=True,
1039
+ ),
1040
+ ),
1041
+ ],
1042
+ xobj_id=-1,
1043
+ )
1044
+
988
1045
  def translate_paragraph(
989
1046
  self,
990
1047
  paragraph: PdfParagraph,
1048
+ page: Page,
991
1049
  pbar: tqdm | None = None,
992
1050
  tracker: ParagraphTranslateTracker = None,
993
1051
  page_font_map: dict[str, PdfFont] = None,
@@ -1039,6 +1097,10 @@ Now, please carefully read the following text to be translated and directly outp
1039
1097
  self.post_translate_paragraph(
1040
1098
  paragraph, tracker, translate_input, translated_text
1041
1099
  )
1100
+ except ContentFilterError as e:
1101
+ logger.warning(f"ContentFilterError: {e.message}")
1102
+ self.add_content_filter_hint(page, paragraph)
1103
+ return
1042
1104
  except Exception as e:
1043
1105
  logger.exception(
1044
1106
  f"Error translating paragraph. Paragraph: {paragraph.debug_id} ({paragraph.unicode}). Error: {e}. ",
@@ -40,9 +40,11 @@ class BatchParagraph:
40
40
  def __init__(
41
41
  self,
42
42
  paragraphs: list[PdfParagraph],
43
+ pages: list[Page],
43
44
  page_tracker: PageTranslateTracker,
44
45
  ):
45
46
  self.paragraphs = paragraphs
47
+ self.pages = pages
46
48
  self.trackers = [page_tracker.new_paragraph() for _ in paragraphs]
47
49
 
48
50
 
@@ -112,6 +114,7 @@ class ILTranslatorLLMOnly:
112
114
  return None
113
115
 
114
116
  def translate(self, docs: Document) -> None:
117
+ self.il_translator.docs = docs
115
118
  tracker = DocumentTranslateTracker()
116
119
  self.mid = 0
117
120
 
@@ -361,8 +364,9 @@ class ILTranslatorLLMOnly:
361
364
 
362
365
  # Create batch with both paragraphs
363
366
  cross_page_paragraphs = [last_curr_paragraph, first_next_paragraph]
367
+ cross_page_pages = [page_curr, page_next]
364
368
  batch_paragraph = BatchParagraph(
365
- cross_page_paragraphs, tracker.new_cross_page()
369
+ cross_page_paragraphs, cross_page_pages, tracker.new_cross_page()
366
370
  )
367
371
 
368
372
  self.mid += 1
@@ -438,7 +442,7 @@ class ILTranslatorLLMOnly:
438
442
  p1.unicode
439
443
  ) + self.calc_token_count(p2.unicode)
440
444
 
441
- batch = BatchParagraph([p1, p2], tracker.new_cross_column())
445
+ batch = BatchParagraph([p1, p2], [page, page], tracker.new_cross_column())
442
446
  self.mid += 1
443
447
  executor.submit(
444
448
  self.translate_paragraph,
@@ -523,7 +527,7 @@ class ILTranslatorLLMOnly:
523
527
  self.mid += 1
524
528
  executor.submit(
525
529
  self.translate_paragraph,
526
- BatchParagraph(paragraphs, tracker),
530
+ BatchParagraph(paragraphs, [page] * len(paragraphs), tracker),
527
531
  pbar,
528
532
  page_font_map,
529
533
  page_xobj_font_map,
@@ -541,7 +545,7 @@ class ILTranslatorLLMOnly:
541
545
  self.mid += 1
542
546
  executor.submit(
543
547
  self.translate_paragraph,
544
- BatchParagraph(paragraphs, tracker),
548
+ BatchParagraph(paragraphs, [page] * len(paragraphs), tracker),
545
549
  pbar,
546
550
  page_font_map,
547
551
  page_xobj_font_map,
@@ -630,6 +634,9 @@ class ILTranslatorLLMOnly:
630
634
  llm_prompt_parts.append("#role")
631
635
  if self.translation_config.custom_system_prompt:
632
636
  llm_prompt_parts.append(self.translation_config.custom_system_prompt)
637
+ llm_prompt_parts.append(
638
+ "When translating, strictly follow the instructions below to ensure translation quality and preserve all formatting, tags, and placeholders:\n"
639
+ )
633
640
  else:
634
641
  llm_prompt_parts.append(
635
642
  f"You are a professional and reliable machine translation engine responsible for translating the input text into {self.translation_config.lang_out}.\n"
@@ -894,6 +901,7 @@ class ILTranslatorLLMOnly:
894
901
  executor.submit(
895
902
  self.il_translator.translate_paragraph,
896
903
  inputs[id_][2],
904
+ batch_paragraph.pages[id_],
897
905
  pbar,
898
906
  inputs[id_][3],
899
907
  page_font_map,
@@ -929,6 +937,7 @@ class ILTranslatorLLMOnly:
929
937
  executor.submit(
930
938
  self.il_translator.translate_paragraph,
931
939
  paragraph,
940
+ batch_paragraph.pages[i],
932
941
  pbar,
933
942
  tracker,
934
943
  page_font_map,
@@ -1,4 +1,7 @@
1
1
  import logging
2
+ import math
3
+ import os
4
+ from concurrent.futures import ThreadPoolExecutor
2
5
  from pathlib import Path
3
6
 
4
7
  import cv2
@@ -7,7 +10,6 @@ from pymupdf import Document
7
10
 
8
11
  import babeldoc.format.pdf.document_il.utils.extract_char
9
12
  from babeldoc.format.pdf.document_il import il_version_1
10
- from babeldoc.format.pdf.document_il.utils.mupdf_helper import get_no_rotation_img
11
13
  from babeldoc.format.pdf.document_il.utils.style_helper import GREEN
12
14
  from babeldoc.format.pdf.translation_config import TranslationConfig
13
15
 
@@ -120,7 +122,7 @@ class LayoutParser:
120
122
  total = len(docs.page)
121
123
  with self.translation_config.progress_monitor.stage_start(
122
124
  self.stage_name,
123
- total,
125
+ total * 2,
124
126
  ) as progress:
125
127
  # Process predictions for each page
126
128
  for page, layouts in self.model.handle_document(
@@ -134,9 +136,15 @@ class LayoutParser:
134
136
  # Convert coordinate system from picture to il
135
137
  # system to the il coordinate system
136
138
  x0, y0, x1, y1 = layout.xyxy
137
- pix = get_no_rotation_img(mupdf_doc[page.page_number])
139
+ # pix = get_no_rotation_img(mupdf_doc[page.page_number])
138
140
  # pix = mupdf_doc[page.page_number].get_pixmap()
139
- h, w = pix.height, pix.width
141
+ # h, w = pix.height, pix.width
142
+ box = mupdf_doc[page.page_number].mediabox_size
143
+ b_h = math.ceil(box.y)
144
+ b_w = math.ceil(box.x)
145
+ # if b_h != h or b_w != w:
146
+ # logger.warning(f"page {page.page_number} mediabox is not correct, b_h: {b_h}, h: {h}, b_w: {b_w}, w: {w}")
147
+ h, w = b_h, b_w
140
148
  x0, y0, x1, y1 = (
141
149
  np.clip(int(x0 - 1), 0, w - 1),
142
150
  np.clip(int(h - y1 - 1), 0, h - 1),
@@ -157,39 +165,47 @@ class LayoutParser:
157
165
  page_layouts.append(page_layout)
158
166
 
159
167
  page.page_layout = page_layouts
160
- self.generate_fallback_line_layout_for_page(page)
161
- self._save_debug_box_to_page(page)
168
+ # self.generate_fallback_line_layout_for_page(page)
169
+ # self._save_debug_box_to_page(page)
162
170
  progress.advance(1)
163
-
171
+ with ThreadPoolExecutor(max_workers=os.cpu_count()) as executor:
172
+ for page in docs.page:
173
+ executor.submit(
174
+ self.generate_fallback_line_layout_for_page, page, progress
175
+ )
164
176
  return docs
165
177
 
166
- def generate_fallback_line_layout_for_page(self, page: il_version_1.Page):
167
- exists_page_layouts = page.page_layout
168
- char_boxes = babeldoc.format.pdf.document_il.utils.extract_char.convert_page_to_char_boxes(
169
- page
170
- )
171
- if not char_boxes:
172
- return
178
+ def generate_fallback_line_layout_for_page(self, page: il_version_1.Page, progress):
179
+ try:
180
+ exists_page_layouts = page.page_layout
181
+ char_boxes = babeldoc.format.pdf.document_il.utils.extract_char.convert_page_to_char_boxes(
182
+ page
183
+ )
184
+ if not char_boxes:
185
+ return
173
186
 
174
- clusters = babeldoc.format.pdf.document_il.utils.extract_char.process_page_chars_to_lines(
175
- char_boxes
176
- )
177
- for cluster in clusters:
178
- boxes = [c[0] for c in cluster.chars]
179
- min_x = min(b.x for b in boxes)
180
- max_x = max(b.x2 for b in boxes)
181
- min_y = min(b.y for b in boxes)
182
- max_y = max(b.y2 for b in boxes)
183
- cluster.chars = il_version_1.Box(min_x, min_y, max_x, max_y)
184
- page_layout = il_version_1.PageLayout(
185
- id=len(exists_page_layouts) + 1,
186
- box=il_version_1.Box(
187
- min_x,
188
- min_y,
189
- max_x,
190
- max_y,
191
- ),
192
- conf=1,
193
- class_name="fallback_line",
187
+ clusters = babeldoc.format.pdf.document_il.utils.extract_char.process_page_chars_to_lines(
188
+ char_boxes
194
189
  )
195
- exists_page_layouts.append(page_layout)
190
+ for cluster in clusters:
191
+ boxes = [c[0] for c in cluster.chars]
192
+ min_x = min(b.x for b in boxes)
193
+ max_x = max(b.x2 for b in boxes)
194
+ min_y = min(b.y for b in boxes)
195
+ max_y = max(b.y2 for b in boxes)
196
+ cluster.chars = il_version_1.Box(min_x, min_y, max_x, max_y)
197
+ page_layout = il_version_1.PageLayout(
198
+ id=len(exists_page_layouts) + 1,
199
+ box=il_version_1.Box(
200
+ min_x,
201
+ min_y,
202
+ max_x,
203
+ max_y,
204
+ ),
205
+ conf=1,
206
+ class_name="fallback_line",
207
+ )
208
+ exists_page_layouts.append(page_layout)
209
+ self._save_debug_box_to_page(page)
210
+ finally:
211
+ progress.advance(1)
@@ -462,11 +462,17 @@ class StylesAndFormulas:
462
462
  line.pdf_character[i + 1] if i < len(line.pdf_character) - 1 else None
463
463
  )
464
464
  isspace = char.char_unicode.isspace() if char.char_unicode else False
465
+ prev_is_space = (
466
+ previous_char.char_unicode.isspace()
467
+ if previous_char and previous_char.char_unicode
468
+ else False
469
+ )
465
470
 
466
471
  is_corner_mark = (
467
472
  (
468
473
  previous_char is not None
469
474
  and not isspace
475
+ and not prev_is_space
470
476
  and not first_is_bullet
471
477
  # 角标字体,有 0.76 的角标和 0.799 的大写,这里用 0.79 取中,同时考虑首字母放大的情况
472
478
  and char.pdf_style.font_size
@@ -476,6 +482,7 @@ class StylesAndFormulas:
476
482
  or (
477
483
  previous_char is not None
478
484
  and not isspace
485
+ and not prev_is_space
479
486
  and not first_is_bullet
480
487
  # 角标字体,有 0.76 的角标和 0.799 的大写,这里用 0.79 取中,同时考虑首字母放大的情况
481
488
  and char.pdf_style.font_size
@@ -487,6 +494,7 @@ class StylesAndFormulas:
487
494
  previous_char is None
488
495
  and next_char is not None
489
496
  and not isspace
497
+ and not prev_is_space
490
498
  and not first_is_bullet
491
499
  # 当前字符字体大小明显小于下一个字符,判定为角标
492
500
  and char.pdf_style.font_size < next_char.pdf_style.font_size * 0.79
@@ -11,6 +11,7 @@ from sklearn.cluster import DBSCAN
11
11
 
12
12
  import babeldoc.format.pdf.high_level
13
13
  import babeldoc.format.pdf.translation_config
14
+ from babeldoc.const import get_process_pool
14
15
  from babeldoc.format.pdf.document_il import il_version_1
15
16
 
16
17
  logger = logging.getLogger(__name__)
@@ -571,6 +572,15 @@ def _merge_lines_on_page(page_lines: list[Line]) -> list[Line]:
571
572
 
572
573
  def process_page_chars_to_lines(
573
574
  chars: list[tuple[il_version_1.Box, str, bool]],
575
+ ) -> list[Line]:
576
+ pool = get_process_pool()
577
+ if pool is None:
578
+ return process_page_chars_to_lines_internal(chars)
579
+ return pool.apply(process_page_chars_to_lines_internal, (chars,))
580
+
581
+
582
+ def process_page_chars_to_lines_internal(
583
+ chars: list[tuple[il_version_1.Box, str, bool]],
574
584
  ) -> list[Line]:
575
585
  """
576
586
  Process characters on a single page to cluster them into lines.
@@ -0,0 +1,42 @@
1
+ import numpy as np
2
+ import pymupdf
3
+
4
+ from babeldoc.const import get_process_pool
5
+
6
+
7
+ def get_no_rotation_img(page: pymupdf.Page, dpi: int = 72) -> pymupdf.Pixmap:
8
+ # return page.get_pixmap(dpi=72)
9
+ original_rotation = page.rotation
10
+ page.set_rotation(0)
11
+ pix = page.get_pixmap(dpi=dpi)
12
+ page.set_rotation(original_rotation)
13
+ return pix
14
+
15
+
16
+ def get_no_rotation_img_multiprocess_internal(
17
+ pdf_bytes: str, pagenum: int, dpi: int = 72
18
+ ) -> np.ndarray:
19
+ # return page.get_pixmap(dpi=72)
20
+ doc = pymupdf.open(pdf_bytes)
21
+ try:
22
+ page = doc[pagenum]
23
+ original_rotation = page.rotation
24
+ page.set_rotation(0)
25
+ pix = page.get_pixmap(dpi=dpi)
26
+ page.set_rotation(original_rotation)
27
+ return np.frombuffer(pix.samples, np.uint8).reshape(
28
+ pix.height,
29
+ pix.width,
30
+ 3,
31
+ )[:, :, ::-1]
32
+ finally:
33
+ doc.close()
34
+
35
+
36
+ def get_no_rotation_img_multiprocess(pdf_bytes: str, pagenum: int, dpi: int = 72):
37
+ pool = get_process_pool()
38
+ if pool is None:
39
+ return get_no_rotation_img_multiprocess_internal(pdf_bytes, pagenum, dpi)
40
+ return pool.apply(
41
+ get_no_rotation_img_multiprocess_internal, (pdf_bytes, pagenum, dpi)
42
+ )
@@ -29,6 +29,10 @@ BLACK = il_version_1.GraphicState(passthrough_per_char_instruction="0 g 0 G")
29
29
 
30
30
  WHITE = il_version_1.GraphicState(passthrough_per_char_instruction="1 g 1 G")
31
31
 
32
+ GRAY80 = il_version_1.GraphicState(passthrough_per_char_instruction="0.80 g 0.80 G")
33
+ GRAY67 = il_version_1.GraphicState(passthrough_per_char_instruction="0.67 g 0.67 G")
34
+ GRAY33 = il_version_1.GraphicState(passthrough_per_char_instruction="0.33 g 0.33 G")
35
+
32
36
  # Generate all color styles
33
37
  RED = il_version_1.GraphicState(
34
38
  passthrough_per_char_instruction="1.0000000000 0.2313725490 0.1882352941 rg "