Skip to content

An API for extracting text and images from PDF attachments within Gmail messages.

License

Notifications You must be signed in to change notification settings

gasparyanvazgen/pdf-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Parser

PDF Parser is a Spring Boot-based application designed to extract text and images from PDF attachments within Gmail messages. It relies on Google APIs to access Gmail and Firebase Cloud Storage to save the extracted images.

Prerequisites

To begin, ensure you have the following prerequisites in place:

  • Java 11 or higher
  • Gmail API Credentials JSON (Refer to the Gmail API Quickstart Guide for acquiring these credentials)
  • Firebase API Credentials JSON for Firebase Cloud Storage (You can create a service account and obtain the JSON credentials from the Firebase Console)

Setup

  1. Start by cloning the repository to your local machine:

    git clone https://github.com/gasparyanvazgen/pdf-parser.git
  2. Ensure you have the necessary credentials files available:

  3. Adjust the application.yml file within the src/main/resources directory to match your specific configuration:

    gmail:
      applicationName: pdf-parser
      tokensDirectoryPath: tokens
      credentialsFilePath: /gmail-credentials.json
      userId: example@gmail.com
    
    firebase:
      storage:
        googleApplicationCredentials: /firebase-credentials.json
        storageBucket: project_id.appspot.com
  4. To launch the application, use Gradle:

    ./gradlew bootRun

The application is now accessible at http://localhost:8080.

Usage

Extracting Bank Statements

To extract bank statements from Gmail messages, initiate a GET request to the following endpoint:

GET http://localhost:8080/api/pdf-parser/parse-bank-statements

Parameters:

  • subject (required): Specify the subject of the Gmail messages you wish to fetch (e.g., "Bank statement").
  • startDate (optional): Set the start date for message filtering (in the format "yyyy-MM-dd").
  • endDate (optional): Define the end date for message filtering (in the format "yyyy-MM-dd").

This endpoint will return a JSON response that includes the extracted text and image URLs from the PDF attachments within matching Gmail messages.

Code Structure

The project is organized as follows:

License

This project is licensed under the MIT License. Refer to the LICENSE file for details.

Releases

No releases published

Packages

No packages published

Languages