class_mcCairoSvg.inc.php
2.79 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
class mcCairoSvg {
public static function inkscapeSvgToPdf($param_input_filename, array $param_outputfile=null, array $param_quality =null) {
$normalsvg_filename =mcInkscape::inkscapeSvgToNormalSvg($param_input_filename);
mcFile::manipulateOutputfileArray($param_outputfile, $param_input_filename);
return mcCairoSvg::svgToPdf($normalsvg_filename, $param_outputfile, $param_quality);
}
public static function inkscapeSvgToPng($param_input_filename, array $param_outputfile=null, array $param_quality =null) {
$normalsvg_filename =mcInkscape::inkscapeSvgToNormalSvg($param_input_filename);
mcFile::manipulateOutputfileArray($param_outputfile, $param_input_filename);
return mcCairoSvg::svgToPng($normalsvg_filename, $param_outputfile, $param_quality);
}
public static function inkscapeSvgToPs($param_input_filename, array $param_outputfile=null, array $param_quality =null) {
$normalsvg_filename =mcInkscape::inkscapeSvgToNormalSvg($param_input_filename);
mcFile::manipulateOutputfileArray($param_outputfile, $param_input_filename);
return mcCairoSvg::svgToPs($normalsvg_filename, $param_outputfile, $param_quality);
}
/**
*
* @param string $param_svgFileString
*/
public static function svgToPdf($param_input_filename, array $param_outputfile=null, array $param_quality =null) {
return mcCairoSvg::doCairosvg('pdf', $param_input_filename, $param_outputfile, $param_quality);
}
public static function svgToPng($param_input_filename, array $param_outputfile=null, array $param_quality =null) {
return mcCairoSvg::doCairosvg('png', $param_input_filename, $param_outputfile, $param_quality);
}
public static function svgToPs($param_input_filename, array $param_outputfile=null, array $param_quality =null) {
return mcCairoSvg::doCairosvg('ps', $param_input_filename, $param_outputfile, $param_quality);
}
private static function doCairosvg($param_format, $param_input_filename, array $param_outputfile=null, array $param_quality =null) {
mcFile::manipulateOutputfileArray($param_outputfile,$param_input_filename);
if(!$param_outputfile['filename']) {
$param_outputfile['filenameextension'] = '.'.$param_format;
$out_pdf = mcFile::createTmpFile($param_outputfile);
} else {
$out_pdf = $param_outputfile['filename'];
}
if(!$param_quality['DPI']) {
D::ulli('$param_quality[DPI] = 30;');
$param_quality['DPI'] = 30;
}
$order = $ausgabe = $return_var = null;
$order = "/var/www/Magento/CairoSVG/cairosvg.sh '".$param_input_filename."' '".$out_pdf."' '".$param_format."' '".$param_quality['DPI']."' ";
D::ulli('$'.$order);
// $shell_exec = shell_exec($order);
$shell_exec = exec($order, $ausgabe, $return_var);
// D::show(array('$shell_exec' => $shell_exec, '$ausgabe'=>$ausgabe, '$return_var' => $return_var), $order);
return $out_pdf;
}
}
?>