import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf.mjs';
import { readFileSync } from 'fs';

async function extractText() {
  const data = new Uint8Array(readFileSync('./public/resume-template.pdf'));
  const pdf = await pdfjsLib.getDocument({ data }).promise;
  
  console.log('Total pages:', pdf.numPages);
  
  for (let i = 1; i <= Math.min(pdf.numPages, 2); i++) {
    const page = await pdf.getPage(i);
    const content = await page.getTextContent();
    console.log(`\n=== Page ${i} ===`);
    // Group by Y position to understand layout
    const items = content.items;
    items.forEach(item => {
      console.log(`${item.transform[5].toFixed(0)}: ${item.str}`);
    });
  }
}

extractText().catch(console.error);
