1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Jobs/Util/PreviewPdf.php

55 lines
1.2 KiB
PHP
Raw Normal View History

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Jobs\Util;
use App\Models\Company;
2022-05-25 08:34:43 +02:00
use App\Utils\Traits\Pdf\PageNumbering;
use App\Utils\Traits\Pdf\PdfMaker;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class PreviewPdf implements ShouldQueue
{
2024-01-14 05:05:00 +01:00
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
use PdfMaker;
use PageNumbering;
/**
* Create a new job instance.
*
2020-10-28 11:10:49 +01:00
* @param $design_string
* @param Company $company
*/
2023-10-17 12:28:18 +02:00
public function __construct(public string $design_string, public Company $company)
{
}
public function handle()
{
2022-05-25 08:34:43 +02:00
$pdf = $this->makePdf(null, null, $this->design_string);
2022-05-25 14:00:17 +02:00
$numbered_pdf = $this->pageNumbering($pdf, $this->company);
2022-05-25 08:34:43 +02:00
if ($numbered_pdf) {
2022-05-25 14:00:17 +02:00
$pdf = $numbered_pdf;
}
2022-05-25 08:34:43 +02:00
return $pdf;
}
}