function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RajkamalRajkamal 

I have page with horizontally scrollable when am printing its not printing the hole page(div) content. Its printing only the part which appearing on the screen. If anyone have the solution for this plz replay to this

Thanks in Advance


Ramu_SFDCRamu_SFDC
Are you using browser print option or any custom button you implemented on the page? If you are using browser print button, you will get what you see on the screen.

Please try using a custom button as per the example given in the below article.

http://www.infallibletechie.com/2013/08/how-to-print-visualforce-page-in.html
Ankit AroraAnkit Arora
Can you provide the code which prints the page?
RajkamalRajkamal
Thanks ramu,
 
 i used window.print() method only but am facing the problem i that only.

RajkamalRajkamal
Hi ankit.

 Actually am using google virtualization chart  to diplay organization hierarchy. But that char generating horizantally so when am printing using window.print() method  am getting hole content just getting left portion of the page only.

Ramu_SFDCRamu_SFDC
Hi Rajkamal, see if this article helps where they used a styling in div attribute to set the page print orientation to landscape mode rather than a default portrait mode. See if this works

http://techman97.wordpress.com/2013/07/22/visualforce-page-printable-view/
RajkamalRajkamal
Hi Ramu i have tired this already but same result thats becauese the page nearly 3000px wide.

Finally i switched to iframe insted of div so i can take print of portion which i want by scrolling but that idea working in chrome only  not in other browsers.
RajkamalRajkamal
Thank you for your valuable time Ramu.

 Google api uses canave technology to create it's own dom element  for creating the chart so we can't renderas PDF  directly from the browser now.

 When i try to do that i got blank PDF page sometime script code in that page.

 Try the bellow code with and without renderAs PDF

 <apex:page renderAs="pdf" >

  <script type="text/javascript" src="https://www.google.com/jsapi"></script>

  <script type="text/javascript">
    google.load("visualization", '1', {packages:['corechart']});
    google.setOnLoadCallback(drawChart);
    function drawChart() {

      var data = google.visualization.arrayToDataTable([
        ['Element', 'Density', { role: 'style' }],
        ['Copper', 8.94, '#b87333', ],
        ['Silver', 10.49, 'silver'],
        ['Gold', 19.30, 'gold'],
        ['Platinum', 21.45, 'color: #e5e4e2' ]
      ]);

      var options = {
        title: "Density of Precious Metals, in g/cm^3",
        bar: {groupWidth: '95%'},
        legend: 'none',
      };

      var chart_div = document.getElementById('chart_div');
      var chart = new google.visualization.ColumnChart(chart_div);

      // Wait for the chart to finish drawing before calling the getImageURI() method.
      google.visualization.events.addListener(chart, 'ready', function () {
        chart_div.innerHTML = '<img src="' + chart.getImageURI() + '">';
        console.log(chart_div.innerHTML);
      });

      chart.draw(data, options);
    document.getElementById('png').outerHTML = '<a href="' + chart.getImageURI() + '">Printable version</a>';
  }
  </script>

<div id='chart_div'></div>
</apex:page>