Javascript Generate PDF

On 01/04/2025

In javascript

<html>
<head>
<style>
.button {
  background-color: white;
  border: none;
  Border-radius:5px;
  color: black;
  padding: 15px 32px;
 border: 2px solid #008CBA; 
 text-align: center;
  font-weight : bold ;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
  top: 38%;
  right: 27%;
  position:absolute;
}
.button:hover {
  background-color: #008CBA;
  color: white;
}
.imagestyle{
    width: 50%;
    margin-left: 20%;
    position: absolute;
    top: -105px;
    display:none;

}
@media print {
@page {
      size:auto;
      margin:.5rem 0;
}
  #printPageButton {
    display: none;
  }
  #imagestyleId{
      display:block;
  }
 [data-automation-id^=QuickLinksWebPart]{
     display: none !important;
  }
  [data-automation-id=TitleTextId]{
     padding-top: 100px;
  }

  [data-automation-id=CanvasSection]{
     top: -140px;
  }
}
</style>
</head>
<body>
<script type="text/javascript">
function generatePdf() {
 const pageTitle = document.title;
 const printTitle = 'Mandate ' + pageTitle;
 document.title = printTitle;
 window.print();
 document.title = pageTitle;
 return false;
}
</script>

<input type="button" class="button" 
id="printPageButton"
value="Generate Mandate" onclick="generatePdf()">
<img src="tlstLogo.png" class="imagestyle" id="imagestyleId"/>

 

</body>
</html>

 

javascript css

No ratings yet - be the first to rate this.