-
-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What were you trying to do?
Pass in a view file to export as a pdf.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Email Export</title>
</head>
<body>
<div class="email-container">
<div>Displays</div>
<div style="color:#220022">Doesn't display</div>
</div>
</body>
</html>What happened?
It will render "Displays". It will not render "Doesn't display" due to the # I am pretty sure.
How to reproduce the bug
System::printToPdf('<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Email Export</title>
</head>
<body>
<div class="email-container">
<div>Displays</div>
<div style="color:#220022">Doesn't display</div>
</div>
</body>
</html>');Debug Output
No errors or logs.
Which operating systems have you seen this occur on?
macOS
Notes
This seems to be fixed by base64 encoding the html snippet before transmitting to the electron api, and then adding base64; inside the loadUrl method:
public function printToPDF(string $html, ?array $settings = []): string
{
return $this->client->post('system/print-to-pdf', [
'html' => base64_encode($html),
'settings' => $settings,
])->json('result');
}yield printWindow.loadURL(`data:text/html;base64;charset=UTF-8,${html}`);Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working