# VIP Schedule PDF Generator

Professional PDF generation for VIP schedules using @react-pdf/renderer.

## Features

- Professional, print-ready PDF documents
- Prominent timestamp showing when PDF was generated
- Warning banner alerting users to check the app for latest updates
- Contact information footer for questions
- Branded header with VIP information
- Color-coded event types (Transport, Meeting, Event, Meal)
- Flight information display
- Driver and vehicle assignments
- Clean, professional formatting suitable for VIPs and coordinators

## Usage

```tsx
import { pdf } from '@react-pdf/renderer';
import { VIPSchedulePDF } from '@/components/VIPSchedulePDF';

// Generate and download PDF
const handleExport = async () => {
  const blob = await pdf(
    <VIPSchedulePDF
      vip={vipData}
      events={scheduleEvents}
      contactEmail="coordinator@example.com"
      contactPhone="(555) 123-4567"
      appUrl={window.location.origin}
    />
  ).toBlob();

  // Create download
  const url = URL.createObjectURL(blob);
  const link = document.createElement('a');
  link.href = url;
  link.download = `${vipData.name}_Schedule.pdf`;
  link.click();
  URL.revokeObjectURL(url);
};
```

## Props

### VIPSchedulePDFProps

| Prop | Type | Required | Description |
|------|------|----------|-------------|
| `vip` | `VIP` | Yes | VIP information including name, organization, arrival details |
| `events` | `PDFScheduleEvent[]` | Yes | Array of scheduled events for the VIP |
| `contactEmail` | `string` | No | Contact email for questions (default from env) |
| `contactPhone` | `string` | No | Contact phone for questions (default from env) |
| `appUrl` | `string` | No | URL to the web app for latest schedule updates |

## Environment Variables

Configure contact information in `.env`:

```env
VITE_CONTACT_EMAIL=coordinator@example.com
VITE_CONTACT_PHONE=(555) 123-4567
VITE_ORGANIZATION_NAME=VIP Coordinator
```

## PDF Structure

1. **Header Section**
   - VIP name (large, branded blue)
   - Organization and department
   - Generation timestamp with warning banner

2. **VIP Information**
   - Arrival mode and expected arrival time
   - Airport pickup and venue transport flags

3. **Flight Information** (if applicable)
   - Flight numbers and routes
   - Scheduled arrival times
   - Flight status

4. **Special Notes** (if provided)
   - Highlighted yellow box with special instructions

5. **Schedule & Itinerary**
   - Events grouped by day
   - Color-coded by event type
   - Time, location, and description
   - Driver and vehicle assignments
   - Event status badges

6. **Footer** (on every page)
   - Contact information
   - Page numbers

## Event Type Colors

- **Transport**: Blue background, blue border
- **Meeting**: Purple background, purple border
- **Event**: Green background, green border
- **Meal**: Orange background, orange border
- **Accommodation**: Gray background, gray border

## Timestamp Warning

The PDF includes a prominent yellow warning banner that shows:
- When the PDF was generated
- A notice that it's a snapshot in time
- Instructions to visit the web app for the latest schedule

This ensures VIPs and coordinators know to check for updates.

## Customization

To customize branding colors, edit the `styles` object in `VIPSchedulePDF.tsx`:

```typescript
const styles = StyleSheet.create({
  title: {
    color: '#1a56db', // Primary brand color
  },
  // ... other styles
});
```

## PDF Output

- **Format**: A4 size
- **Font**: Helvetica (built-in, ensures consistent rendering)
- **File naming**: `{VIP_Name}_Schedule_{Date}.pdf`
- **Quality**: Print-ready, professional formatting

## Browser Compatibility

Works in all modern browsers:
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+

## Performance

PDF generation is fast:
- Small schedules (1-5 events): < 1 second
- Medium schedules (6-20 events): 1-2 seconds
- Large schedules (20+ events): 2-3 seconds

## Troubleshooting

**PDF fails to generate:**
- Check browser console for errors
- Ensure all required props are provided
- Verify event data has valid date strings

**Styling looks wrong:**
- @react-pdf/renderer uses its own styling system
- Not all CSS properties are supported
- Check official docs for supported styles

**Fonts not loading:**
- Built-in fonts (Helvetica, Times, Courier) always work
- Custom fonts require Font.register() call
- Ensure font URLs are accessible

## Future Enhancements

- [ ] Add QR code linking to web app
- [ ] Support for custom logos/branding
- [ ] Multiple language support
- [ ] Print optimization options
- [ ] Email integration for sending PDFs
