27 lines
No EOL
954 B
Python
27 lines
No EOL
954 B
Python
# main.py
|
|
import asyncio
|
|
from docling.document_converter import DocumentConverter
|
|
|
|
async def dump_docling_output():
|
|
file_path = "aula_int_plus_1_glos_en_alfa.pdf"
|
|
output_path = "docling_output.md"
|
|
|
|
print(f"🔄 Docling is analyzing structural layout for '{file_path}'...")
|
|
|
|
try:
|
|
converter = DocumentConverter()
|
|
result = converter.convert(file_path)
|
|
markdown_text = result.document.export_to_markdown()
|
|
|
|
# Save the exact output to a file in your project root
|
|
with open(output_path, "w", encoding="utf-8") as f:
|
|
f.write(markdown_text)
|
|
|
|
print(f"📝 Success! Raw Docling layout exported cleanly to: {output_path}")
|
|
print("👀 Open this file in VS Code to see exactly how the text flows.")
|
|
|
|
except Exception as e:
|
|
print(f"❌ Docling processing failed: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(dump_docling_output()) |