Nikki
6 months ago

Removing ID from tab

Posted 6 months ago by Nikki

I've created a pdf using barryvdh/laravel-dompdf the problem I'm having is that my web browser tab has the ID of the record and I would like to have it removed.

Here is my PDF

<html style="margin: 0; padding: 0;">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>{{ $order->invoice_number }}</title>

        <style>
            @font-face{
                font-family: 'arial';
                src: url('http://shop.test/fonts/arial.ttf') format('truetype');
            }

            @font-face{
                font-family: 'arial_bold';
                src: url('http://shop.test/fonts/arialbd.ttf') format('truetype');
            }

            tbody tr:nth-child(odd){
              background-color: #f3f4f5;
            }

            table{
                border: none;
            }
        </style>
    </head>

    <body style="margin: 0; padding: 0; font-family: arial; font-size: 13px;">
        <div style="background-color: #f3f4f5; width: 100%; height: 300px;">
            <div style="width: 700px; margin: 0 auto;">
                <div style="font-size: 50px; margin-bottom: 25px">
                    Invoice
                </div>
                            
                <div style="float: left; padding-left: 100px;">
                    <div style="font-family: arial_bold;">
                        BILL TO:
                    </div>

                    <div>
                        {{ $user->name }}
                    </div>

                    <div>
                        @if(!empty($user->company_name))
                            {{ $user->company_name }}
                        @endif
                    </div>
    
                    <br>

                    <div>
                        <div>{{ $address->complex }},</div>
                        <div>{{ $address->address }},</div>
                        <div>{{ $address->suburb }},</div>
                        <div>{{ $address->city }},</div>
                        <div>{{ $address->province }},</div>
                        <div>{{ $address->postal_code }}</div>
                    </div>
                </div>
            </div>

            <div style="float: right; margin-right: 80px;">
                <div>
                    <div>
                        <span style="font-family: arial_bold;">INVOICE NUMBER:</span> {{ $order->invoice_number }}
                    </div>

                    <div>
                        <span style="font-family: arial_bold;">ORDER DATE:</span> {{ Carbon\Carbon::parse($order->order_date)->format('d F Y') }}
                    </div>
                </div>
            </div>

            <div style="clear: both;"></div>
        </div>

        <div style="width: 700px; margin: 30px auto;">
            <table width="100%" cellspacing="0" cellpadding="0">
                <thead>
                    <tr>
                        <td></td>
                        <td style="font-family: arial_bold;">
                            Description
                        </td>
                        <td style="font-family: arial_bold; text-align: center;">
                            Qty
                        </td>
                        <td style="font-family: arial_bold; text-align: center;">
                            Unit Price
                        </td>
                        <td style="font-family: arial_bold; text-align: center;">
                            Total Price
                        </td>
                    </tr>
                </thead>

                <tbody>
                    @foreach($order_item->items as $item)
                        <?php
                            $image = getImagesArray($item['item']['image']);
                        ?>
                        <tr>
                            <td>
                                @if(!empty($image))
                                    <img src={!! asset("product_images/thumbs/$image[0]") !!}>
                                @endif
                            </td>
                            <td>    
                                {{ $item['item']['title'] }}
                            </td>
                            <td style="text-align: center;">
                                {{ $item['qty'] }}
                            </td>
                            <td style="text-align: center;">
                                R {{ $item['item']['price'] }}
                            </td>
                            <td style="text-align: center;">
                                R {{ $item['price'] }}
                            </td>
                        </tr>
                    @endforeach

                        <tr>
                            <td style="padding: 50px 0 5px 0; background-color: #fff;"></td>
                            <td style="padding: 50px 0 5px 0; background-color: #fff;"></td>
                            <td style="padding: 50px 0 5px 0; background-color: #fff;"></td>
                            <td style="padding: 50px 0 5px 0; background-color: #fff;"></td>
                            <td style="padding: 50px 0 5px 0; background-color: #fff;"></td>
                        </tr>

                        <tr>
                            <td rowspan="4" colspan="3" style="padding: 50px 0 5px 0; background-color: #fff; border-top: 2px solid #000;"></td>
                            <td style="text-align: right; padding: 50px 10px 5px 0; border-top: 2px solid #000;">
                                SUBTOTAL:
                            </td>
                            <td style="text-align: center; padding: 50px 0 5px 0; border-top: 2px solid #000;">
                                R {{ $order_item->totalPrice }}
                            </td>
                        </tr>

                        @if(!empty($order->delivery_fee))
                            <tr>
                                <td style="text-align: right; padding: 0 10px 15px 0;">
                                    DELIVERY FEE:
                                </td>
                                <td style="text-align: center; padding: 0 0 15px 0;">
                                    R {{ $order->delivery_fee }}
                                </td>
                            </tr>
                        @endif

                        <tr>
                            <td style="text-align: right; padding: 0 10px 0 0; background-color: #000000; color: #ffffff; font-family: arial_bold">
                                TOTAL:
                            </td>
                            <td style="border-left: 1px solid #000;  text-align: center; padding: 0; background-color: #000000; color: #ffffff; font-family: arial_bold">
                                R {{ $order->order_price }}
                            </td>
                        </tr>
                </tbody>
            </table>
        </div>
    </body>
</html>

and here is my controller function

public function invoicesPdf($id)
    {
        $order = Order::find($id);

        $user = Auth::user();
        $order_item = unserialize($order->cart);
        $address = json_decode($order->address);

        PDF::setOptions(['defaultFont' => 'sans-serif']);
        $pdf = PDF::loadView('public.pdf.invoice', compact('order', 'user', 'order_item', 'address'));

        return $pdf->stream();
    }

Please sign in or create an account to participate in this conversation.