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

80
Views
Export Page to PDF using Javascript

I'm trying to export a web page containing many tables as a .pdf file. I figured out triggering the default print function using javascript might do the trick.

the site is quite long and depeding on the loaded data might be shorter or even longer.

The site looks something like this (example, the pink like indicates the printable area when pressing Strg+P, result here.)

The main issue here is, that the text gets kind of squished together (?) and get's cut off.

enter image description here

here's the code I'm trying to work on:

javascript itself is triggering the default print function

<script>
  $("#employeePrintPage").click(function () {
    window.print();
  });
</script>

css is hiding everything I don't need (eg. logo and navigation bar) as well as trying to get page-break to work.

 @media print {
    #loadcontainer {
        background-color: white;
        height: 100%;
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        margin: 0;
        padding: 15px;
        font-size: 14px;
        line-height: 18px;
    }

    .navbar, nav, .navbar-menu-wrapper, .navbar-nav-right, .hideprint { display: none !important; }


    table { page-break-after:always !important }
    tr    { page-break-inside:avoid !important; page-break-after:auto !important }
    td    { page-break-inside:avoid !important; page-break-after:auto !important }
    thead { display:table-header-group !important }
    tfoot { display:table-footer-group !important }

  }

i tried to use a couple of jquery plugins but none of them worked with input fields.

I am unable to open a new window because input fields don't adopt values.

about 4 years ago · Juan Pablo Isaza
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!