Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/portal/docs/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/portal/docs/INSTALL_TCPDF.md

# Installing TCPDF for PDF Export

## What is TCPDF?

TCPDF is a PHP library for generating PDF documents. It's used in the member upload feature to export upload results (including member credentials) as PDF files.

## Installation Steps

### Step 1: Navigate to Project Directory

Open Command Prompt or Terminal and navigate to your project directory:

```bash
cd c:\xampp\htdocs\copmadinaarea
```

### Step 2: Install TCPDF via Composer

Run the following command:

```bash
composer require tecnickcom/tcpdf
```

**OR** if you want to install all dependencies at once:

```bash
composer install
```

This will install both PhpSpreadsheet (for Excel) and TCPDF (for PDF).

### Step 3: Verify Installation

After installation, check that the vendor folder contains:
- `vendor/tecnickcom/tcpdf/`
- `vendor/phpoffice/phpspreadsheet/`

### Step 4: Test the Feature

1. Go to **Membership → Upload Members**
2. Upload a CSV or Excel file with member data
3. After successful upload, you'll see upload results
4. Click the **"Export to PDF"** button
5. A PDF file will be downloaded with all upload results

## What Gets Exported to PDF?

The PDF export includes:
- **Upload date and time**
- **Summary statistics** (Total, Successful, Warnings, Errors)
- **Complete results table** with:
  - Row number
  - Member name
  - Status (color-coded)
  - Membership card number
  - **Member credentials (Username & Password)**

## Troubleshooting

### Error: "Class 'TCPDF' not found"

**Solution:** Run `composer install` or `composer require tecnickcom/tcpdf`

### Error: "vendor/autoload.php not found"

**Solution:** 
1. Ensure Composer is installed on your system
2. Run `composer install` in the project directory

### Error: "Unable to export PDF"

**Solution:**
1. Check that upload results exist (upload members first)
2. Ensure `vendor/tecnickcom/tcpdf/` folder exists
3. Check PHP memory limit (increase if needed in php.ini)

## Features of PDF Export

✅ **Professional layout** with church branding
✅ **Color-coded status** (Green=Success, Yellow=Warning, Red=Error)
✅ **Summary statistics** at the top
✅ **Complete credentials** including usernames and passwords
✅ **Downloadable filename** with timestamp
✅ **Automatic page breaks** for large uploads

## Use Case

The PDF export is particularly useful for:
- **Sharing credentials** with new members
- **Record keeping** of bulk uploads
- **Printing** member account details for distribution
- **Audit trails** of member registration

## File Naming

Downloaded PDF files are named:
```
member_upload_results_YYYYMMDD_HHMMSS.pdf
```

Example: `member_upload_results_20250113_143052.pdf`

## Required PHP Extensions

Make sure these are enabled in your `php.ini`:
- `extension=gd` (for image processing)
- `extension=mbstring` (for multi-byte strings)
- `extension=zip` (for PhpSpreadsheet)

## Alternative Installation (Manual)

If Composer is not available:

1. Download TCPDF from: https://github.com/tecnickcom/TCPDF/releases
2. Extract to `vendor/tecnickcom/tcpdf/`
3. Ensure the autoload path is correct

## Support

For issues with TCPDF library, visit:
- GitHub: https://github.com/tecnickcom/TCPDF
- Documentation: https://tcpdf.org/

---

**Installation Complete!** You can now export member upload results to PDF with full credentials included.

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists