mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-08 05:54:47 +00:00
Feat(Gotenberg): Opt-in alternative pdf generation for modern CSS (#184)
* WIP(gotenberg): add pdf generation abstraction and UI * feat(pdf): settings validate(clien+server) & save * fix(gotenberg): Use correct default papersize chore(gotengberg): Remove unused GOTENBERG_MARGINS env from .env * style(gotenberg): fix linter/styling issues * fix(pdf): use pdf config policy * fix: revert accidental capitalization in mail config vue * Update composer, remove whitespace typo * Fix small typos * fix cookie/env issue * Add gotenberg to .dev, move admin menu item up
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V1\Admin\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\PDFConfigurationRequest;
|
||||
use App\Space\EnvironmentManager;
|
||||
|
||||
class PDFConfigurationController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var EnvironmentManager
|
||||
*/
|
||||
protected $environmentManager;
|
||||
|
||||
public function __construct(EnvironmentManager $environmentManager)
|
||||
{
|
||||
$this->environmentManager = $environmentManager;
|
||||
}
|
||||
|
||||
public function getDrivers()
|
||||
{
|
||||
$this->authorize('manage pdf config');
|
||||
|
||||
$drivers = [
|
||||
'dompdf',
|
||||
'gotenberg',
|
||||
];
|
||||
|
||||
return response()->json($drivers);
|
||||
}
|
||||
|
||||
public function getEnvironment()
|
||||
{
|
||||
$this->authorize('manage pdf config');
|
||||
|
||||
$config = [
|
||||
'pdf_driver' => config('pdf.driver'),
|
||||
'gotenberg_host' => config('pdf.gotenberg.host'),
|
||||
'gotenberg_margins' => config('pdf.gotenberg.margins'),
|
||||
'gotenberg_papersize' => config('pdf.gotenberg.papersize'),
|
||||
];
|
||||
|
||||
return response()->json($config);
|
||||
}
|
||||
|
||||
public function saveEnvironment(PDFConfigurationRequest $request)
|
||||
{
|
||||
$this->authorize('manage pdf config');
|
||||
$results = $this->environmentManager->savePDFVariables($request);
|
||||
|
||||
return response()->json($results);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user