Skip to content

Conversation

@lethanhquy1234-ops
Copy link

@lethanhquy1234-ops lethanhquy1234-ops commented Dec 1, 2025

import os
from markitdown import MarkItDown

md = MarkItDown()

folder = "pdf_files" #HS RCP 1-30.pdf

output = "markdown_output" #
Uploading HS RCP 1-30.pdf…
.md

os.makedirs(output, exist_ok=True)

for f in os.listdir(folder):
if f.lower().endswith(".pdf"):
full = os.path.join(folder, f)
print(f"Đang xử lý: {full}")

    # OCR để đọc PDF scan
    result = md.convert(full, use_ocr=True)

    out_md = os.path.join(output, f.replace(".pdf", ".md"))
    with open(out_md, "w", encoding="utf-8") as of:
        of.write(result.text_content)

print("Done!")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant