<?php
// test-pdf.php - Debug file
echo "<h1>PDF Test Page</h1>";

// Check if PDF exists
$pdf_file = 'pdfs/P1.pdf';
$pdf_url = 'https://rotomaxelectric.com/pdfs/P1.pdf';

echo "<h3>Checking PDF File:</h3>";
echo "<p>Local path: " . realpath($pdf_file) . "</p>";
echo "<p>File exists: " . (file_exists($pdf_file) ? 'YES' : 'NO') . "</p>";
echo "<p>File size: " . (file_exists($pdf_file) ? filesize($pdf_file) . ' bytes' : 'N/A') . "</p>";

echo "<h3>Test Links:</h3>";
echo "<ol>";
echo "<li><a href='pdf-view.php?file=P1.pdf'>pdf-view.php?file=P1.pdf</a></li>";
echo "<li><a href='pdfs/P1.pdf' target='_blank'>Direct PDF Link</a></li>";
echo "<li><a href='d63-series-pmdc-motors.php'>Back to Product Page</a></li>";
echo "</ol>";

// Test file permissions
if (file_exists($pdf_file)) {
    echo "<h3>File Permissions:</h3>";
    echo "<p>Readable: " . (is_readable($pdf_file) ? 'YES' : 'NO') . "</p>";
    echo "<p>Permissions: " . substr(sprintf('%o', fileperms($pdf_file)), -4) . "</p>";
}
?>