Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,26 @@ public function printers(): array
})->toArray();
}

public function print(string $html, ?Printer $printer = null): void
/**
* For $settings options, see https://www.electronjs.org/docs/latest/api/web-contents#contentsprintoptions-callback
*/
public function print(string $html, ?Printer $printer = null, ?array $settings = []): void
{
$this->client->post('system/print', [
'html' => $html,
'printer' => $printer->name ?? '',
'settings' => $settings,
]);
}

public function printToPDF(string $html): string
/**
* For $settings options, see https://www.electronjs.org/docs/latest/api/web-contents#contentsprinttopdfoptions
*/
public function printToPDF(string $html, ?array $settings = []): string
{
return $this->client->post('system/print-to-pdf', [
'html' => $html,
'settings' => $settings,
])->json('result');
}

Expand Down
Loading