PDF Viewer: Can you set the PDF with code

I want to be able to display different PDFs on my site using URL links to where they are stored in cloud storage.
I have tried doing this with an HTML element however they will not be displayed in Chrome.
Is there a way to set the PDF the viewer displays with code?

I have this question as well.