Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
changing the size of embedded PDF in javascript

noob here, I want the embedded PDF to appear with 100% width and 97,5% height but i cant figure it out

  <style>.size {
      width:100%;
      height:97.5%;
    }
  </style>
    <button type="button" id="show" onclick="PDFshow(this); classadd()" >PDF anzeigen</button>
    <div id="pdfsize"> 
    <script>
      function PDFshow(x) {
        x.style.visibility = 'hidden';      
        var x = document.createElement("EMBED");
        x.setAttribute("src", "Doku.pdf");
        document.body.appendChild(x); 
      }
    </script>
    </div>
  

    <script>
      function classadd() {
        var element = document.getElementById("pdfsize");
        element.classList.add("size");
      }
    </script>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Add this after x.setAttribute("src", "images/application-form.pdf"); :

x.setAttribute("width", "100%");
x.setAttribute("height", "97.5%");

you can delete the css code of .size and add height on the body tag of 100vh.

about 4 years ago · Juan Pablo Isaza Report

0

<button type="button" id="show" onclick="showPDF(this)" >PDF anzeigen</button>

<script>
  function showPDF(x) {
    x.style.display = "none";
    var x = document.createElement("EMBED");
    x.setAttribute("src", "Doku.pdf");
    x.classList.add("size");
    document.body.appendChild(x);
  }
</script>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!