mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for pdf preview
This commit is contained in:
parent
920bbf8b75
commit
8856e3fada
@ -18,6 +18,7 @@ use App\Jobs\Invoice\CreateInvoicePdf;
|
||||
use App\Jobs\Util\PreviewPdf;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class PreviewController extends BaseController
|
||||
@ -155,7 +156,7 @@ class PreviewController extends BaseController
|
||||
return response()->json(['message' => 'Invalid custom design object'], 400);
|
||||
}
|
||||
|
||||
$designer = new Designer($invoice, $design_object, $invoice->client->getSetting('pdf_variables'), lcfirst(request()->has('entity')));
|
||||
$designer = new Designer($invoice, $design_object, auth()->user()->company()->settings->pdf_variables, lcfirst(request()->has('entity')));
|
||||
|
||||
$html = $this->generateEntityHtml($designer, $invoice, $contact);
|
||||
|
||||
@ -165,6 +166,9 @@ class PreviewController extends BaseController
|
||||
$contact->forceDelete();
|
||||
$client->forceDelete();
|
||||
|
||||
return response()->file($file_path, array('content-type' => 'application/pdf'));
|
||||
$response = Response::make($file_path, 200);
|
||||
$response->header('Content-Type', 'application/pdf');
|
||||
return $response;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -33,14 +33,10 @@ use Spatie\Browsershot\Browsershot;
|
||||
|
||||
class PreviewPdf implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker;
|
||||
|
||||
public $invoice;
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, PdfMaker;
|
||||
|
||||
public $company;
|
||||
|
||||
public $contact;
|
||||
|
||||
private $disk;
|
||||
|
||||
public $design_string;
|
||||
@ -61,16 +57,8 @@ class PreviewPdf implements ShouldQueue
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$path = $this->company->company_key;
|
||||
|
||||
//Storage::makeDirectory($path, 0755);
|
||||
return $this->makePdf(null, null, $this->design_string);
|
||||
|
||||
$file_path = $path . '/stream.pdf';
|
||||
|
||||
$pdf = $this->makePdf(null, null, $this->design_string);
|
||||
|
||||
$instance = Storage::disk('local')->put($file_path, $pdf);
|
||||
|
||||
return storage_path('app') .'/'. $file_path;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user