Welcome to mirror list, hosted at ThFree Co, Russian Federation.

wkhtmltopdf.php « lib - github.com/nextcloud/files_markdown.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2a74ed7f520bd12fe481d81bd6106676f7a94e29 (plain)
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
/**
 * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

namespace OCA\Files_Markdown;

class WKHTMLtoPDF {
	private $bin;

	public function __construct() {
		$this->bin = realpath(__DIR__ . '/../bin/wkhtmltopdf');
		if (!file_exists($this->bin)) {
			throw new \Exception('binary not found');
		}
	}

	public function renderHTMLFile($source, $target) {
		$cmd = $this->bin . ' --output-format pdf ' . escapeshellarg($source) . ' ' . escapeshellarg($target);
		exec($cmd);
	}
}