diff --git a/src/Commands/BuildCommand.php b/src/Commands/BuildCommand.php index 04bfca9..d3ec226 100644 --- a/src/Commands/BuildCommand.php +++ b/src/Commands/BuildCommand.php @@ -24,6 +24,7 @@ class BuildCommand extends Command * @var string|string[]|null */ public $themeName; + /** * @var OutputInterface */ @@ -204,9 +205,7 @@ protected function buildPdf(string $html, array $config, string $currentPath, st $pdf->SetMargins(400, 100, 12); - if (! $this->disk->isFile($currentPath.'/assets/cover.jpg')) { - $this->output->writeln('==> No assets/cover.jpg File Found. Skipping ...'); - } else { + if ($this->disk->isFile($currentPath . '/assets/cover.jpg')) { $this->output->writeln('==> Adding Book Cover ...'); $coverPosition = $config['cover']['position'] ?? 'position: absolute; left:0; right: 0; top: -.2; bottom: 0;'; @@ -221,6 +220,16 @@ protected function buildPdf(string $html, array $config, string $currentPath, st ); $pdf->AddPage(); + } elseif ($this->disk->isFile($currentPath . '/assets/cover.html')) { + $this->output->writeln('==> Adding Book Cover ...'); + + $cover = $this->disk->get($currentPath . '/assets/cover.html'); + + $pdf->WriteHTML($cover); + + $pdf->AddPage(); + } else { + $this->output->writeln('==> No assets/cover.jpg File Found. Skipping ...'); } $pdf->SetHTMLFooter(''); diff --git a/stubs/assets/cover.html b/stubs/assets/cover.html new file mode 100644 index 0000000..ffe76b3 --- /dev/null +++ b/stubs/assets/cover.html @@ -0,0 +1 @@ +

Title