1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for Historical PDF generation

This commit is contained in:
David Bomba 2021-05-04 19:56:15 +10:00
parent b2d38ac97c
commit bd22dc3314

View File

@ -14,12 +14,14 @@ namespace App\Http\Controllers;
use App\Http\Requests\Activity\DownloadHistoricalEntityRequest;
use App\Models\Activity;
use App\Transformers\ActivityTransformer;
use App\Utils\HostedPDF\NinjaPdf;
use App\Utils\PhantomJS\Phantom;
use App\Utils\Traits\Pdf\PdfMaker;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use stdClass;
use Symfony\Component\HttpFoundation\StreamedResponse;
use stdClass;
class ActivityController extends BaseController
{
@ -139,7 +141,15 @@ class ActivityController extends BaseController
return response()->json(['message'=> ctrans('texts.no_backup_exists'), 'errors' => new stdClass], 404);
}
$pdf = $this->makePdf(null, null, $backup->html_backup);
if (config('ninja.phantomjs_pdf_generation')) {
$pdf = (new Phantom)->convertHtmlToPdf($backup->html_backup);
}
elseif(config('ninja.invoiceninja_hosted_pdf_generation')){
$pdf = (new NinjaPdf())->build($backup->html_backup);
}
else {
$pdf = $this->makePdf(null, null, $backup->html_backup);
}
if (isset($activity->invoice_id)) {
$filename = $activity->invoice->numberFormatter().'.pdf';