{"id":20244533,"url":"https://github.com/alextkdev/pdf-to-word-conversion","last_synced_at":"2025-03-03T15:24:24.580Z","repository":{"id":252382430,"uuid":"840277283","full_name":"AlexTkDev/PDF-to-Word-Conversion","owner":"AlexTkDev","description":"A parser that will retype text from a PDF into an MS Word document with the specified specifications","archived":false,"fork":false,"pushed_at":"2024-12-13T17:26:09.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T01:46:41.134Z","etag":null,"topics":["google-cloud-vision-api","pdf-to-text","pillow-library","pymypdf","python-dox","tesseract-ocr"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexTkDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-09T10:51:21.000Z","updated_at":"2024-12-13T17:26:13.000Z","dependencies_parsed_at":"2024-12-13T18:23:55.259Z","dependency_job_id":"ce82a19a-5044-449a-bf0c-9ce6b7b22f0a","html_url":"https://github.com/AlexTkDev/PDF-to-Word-Conversion","commit_stats":null,"previous_names":["alextkdev/pdf-to-word-conversion"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexTkDev%2FPDF-to-Word-Conversion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexTkDev%2FPDF-to-Word-Conversion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexTkDev%2FPDF-to-Word-Conversion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexTkDev%2FPDF-to-Word-Conversion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexTkDev","download_url":"https://codeload.github.com/AlexTkDev/PDF-to-Word-Conversion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241688077,"owners_count":20003393,"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":["google-cloud-vision-api","pdf-to-text","pillow-library","pymypdf","python-dox","tesseract-ocr"],"created_at":"2024-11-14T09:15:56.270Z","updated_at":"2025-03-03T15:24:24.556Z","avatar_url":"https://github.com/AlexTkDev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## PDF-to-Word-Conversion\n\n### Description\n\nThe **PDF-to-Word-Conversion** project is designed to convert pages of a PDF document into separate\npages of a Microsoft\nWord document while adhering to specific technical requirements. The project employs two main\nprocessing strategies:\nusing the Google Cloud Vision API for text extraction and local processing with PyMuPDF and\nTesseract.\n\n### Tech Stack\n\n- **Google Cloud Vision API**: For extracting text from images.\n- **PyMuPDF**: For working with PDF documents.\n- **Tesseract OCR**: For recognizing text in images.\n- **pdf2image**: For converting PDF pages into images.\n- **Pillow**: For image processing.\n- **python-docx**: For creating and editing Word documents.\n- **tqdm**: For displaying progress.\n- **Flake8**: For linting.\n- **Pytest**: For tests.\n\n### Installation\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/AlexTkDev/PDF-to-Word-Conversion.git\n   cd PDF-to-Word-Conversion\n   ```\n2. **Create and activate a virtual environment:**\n   ```bash\n   python -m venv venv\n   source venv/bin/activate  # For Windows use `venv\\Scripts\\activate`\n   ```\n3. **Install dependencies:**\n   ```bash\n   pip install -r requirements.txt\n   ```\n   **Note:** Ensure that **Google Cloud SDK** and **Tesseract OCR** are installed and configured.\n4. **Set up Google Cloud Vision API:**\n    - Obtain a Google Cloud credentials file (JSON format).\n    - Set the path to this file in the environment variable `GOOGLE_APPLICATION_CREDENTIALS`.\n\n5. **Setting up Tesseract OCR:**\n    - **For Windows:**\n        - Download the Tesseract OCR installer from\n          the [official repository](https://github.com/tesseract-ocr/tesseract)\n          or [source](https://github.com/UB-Mannheim/tesseract/wiki).\n        - Run the installer and follow the instructions.\n        - Add the path to Tesseract in the PATH environment variable (e.g.,\n          `C:\\Program Files\\Tesseract-OCR`).\n\n    - **For macOS:**\n        - Use Homebrew to install Tesseract. Open a terminal and run:\n          ```bash\n          brew install tesseract\n          ```\n    - **For Linux:**\n        - Install Tesseract using a package manager. For example, on Ubuntu:\n          ```bash\n          sudo apt-get update\n          sudo apt-get install tesseract-ocr\n          ```\n    - **Installing Language Packages:**\n        - To add additional language packages, follow the instructions for your operating system.\n    - **Using in Python:**\n        - Install the `pytesseract` library:\n          ```bash\n          pip install pytesseract\n          ```\n        - Ensure that `pytesseract` knows where Tesseract is installed:\n        ```python\n        import pytesseract\n            # Specify the path to Tesseract if it's not in PATH\n         pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'\n            # for Windows\n        ```\n6. **Run the scripts:**\n    - To process PDF using Google Cloud Vision API:\n      ```bash\n      python PDF_processing_with_Google_Cloud_Vision_API.py\n      ```\n    - To process PDF locally using PyMuPDF and Tesseract:\n      ```bash\n      python processing_PDF_locally.py\n      ```\n\n### Running tests\n\n- To run tests, use the command:\n\n```bash\n pytest tests/\n```\n\n### Linting\n\n- To check your code for standards compliance, use Flake8. Run the command:\n\n```bash\nflake8 PDF_processing_with_Google_Cloud_Vision_API.py processing_PDF_locally.py --show-source --statistics\nflake8 PDF_processing_with_Google_Cloud_Vision_API.py processing_PDF_locally.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics\n```\n\n### Notes\n\n- In the script `PDF_processing_with_Google_Cloud_Vision_API.py`, replace\n  `'path_to_your_google_credentials.json'` with\n  the path to your Google Cloud credentials file.\n- In the script `processing_PDF_locally.py`, replace `'Open Project 100 images.pdf'` with the path\n  to your PDF document.\n\n### Project Structure\n\n- **PDF_processing_with_Google_Cloud_Vision_API.py**: Script for extracting text from images using\n  Google Cloud Vision\n  API and creating a Word document.\n- **processing_PDF_locally.py**: Script for extracting text from images using Tesseract and\n  creating a Word document.\n\n### Contributing\n\n- If you want to make changes to the project, fork the repository, make your changes, and create a\n  Pull Request.\n\n### License\n\nThis project is licensed under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falextkdev%2Fpdf-to-word-conversion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falextkdev%2Fpdf-to-word-conversion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falextkdev%2Fpdf-to-word-conversion/lists"}