Good question. OpenCPU captures graphics using evaluate
which stores each graphic individually. The API itself doesn't support combining multiple graphics within a single file. I would personally do this sort of PDF
post processing in the application layer (i.e. with non-R tools), but perhaps it would be useful to support this in the API.
Some suggestions:
Any file that your R function/script saves to the working directory (i.e.
getwd()
) will also become available through the API. So one thing you could do is in your R code manually create your combinedpdf
file and save it to the working directory and then download it through opencpu.Graphics are actually
recordedPlot
objects, and besidespng
,pdf
andsvg
, you can also retrieve the graphic asrds
orrda
. So you could write an R function that downloads therecordedPlot
object from the API and then prints it. Not sure if that would be helpful in your use case.