@@ 40-53 (lines=14) @@ | ||
37 | * @return response |
|
38 | * @throws \Exception |
|
39 | */ |
|
40 | public function generateFromURL($params) |
|
41 | { |
|
42 | if(empty($params['url'])) |
|
43 | throw new \Exception('Parameter \'url\' must be set' ); |
|
44 | ||
45 | $params = $this->validator->validate($params); |
|
46 | ||
47 | try { |
|
48 | return $this->client->sendRequest('pdf', $params, 'POST'); |
|
49 | } catch (\Exception $ex) { |
|
50 | throw $ex; |
|
51 | } |
|
52 | ||
53 | } |
|
54 | ||
55 | /** |
|
56 | * Generates PDF file from provided HTML string |
|
@@ 62-74 (lines=13) @@ | ||
59 | * @return response |
|
60 | * @throws \Exception |
|
61 | */ |
|
62 | public function generateFromHTML($params) |
|
63 | { |
|
64 | if(empty($params['html'])) |
|
65 | throw new \Exception('Parameter \'html\' must be set' ); |
|
66 | ||
67 | $params = $this->validator->validate($params); |
|
68 | ||
69 | try { |
|
70 | return $this->client->sendRequest('pdf', $params, 'POST'); |
|
71 | } catch (\Exception $ex) { |
|
72 | throw $ex; |
|
73 | } |
|
74 | } |
|
75 | ||
76 | /** |
|
77 | * Generates PDF file from provided file (html, zip, tar.gz...) |