Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 2162

Extensions for Joomla! 4.x • Re: Embed pdf in Article and make it responsive

$
0
0
Hello,

Your approach to embedding a PDF in Joomla 4 using an iframe or <object> tag is sound. However, the issue of responsiveness for PDFs on different devices can indeed be challenging. It's great that you've already found a method that works well on desktops, but as you've noticed, it doesn't translate perfectly to smaller screens.

To address the responsiveness, you might consider using CSS to control the size and aspect ratio of the container for the PDF. This could help maintain the PDF's usability across various devices. Here's a simple CSS approach you could try:

Code:

css.object-container {    width: 100%;    max-width: 1000px; /* Adjust based on your preference */    height: auto;    aspect-ratio: 1000 / 1500; /* Adjust the ratio as per your PDF's dimensions */}object {    width: 100%;    height: auto;}
Then, wrap your <object> tag with a div using this class:

html

Code:

<div class="object-container">    <object data="your-pdf-link.pdf" type="application/pdf">        Your fallback message here.    </object></div>
If resizing the PDF is still necessary, you might want to explore online tools for optimizing PDF files for web viewing. A useful resource for this is PDF Help, where you can adjust the PDF file size and format to better suit web responsiveness.

Good luck with your Joomla project, and I hope this helps make your PDFs more responsive on all devices!

Statistics: Posted by yalhazmi — Wed Mar 20, 2024 2:06 am



Viewing all articles
Browse latest Browse all 2162

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>