public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Html to docx using pandoc
@ 2019-09-30 11:57 Mohit Bansal
       [not found] ` <65c79c89-ba69-4895-bc7e-35e75a2895b5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Mohit Bansal @ 2019-09-30 11:57 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 3378 bytes --]

I have an HTML file which is using a script to create charts and graphs.
using that script, HTML file creates a graph.
I want to convert that Html file to docx but when I try to convert that file
it doesn't convert/read script tag to make chart/graph in Docx.

<html>
 <head>
   <script type="text/javascript" src=
"https://www.gstatic.com/charts/loader.js"></script>
   <script type="text/javascript">

      // Load Charts and the corechart package.
     google.charts.load('current', {'packages':['corechart']});

      // Draw the pie chart for Sarah's pizza when Charts is loaded.
     google.charts.setOnLoadCallback(drawSarahChart);

      // Draw the pie chart for the Anthony's pizza when Charts is loaded.
     google.charts.setOnLoadCallback(drawAnthonyChart);

      // Callback that draws the pie chart for Sarah's pizza.
     function drawSarahChart() {

        // Create the data table for Sarah's pizza.
       var data = new google.visualization.DataTable();
       data.addColumn('string', 'Topping');
       data.addColumn('number', 'Slices');
       data.addRows([
         ['Mushrooms', 1],
         ['Onions', 1],
         ['Olives', 2],
         ['Zucchini', 2],
         ['Pepperoni', 1]
       ]);

        // Set options for Sarah's pie chart.
       var options = {title:'How Much Pizza Sarah Ate Last Night',
                      width:400,
                      height:300};

        // Instantiate and draw the chart for Sarah's pizza.
       var chart = new google.visualization.PieChart(document.getElementById
('Sarah_chart_div'));
       chart.draw(data, options);
     }

      // Callback that draws the pie chart for Anthony's pizza.
     function drawAnthonyChart() {

        // Create the data table for Anthony's pizza.
       var data = new google.visualization.DataTable();
       data.addColumn('string', 'Topping');
       data.addColumn('number', 'Slices');
       data.addRows([
         ['Mushrooms', 2],
         ['Onions', 2],
         ['Olives', 2],
         ['Zucchini', 0],
         ['Pepperoni', 3]
       ]);

        // Set options for Anthony's pie chart.
       var options = {title:'How Much Pizza Anthony Ate Last Night',
                      width:400,
                      height:300};

        // Instantiate and draw the chart for Anthony's pizza.
       var chart = new google.visualization.PieChart(document.getElementById
('Anthony_chart_div'));
       chart.draw(data, options);
     }
   </script>
 </head>
 <body>
   <!--Table and divs that hold the pie charts-->
   <table class="columns">
     <tr>
       <td><div id="Sarah_chart_div" style="border: 1px solid #ccc"></div></
td>
       <td><div id="Anthony_chart_div" style="border: 1px solid #ccc"></div
></td>
     </tr>
   </table>
 </body>
</html>


Sample Html code is here
I want a graph in docx which i tried to convert using pandoc but 
graphdoesnt appears in the docx when i convert
can we add a graph/chart in docx using pandoc?



-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/65c79c89-ba69-4895-bc7e-35e75a2895b5%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 12956 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Html to docx using pandoc
       [not found] ` <65c79c89-ba69-4895-bc7e-35e75a2895b5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-09-30 15:52   ` John MacFarlane
  2019-10-01  5:44   ` Mohit Bansal
  1 sibling, 0 replies; 7+ messages in thread
From: John MacFarlane @ 2019-09-30 15:52 UTC (permalink / raw)
  To: Mohit Bansal, pandoc-discuss


Sorry, that's out of scope.  Pandoc would have to embed a javascript
interpreter and canvas renderer in order to handle this.

Mohit Bansal <bansalmohit031-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I have an HTML file which is using a script to create charts and graphs.
> using that script, HTML file creates a graph.
> I want to convert that Html file to docx but when I try to convert that file
> it doesn't convert/read script tag to make chart/graph in Docx.
>
> <html>
>  <head>
>    <script type="text/javascript" src=
> "https://www.gstatic.com/charts/loader.js"></script>
>    <script type="text/javascript">
>
>       // Load Charts and the corechart package.
>      google.charts.load('current', {'packages':['corechart']});
>
>       // Draw the pie chart for Sarah's pizza when Charts is loaded.
>      google.charts.setOnLoadCallback(drawSarahChart);
>
>       // Draw the pie chart for the Anthony's pizza when Charts is loaded.
>      google.charts.setOnLoadCallback(drawAnthonyChart);
>
>       // Callback that draws the pie chart for Sarah's pizza.
>      function drawSarahChart() {
>
>         // Create the data table for Sarah's pizza.
>        var data = new google.visualization.DataTable();
>        data.addColumn('string', 'Topping');
>        data.addColumn('number', 'Slices');
>        data.addRows([
>          ['Mushrooms', 1],
>          ['Onions', 1],
>          ['Olives', 2],
>          ['Zucchini', 2],
>          ['Pepperoni', 1]
>        ]);
>
>         // Set options for Sarah's pie chart.
>        var options = {title:'How Much Pizza Sarah Ate Last Night',
>                       width:400,
>                       height:300};
>
>         // Instantiate and draw the chart for Sarah's pizza.
>        var chart = new google.visualization.PieChart(document.getElementById
> ('Sarah_chart_div'));
>        chart.draw(data, options);
>      }
>
>       // Callback that draws the pie chart for Anthony's pizza.
>      function drawAnthonyChart() {
>
>         // Create the data table for Anthony's pizza.
>        var data = new google.visualization.DataTable();
>        data.addColumn('string', 'Topping');
>        data.addColumn('number', 'Slices');
>        data.addRows([
>          ['Mushrooms', 2],
>          ['Onions', 2],
>          ['Olives', 2],
>          ['Zucchini', 0],
>          ['Pepperoni', 3]
>        ]);
>
>         // Set options for Anthony's pie chart.
>        var options = {title:'How Much Pizza Anthony Ate Last Night',
>                       width:400,
>                       height:300};
>
>         // Instantiate and draw the chart for Anthony's pizza.
>        var chart = new google.visualization.PieChart(document.getElementById
> ('Anthony_chart_div'));
>        chart.draw(data, options);
>      }
>    </script>
>  </head>
>  <body>
>    <!--Table and divs that hold the pie charts-->
>    <table class="columns">
>      <tr>
>        <td><div id="Sarah_chart_div" style="border: 1px solid #ccc"></div></
> td>
>        <td><div id="Anthony_chart_div" style="border: 1px solid #ccc"></div
>></td>
>      </tr>
>    </table>
>  </body>
> </html>
>
>
> Sample Html code is here
> I want a graph in docx which i tried to convert using pandoc but 
> graphdoesnt appears in the docx when i convert
> can we add a graph/chart in docx using pandoc?
>
>
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/65c79c89-ba69-4895-bc7e-35e75a2895b5%40googlegroups.com.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Html to docx using pandoc
       [not found] ` <65c79c89-ba69-4895-bc7e-35e75a2895b5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2019-09-30 15:52   ` John MacFarlane
@ 2019-10-01  5:44   ` Mohit Bansal
       [not found]     ` <785651a7-511c-4eab-adf2-062d92db8472-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Mohit Bansal @ 2019-10-01  5:44 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 3702 bytes --]

Can we render this html with javascript as it appears on the webpage?

On Monday, September 30, 2019 at 5:27:10 PM UTC+5:30, Mohit Bansal wrote:
>
> I have an HTML file which is using a script to create charts and graphs.
> using that script, HTML file creates a graph.
> I want to convert that Html file to docx but when I try to convert that 
> file
> it doesn't convert/read script tag to make chart/graph in Docx.
>
> <html>
>  <head>
>    <script type="text/javascript" src="
> https://www.gstatic.com/charts/loader.js"></script>
>    <script type="text/javascript">
>
>       // Load Charts and the corechart package.
>      google.charts.load('current', {'packages':['corechart']});
>
>       // Draw the pie chart for Sarah's pizza when Charts is loaded.
>      google.charts.setOnLoadCallback(drawSarahChart);
>
>       // Draw the pie chart for the Anthony's pizza when Charts is loaded.
>      google.charts.setOnLoadCallback(drawAnthonyChart);
>
>       // Callback that draws the pie chart for Sarah's pizza.
>      function drawSarahChart() {
>
>         // Create the data table for Sarah's pizza.
>        var data = new google.visualization.DataTable();
>        data.addColumn('string', 'Topping');
>        data.addColumn('number', 'Slices');
>        data.addRows([
>          ['Mushrooms', 1],
>          ['Onions', 1],
>          ['Olives', 2],
>          ['Zucchini', 2],
>          ['Pepperoni', 1]
>        ]);
>
>         // Set options for Sarah's pie chart.
>        var options = {title:'How Much Pizza Sarah Ate Last Night',
>                       width:400,
>                       height:300};
>
>         // Instantiate and draw the chart for Sarah's pizza.
>        var chart = new google.visualization.PieChart(document.
> getElementById('Sarah_chart_div'));
>        chart.draw(data, options);
>      }
>
>       // Callback that draws the pie chart for Anthony's pizza.
>      function drawAnthonyChart() {
>
>         // Create the data table for Anthony's pizza.
>        var data = new google.visualization.DataTable();
>        data.addColumn('string', 'Topping');
>        data.addColumn('number', 'Slices');
>        data.addRows([
>          ['Mushrooms', 2],
>          ['Onions', 2],
>          ['Olives', 2],
>          ['Zucchini', 0],
>          ['Pepperoni', 3]
>        ]);
>
>         // Set options for Anthony's pie chart.
>        var options = {title:'How Much Pizza Anthony Ate Last Night',
>                       width:400,
>                       height:300};
>
>         // Instantiate and draw the chart for Anthony's pizza.
>        var chart = new google.visualization.PieChart(document.
> getElementById('Anthony_chart_div'));
>        chart.draw(data, options);
>      }
>    </script>
>  </head>
>  <body>
>    <!--Table and divs that hold the pie charts-->
>    <table class="columns">
>      <tr>
>        <td><div id="Sarah_chart_div" style="border: 1px solid #ccc"></div
> ></td>
>        <td><div id="Anthony_chart_div" style="border: 1px solid #ccc"></
> div></td>
>      </tr>
>    </table>
>  </body>
> </html>
>
>
> Sample Html code is here
> I want a graph in docx which i tried to convert using pandoc but 
> graphdoesnt appears in the docx when i convert
> can we add a graph/chart in docx using pandoc?
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/785651a7-511c-4eab-adf2-062d92db8472%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 13131 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Html to docx using pandoc
       [not found]     ` <785651a7-511c-4eab-adf2-062d92db8472-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-10-01  6:39       ` Mohit Bansal
       [not found]         ` <44aff450-f6c1-4629-880e-9e469e44fbc8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Mohit Bansal @ 2019-10-01  6:39 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 620 bytes --]

Does any method that we can render javascript while conversion?
or 
Can we add any javascript interpreter while running?

are there any methods exist to read javascript or to embed js interpreter 
into pandoc?

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/44aff450-f6c1-4629-880e-9e469e44fbc8%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Html to docx using pandoc
       [not found]         ` <44aff450-f6c1-4629-880e-9e469e44fbc8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-10-01  9:07           ` Agustín Martín
       [not found]             ` <43195bbb-c3c1-4f2c-b164-6394b45247c4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Agustín Martín @ 2019-10-01  9:07 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1028 bytes --]

I guess you could preprocess your html somehow, or just the script part 
with node, and get the chart's URL 
<https://stackoverflow.com/a/22523217/4045620>. If you could insert that 
URL back into your original document it would be picked up by pandoc (I 
think).
As jmf said, this is a bit out of scope for pandoc itself.

On Tuesday, October 1, 2019 at 8:39:07 AM UTC+2, Mohit Bansal wrote:
>
> Does any method that we can render javascript while conversion?
> or 
> Can we add any javascript interpreter while running?
>
> are there any methods exist to read javascript or to embed js interpreter 
> into pandoc?
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/43195bbb-c3c1-4f2c-b164-6394b45247c4%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1532 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Html to docx using pandoc
       [not found]             ` <43195bbb-c3c1-4f2c-b164-6394b45247c4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-10-01  9:15               ` Mohit Bansal
       [not found]                 ` <c360b9b1-8bcc-4b76-9e03-aa6308de229d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Mohit Bansal @ 2019-10-01  9:15 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1038 bytes --]

process of conversion of the document from HTML to Docx is headed.
script in HTML is also there.
how could I preprocess the Html?
could u provide a sample code how should I proceed further?

On Tuesday, October 1, 2019 at 2:37:05 PM UTC+5:30, Agustín Martín wrote:
>
> I guess you could preprocess your html somehow, or just the script part 
> with node, and get the chart's URL 
> <https://stackoverflow.com/a/22523217/4045620>. If you could insert that 
> URL back into your original document it would be picked up by pandoc (I 
> think).
> As jmf said, this is a bit out of scope for pandoc itself.
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/c360b9b1-8bcc-4b76-9e03-aa6308de229d%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1943 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Html to docx using pandoc
       [not found]                 ` <c360b9b1-8bcc-4b76-9e03-aa6308de229d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-10-01 16:16                   ` John MacFarlane
  0 siblings, 0 replies; 7+ messages in thread
From: John MacFarlane @ 2019-10-01 16:16 UTC (permalink / raw)
  To: Mohit Bansal, pandoc-discuss


See e.g. https://phantomjs.org/quick-start.html
Several methods are described here:
https://stackoverflow.com/questions/8049520/web-scraping-javascript-page-with-python


Mohit Bansal <bansalmohit031-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> process of conversion of the document from HTML to Docx is headed.
> script in HTML is also there.
> how could I preprocess the Html?
> could u provide a sample code how should I proceed further?
>
> On Tuesday, October 1, 2019 at 2:37:05 PM UTC+5:30, Agustín Martín wrote:
>>
>> I guess you could preprocess your html somehow, or just the script part 
>> with node, and get the chart's URL 
>> <https://stackoverflow.com/a/22523217/4045620>. If you could insert that 
>> URL back into your original document it would be picked up by pandoc (I 
>> think).
>> As jmf said, this is a bit out of scope for pandoc itself.
>>
>>
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/c360b9b1-8bcc-4b76-9e03-aa6308de229d%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2y2y4moew.fsf%40johnmacfarlane.net.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-10-01 16:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30 11:57 Html to docx using pandoc Mohit Bansal
     [not found] ` <65c79c89-ba69-4895-bc7e-35e75a2895b5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-09-30 15:52   ` John MacFarlane
2019-10-01  5:44   ` Mohit Bansal
     [not found]     ` <785651a7-511c-4eab-adf2-062d92db8472-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-10-01  6:39       ` Mohit Bansal
     [not found]         ` <44aff450-f6c1-4629-880e-9e469e44fbc8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-10-01  9:07           ` Agustín Martín
     [not found]             ` <43195bbb-c3c1-4f2c-b164-6394b45247c4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-10-01  9:15               ` Mohit Bansal
     [not found]                 ` <c360b9b1-8bcc-4b76-9e03-aa6308de229d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-10-01 16:16                   ` John MacFarlane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).