Cannot process pdf with a longer header #868
Replies: 1 comment 4 replies
-
I tried recreating this the following way: $targetPath = __DIR__.'/temp/large_header.pdf';
$lorem = file_get_contents('http://loripsum.net/api/html?p=150');
Browsershot::html('<h1>Hello, World!</h1>')
->showBrowserHeaderAndFooter()
->headerHtml($lorem)
->save($targetPath); However, even with a header spanning 150 paragraphs of lorem ipsum text, this finishes in under two seconds, and creates the PDF just fine. Judging by the error you included, what's missing is the command-line argument including the JSON holding the data that gets passed to the browser instance. It looks like it's there, but for some reason, the keys and values (all strings) have two sets of double quotes (") around them. i.e When providing URLs, you should also not provide URLs to files, as indicated by this snippet from the if (str_starts_with(strtolower($url), 'file://')) {
throw FileUrlNotAllowed::make();
} I believe the JSON issue is preventing this exception from throwing, as the string actually begins with |
Beta Was this translation helpful? Give feedback.
-
When the headerTemplate passed as option to Browsershot is too long (this happens for example when the base64 encoding of an image is on average long or by adding multiple images with a short encoding that individually might work) the following error occurs (omitted the full content of headerTemplate to make the error readable):
This prevents me from creating elaborate or multi-image headers or footers, can anyone help me on this?
Beta Was this translation helpful? Give feedback.
All reactions