# Professional PDF Generator for TimeTrack Pro # Creates a beautifully formatted PDF document from scratch $OutputPath = "C:\Users\alexi\Documents\projects\timetrack-pro\TimeTrack_Pro_Technical_Reference.pdf" Write-Host "Creating professional PDF document..." -ForegroundColor Cyan try { # Create Word application $Word = New-Object -ComObject Word.Application $Word.Visible = $false # Create new document $Doc = $Word.Documents.Add() $Selection = $Word.Selection # Define color scheme (Professional Blue) $PrimaryColor = 255 * 65536 + 255 * 256 + 255 # Will be set per element $AccentColor = 41 + 128 * 256 + 185 * 65536 # #2980B9 - Professional Blue $DarkColor = 44 + 62 * 256 + 80 * 65536 # #2C3E50 - Dark Blue-Grey # ============================================================================ # COVER PAGE # ============================================================================ $Selection.Font.Name = "Segoe UI" $Selection.Font.Size = 48 $Selection.Font.Bold = $true $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.Alignment = 1 # Center $Selection.ParagraphFormat.SpaceBefore = 150 $Selection.TypeText("TimeTrack Pro") $Selection.TypeParagraph() $Selection.Font.Size = 24 $Selection.Font.Bold = $false $Selection.Font.Color = $AccentColor $Selection.ParagraphFormat.SpaceBefore = 0 $Selection.TypeText("Technical & Functional Reference") $Selection.TypeParagraph() $Selection.TypeParagraph() # Horizontal line $Selection.ParagraphFormat.Alignment = 1 $Selection.Font.Size = 11 $Selection.Font.Color = $AccentColor $Selection.TypeText("_" * 60) $Selection.TypeParagraph() $Selection.TypeParagraph() # Subtitle $Selection.Font.Size = 14 $Selection.Font.Color = $DarkColor $Selection.Font.Italic = $true $Selection.ParagraphFormat.SpaceBefore = 30 $Selection.TypeText("Professional Time Tracking Application") $Selection.TypeParagraph() $Selection.TypeText("Built with Microsoft Access & VBA") $Selection.TypeParagraph() $Selection.TypeText("Automated Development via MCP VBA Server") $Selection.TypeParagraph() $Selection.TypeParagraph() $Selection.TypeParagraph() # Key metrics box $Selection.Font.Size = 12 $Selection.Font.Italic = $false $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.ParagraphFormat.SpaceBefore = 80 $Selection.TypeText("Project Highlights") $Selection.TypeParagraph() $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.Alignment = 0 # Left align $Selection.ParagraphFormat.LeftIndent = 100 $Selection.TypeText("• 915 Lines of Professional VBA Code") $Selection.TypeParagraph() $Selection.TypeText("• 7 Modular Components") $Selection.TypeParagraph() $Selection.TypeText("• 45% Development Time Reduction via Automation") $Selection.TypeParagraph() $Selection.TypeText("• Production-Ready Business Application") $Selection.TypeParagraph() $Selection.TypeParagraph() # Author info at bottom $Selection.ParagraphFormat.LeftIndent = 0 $Selection.ParagraphFormat.Alignment = 1 # Center $Selection.ParagraphFormat.SpaceBefore = 200 $Selection.Font.Size = 12 $Selection.Font.Bold = $true $Selection.Font.Color = $DarkColor $Selection.TypeText("Alexis Trouvé") $Selection.TypeParagraph() $Selection.Font.Size = 10 $Selection.Font.Bold = $false $Selection.Font.Color = $AccentColor $Selection.TypeText("alexistrouve.pro@gmail.com") $Selection.TypeParagraph() $Selection.TypeParagraph() $Selection.Font.Size = 9 $Selection.Font.Color = $DarkColor $Selection.TypeText("Version 1.0 | January 2025") $Selection.TypeParagraph() # Page break $Selection.InsertNewPage() # ============================================================================ # TABLE OF CONTENTS # ============================================================================ $Selection.Font.Name = "Segoe UI" $Selection.Font.Size = 20 $Selection.Font.Bold = $true $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.Alignment = 0 $Selection.ParagraphFormat.SpaceBefore = 0 $Selection.ParagraphFormat.LeftIndent = 0 $Selection.TypeText("Table of Contents") $Selection.TypeParagraph() $Selection.TypeParagraph() # Insert TOC $Range = $Selection.Range $TOC = $Doc.TablesOfContents.Add($Range, $true, 1, 3, $true, "", $true, $true) $Selection.TypeParagraph() # Page break $Selection.InsertNewPage() # ============================================================================ # SECTION 1: EXECUTIVE SUMMARY # ============================================================================ # Section header with background $Selection.Font.Size = 18 $Selection.Font.Bold = $true $Selection.Font.Color = 16777215 # White $Selection.ParagraphFormat.Shading.BackgroundPatternColor = $DarkColor $Selection.ParagraphFormat.SpaceBefore = 0 $Selection.ParagraphFormat.SpaceAfter = 12 $Selection.ParagraphFormat.LeftIndent = 10 $Selection.Style = "Heading 1" $Selection.TypeText(" 1. Executive Summary") $Selection.TypeParagraph() # Reset formatting $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.Shading.BackgroundPatternColor = 16777215 # White $Selection.ParagraphFormat.LeftIndent = 0 $Selection.ParagraphFormat.SpaceAfter = 6 $Selection.Style = "Normal" $Selection.TypeText("TimeTrack Pro is a professional time tracking application built on Microsoft Access, showcasing advanced database design, VBA automation, and modern development practices. This project demonstrates the capability to deliver production-ready business applications through automated development workflows using the VBA MCP Server.") $Selection.TypeParagraph() $Selection.TypeParagraph() $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.TypeText("Key Achievement:") $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.TypeText(" Complete application development (database structure, business logic, queries, and VBA modules) automated via MCP (Model Context Protocol) integration, demonstrating cutting-edge AI-assisted development capabilities.") $Selection.TypeParagraph() $Selection.TypeParagraph() # Statistics table $Selection.Font.Bold = $true $Selection.Font.Size = 12 $Selection.Font.Color = $AccentColor $Selection.TypeText("Project Statistics") $Selection.TypeParagraph() $Selection.Font.Bold = $false $Selection.Font.Size = 11 $Table = $Doc.Tables.Add($Selection.Range, 7, 2) $Table.Style = "Grid Table 4 - Accent 1" $Table.ApplyStyleHeadingRows = $true # Header row $Table.Cell(1, 1).Range.Text = "Metric" $Table.Cell(1, 2).Range.Text = "Value" # Data rows $Table.Cell(2, 1).Range.Text = "Total VBA Lines" $Table.Cell(2, 2).Range.Text = "915" $Table.Cell(3, 1).Range.Text = "VBA Modules" $Table.Cell(3, 2).Range.Text = "7" $Table.Cell(4, 1).Range.Text = "Database Tables" $Table.Cell(4, 2).Range.Text = "3" $Table.Cell(5, 1).Range.Text = "Functions" $Table.Cell(5, 2).Range.Text = "45+" $Table.Cell(6, 1).Range.Text = "Development Time Saved" $Table.Cell(6, 2).Range.Text = "45%" $Table.Cell(7, 1).Range.Text = "Comment Ratio" $Table.Cell(7, 2).Range.Text = "25%" $Selection.EndKey(6) # End of document $Selection.TypeParagraph() $Selection.TypeParagraph() # ============================================================================ # SECTION 2: PROJECT OVERVIEW # ============================================================================ $Selection.Style = "Heading 1" $Selection.Font.Size = 18 $Selection.Font.Bold = $true $Selection.Font.Color = 16777215 $Selection.ParagraphFormat.Shading.BackgroundPatternColor = $DarkColor $Selection.ParagraphFormat.LeftIndent = 10 $Selection.TypeText(" 2. Project Overview") $Selection.TypeParagraph() $Selection.Style = "Normal" $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.Shading.BackgroundPatternColor = 16777215 $Selection.ParagraphFormat.LeftIndent = 0 # Subsection: Purpose $Selection.Style = "Heading 2" $Selection.Font.Size = 14 $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.TypeText("2.1 Purpose") $Selection.TypeParagraph() $Selection.Style = "Normal" $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.TypeText("TimeTrack Pro is a time management tool designed for freelancers, consultants, and small teams to:") $Selection.TypeParagraph() $Selection.ParagraphFormat.LeftIndent = 30 $Selection.TypeText("• Track billable hours across multiple clients and projects") $Selection.TypeParagraph() $Selection.TypeText("• Calculate revenue automatically based on hourly rates") $Selection.TypeParagraph() $Selection.TypeText("• Generate professional reports for invoicing and analysis") $Selection.TypeParagraph() $Selection.TypeText("• Maintain a complete audit trail of time entries") $Selection.TypeParagraph() $Selection.ParagraphFormat.LeftIndent = 0 $Selection.TypeParagraph() # Subsection: Target Audience $Selection.Style = "Heading 2" $Selection.Font.Size = 14 $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.TypeText("2.2 Target Audience") $Selection.TypeParagraph() $Selection.Style = "Normal" $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.LeftIndent = 30 $Selection.Font.Bold = $true $Selection.TypeText("Freelancers: ") $Selection.Font.Bold = $false $Selection.TypeText("Independent consultants tracking multiple client projects") $Selection.TypeParagraph() $Selection.Font.Bold = $true $Selection.TypeText("Small Teams: ") $Selection.Font.Bold = $false $Selection.TypeText("Agencies managing client work and resource allocation") $Selection.TypeParagraph() $Selection.Font.Bold = $true $Selection.TypeText("Consultants: ") $Selection.Font.Bold = $false $Selection.TypeText("Professional services requiring detailed time records") $Selection.TypeParagraph() $Selection.ParagraphFormat.LeftIndent = 0 $Selection.TypeParagraph() # ============================================================================ # SECTION 3: DATABASE ARCHITECTURE # ============================================================================ $Selection.Style = "Heading 1" $Selection.Font.Size = 18 $Selection.Font.Bold = $true $Selection.Font.Color = 16777215 $Selection.ParagraphFormat.Shading.BackgroundPatternColor = $DarkColor $Selection.ParagraphFormat.LeftIndent = 10 $Selection.TypeText(" 3. Database Architecture") $Selection.TypeParagraph() $Selection.Style = "Normal" $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.Shading.BackgroundPatternColor = 16777215 $Selection.ParagraphFormat.LeftIndent = 0 $Selection.TypeText("The application uses a normalized relational database structure with three core tables:") $Selection.TypeParagraph() $Selection.TypeParagraph() # Table: tbl_Clients $Selection.Style = "Heading 2" $Selection.Font.Size = 14 $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.TypeText("3.1 Table: tbl_Clients") $Selection.TypeParagraph() $Selection.Style = "Normal" $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.TypeText("Stores client information and contact details.") $Selection.TypeParagraph() $Selection.TypeParagraph() $TableClients = $Doc.Tables.Add($Selection.Range, 7, 4) $TableClients.Style = "Grid Table 4 - Accent 1" $TableClients.ApplyStyleHeadingRows = $true $TableClients.Cell(1, 1).Range.Text = "Field" $TableClients.Cell(1, 2).Range.Text = "Type" $TableClients.Cell(1, 3).Range.Text = "Size" $TableClients.Cell(1, 4).Range.Text = "Description" $TableClients.Cell(2, 1).Range.Text = "ClientID" $TableClients.Cell(2, 2).Range.Text = "AutoNumber" $TableClients.Cell(2, 3).Range.Text = "Long" $TableClients.Cell(2, 4).Range.Text = "Primary Key" $TableClients.Cell(3, 1).Range.Text = "Nom" $TableClients.Cell(3, 2).Range.Text = "Text" $TableClients.Cell(3, 3).Range.Text = "100" $TableClients.Cell(3, 4).Range.Text = "Client name (required)" $TableClients.Cell(4, 1).Range.Text = "Email" $TableClients.Cell(4, 2).Range.Text = "Text" $TableClients.Cell(4, 3).Range.Text = "100" $TableClients.Cell(4, 4).Range.Text = "Email address" $TableClients.Cell(5, 1).Range.Text = "Telephone" $TableClients.Cell(5, 2).Range.Text = "Text" $TableClients.Cell(5, 3).Range.Text = "20" $TableClients.Cell(5, 4).Range.Text = "Phone number" $TableClients.Cell(6, 1).Range.Text = "Notes" $TableClients.Cell(6, 2).Range.Text = "Memo" $TableClients.Cell(6, 3).Range.Text = "-" $TableClients.Cell(6, 4).Range.Text = "Additional notes" $TableClients.Cell(7, 1).Range.Text = "DateCreation" $TableClients.Cell(7, 2).Range.Text = "DateTime" $TableClients.Cell(7, 3).Range.Text = "-" $TableClients.Cell(7, 4).Range.Text = "Record creation timestamp" $Selection.EndKey(6) $Selection.TypeParagraph() $Selection.TypeParagraph() # ============================================================================ # SECTION 4: VBA MODULES # ============================================================================ $Selection.Style = "Heading 1" $Selection.Font.Size = 18 $Selection.Font.Bold = $true $Selection.Font.Color = 16777215 $Selection.ParagraphFormat.Shading.BackgroundPatternColor = $DarkColor $Selection.ParagraphFormat.LeftIndent = 10 $Selection.TypeText(" 4. VBA Architecture") $Selection.TypeParagraph() $Selection.Style = "Normal" $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.Shading.BackgroundPatternColor = 16777215 $Selection.ParagraphFormat.LeftIndent = 0 $Selection.TypeText("The application uses a modular VBA architecture with 7 core modules totaling 915 lines of code:") $Selection.TypeParagraph() $Selection.TypeParagraph() $TableModules = $Doc.Tables.Add($Selection.Range, 8, 3) $TableModules.Style = "Grid Table 4 - Accent 1" $TableModules.ApplyStyleHeadingRows = $true $TableModules.Cell(1, 1).Range.Text = "Module" $TableModules.Cell(1, 2).Range.Text = "Purpose" $TableModules.Cell(1, 3).Range.Text = "LOC" $TableModules.Cell(2, 1).Range.Text = "mod_Config" $TableModules.Cell(2, 2).Range.Text = "Application configuration and constants" $TableModules.Cell(2, 3).Range.Text = "80" $TableModules.Cell(3, 1).Range.Text = "mod_Navigation" $TableModules.Cell(3, 2).Range.Text = "Form navigation and UI flow control" $TableModules.Cell(3, 3).Range.Text = "120" $TableModules.Cell(4, 1).Range.Text = "mod_DataAccess" $TableModules.Cell(4, 2).Range.Text = "CRUD operations and database layer" $TableModules.Cell(4, 3).Range.Text = "200" $TableModules.Cell(5, 1).Range.Text = "mod_Calculs" $TableModules.Cell(5, 2).Range.Text = "Business logic and calculations" $TableModules.Cell(5, 3).Range.Text = "150" $TableModules.Cell(6, 1).Range.Text = "mod_Export" $TableModules.Cell(6, 2).Range.Text = "Report generation and export" $TableModules.Cell(6, 3).Range.Text = "120" $TableModules.Cell(7, 1).Range.Text = "mod_Utils" $TableModules.Cell(7, 2).Range.Text = "Helper functions and validation" $TableModules.Cell(7, 3).Range.Text = "100" $TableModules.Cell(8, 1).Range.Text = "mod_FormBuilder" $TableModules.Cell(8, 2).Range.Text = "Automated form creation (dev only)" $TableModules.Cell(8, 3).Range.Text = "145" $Selection.EndKey(6) $Selection.TypeParagraph() $Selection.TypeParagraph() # ============================================================================ # SECTION 5: MCP VBA AUTOMATION # ============================================================================ $Selection.Style = "Heading 1" $Selection.Font.Size = 18 $Selection.Font.Bold = $true $Selection.Font.Color = 16777215 $Selection.ParagraphFormat.Shading.BackgroundPatternColor = $DarkColor $Selection.ParagraphFormat.LeftIndent = 10 $Selection.TypeText(" 5. MCP VBA Server Automation") $Selection.TypeParagraph() $Selection.Style = "Normal" $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.Shading.BackgroundPatternColor = 16777215 $Selection.ParagraphFormat.LeftIndent = 0 $Selection.TypeText("This project showcases advanced automation using the VBA MCP Server (Model Context Protocol), enabling AI-assisted development of Access applications.") $Selection.TypeParagraph() $Selection.TypeParagraph() # Development metrics $Selection.Style = "Heading 2" $Selection.Font.Size = 14 $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.TypeText("5.1 Development Efficiency") $Selection.TypeParagraph() $Selection.Style = "Normal" $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $TableDev = $Doc.Tables.Add($Selection.Range, 7, 4) $TableDev.Style = "Grid Table 4 - Accent 1" $TableDev.ApplyStyleHeadingRows = $true $TableDev.Cell(1, 1).Range.Text = "Phase" $TableDev.Cell(1, 2).Range.Text = "Estimated" $TableDev.Cell(1, 3).Range.Text = "Actual" $TableDev.Cell(1, 4).Range.Text = "Method" $TableDev.Cell(2, 1).Range.Text = "Database Design" $TableDev.Cell(2, 2).Range.Text = "1h" $TableDev.Cell(2, 3).Range.Text = "0.5h" $TableDev.Cell(2, 4).Range.Text = "MCP Automated" $TableDev.Cell(3, 1).Range.Text = "Test Data" $TableDev.Cell(3, 2).Range.Text = "30min" $TableDev.Cell(3, 3).Range.Text = "15min" $TableDev.Cell(3, 4).Range.Text = "MCP Automated" $TableDev.Cell(4, 1).Range.Text = "VBA Modules" $TableDev.Cell(4, 2).Range.Text = "3h" $TableDev.Cell(4, 3).Range.Text = "1h" $TableDev.Cell(4, 4).Range.Text = "MCP Automated" $TableDev.Cell(5, 1).Range.Text = "SQL Queries" $TableDev.Cell(5, 2).Range.Text = "30min" $TableDev.Cell(5, 3).Range.Text = "20min" $TableDev.Cell(5, 4).Range.Text = "MCP Automated" $TableDev.Cell(6, 1).Range.Text = "Forms" $TableDev.Cell(6, 2).Range.Text = "2h" $TableDev.Cell(6, 3).Range.Text = "1h" $TableDev.Cell(6, 4).Range.Text = "Script + Manual" $TableDev.Cell(7, 1).Range.Text = "Testing & Docs" $TableDev.Cell(7, 2).Range.Text = "2h" $TableDev.Cell(7, 3).Range.Text = "2h" $TableDev.Cell(7, 4).Range.Text = "Manual" $Selection.EndKey(6) $Selection.TypeParagraph() $Selection.TypeParagraph() # Highlight box $Selection.ParagraphFormat.Shading.BackgroundPatternColor = 15132390 # Light blue $Selection.ParagraphFormat.LeftIndent = 20 $Selection.ParagraphFormat.RightIndent = 20 $Selection.Font.Bold = $true $Selection.Font.Size = 12 $Selection.Font.Color = $DarkColor $Selection.TypeText("Development Efficiency: 45% time reduction through automation") $Selection.TypeParagraph() $Selection.Font.Bold = $false $Selection.Font.Size = 11 $Selection.TypeText("Total estimated: 9 hours | Actual: ~5 hours") $Selection.TypeParagraph() $Selection.ParagraphFormat.Shading.BackgroundPatternColor = 16777215 $Selection.ParagraphFormat.LeftIndent = 0 $Selection.ParagraphFormat.RightIndent = 0 $Selection.TypeParagraph() # ============================================================================ # SECTION 6: PROFESSIONAL SERVICES # ============================================================================ $Selection.Style = "Heading 1" $Selection.Font.Size = 18 $Selection.Font.Bold = $true $Selection.Font.Color = 16777215 $Selection.ParagraphFormat.Shading.BackgroundPatternColor = $DarkColor $Selection.ParagraphFormat.LeftIndent = 10 $Selection.TypeText(" 6. Professional Services Available") $Selection.TypeParagraph() $Selection.Style = "Normal" $Selection.Font.Size = 11 $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.Shading.BackgroundPatternColor = 16777215 $Selection.ParagraphFormat.LeftIndent = 0 $Selection.TypeText("This project demonstrates expertise in the following areas:") $Selection.TypeParagraph() $Selection.TypeParagraph() $Selection.ParagraphFormat.LeftIndent = 30 $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.TypeText("• Microsoft Access Development") $Selection.TypeParagraph() $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.LeftIndent = 50 $Selection.TypeText("Forms, reports, VBA automation, and SQL optimization") $Selection.TypeParagraph() $Selection.TypeParagraph() $Selection.ParagraphFormat.LeftIndent = 30 $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.TypeText("• Database Design & Architecture") $Selection.TypeParagraph() $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.LeftIndent = 50 $Selection.TypeText("Normalization, indexing, referential integrity, and performance tuning") $Selection.TypeParagraph() $Selection.TypeParagraph() $Selection.ParagraphFormat.LeftIndent = 30 $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.TypeText("• Business Application Development") $Selection.TypeParagraph() $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.LeftIndent = 50 $Selection.TypeText("Requirements analysis, UX design, testing, and deployment") $Selection.TypeParagraph() $Selection.TypeParagraph() $Selection.ParagraphFormat.LeftIndent = 30 $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.TypeText("• Process Automation") $Selection.TypeParagraph() $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.LeftIndent = 50 $Selection.TypeText("VBA macros, AI-assisted development (MCP), workflow optimization") $Selection.TypeParagraph() $Selection.TypeParagraph() $Selection.ParagraphFormat.LeftIndent = 30 $Selection.Font.Bold = $true $Selection.Font.Color = $AccentColor $Selection.TypeText("• Legacy System Modernization") $Selection.TypeParagraph() $Selection.Font.Bold = $false $Selection.Font.Color = $DarkColor $Selection.ParagraphFormat.LeftIndent = 50 $Selection.TypeText("Access to SQL Server migration, web application conversion") $Selection.TypeParagraph() $Selection.ParagraphFormat.LeftIndent = 0 $Selection.TypeParagraph() $Selection.TypeParagraph() # Contact box $Selection.ParagraphFormat.Shading.BackgroundPatternColor = $DarkColor $Selection.ParagraphFormat.LeftIndent = 40 $Selection.ParagraphFormat.RightIndent = 40 $Selection.ParagraphFormat.SpaceBefore = 12 $Selection.ParagraphFormat.SpaceAfter = 12 $Selection.Font.Bold = $true $Selection.Font.Size = 14 $Selection.Font.Color = 16777215 $Selection.ParagraphFormat.Alignment = 1 $Selection.TypeText("Contact Information") $Selection.TypeParagraph() $Selection.Font.Bold = $false $Selection.Font.Size = 11 $Selection.Font.Color = 16777215 $Selection.TypeText("Alexis Trouvé") $Selection.TypeParagraph() $Selection.TypeText("alexistrouve.pro@gmail.com") $Selection.TypeParagraph() $Selection.Font.Italic = $true $Selection.Font.Size = 10 $Selection.TypeText("Response time: Within 24 hours") $Selection.TypeParagraph() $Selection.ParagraphFormat.Shading.BackgroundPatternColor = 16777215 $Selection.ParagraphFormat.LeftIndent = 0 $Selection.ParagraphFormat.RightIndent = 0 $Selection.ParagraphFormat.Alignment = 0 $Selection.Font.Italic = $false # ============================================================================ # UPDATE TABLE OF CONTENTS # ============================================================================ Write-Host "Updating table of contents..." -ForegroundColor Yellow $TOC.Update() # ============================================================================ # ADD HEADERS AND FOOTERS # ============================================================================ Write-Host "Adding headers and footers..." -ForegroundColor Yellow $Section = $Doc.Sections.Item(1) $Header = $Section.Headers.Item(1) $Footer = $Section.Footers.Item(1) # Header $Header.Range.Text = "TimeTrack Pro - Technical Reference" $Header.Range.Font.Size = 9 $Header.Range.Font.Color = 8421504 # Grey $Header.Range.ParagraphFormat.Alignment = 2 # Right align # Footer $Footer.Range.Text = "Page " $Footer.Range.Font.Size = 9 $Footer.Range.Font.Color = 8421504 $Footer.Range.ParagraphFormat.Alignment = 1 # Center $Field = $Footer.Range.Fields.Add($Footer.Range, 26) # wdFieldPage $Footer.Range.InsertAfter(" | Alexis Trouvé | 2025") # ============================================================================ # SAVE AS PDF # ============================================================================ Write-Host "Saving as PDF..." -ForegroundColor Yellow $Doc.SaveAs([ref]$OutputPath, [ref]17) Write-Host "Closing document..." -ForegroundColor Yellow $Doc.Close() $Word.Quit() # Cleanup [System.Runtime.Interopservices.Marshal]::ReleaseComObject($Selection) | Out-Null [System.Runtime.Interopservices.Marshal]::ReleaseComObject($Doc) | Out-Null [System.Runtime.Interopservices.Marshal]::ReleaseComObject($Word) | Out-Null [System.GC]::Collect() [System.GC]::WaitForPendingFinalizers() Write-Host "" Write-Host "SUCCESS! Professional PDF created:" -ForegroundColor Green Write-Host $OutputPath -ForegroundColor Cyan Write-Host "" } catch { Write-Host "" Write-Host "ERROR:" -ForegroundColor Red Write-Host $_.Exception.Message -ForegroundColor Red if ($Word) { $Word.Quit() [System.Runtime.Interopservices.Marshal]::ReleaseComObject($Word) | Out-Null } exit 1 }