diff --git a/app/Http/Controllers/BatchExportController.php b/app/Http/Controllers/BatchExportController.php
index 48f8c74d..f33d6ddc 100644
--- a/app/Http/Controllers/BatchExportController.php
+++ b/app/Http/Controllers/BatchExportController.php
@@ -8,7 +8,6 @@
namespace App\Http\Controllers;
-
use App\Policies\ProjectPolicy;
use App\Repositories\Document;
use App\Repositories\Project;
@@ -167,6 +166,8 @@ private function exportPDF(array $navigators, Project $project, Collection $docu
'mode' => 'utf-8',
'tempDir' => sys_get_temp_dir(),
'defaultfooterline' => false,
+ 'useSubstitutions' => true,
+ 'backupSubsFont' => ['dejavusanscondensed', 'arialunicodems', 'sun-exta'],
]);
$mpdf->allow_charset_conversion = true;
@@ -186,7 +187,8 @@ private function exportPDF(array $navigators, Project $project, Collection $docu
$mpdf->WriteHTML($header);
$pageNo = 1;
- $this->traverseNavigators($navigators,
+ $this->traverseNavigators(
+ $navigators,
function ($id, array $parents) use ($documents, $mpdf, &$pageNo) {
if ($pageNo > 1) {
$mpdf->AddPage();
@@ -225,7 +227,9 @@ function ($id, array $parents) use ($documents, $mpdf, &$pageNo) {
}
$pageNo++;
- }, []);
+ },
+ []
+ );
$mpdf->Output();
}
@@ -250,7 +254,6 @@ private function traverseNavigators(array $navigators, \Closure $callback, array
}
}
-
/**
* 检查是否用户有导出权限
*
@@ -270,4 +273,4 @@ private function canExport($projectId)
return $project;
}
-}
\ No newline at end of file
+}
diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php
index fbd32b29..3dcd750f 100644
--- a/app/Http/Controllers/ExportController.php
+++ b/app/Http/Controllers/ExportController.php
@@ -14,7 +14,6 @@
class ExportController extends Controller
{
-
/**
* 直接将内容导出为下载文件
*
@@ -45,15 +44,19 @@ public function pdf(Request $request, $type)
$author = $request->input('author');
$mpdf = new Mpdf([
- 'mode' => 'utf-8',
- 'tempDir' => sys_get_temp_dir()
+ 'mode' => 'utf-8',
+ 'tempDir' => sys_get_temp_dir(),
+ 'useSubstitutions' => true,
+ 'backupSubsFont' => ['dejavusanscondensed', 'arialunicodems', 'sun-exta'],
]);
+ $mpdf->SetFooter('{PAGENO} / {nbpg}');
+ $mpdf->SetTitle($title);
+
$mpdf->allow_charset_conversion = true;
$mpdf->useAdobeCJK = true;
$mpdf->autoLangToFont = true;
$mpdf->autoScriptToLang = true;
- $mpdf->title = $title;
$mpdf->author = $author ?? \Auth::user()->name ?? 'wizard';
$header = '';
@@ -68,7 +71,6 @@ public function pdf(Request $request, $type)
break;
}
-
$header .= '';
$header .= '';
$mpdf->WriteHTML($header);
@@ -91,5 +93,4 @@ public function pdf(Request $request, $type)
$mpdf->Output();
}
-
-}
\ No newline at end of file
+}