Problem with Custom Visualization Component while export in pdf format

0

Hi ,

I am facing problem with Custom Visualization Component while exporting it in pdf format. Html format is working fine but pdf/java is not working.

I have checked the phantomjs path, It is set correctly and tested with command promp also.

I have also changed phantomjs version from 2.0 to 1.9.2. Still the problem exist.

Due to this issue i am not able to export my CVC reports. 

Kindly help regarding this. It is important. !!!

akthar.itzme's picture
Joined: Sep 23 2014 - 10:38pm
Last seen: 2 years 8 months ago

I request Jasper Team to help quickly.

akthar.itzme - 3 years 5 months ago

My Javascript code is as follow :

define(['jquery_hc','hchart'], function ($, Highcharts) {
 
function getMonoChromeColors() {
 
var colors = [],
base = Highcharts.getOptions().colors[0],
i;
 
for (i = 0; i < 10; i += 1) {
// Start out with a darkened base color (negative brighten), and end
// up with a much brighter color
colors.push(Highcharts.Color(base).brighten((i - 3) / 7).get());
}
return colors;
}
 
return function (instanceData) {
 
/**
* Drop-in compatibility fix for semi-transparent strokes and fills for old WebKit 
* browsers as well as Batik export servers. The fix splits rgba fill colors into 
* solid colors for fills, and a separate fill-opacity attribute.
*/
Highcharts.SVGElement.prototype.fillSetter = Highcharts.SVGElement.prototype.strokeSetter = function (value, key, element) {
   var colorObject;
 
   if (typeof value === 'string') {
       if (value.indexOf('rgba') === 0) {
           // Split it up
           colorObject = Highcharts.Color(value);
           element.setAttribute(key + '-opacity', colorObject.get('a'));
           element.setAttribute(key, colorObject.get('rgb'));
       } else {
           element.removeAttribute(key + '-opacity');
           element.setAttribute(key, value);
       }
   } else {
       this.colorGradient(value, key, element);
   }
};
 
var data = [{"name" : "apple", "y" : 200}, {"name" : "Orange", "y" : 100}];
        var series0 = instanceData.series[0];
        // I have used dummy data already So, not going to use series0 data.
        var config = {
        chart: {
        renderTo: instanceData.id,
       backgroundColor: null,
                        borderWidth: 0,
                        margin: [2, 0, 2, 0],
       type: 'pie',
       width: instanceData.width,
                        height: instanceData.height,
                        style: {
                           overflow: 'visible'
                       },
                       skipClone: true
   },
   tooltip: {
    backgroundColor: null,
                        borderWidth: 0,
                        shadow: false,
                        useHTML: true,
                        hideDelay: 0,
                        shared: true,
                        padding: 0,
       pointFormat: '<b>{point.y} ({point.percentage:.1f}%)</b>'
   },
   plotOptions: {
       pie: {
           allowPointSelect: true,
           cursor: 'pointer',
           dataLabels: {
               enabled: true,
               format: '<b>{point.name}</b>: {point.percentage:.1f} %',
               style: {
                   color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
               }
           },
           colors: getMonoChromeColors()
       }
   },
   series: [{
       name: 'Brands',
       data: data
   }]
   };
   
new Highcharts.Chart(config);
};
});
akthar.itzme - 3 years 5 months ago

2 Answers:

0

It's working OK for me. Of course, pdf isn't interactive but I do get static images.

Check if there is any error in the Tomcat console and fix it if there is.

hozawa's picture
44169
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 month 5 days ago
0

Hi,

Thanks for your answer. I checked my server log i am getting the following error:

ERROR CVElementPhantomJSImageProvider,pool-15-thread-2:91 - Generating image for Custom Visualization element 1334138075 failed.
net.sf.jasperreports.engine.JRRuntimeException: Error while executing the javascript file to generate the SVG image: External process did not end properly; exit value: 1; process output:
--- Running highcharts.src.js from GitHub, branch/commit/tag "master" ---
SCRIPT_SUCCESS
 
Now after some times i get empty PDF reports.
 
HTML Output is working great always.
 
Kindly guide me in solving this. Urgent !!!
akthar.itzme's picture
Joined: Sep 23 2014 - 10:38pm
Last seen: 2 years 8 months ago
Feedback
randomness