Pārlūkot izejas kodu

卷子生成pdf效果制作

yemeishu 2 nedēļas atpakaļ
vecāks
revīzija
ac70518988
1 mainītis faili ar 3 papildinājumiem un 0 dzēšanām
  1. 3 0
      app/Services/ExamPdfExportService.php

+ 3 - 0
app/Services/ExamPdfExportService.php

@@ -119,6 +119,7 @@ class ExamPdfExportService
             '--headless',
             '--disable-gpu',
             '--no-sandbox',
+            '--disable-dev-shm-usage', // 避免容器内 /dev/shm 过小导致崩溃
             '--print-to-pdf=' . $tmpPdf,
             '--print-to-pdf-no-header',
             '--allow-file-access-from-files',
@@ -129,6 +130,8 @@ class ExamPdfExportService
 
         if (!$process->isSuccessful() || !file_exists($tmpPdf)) {
             Log::error('ExamPdfExportService: Chrome 渲染失败', [
+                'cmd' => implode(' ', $process->getCommandLine()),
+                'exit_code' => $process->getExitCode(),
                 'error' => $process->getErrorOutput(),
                 'output' => $process->getOutput(),
             ]);