How i pass a media query or fix width and height using onclick event?

So i convert html page to pdf by using onclick event

My code is:-
function generatePDF() {
var element = document.getElementById(‘invoice’);

var doc = {

filename: ‘myfile.pdf’,
image: { type: ‘jpeg’, quality: 1 },
html2canvas: { dpi:192, letterRendering : true, scale: 2, text Align: ‘center’, },
jsPDF: { unit: ‘pt’, format: ‘letter’, orientation: ‘portrait’, format: ‘a4’ },

};

html2pdf().set(doc).from(element).save();

}

By using onclick event the page will be downloaded successfully but the alignment of the content
is changed.
I want to give fix size so the content alignment is not change and also in mobile view the page will be downloaded at that defined fix size.