niklasravnsborg / laravel-pdf

📄 Laravel PDF
708 stars 211 forks source link

Center does not works #216

Closed davyyg closed 2 years ago

davyyg commented 2 years ago

Hello,

I am trying to center my page:

HargaController.php

      // bikin pdf
        $pdf = PDF::loadView('pdf.document', compact('body_pdf'));

        $fn = 'Penawaran_'. str_replace(" ", "_", $nama) .'_'. date('YmdHis') . '.pdf';
        $file_name = storage_path() . '/app/public/images/quotation/' . $fn; 

        // Simpan file pdf ke storage
        $pdf->save($file_name);

pdf/document.blade.php

<html>

<center><h3>Surat Penawaran Harga</h3></center>

<br><br>

{!! $body_pdf !!}

</html>

The result is The title text align left not in the center. I wonder why the center does not work ?

msadeghyan1996 commented 2 years ago

hi. you can use center with below way :

<div style="width:100%; text-align:center;"><h3>Surat Penawaran Harga</h3></div>

this way work fine for me.