PHP_VERSION, 'engine' => 'native-php', 'documents' => []];
foreach (['invoice', 'catalogue', 'multipage', 'css1'] as $name) {
$started = hrtime(true);
$html = $read(__DIR__ . '/sources/' . $name . '.html');
$result = $converter->convert(new HtmlSource($html), $options);
file_put_contents($destination . '/' . $name . '.pdf', $result->pdf);
$manifest['documents'][$name] = [
'pages' => $result->pageCount,
'elapsedSeconds' => (hrtime(true) - $started) / 1e9,
'peakMemoryBytes' => memory_get_peak_usage(true),
'sourceSha256' => hash('sha256', $html),
'pdfSha256' => hash('sha256', $result->pdf),
'bytes' => strlen($result->pdf),
'diagnostics' => $result->diagnostics,
];
fwrite(STDOUT, $name . ': ' . $result->pageCount . ' page(s), ' . strlen($result->pdf) . " bytes\n");
}
file_put_contents($destination . '/manifest.json', json_encode($manifest, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR) . "\n");