Skip to content

.html(), how to fit content to single pdf? My div is printing into 3 total pages? #2911

@HennDev

Description

@HennDev

Using the latest version, here:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.1.1/jspdf.umd.min.js" integrity="sha512-/Am09zlYshHgRizY3RkConGj4BsYIdb8mS7r5XAXw0rTiLgGSHzpUHTQBhinWR32C/KzLr749J1xuORzT2JnRA==" crossorigin="anonymous"></script>
</script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>

	let pdf = new jsPDF('l', 'pt','a4',true);
	pdf.html(document.getElementById('mainClone'), {
		callback: function () {
			pdf.save('test.pdf');
			window.open(pdf.output('bloburl')); // to debug
		}
	});

Essentially it is printing this one element out into 3 pages (landscape). I can't figure out how to adjust the sizing properly so everything passed into the first param of html() gets used in one page. Anyone have tips on this?

Below are the results of the html table and then the resulting pdf.

https://i.imgur.com/r60rteJ.png

https://i.imgur.com/aSSBLTu.png

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions