We can make the src attribute a template literal like below. import testPdf from './Test.pdf'; Then, in the App component, I will add an iframe and give it a src attribute with the testPdf like so. Connect and share knowledge within a single location that is structured and easy to search. here's my code: Using JS libraries, like pdf.js by Mozilla. How could my characters be tricked into thinking they are on Mars? Is this an at-all realistic configuration for a DHC-2 Beaver? How to generate PDF file from external text files using PHP ? How to pop an alert message box using PHP ? I hope this article was helpful for you if you were struggling to find a good solution like I did. <a href="/downloads/ file.pdf" target="_blank">Open PDF</a> @NawedKhan what is the alternative? If you are curious to read more about how this works, take a look here. How do I give text or an image a transparent background using CSS? How to execute PHP code using command line ? Find centralized, trusted content and collaborate around the technologies you use most. I want to be able to quit Finder but can't edit Finder's Info.plist after disabling SIP. For example: Thanks for contributing an answer to Stack Overflow! Read this first ! Can virent/viret mean "green" in an adjectival sense? frameborder="0"></iframe>. How is Python best for mobile app development? Why I implemented my own JSON.stringify() and console API, 5 websites to learn Frontend-web development faster, Learn the difference between CSS & JavaScript, Loading components dynamically in angular, Nuxt Ionic: Using Nuxt, Prisma and Ionic Framework to Build Full Stack Mobile Applications,