要在Laravel中安装CKEditor/CKEditor5导出PDF插件,可以按照以下步骤进行操作:
composer require unisharp/laravel-ckeditor
composer require johntaa/laravel-ckeditor5
composer require johntaa/laravel-ckeditor5-pdf-export
config/app.php
文件,在 providers
数组中添加以下两行:Unisharp\Ckeditor\ServiceProvider::class,
Johntaa\CKEditor\CKEditorServiceProvider::class,
php artisan vendor:publish --tag=ckeditor
php artisan vendor:publish --tag=ckeditor5
config/ckeditor.php
文件,并将以下代码添加到 plugins
数组中:'plugins' => [
// 其他插件...
'pdfexport' => [
'provider' => 'johntaa\CKEditor\CKEditorPluginPdfExport',
'buttons' => [
'PdfExport'
],
],
],
{!! \Ckeditor::field('content') !!}
这将在表单中创建一个CKEditor的实例,其中 'content' 是表单字段的名称。
请确保将脚本放在视图中正确的位置,并将 content
替换为你的表单字段的名称。
现在,你就可以在CKEditor工具栏中看到 "导出为PDF" 按钮,并使用它将内容导出为PDF文件。