Category : dompdf

I currently using barryvdh/laravel-dompdf for printing pdf. But whenever I click on the print button it always downloads the file instead of opening a browser tab. How I can fix this ??? I’ve seen others post but I didn’t get the right solution too. $customer = Customer::findOrFail($id); $pdf = PDF::loadView(‘pdf.info-print’, $customer); return $pdf->stream(‘info.pdf’); Sourc..

Read more

use IlluminateHttpRequest; use PDF; class PDFController extends Controller { /** * Display a listing of the resource. * * @return IlluminateHttpResponse */ public function generatePDF() { $data = [ ‘title’ => ‘hello world’, ‘date’ => date(‘m/d/Y’) ]; $pdf = PDF::loadView(‘myPDF’, $data); return $pdf->download(‘itsolutionstuff.pdf’); } } Sourc..

Read more

When generating my PDF with custom fonts and trying to stream like this: $pdf = PDF::loadView( ‘/pdfs/invoice’,$data); return $pdf->stream(); local environment everything works fine. I can generate the pdf also. production environment I am getting the error which written on the title. And I have saved my Font files within storage/fonts and I have added ..

Read more

As per documentation, we print the page number on each pdf page but my problem is I want to use the PHP variables inside dom script tag which I can’t <script type="text/php"> if (isset($pdf)) { $font = $fontMetrics->getFont("Arial", "bold"); $pdf->page_text(555, 745, "{PAGE_NUM}", $font, 7, array(0, 0, 0)); } </script> @php $page = "{PAGE_NUM}";// it prints ..

Read more

I have an html view where I load data from the database. I’m using dompdf to print this view. But the report is not generated, until the browser displays this error: Maximum execution time of 60 seconds exceeded. But without loading data from the database, the report is generated This my View: <table class="table table-hover ..

Read more

After 3 hours of googling and searching, I have officially given up. How can you load this font in Laravel/DomPDF properly? In my controller I have: $pdf = App::make(‘dompdf.wrapper’)->loadView(‘pdf’, [ ‘some’ => $data, ]); return $pdf->stream(‘my.pdf’); In my blade file I have: <link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:[email protected];700&display=swap" rel="stylesheet"> <style> html, body { font-family: ‘Open Sans Condensed’, sans-serif; font-size: ..

Read more

I try to change the Producer meta data in my laravel project with barryvdh DomPDF with this code $pdf = PDF::loadView(‘export.eport_template’, $data) ->addInfo([‘Producer’=>’The Producer XYZ’]) ->setPaper(‘a4’, ‘portrait’); $tx_name = "Report_" . now()->timestamp . ".pdf"; $pdf->save(public_path() . ‘/storage/exports/’ . $tx_name); but after export, the property of the pdf on Producer is still "dompdf 0.8.6 + CPDF" ..

Read more

When I used laravel-dompdf, for a small number of users, it runs okay. But when I generated dummy data and try to download the pdf, it takes too much time for it too querying and process the whole thing. Here is a sample of data that I want to output, I thought maybe the empty ..

Read more

I am using DOMPDF to generate PDF and I want to upload that pdf to s3 when it is generated by DOMPDF here is my code which i uses for upload file on S3 but it did not worked $options = new Options(); $options->set(‘isHtml5ParserEnabled’, true); $options->set(‘isRemoteEnabled’, true); $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->set_paper($paper, $orientation); $dompdf->render(); ..

Read more

At the moment I am trying to generate a PDF in laravel using the DomPDF library. This is the code that I have so far: Controller class: public function downloadPDF($id) { $user = User::find($id); $pdf = PDF::loadView(‘pdf.cardsReport’, $user); return $pdf->download(‘cards.pdf’); } Route: Route::get(‘/downloadPDF/{id}’,’[email protected]’); View – cardReport.blade.php(inside pdf folder): <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> ..

Read more

I’m upgrading from Laravel 7 to 8 and would like to switch to barryvdh/laravel-dompdf for PDF generation. I was using niklasravnsborg/laravel-pdf up untill now, but since that package doesn’t support Laravel 8, I need to switch. So I am in the processing of altering my existing code to use barryvdh/laravel-dompdf, but I’m running into an ..

Read more