title: Highcharts with phantomjs and highcharts-convert.js to create PDF with html and Graphs
body: <p>I am trying to generate a PDF file that includes Highcharts in them as part of the PDF. i.e. html tables followed by Graphs, more tables etc. I am using PhantomJS (and have Highcharts-Convert.js). When I create the PDF with the PhantomJS rasterize.js file I get the PDF but the Highcharts come out wrong (the column bars for example dont climb to their correct number - if the value is 200, the bar would rise to 50 for example). </p>
  
  <p>I think that Phantomjs with highcharts-convert.js is just per graph (like when you save as PDF from the chart). How do I sort this for the entire page that contains HTML and Highcharts graphs?</p>
  
  <p>In other words, looking to "export entire page" as PDF (preferably through command line).</p>
  
  <p>Been going crazy trying to solve, appreciate the assistance here.</p>
  
  <p>I have inserted the code below. This is an example of the completed HTML page that is generated at Server side that I want to convert to PDF automatically.
  Sorry new to posting so hope I am doing it right.</p>
  
  <pre><code>&lt;HTML&gt;
  &lt;HEAD&gt;
  &lt;TITLE&gt;My Title&lt;/TITLE&gt;  
  &lt;SCRIPT src="include/jquery-1.9.1.js"&gt;&lt;/SCRIPT&gt;
  &lt;SCRIPT src="include/jquery-ui.js"&gt;&lt;/SCRIPT&gt;
  &lt;SCRIPT src="include/highcharts.js"&gt;&lt;/SCRIPT&gt;
  &lt;SCRIPT src="include/exporting.js"&gt;&lt;/SCRIPT&gt;
  &lt;SCRIPT src="include/highcharts-more.js"&gt;&lt;/SCRIPT&gt;
  
  &lt;SCRIPT&gt;  
  $(function () {
      $('#DailyAllDoors').highcharts({
          chart: {
              type: 'column',
              width:width,
              borderColor: '#000000',
              borderWidth: 2
          },
                   credits: {
                    enabled: false
                    },
                  exporting: { enabled: true },
          title: {
              text: 'Daily Report '
          },
          subtitle: {
              text: '01 July 2015 to : 31 July 2015   (31 Days)'
          },
          xAxis: {
              categories: [
                  'Wed 1 July 2015','Thu 2 July 2015','Fri 3 July 2015','Sat 4 July 2015','Sun 5 July 2015','Mon 6 July 2015','Tue 7 July 2015','Wed 8 July 2015','Thu 9 July 2015','Fri 10 July 2015','Sat 11 July 2015','Sun 12 July 2015','Mon 13 July 2015','Tue 14 July 2015','Wed 15 July 2015','Thu 16 July 2015','Fri 17 July 2015','Sat 18 July 2015','Sun 19 July 2015','Mon 20 July 2015','Tue 21 July 2015','Wed 22 July 2015','Thu 23 July 2015','Fri 24 July 2015','Sat 25 July 2015','Sun 26 July 2015','Mon 27 July 2015','Tue 28 July 2015','Wed 29 July 2015','Thu 30 July 2015','Fri 31 July 2015',
              ],
                     labels: {
                          rotation: -45,
                           align: 'right',
                           step:1,
                      }
          },
          yAxis: [{
          min: 0,
              labels: {
                  formatter: function () {
                      return Highcharts.numberFormat(this.value,0);
                  },
                  style: {
                      color: 'black'
                  }
              },
              title: {
                  text: ' Visitors',
                  style: {
                      color: 'black'
                  }
              },
              stackLabels: {
                  enabled: false,
                  style: {
                      fontWeight: 'bold',
                      color: (Highcharts.theme &amp;&amp; Highcharts.theme.textColor) || 'gray'
                  },
               formatter: function () {
                      return Highcharts.numberFormat(this.total,0);
                  }
              }
  
          }
          ],
          tooltip: {
              headerFormat: '&lt;strong&gt;&lt;span style="font-size:12px"&gt;{point.key}&lt;/span&gt;&lt;/strong&gt;&lt;table width="250"&gt;',
              pointFormat: '&lt;tr&gt;&lt;td style="color:{series.color};padding:0"&gt;&lt;font size="2px"&gt;{series.name}: &lt;/font&gt;&lt;/td&gt;' +
                  '&lt;td style="padding:0"&gt;&lt;font style="color:{series.color}" size="2px"&gt;&lt;b&gt;{point.y}&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;',
              footerFormat: '&lt;tr&gt;&lt;td padding:0"&gt;&lt;font size="1px"&gt;&lt;em&gt;(Disclaimer: Averages indicated for the period selected)&lt;/em&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;',
              shared: true,
              useHTML: true
          },
      plotOptions: {
          line: {
               marker: {
                  enabled: false
              }
          },
          column: {
              stacking: 'normal',
              dataLabels: {
                      enabled: false,
                      style: {
                          fontWeight: 'bold',
                          color: 'white',
                      },
                      formatter: function () {
                          return Highcharts.numberFormat(this.y,0);
                      }
              }
          }
      },
          series: [
              {
                  id: 'Total ',
                  name: 'Total',
                  data: [
                  4593,4667,6852,{y:9792,  color: 'grey'},{y:7603,  color: 'grey'},3455,3312,3380,3526,5333,{y:7891,  color: 'grey'},{y:6293,  color: 'grey'},2685,3144,3319,3696,5603,{y:7328,  color: 'grey'},{y:5352,  color: 'grey'},2299,2224,2563,2576,5226,{y:9534,  color: 'grey'},{y:7373,  color: 'grey'},2763,2899,3123,3468,6481
                  ]
              }, 
  
          {
              id: ' Average',
              name: ' Average',
             yAxis: 0,
              type: 'line',
              color: '#00806b',
              data: [
                  4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,4785,
              ],
               dataLabels: {
                  enabled: false,
                   color: 'red',
                      formatter: function () {
                          return Highcharts.numberFormat(this.y,0);
                      }
              }
          }
          ,{
              name: 'Event Days',
             yAxis: 0,
              type: 'line',
              color: '#ed0181',
              data: [],
          }
      ,{
        type: 'scatter',
        name: ' ',
        tooltip: {
          enabled: false
        },
        dataLabels: {
          format: '{key}  Average',
          enabled: true,
          color: '#00806b',
          fontWeight: 'bold',
          y: 0,
        },
        data: [
        { x: 1, y: 4785, name: '4 785'}
        ],
        marker: {
          enabled: false,
        }
      }       
          ]
      });
  
  });
  &lt;/SCRIPT&gt;
  &lt;/HEAD&gt;
  &lt;BODY&gt;
  &lt;TABLE bgcolor="#00b9f1" border="0" width="100%" align="center"&gt;
      &lt;TR&gt;
          &lt;TD height="30" align="left"&gt;&lt;STRONG&gt;&lt;FONT color="white"&gt;TOTALS&lt;/FONT&gt;&lt;/STRONG&gt;
          &lt;/TD&gt;
      &lt;/TR&gt;
  &lt;/TABLE&gt;
  &lt;DIV id="DailyAllDoors" width="300"&gt;&lt;/DIV&gt;  
  &lt;BR&gt;&lt;BR&gt;
  &lt;TABLE border="1" width="70%"&gt;
      &lt;TR&gt;
          &lt;TD bgcolor="#000080"&gt;&lt;FONT color="#FFFFFF"&gt;Date&lt;/FONT&gt;
          &lt;/TD&gt;
          &lt;TD bgcolor="#000080"&gt;&lt;FONT color="#FFFFFF"&gt;Days&lt;/FONT&gt;
          &lt;/TD&gt;
          &lt;TD bgcolor="#000080"&gt;&lt;FONT color="#FFFFFF"&gt; Visitors&lt;/FONT&gt;
          &lt;/TD&gt;
          &lt;TD bgcolor="#000080"&gt;&lt;FONT color="#FFFFFF"&gt;Event Day&lt;/FONT&gt;
          &lt;/TD&gt;
          &lt;TD bgcolor="#000080"&gt;&lt;FONT color="#FFFFFF"&gt;Event Day Description&lt;/FONT&gt;
          &lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD&gt;    01 July 2015
          &lt;/TD&gt;
          &lt;TD&gt;    Wed
          &lt;/TD&gt;
          &lt;TD&gt;    4593
          &lt;/TD&gt;
          &lt;TD&gt;
          &lt;/TD&gt;
          &lt;TD&gt;
          &lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD&gt;    01 July 2015
          &lt;/TD&gt;
          &lt;TD&gt;    Wed
          &lt;/TD&gt;
          &lt;TD&gt;    4593
          &lt;/TD&gt;
          &lt;TD&gt;
          &lt;/TD&gt;
          &lt;TD&gt;
          &lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
          &lt;TD&gt;    01 July 2015
          &lt;/TD&gt;
          &lt;TD&gt;    Wed
          &lt;/TD&gt;
          &lt;TD&gt;    4593
          &lt;/TD&gt;
          &lt;TD&gt;
          &lt;/TD&gt;
          &lt;TD&gt;
          &lt;/TD&gt;
      &lt;/TR&gt;
  &lt;/TABLE&gt;
  &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>Finally I am running PhantomJS as:</p>
  
  <p>phantomjs --web-security=false rasterize.js "<a href="http://localhost:151/Reports.asp" rel="nofollow">http://localhost:151/Reports.asp</a>" reports.pdf</p>
  
  <p>The above works but creates a PDF with Highcharts where the column bar doesnt rise to the correct point (if the value is 1000, it climbs to 50 for example).</p>