The goal is to have an iframe inside my Shiny app that has no vertical scroll bars (so the PDF displayed inside is fully visible), and automatically adjust the height based on window resizing.
I can adjust the height of the iframe to something that will almost always show the entire PDF (ex: 600px).
pdf_b64 <-
dataURI(file = pdf_file_path, mime = "application/pdf")
tags$div(
id = "pdf",
tags$iframe(
style = "height:600px;width:100%",
src = pdf_b64,
frameborder = "0"
)
)
But when the browser window is reduced in size, the iframe is too long relative to the PDF and looks poor.
I came across this blog post which looks promising, but I'm not sure it's applicable or how to incorporate it into my Shiny app.
Also, the PDF is only one page. I've thought about converting the PDF to an image and using renderImage() & imageOutput(). Is this a better approach?