Fpdi example

return $data[0];
    }

    /** * Simple helper function which actually merges a given array of document-paths * * @param array<string> $paths */
    private function mergeDocuments(array $paths): void
    {
        $pdf = new Fpdi();

        foreach ($paths as $path) {
            $numPages = $pdf->setSourceFile($path);
            for ($i = 1; $i <= $numPages; ++$i) {
                $template = $pdf->importPage($i);
                $size = $pdf->getTemplateSize($template);
                if (!\is_array($size)) {
                    continue;
                }
                $pdf->AddPage('P', [$size['width']$size['height']]);
                $pdf->useTemplate($template);
            }
Home | Imprint | This part of the site doesn't use cookies.