title: Error using R flextable package - cannot load temporary image file
body: <p>I am trying to save a data frame as an image file using flextable, with the ultimate goal to plot it next to a ggplot object. Here is example of the code:</p>
  
  <pre><code>library(flextable)
  ft &lt;- flextable( head( mtcars ) )
  ft &lt;- autofit(ft)
  tf &lt;- tempfile(fileext = ".png")
  save_as_image(ft, tf)
  </code></pre>
  
  <p>which returns the following error:</p>
  
  <pre><code>Could not load  file:///D:/Antonis/Documents/file:/C:/Users/Antonis/AppData/Local/Temp/RtmpmgSSYv/file2510dc77c47.html
  Error in webshot::webshot(url = sprintf("file://%s", tf), file = path,  : 
    webshot.js returned failure value: 1
  In addition: Warning message:
  In normalizePath(path.expand(path), winslash, mustWork) :
    path[1]="file://C:\Users\Antonis\AppData\Local\Temp\RtmpmgSSYv\file2510dc77c47.html": The filename, directory name, or volume label syntax is incorrect
  </code></pre>
  
  <p>It seems like the file path is incorrect. I tried to change the working directory with setwd:</p>
  
  <pre><code>setwd("C:/Users/Antonis/AppData/Local/Temp/RtmpmgSSYv")
  </code></pre>
  
  <p>but the error persists:</p>
  
  <pre><code>Could not load  file:///C:/Users/Antonis/AppData/Local/Temp/RtmpmgSSYv/file:/C:/Users/Antonis/AppData/Local/Temp/RtmpmgSSYv/file25105e4f2c8b.html
  Error in webshot::webshot(url = sprintf("file://%s", tf), file = path,  : 
    webshot.js returned failure value: 1
  In addition: Warning message:
  In normalizePath(path.expand(path), winslash, mustWork) :
    path[1]="file://C:\Users\Antonis\AppData\Local\Temp\RtmpmgSSYv\file25105e4f2c8b.html": The filename, directory name, or volume label syntax is incorrect
  </code></pre>
  
  <p>The same happens when I try to set the path through the tempfile command:</p>
  
  <pre><code>tf &lt;- tempfile(tmpdir = "C:/Users/Antonis/AppData/Local/Temp/RtmpmgSSYv", fileext = ".png")
  </code></pre>
  
  <p>The save_as_image help file also did not offer some insight.</p>
  
  <p>The above code is quite generic and in fact it is drawn from a blog post, so my problem seems to be local. 
  Any suggestions?</p>