Hello to the whole community,
I’m using html2pdf javascript to extrapolate graphs created in Laravel, but the problem is that on a graph that’s too large I had to set x-y overflow for the scroll, now the half graph comes out in the PDF.
How can I solve to have everything in the PDF?
This is the graph and the code
thank you so much community..
<script>
$('#btn-one').click(function() {
let div = document.querySelector(".tutto");
var opt = {
margin: [0, 8, 0, 0],
pagebreak: { mode: 'avoid-all' }
};
html2pdf().from(div).set(opt).save('dashboard-pers-layout-1.pdf');
});
</script>
“This is the graph” – can’t tell from just a screenshot, what this actually is. Is the whole thing one image? Or is this actually HTML content?
yes this is the graph.. if you want, post the html too! basically in the app there is x y overflow to scroll down and to the left and if I want to save the PDF it doesn’t remove the overflow it stays like this. I would like to see all the results in the PDF instead
I asked what it is made of, because with an image you could have simply limited the max-width to 100%. But if it is HTML, then you will either have to find a way to scale this down so that it will all fit without a scrollbar being necessary – or find a different way of displaying this in your PDF altogether.
Yes, you’re right, do you happen to have any ideas?
Or maybe actually allow the content to break into multiple lines. What you got there isn’t much of an actual “graph” to begin with, rather just a list of properties with a yes/no indicator … Viewers should still be able to interpret this correctly, if you allowed the content under “Maggazino Scaffalle A A1” to display in two or more lines, I suppose …?
Show 11 more comments