{"id":20766863,"url":"https://github.com/rezapace/pdf-to-readme","last_synced_at":"2026-05-02T03:02:27.271Z","repository":{"id":242283442,"uuid":"809160224","full_name":"rezapace/pdf-to-readme","owner":"rezapace","description":"This tool converts PDF files to a README.md file, removes unnecessary spaces and line breaks, splits the resulting markdown file into smaller chunks, and compresses them into a ZIP file.","archived":false,"fork":false,"pushed_at":"2024-06-16T04:28:03.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T06:27:48.453Z","etag":null,"topics":["colab","colab-notebook","converter","pdf","python","python3"],"latest_commit_sha":null,"homepage":"https://devreza.my.id/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rezapace.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-01T21:47:07.000Z","updated_at":"2024-06-16T04:28:05.000Z","dependencies_parsed_at":"2024-06-16T05:29:13.214Z","dependency_job_id":null,"html_url":"https://github.com/rezapace/pdf-to-readme","commit_stats":null,"previous_names":["rezapace/pdf-to-readme"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezapace%2Fpdf-to-readme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezapace%2Fpdf-to-readme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezapace%2Fpdf-to-readme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezapace%2Fpdf-to-readme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rezapace","download_url":"https://codeload.github.com/rezapace/pdf-to-readme/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243094463,"owners_count":20235513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["colab","colab-notebook","converter","pdf","python","python3"],"created_at":"2024-11-17T11:26:29.843Z","updated_at":"2026-05-02T03:02:22.225Z","avatar_url":"https://github.com/rezapace.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PDF to README.md Conversion Tool\npdf converter\n## Overview\nThis tool converts PDF files to a README.md file, removes unnecessary spaces and line breaks, splits the resulting markdown file into smaller chunks, and compresses them into a ZIP file.\n\n## Dependencies\n- Python 3\n- PyMuPDF\n- markdown2\n- Google Colab\n\n## Installation\nInstall the required packages:\n```bash\n!pip install pymupdf\n!pip install markdown2\n```\n\n## Usage\n\n### Step 1: Convert PDF to README.md\n\n1. **Upload PDF files:**\n    ```python\n    from google.colab import files\n    uploaded = files.upload()\n    pdf_paths = list(uploaded.keys())\n    ```\n\n2. **Convert PDFs to README.md:**\n    ```python\n    import fitz  # PyMuPDF\n    import markdown2\n\n    def pdf_to_text(pdf_path):\n        doc = fitz.open(pdf_path)\n        text = \"\"\n        for page_num in range(len(doc)):\n            page = doc.load_page(page_num)\n            text += page.get_text()\n        return text\n\n    def text_to_markdown_minified(text):\n        minified_text = text.replace('\\n', '').replace('  ', ' ')\n        markdown_text = markdown2.markdown(minified_text)\n        return markdown_text\n\n    def save_to_file(content, file_path):\n        with open(file_path, 'w') as file:\n            file.write(content)\n\n    def convert_pdfs_to_readme(pdf_paths, readme_path):\n        combined_text = \"\"\n        for pdf_path in pdf_paths:\n            combined_text += pdf_to_text(pdf_path)\n        readme_content = text_to_markdown_minified(combined_text)\n        save_to_file(readme_content, readme_path)\n        print(f\"Conversion successful! README.md file saved at: {readme_path}\")\n\n    convert_pdfs_to_readme(pdf_paths, \"README.md\")\n    ```\n\n### Step 2: Split README.md into Smaller Files\n```python\nimport os\n\ndef split_file(file_path, chunk_size=5120):\n    with open(file_path, 'r') as file:\n        content = file.read()\n\n    base_dir = \"split_files\"\n    if not os.path.exists(base_dir):\n        os.makedirs(base_dir)\n\n    for i in range(0, len(content), chunk_size):\n        chunk = content[i:i + chunk_size]\n        chunk_file_path = os.path.join(base_dir, f\"README_part_{i//chunk_size + 1}.md\")\n        save_to_file(chunk, chunk_file_path)\n\n    print(f\"File split and saved in folder: {base_dir}\")\n\nsplit_file(\"README.md\", chunk_size=5120)\n```\n\n### Step 3: Compress Split Files into ZIP\n```python\nimport shutil\n\ndef zip_folder(folder_path, output_path):\n    shutil.make_archive(output_path, 'zip', folder_path)\n    print(f\"Folder {folder_path} successfully zipped into {output_path}.zip\")\n\nfolder_to_zip = \"/content/split_files\"\noutput_zip = \"/content/split_files\"\nzip_folder(folder_to_zip, output_zip)\nfiles.download(output_zip + \".zip\")\n```\n\n## Stack Used\n- **Python:** Programming language for scripting.\n- **PyMuPDF:** Library for PDF processing.\n- **markdown2:** Library for converting text to Markdown.\n- **Google Colab:** Platform for running the code and handling file uploads/downloads.\nGoogle Colab: Platform for running the code and handling file uploads/downloads.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frezapace%2Fpdf-to-readme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frezapace%2Fpdf-to-readme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frezapace%2Fpdf-to-readme/lists"}