{
$html = $this->containHtml($html);
$html = $this->replaceIframesWithLinks($html);
+
return $this->pdfGenerator->fromHtml($html);
}
$doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
$xPath = new DOMXPath($doc);
-
$iframes = $xPath->query('//iframe');
/** @var DOMElement $iframe */
foreach ($iframes as $iframe) {
$anchor->setAttribute('href', $link);
$paragraph = $doc->createElement('p');
$paragraph->appendChild($anchor);
- $iframe->replaceWith($paragraph);
+ $iframe->parentNode->replaceChild($paragraph, $iframe);
}
return $doc->saveHTML();
namespace BookStack\Entities\Tools;
-use Barryvdh\Snappy\Facades\SnappyPdf;
use Barryvdh\DomPDF\Facade as DomPDF;
+use Barryvdh\Snappy\Facades\SnappyPdf;
class PdfGenerator
{
-
/**
* Generate PDF content from the given HTML content.
*/
return $pdf->output();
}
-
-}
\ No newline at end of file
+}