-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathclientPdf.php
More file actions
25 lines (19 loc) · 765 Bytes
/
clientPdf.php
File metadata and controls
25 lines (19 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
include('ScreenshotMachine.php');
$customer_key = "PUT_YOUR_CUSTOMER_KEY_HERE";
$secret_phrase = ""; //leave secret phrase empty, if not needed
$machine = new ScreenshotMachine($customer_key, $secret_phrase);
//mandatory parameter
$options['url'] = "https://www.google.com";
// all next parameters are optional, see our website to PDF API guide for more details
$options['paper'] = "letter";
$options['orientation'] = "portrait";
$options['media'] = "print";
$options['bg'] = "nobg";
$options['delay'] = "2000";
$options['scale'] = "50";
$pdf_api_url = $machine->generate_pdf_api_url($options);
//save PDF file
$output_file = 'output.pdf';
file_put_contents($output_file, file_get_contents($pdf_api_url));
echo 'PDF saved as ' . $output_file . PHP_EOL;