diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php
index 45d0582cb5..3291cd2519 100644
--- a/pandora_console/include/chart_generator.php
+++ b/pandora_console/include/chart_generator.php
@@ -96,9 +96,13 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['only_image'] = false;
- $params['width'] = '1048';
+ $params['width'] = (int) $_REQUEST['viewport_width'];
$params['menu'] = false;
+ if((!isset($params['width']) || ($params['width'] <= 0)) {
+ $params['width'] = 1048;
+ }
+
$params_combined = json_decode($_REQUEST['data_combined'], true);
$module_list = json_decode($_REQUEST['data_module_list'], true);
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index f19da0c53a..36ec32f746 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -3252,11 +3252,14 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
$result = exec($cmd);
if($params['return_img_base_64']){
+ // To be used in alerts
+ $width_img = 500;
return $result;
}
else{
+ // to be used in PDF files
$config["temp_images"][] = $img_path;
- return '
';
+ return '
';
}
}
diff --git a/pandora_console/include/web2image.js b/pandora_console/include/web2image.js
index f5fd552e5c..8b548fcbd1 100644
--- a/pandora_console/include/web2image.js
+++ b/pandora_console/include/web2image.js
@@ -31,12 +31,14 @@ if(type_graph_pdf == 'combined'){
"&data_combined=" + url_params_comb +
"&data_module_list=" + url_module_list +
"&type_graph_pdf=" + type_graph_pdf +
- "&session_id=" + session_id;
+ "&session_id=" + session_id +
+ "&viewport_width=" + viewport_width;
}
else{
post_data = "data=" + url_params +
"&type_graph_pdf=" + type_graph_pdf +
- "&session_id=" + session_id;
+ "&session_id=" + session_id +
+ "&viewport_width=" + viewport_width;
}
page.viewportSize = { width: _width, height: _height };