Skip to content

Commit

Permalink
Use the rendering options provider for the PDF generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Roshyo committed Mar 29, 2022
1 parent f4a2117 commit 8acee4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Generator/GiftCardPdfGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ public function generateAndGetContent(
'giftCard' => $giftCard,
'configuration' => $giftCardChannelConfiguration,
]);
$renderingOptions = $this->renderingOptionsProvider->getRenderingOptions($giftCardChannelConfiguration);

return $this->snappy->getOutputFromHtml($html);
return $this->snappy->getOutputFromHtml($html, $renderingOptions);
}

public function generateAndSavePdf(
Expand All @@ -72,9 +73,10 @@ public function generateAndSavePdf(
'giftCard' => $giftCard,
'configuration' => $giftCardChannelConfiguration,
]);
$renderingOptions = $this->renderingOptionsProvider->getRenderingOptions($giftCardChannelConfiguration);

$filePath = $this->giftCardPdfPathGenerator->generatePath($giftCardChannelConfiguration);
$pdfContent = $this->snappy->getOutputFromHtml($html, []);
$pdfContent = $this->snappy->getOutputFromHtml($html, $renderingOptions);

$this->filesystem->write(
$filePath,
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Generator/GiftCardPdfGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function it_generates_pdf_and_gets_content(): void
'giftCard' => $giftCard,
'configuration' => $giftCardChannelConfiguration,
])->willReturn('super GiftCard template');
$snappy->getOutputFromHtml('super GiftCard template')->willReturn('<PDF>super GiftCard template</PDF>');
$snappy->getOutputFromHtml('super GiftCard template', [])->willReturn('<PDF>super GiftCard template</PDF>');

$giftCardPdfGenerator = new GiftCardPdfGenerator(
$twig->reveal(),
Expand Down

0 comments on commit 8acee4b

Please sign in to comment.