question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set bottom and top margin for addHTML

See original GitHub issue

Hi,

I am not able to add margin to top and bottom for multiple pages. How can i add that?

Below code represents:
`

exportAsPdf() {
self = this;

const elementToPrint = document.getElementById('widgets'); //The html element to become a pdf

const pdf = new jsPDF('p', 'pt', 'a4');

pdf.internal.scaleFactor = 2.25;

pdf.text(20, 30, "Dashboard");

let options = {
    pagesplit: true,
    background: '#fff',
    format: 'PNG',
    padding: 50,
    margin: {
        top: 40,
        bottom: 30
    }
};

let margins = {
    top: 40,
    bottom: 30
};

//pdf.rect(20, 20, pdf.internal.pageSize.width - 40, doc.internal.pageSize.height - 40, 'S');
// pdf.setDisplayMode("125%", "continuous");
pdf.addHTML(elementToPrint, 0, 30, options, () => {
    pdf.save('Dashboard.pdf');
});}

` Please help me out.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12

github_iconTop GitHub Comments

9reactions
Uzlopakcommented, Dec 6, 2017

Open your own issue… Is this not clear enough?

0reactions
vivekalwayscommented, Dec 6, 2017

Es tut mir leid…

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to set top and bottom margin in addHTML - Stack Overflow
Do it like this: pdf.addHTML(document.getElementById('exportthis'), 5, 10, { pagesplit: true, margin: margins }, function(dispose) { var ...
Read more >
How to set bottom and top margin for addHTML #1439 - GitHub
Hi, I am not able to add margin to top and bottom for multiple pages. How can i add that? Below code represents:...
Read more >
How To Set Top And Bottom Margin In Addhtml - ADocLib
Setting Custom Margins. Go to Page Layout → Page Setup → Margins → Custom Margins to open the Page Setup box to the...
Read more >
CSS Margin - W3Schools
The CSS margin properties are used to create space around elements, outside of any defined borders. ... margin-top; margin-right; margin-bottom; margin-left.
Read more >
Add HTML Header or Footer - Encodian Support
Top Margin : Set the top margin value (pt.) The default value is set to 0. Bottom Margin: Set the bottom margin value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found