Skip to content

Use template on first page #136

Open
@ericlaaper

Description

@ericlaaper

Hi Carlos,

I want to use a template for creating PDF's. I can get this working for second and later pages.

            $pdf = PDF::loadView('pdf.reportScan.test', $valueArray);
            $instance = $pdf->getMpdf(); // get instance
            $instance->SetDocTemplate(storage_path('template/sjabloon.pdf'), true);

            $instance->AddPage(); // add new page with landscape orientation
            $instance->WriteHTML(View::make('pdf.reportScan.aScan', $valueArray)->render()); // set page from view with data
            $filename = "TempFileAscan $lastNameClient .pdf";
            $pdf->save(storage_path( "$filename"));
            return response()->download(storage_path("$filename"))->deleteFileAfterSend(true);

In this way I am creating two separate parts to get this working
But is there way to get the instance before the loadView.
Or maybe yuo have an other solution?

Thanks is advance

Eric

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions