title: RShiny - export diagrammeR plot to powerpoint
body: <p>I have an RShiny application that generates a network plot using the diagrammeR package:</p>
  <pre><code>blc3001 &lt;- eventReactive(input$datapath,{
      data_blc &lt;- readxl::read_xlsx(input$datapath$datapath)
      blc3001 &lt;- &quot;digraph test{&lt;TONS OF GRAPH CODE&gt;&quot;
  })    
  </code></pre>
  <p>I can output to Shiny using:</p>
  <pre><code>output$blc3001 &lt;- renderGrViz({
      grViz(blc3001())
    })
  </code></pre>
  <p>And I can download as a .png using:</p>
  <pre><code>  output$d_blc3001 &lt;- downloadHandler(
      filename = &quot;blc3001.png&quot;,
      content = function(file) {
        grViz(blc3001()) %&gt;% export_svg %&gt;% charToRaw %&gt;% rsvg_png(file)
      },
      contentType = &quot;image/png&quot;
    )
  </code></pre>
  <p>Now I am trying to download this graph into a powerpoint slide, but am running into difficulty. I am open to any method or package, but I am currently trying to do this via the &quot;officer&quot; package.</p>
  <pre><code>output$blc3001_powerpoint &lt;- downloadHandler(
      filename = function() {
        &quot;blc3001.pptx&quot;
      },
      content = function(file) {
        
        image &lt;- grViz(blc3001()) %&gt;% export_svg %&gt;% charToRaw %&gt;% rsvg_png()
                    
        ppt_report &lt;- read_pptx() %&gt;%
          add_slide(layout = &quot;Title and Content&quot;, master = &quot;Office Theme&quot;) %&gt;%
          ph_with(value =  image, location = ph_location_type(type = &quot;body&quot;))
  
        print(ppt_report, target = file)
      }
    )
  </code></pre>
  <p>Although I can download the png, when I define ppt_report, I get error:</p>
  <pre><code>Error in UseMethod(&quot;ph_with&quot;, value) : 
    no applicable method for 'ph_with' applied to an object of class &quot;raw&quot;
  </code></pre>
  <p>I assume this is because I specify content type is img/PNG in the image download handler, but not the powerpoint download handler. I can download the powerpoint without error if I remove &quot;%&gt;% charToRaw %&gt;% rsvg_png()&quot; from defining image, but the powerpoint slide contains the XML code rather than rendering the actual svg. If anyone can please provide any tips on how to proceed I would greatly appreciate it! Thanks!</p>