Use a second layout or a popover with another container. Disable the main container and copy the image / pdf to this second container for viewing. When they close the popover or return from the second layout then empty the viewing container. Usually you would have a thumbnail on the main layout with the full image on the viewing layout / popover.
I ended up doing something very similar and replaced it from being a "go to related records" layout to scripting it into temporary global containers. Thank you for your quick response!