1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Added wkhtmltopdf support and done some style tweaks

Closes #248
This commit is contained in:
Dan Brown
2017-01-01 12:20:30 +00:00
parent 0eb90cb3b6
commit 3f0ef57d31
8 changed files with 152 additions and 8 deletions

View File

@@ -1,6 +1,5 @@
<?php namespace BookStack\Services;
use BookStack\Page;
class ExportService
@@ -28,8 +27,13 @@ class ExportService
{
$cssContent = file_get_contents(public_path('/css/export-styles.css'));
$pageHtml = view('pages/pdf', ['page' => $page, 'css' => $cssContent])->render();
$useWKHTML = config('snappy.pdf.binary') !== false;
$containedHtml = $this->containHtml($pageHtml);
$pdf = \PDF::loadHTML($containedHtml);
if ($useWKHTML) {
$pdf = \SnappyPDF::loadHTML($containedHtml);
} else {
$pdf = \PDF::loadHTML($containedHtml);
}
return $pdf->output();
}