Commit 28ca50c7 authored by Mahmoud Aglan's avatar Mahmoud Aglan

pdf

parent bcd98b65
...@@ -13,6 +13,16 @@ RUN apt-get update && apt-get install -y \ ...@@ -13,6 +13,16 @@ RUN apt-get update && apt-get install -y \
default-mysql-client \ default-mysql-client \
dos2unix \ dos2unix \
git \ git \
wkhtmltopdf \
xvfb \
libxrender1 \
libfontconfig1 \
fonts-noto \
fonts-noto-core \
fonts-noto-extra \
fonts-arabeyes \
fontconfig \
&& fc-cache -fv \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# ── Install Composer ── # ── Install Composer ──
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
} }
* { box-sizing: border-box; margin: 0; padding: 0; } * { box-sizing: border-box; margin: 0; padding: 0; }
body { body {
font-family: 'Segoe UI', Tahoma, Arial, sans-serif; font-family: 'Noto Sans Arabic', 'Noto Sans', 'Segoe UI', Tahoma, Arial, sans-serif;
font-size: 13px; font-size: 13px;
line-height: 1.7; line-height: 1.7;
color: #1A1A2E; color: #1A1A2E;
......
...@@ -40,15 +40,23 @@ final class PdfExportService ...@@ -40,15 +40,23 @@ final class PdfExportService
file_put_contents($tmpInput, $html); file_put_contents($tmpInput, $html);
$cmd = escapeshellarg($wkhtmltopdf) $cmd = escapeshellarg($wkhtmltopdf)
. ' --encoding utf-8 --page-size A4 --margin-top 10 --margin-bottom 10' . ' --encoding utf-8'
. ' --page-size A4'
. ' --margin-top 15 --margin-bottom 15 --margin-left 12 --margin-right 12'
. ' --enable-local-file-access'
. ' --no-stop-slow-scripts'
. ' --javascript-delay 500'
. ' --image-quality 85'
. ' --print-media-type'
. ' ' . escapeshellarg($tmpInput) . ' ' . escapeshellarg($tmpInput)
. ' ' . escapeshellarg($tmpOutput); . ' ' . escapeshellarg($tmpOutput)
. ' 2>&1';
exec($cmd, $output, $returnCode); exec($cmd, $output, $returnCode);
@unlink($tmpInput); @unlink($tmpInput);
if ($returnCode === 0 && file_exists($tmpOutput)) { if (($returnCode === 0 || $returnCode === 1) && file_exists($tmpOutput) && filesize($tmpOutput) > 0) {
$pdfContent = file_get_contents($tmpOutput); $pdfContent = file_get_contents($tmpOutput);
@unlink($tmpOutput); @unlink($tmpOutput);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment