Skip to content

Commit

Permalink
add funtion to print
Browse files Browse the repository at this point in the history
  • Loading branch information
masdzub committed Dec 30, 2023
1 parent 03399bc commit fc96cc5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
18 changes: 16 additions & 2 deletions assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
list-style-type: disc; /* Set bullet points as filled circles */
/* Add any additional styling here */
}

.custom-list li {
margin-left: 20px; /* Adjust the value as needed for indentation */
/* Add any additional styling for the li here */
Expand Down Expand Up @@ -58,4 +58,18 @@
100% {
transform: rotate(360deg);
}
}
}

@media print {

/* Hide specific elements from printing */
.text-center > * {
display: none;
}

/* Show content you want to include in the print version */
.container,
.section {
display: block;
}
}
10 changes: 9 additions & 1 deletion assets/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ document.addEventListener('DOMContentLoaded', function() {
var html = document.documentElement.outerHTML;
var minifiedHTML = html.replace(/[\n\r]+|[\s]{2,}/g, ' ').replace(/> </g, '><');
document.documentElement.outerHTML = minifiedHTML;
});
});

// Function to handle printing
function printResume() {
window.print();
}

// Add an event listener to the print button
document.getElementById('printButton').addEventListener('click', printResume);
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ <h2 class="text-2xl font-light mb-4 flex">
<i class="fas fa-download mr-2"></i>
Download CV
</a>

<button id="printButton" class="inline-flex items-center px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600 transition duration-300 ease-in-out">
<i class="fas fa-print mr-2"></i>
Print
</button>
</div>

</main>
Expand Down

0 comments on commit fc96cc5

Please sign in to comment.