Black Friday 2026 50% off every plan Our biggest deal of the year on #1 Joomla products.
Ends in 12d 09h 12m 20s
Claim 50% off
Solved SP Page Builder

embed pdf

Asked by bageo 1 year ago Last activity 1 year ago

Hello I want to show a pdf in an article using the code I found from an older post of you:
<object data="/uploads/media/default/0001/01/540cb75550adf33f281f29132dddd14fded85bfc.pdf" type="application/pdf" width="100%" height="500px">
<p>Unable to display PDF file. <a href="/uploads/media/default/0001/01/540cb75550adf33f281f29132dddd14fded85bfc.pdf">Download</a> instead.</p>
</object>

    this works fine when I visit my site from a pc but not from any mobile ...
    I installed PDF Embed plugin but doesnt work either 
    what can I do??

Accepted answer

Marked as the solution
Paul Frankowski Senior Staff
1 year ago · edited

Hi,

In general, is not recommended to use PDF as viewer on mobile devices. This format is not Mobile friendly. That's why use download link under.


I can share an example, that may help you a little bit, but it's beyond JoomShaper support (!) Use it inside Raw HTML addon. BTW On iOS (Safari), PDF preview may be limited.

HTML Code

  <div class="pdf-container">
    <object 
      data="path/to-your-file.pdf#toolbar=0&navpanes=0" 
      type="application/pdf">
      <p>Your browser does not support PDF preview. 
         <a href="/path/to-your-file.pdf">Download PDF file</a>.
      </p>
    </object>
  </div>

CSS code (use it inside Page Settings > Page CSS > CSS or Template options > Custom code > Custom CSS)

.pdf-container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;}
  object {
      width: 100%;
      height: 100%;
      border: none;}

1 more reply

bageo Asked this

thanks a lot

Log in to reply.