0

I am sadly using Windows 7, which could be the problem...

I want to add a existing image file to a pander report, using live report generation on the Windows platform, outputting to docx:

library(pander)
setwd("T:/R/Temp") #this contains the subfolder & file /plots/temp.png
myReport = Pandoc$new(author="Jerubaal",title="Where's my picture?", format="docx")
myReport$add.paragraph("There should be a picture after this.")
myReport$add(pandoc.image("/plots/temp.png"))
myReport$add.paragraph("There should be a picture before this.")
myReport$export()

Alas, there is no image included when running it in Windows (not even in the md file).

It doesn't work if I try putting the code straight in:

myReport$add("![](/plots/temp.png)")

If I try this:

myReport$add("![/plots/temp.png](/plots/temp.png)")

I just get the text for the path: /plots/temp.png

Any suggestions?

FYI: Some time ago, trying out ggplot, I got it to work in Ubuntu: earlier question

This report was generated with R (3.0.3) and pander (0.3.9) in 0.02 sec on x86_64-w64-mingw32 platform.

Community
  • 1
  • 1
Jerubaal
  • 65
  • 1
  • 7
  • Pls give it a try without the leading `/`, so something like: `pandoc.image("plots/temp.png")` – daroczig Apr 22 '14 at 21:57
  • Hi @daroczig, I have tried it again without the leading / but there is still no image in the docx. – Jerubaal Apr 23 '14 at 08:51
  • 1
    sry, `pandoc.image` does not return anything, instead pls use `pandoc.image.return`. Or as you did: define the markdown by hand, but do not include the leading `/`. This way it should work. – daroczig Apr 23 '14 at 10:25
  • Perfect! pandoc.image.return works on Windows, outputting to docx. Thanks @daroczig – Jerubaal Apr 24 '14 at 10:31

0 Answers0