SIGN IN SIGN UP

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

0 0 168 TypeScript

V2: Convert Tool (#3828)

๐Ÿ”„ Dynamic Processing Strategies

- Adaptive routing: Same tool uses different backend endpoints based on
file analysis
- Combined vs separate processing: Intelligently chooses between merge
operations and individual file processing
- Cross-format workflows: Enable complex conversions like "mixed files โ†’
PDF" that other tools can't handle

  โš™๏ธ Format-Specific Intelligence

  Each conversion type gets tailored options:
  - HTML/ZIP โ†’ PDF: Zoom controls (0.1-3.0 increments) with live preview
  - Email โ†’ PDF: Attachment handling, size limits, recipient control
  - PDF โ†’ PDF/A: Digital signature detection with warnings
  - Images โ†’ PDF: Smart combining vs individual file options

 File Architecture

  Core Implementation:
  โ”œโ”€โ”€ Convert.tsx                     # Main stepped workflow UI
โ”œโ”€โ”€ ConvertSettings.tsx # Centralized settings with smart detection
โ”œโ”€โ”€ GroupedFormatDropdown.tsx # Enhanced format selector with grouping
โ”œโ”€โ”€ useConvertParameters.ts # Smart detection & parameter management
  โ”œโ”€โ”€ useConvertOperation.ts         # Multi-strategy processing logic
  โ””โ”€โ”€ Settings Components:
      โ”œโ”€โ”€ ConvertFromWebSettings.tsx      # HTML zoom controls
      โ”œโ”€โ”€ ConvertFromEmailSettings.tsx    # Email attachment options
โ”œโ”€โ”€ ConvertToPdfaSettings.tsx # PDF/A with signature detection
      โ”œโ”€โ”€ ConvertFromImageSettings.tsx    # Image PDF options
      โ””โ”€โ”€ ConvertToImageSettings.tsx      # PDF to image options

 Utility Layer

  Utils & Services:
โ”œโ”€โ”€ convertUtils.ts # Format detection & endpoint routing
  โ”œโ”€โ”€ fileResponseUtils.ts          # Generic API response handling
โ””โ”€โ”€ setupTests.ts # Enhanced test environment with crypto mocks

  Testing & Quality

  Comprehensive Test Coverage

  Test Suite:
โ”œโ”€โ”€ useConvertParameters.test.ts # Parameter logic & smart detection
  โ”œโ”€โ”€ useConvertParametersAutoDetection.test.ts  # File type analysis
โ”œโ”€โ”€ ConvertIntegration.test.tsx # End-to-end conversion workflows
  โ”œโ”€โ”€ ConvertSmartDetectionIntegration.test.tsx  # Mixed file scenarios
  โ”œโ”€โ”€ ConvertE2E.spec.ts                     # Playwright browser tests
โ”œโ”€โ”€ convertUtils.test.ts # Utility function validation
  โ””โ”€โ”€ fileResponseUtils.test.ts              # API response handling

  Advanced Test Features

  - Crypto API mocking: Proper test environment for file hashing
  - File.arrayBuffer() polyfills: Complete browser API simulation
  - Multi-file scenario testing: Complex batch processing validation
- CI/CD integration: Vitest runs in GitHub Actions with proper artifacts

---------

Co-authored-by: Connor Yoh <connor@stirlingpdf.com>
Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
C
ConnorYoh committed
9c9acbfb5bdda9c91b741d998043fc53e5652f81
Parent: 8881f19
Committed by GitHub <noreply@github.com> on 8/1/2025, 3:08:04 PM