# Quick Start Guide

## Installation

```bash
pip3 install -r requirements.txt
```

## Running the Server

```bash
python3 main.py
```

The server will start on `http://localhost:8000`

## Testing the API

### Option 1: Use the test script
```bash
python3 test_conversion.py
```

### Option 2: Use curl commands

**Convert all .bin files in current directory:**
```bash
curl "http://localhost:8000/convert/all"
```

**Convert files in specific directory:**
```bash
curl "http://localhost:8000/convert/all?root_dir=/path/to/directory"
```

**Convert a single file:**
```bash
curl "http://localhost:8000/convert/single?file_path=/path/to/file.bin"
```

### Option 3: Use the interactive docs
Open your browser to: `http://localhost:8000/docs`

## Example Output

The API will:
- Find all `.bin` files (LEADTOOLS JPEG) in the specified directory (recursively)
- Convert each `.bin` file to `.jpg` (removes LEADTOOLS metadata, creates standard JPEG)
- Convert each `.bin` file to `.pdf` (directly from the .bin file)
- Save output files (`.jpg` and `.pdf`) in the same directory as the source `.bin` file
- Return a JSON response with conversion results

**Note:** Both conversions (`.bin` → `.jpg` and `.bin` → `.pdf`) happen independently from the original `.bin` file.

Example response:
```json
{
  "total_found": 3,
  "successful": 3,
  "failed": 0,
  "results": [
    {
      "bin_file": "/path/to/file.bin",
      "jpeg_file": "/path/to/file.jpg",
      "pdf_file": "/path/to/file.pdf",
      "status": "completed",
      "error": null
    }
  ]
}
```
