I build shiny app that is expected to create PDF report out of
the user input data, through knitr. My application is working perfectly when
run on my computer through R Studio but once I upload it to the shiny server (shinyapps.io)
some latex packages that I use stop working and I do not understand
why. Using eso-pic or hyperref result in error:
Running ' texi2div ' on ' pdf_shell.tex ' failed.xelatex compiler
when compiling the PDF but it did not solve all of my problems. My
problem is mainly related to
the hyperref package which is functioning well when run through the R
Studio
but crash or covers text when run through shiny server. Below you will
find
pictures visualizing my problem with hyperref (one is compiled through R
Studio (working well) and the "broken" via deployed app on shinyapps.io). pdflatex,
without getting the above mentioned error? Or you maybe have any pro
tips that could solve the problems differently. Any input is much
appreciated.I compile documents via shiny simply with:
output$report = downloadHandler(
filename = reactive({paste0(input$filename,'.pdf')}),
content = function(file) {
out = knit2pdf(input = 'pdf_shell.Rnw')
file.rename(out, file)
},
contentType = 'application/pdf' )
Thank you,
WiktorshinyServer(function(input, output) {
output$report = downloadHandler(
filename = reactive({paste0(input$filename,'.pdf')}),
content = function(file) {
out = knit2pdf(input = 'pdf_test.Rnw', compiler = 'xelatex')
file.rename(out, file) # move pdf to file for downloading
},
contentType = 'application/pdf'
)
}
)
library(shiny)
library(knitr)
shinyUI(fluidPage(
fluidRow(
column(3,
wellPanel(
textInput('filename', 'File name', value = ''),
downloadButton('report', label = 'Download PDF')
)
)
)
)
)
\documentclass{article}
\usepackage{eso-pic}
\usepackage{hyperref}
\begin{document}
foo
\begin{Form}
\section{Form}
\TextField[name=1, multiline=true, width=\linewidth,height=0.6in, bordercolor = 1 1 1, charsize=0pt]{} \\
\TextField[name=12, multiline=true, width=\linewidth,height=0.6in, bordercolor = 1 1 1, charsize=0pt]{} \\
\TextField[name=13, multiline=true, width=\linewidth,height=0.6in, bordercolor = 1 1 1, charsize=0pt]{}
\end{Form}
\end{document}