diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index f6e97b7e01..4f85449878 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -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';