Skip to content

Instantly share code, notes, and snippets.

View avtarnanrey's full-sized avatar
:electron:

Avtar Nanrey avtarnanrey

:electron:
View GitHub Profile
@avtarnanrey
avtarnanrey / apache_config.conf
Last active May 6, 2020 16:08
Common apache config to redirect http to https and setting SSL certificate and allow .httaccess settings
<VirtualHost *:80>
Redirect "/" "https://your_website.com"
</VirtualHost>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName your_website.com
ServerAlias www.your_website.com
DocumentRoot /var/www/your_website.com
ErrorLog ${APACHE_LOG_DIR}/website_error.log
@avtarnanrey
avtarnanrey / html-to-pdf.js
Last active January 21, 2025 16:09
html2canvas or html-to-image or modern-screenshot with jsToPDF
download(): void {
const printContent = document.querySelector('.card-body');
if (printContent) {
// Replace below line with library function, whichever you're using.
domToPng(printContent, { quality: 1, scale: 2 }) // Scale set to 2 for better quality in PDF
.then((canvas) => {
const imgData = canvas;
const pdf = new jsPDF('p', 'mm', 'letter'); // Portrait, mm, Letter size
const imgWidth = 86;