���� ������������������������������������ $pdfFilename
"; // === Convert API Call === $url = 'https://v2.convertapi.com/convert/pdf/to/jpg?Secret=' . $convertApiSecret; $postFields = ['File' => new CURLFile($uploadedPath)]; $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postFields ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode === 200) { $result = json_decode($response, true); $htmlImages = ''; if (isset($result['Files'])) { foreach ($result['Files'] as $index => $file) { $fileName = 'page' . ($index + 1) . '.jpg'; $localImagePath = $outputDir . $fileName; $imageUrl = $outputUrl . $fileName; if (!empty($file['FileData'])) { $imageData = base64_decode($file['FileData']); if ($imageData !== false && file_put_contents($localImagePath, $imageData)) { echo "✅ Saved image: $fileName
"; $htmlImages .= '

' . '' . '

';} else { echo "❌ Failed to save image $fileName
"; } } else { echo "⚠️ No FileData for $fileName
"; } } // === SEND TO CLIENTPOINT === $clientpointPayload = [ 'api_key' => $clientpointApiKey, 'template_id' => [$templateId], 'auto_process' => "true", 'data' => [ 'ClientPDF' => $htmlImages ] ]; $ch = curl_init($clientpointApiUrl); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => ['Content-Type: application/json'], CURLOPT_POSTFIELDS => json_encode($clientpointPayload), ]); $clientpointResponse = curl_exec($ch); $clientpointHttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($clientpointHttpCode === 200) { echo "✅ ClientPoint updated successfully.
"; } else { echo "❌ Failed to update ClientPoint (HTTP $clientpointHttpCode).
"; echo "
$clientpointResponse
"; } } else { echo "❌ No images returned by ConvertAPI.
"; } } else { echo "❌ ConvertAPI request failed (HTTP $httpCode).
"; echo "
$response
"; } } else { echo "❌ Failed to move uploaded file.
"; } } else { echo "❌ File upload error.
"; } } ?> Upload PDF and Convert to Images

Upload a PDF to Convert to JPG