Note that there are some explanatory texts on larger screens.

plurals
  1. POabc.pdf render google charts
    primarykey
    data
    text
    <p>i'm trying to export charts created with googles api to pdf, using abcpdf.</p> <p>i've tried the solution from these questions</p> <p><a href="https://stackoverflow.com/questions/10465742/can-abcpdf-create-a-pdf-from-a-page-created-with-javascript">answer1</a> <a href="https://stackoverflow.com/questions/10194325/letting-the-javascript-finish-before-rendering-pdf-in-abc-pdf">answer2</a></p> <p>but neither works, and i get nothing created from the javascript.</p> <p>the page i'm trying to render as pdf is </p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="boop.aspx.cs" Inherits="boop" %&gt; &lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; google.load('visualization', '1.0', { 'packages': ['corechart'] }); document.addEventListener("DOMContentLoaded", function drawChart() { // Create the data table. var data = new google.visualization.DataTable(); data.addColumn('string', 'Topping'); data.addColumn('number', 'Slices'); data.addRows([ ['Mushrooms', 3], ['Onions', 1], ['Olives', 1], ['Zucchini', 1], ['Pepperoni', 2] ]); var options = { 'title': 'How Much Pizza I Ate Last Night', 'width': 400, 'height': 300 }; var chart = new google.visualization.PieChart(document.getElementById('chart_div')); chart.draw(data, options); }); &lt;/script&gt; &lt;/head&gt; &lt;body &gt; &lt;form id="form1" runat="server"&gt; &lt;div id="chart_div"&gt;&lt;/div&gt; &lt;/form&gt; &lt;asp:Label Text="hej" runat="server" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>when i access the page in the browser the chart is rendered, confirming that the COMContentLoaded even triggers the function.</p> <p>the code where i want to save the chart as a pdf</p> <pre><code> Doc theDoc = new Doc(); theDoc.HtmlOptions.Timeout = 10000; theDoc.HtmlOptions.UseScript = true; theDoc.AddImageUrl("http://localhost:57833/boop.aspx"); theDoc.Save(Server.MapPath("img/htmlimport.pdf")); theDoc.Clear(); </code></pre> <p>my current code is a bit of a mixup from my previous effords using the beforementioned answers, without success. all i get in the pdf is my static label text.</p> <p>i'm using abc.pdf8.</p> <p>alternatively, doesanyone know of another free/cheap chart tool, for asp.net which abcpdf would be able to render as a pdf, or a tool that can render google charts as pdf ?</p> <h2><strong>Fixed</strong></h2> <p>this short answer made it work. </p> <p><a href="https://stackoverflow.com/a/13482231/744610">https://stackoverflow.com/a/13482231/744610</a></p> <p>calling my drawchart function made the chart render and the pdf not contains everything needed.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload