diff --git a/packages/Webkul/Admin/src/Resources/views/sales/invoices/pdf.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/invoices/pdf.blade.php
index 2d88d2463..a8115351c 100755
--- a/packages/Webkul/Admin/src/Resources/views/sales/invoices/pdf.blade.php
+++ b/packages/Webkul/Admin/src/Resources/views/sales/invoices/pdf.blade.php
@@ -331,9 +331,15 @@
- | {{ __('admin::app.sales.orders.grand-total') }} |
- - |
- {!! core()->formatBasePrice($invoice->base_grand_total, true) !!} |
+
+
+ |
+
+
+
+ | {{ __('admin::app.sales.orders.grand-total') }} |
+ - |
+ {!! core()->formatBasePrice($invoice->base_grand_total, true) !!} |
diff --git a/packages/Webkul/Shop/src/Http/Controllers/OrderController.php b/packages/Webkul/Shop/src/Http/Controllers/OrderController.php
index c0778d1d6..b551a4b7d 100644
--- a/packages/Webkul/Shop/src/Http/Controllers/OrderController.php
+++ b/packages/Webkul/Shop/src/Http/Controllers/OrderController.php
@@ -94,9 +94,13 @@ class OrderController extends Controller
abort(404);
}
- $pdf = PDF::loadView('shop::customers.account.orders.pdf', compact('invoice'))->setPaper('a4');
+ $html = view('shop::customers.account.orders.pdf', compact('invoice'))->render();
- return $pdf->download('invoice-' . $invoice->created_at->format('d-m-Y') . '.pdf');
+ $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
+
+ return PDF::loadHTML($this->adjustArabicAndPersianContent($html))
+ ->setPaper('a4')
+ ->download('invoice-' . $invoice->created_at->format('d-m-Y') . '.pdf');
}
/**
@@ -125,4 +129,24 @@ class OrderController extends Controller
return redirect()->back();
}
+
+ /**
+ * Adjust arabic and persian content.
+ *
+ * @param string $html
+ * @return string
+ */
+ private function adjustArabicAndPersianContent($html)
+ {
+ $arabic = new \ArPHP\I18N\Arabic();
+
+ $p = $arabic->arIdentify($html);
+
+ for ($i = count($p) - 1; $i >= 0; $i -= 2) {
+ $utf8ar = $arabic->utf8Glyphs(substr($html, $p[$i - 1], $p[$i] - $p[$i - 1]));
+ $html = substr_replace($html, $utf8ar, $p[$i - 1], $p[$i] - $p[$i - 1]);
+ }
+
+ return $html;
+ }
}
\ No newline at end of file
diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php
index f64ab0a0c..eb91caa77 100755
--- a/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php
+++ b/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php
@@ -347,7 +347,13 @@
{{ core()->formatPrice($invoice->tax_amount, $invoice->order->order_currency_code) }} |
-
+
+
+
+ |
+
+
+
| {{ __('shop::app.customer.account.order.view.grand-total') }} |
- |
{{ core()->formatPrice($invoice->grand_total, $invoice->order->order_currency_code) }} |