Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use template on first page #136

Open
ericlaaper opened this issue Sep 28, 2023 · 0 comments
Open

Use template on first page #136

ericlaaper opened this issue Sep 28, 2023 · 0 comments

Comments

@ericlaaper
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant