I'm writing a Shiny app and I'm trying to display a local PDF file in the app. No matter which path I try, I'm getting a "Not Found" error.
from shiny import App, Inputs, Outputs, Session, render, ui
import shiny.experimental as x
items = [x.ui.accordion_panel("Instructions", "Instructions for use"),
x.ui.accordion_panel("Docs", ui.output_ui("pdf"))]
app_ui = ui.page_fluid(
ui.h2("Test"),
x.ui.accordion(*items, id="acc")
)
def server(input: Inputs, output: Outputs, session: Session):
@output
@render.ui
def pdf():
return ui.tags.iframe(src="Test.pdf", width="50%", height="200%")
app = App(app_ui, server)
The file "Test.pdf" is in the same folder as the app, and I also tried creating a folder named "www" and storing "Test.pdf" in there. If I replace the local path with a URL the PDF displays, but I can't seem to figure out why I'm unable to display a local PDF file.
Any help would be very much appreciated - thank you very much!