Alternatives to texi2pdf?

shiny

#1

I have the code below in my shiny app. It reads a Sweave file and produces a PDF file. The shiny app is hosed on Google Cloud Platform.

 content <- function(file) {
        #Generate Report
        tempReport   <- "SDO_Report.Rnw" 
        tempTex   <- "SDO_Report.tex"     
       
        
        # Set up parameters to pass to Rnw document
        outChk <- input$outChk
        olistID <- idList
        olevel <- input$level
        ocurACS <- curACS
        ocurYr <- curYr
        placelist <- PlaceList
        filemat <- fileMat
 
        #knitting file and copy to final document
        
        knit(input=tempReport,output=tempTex)

        tools::texi2pdf(tempTex)
        tempPDF <- "SDO_Report.pdf"
        file.rename(tempPDF, file) # move pdf to file for downloading
      } #Content

The message log highlights the following error:

processing file: SDO_Report.Rnw
output file: SDO_Report.tex
Warning: Error in texi2dvi: Running 'texi2dvi' on 'SDO_Report.tex' failed.
Messages:
mkdir: cannot create directory ‘SDO_Report.t2d’: Permission denied
/usr/bin/texi2dvi: cannot create directory: SDO_Report.t2d
Stack trace (innermost first):
    52: texi2dvi
    51: tools::texi2pdf
    50: download$func [/srv/shiny-server/ProfileDashboard2/app.R#1191]
     1: runApp
Error : An error has occurred. Check your logs or contact the app author for clarification.

Is there a work around to this? Can I direct texi2dvi to send its temp files somewhere else than /usr/bin?

Any suggestions would be appreciated.
Cheers
AB