johnnywang1994 / jsPDF-html2canvas

A combine usage with jsPDF & html2canvas, which translating html content to PDF file.
MIT License
74 stars 9 forks source link

Not able add the top margin at the 2nd page onwards #40

Open tabish9936 opened 7 months ago

tabish9936 commented 7 months ago

As I am converting html to pdf if the html content is of the one page then it is fine if the content goes beyond that then the text in the in the 1st page get break down so need add the margin top at the 2nd page onwards but there is no such functionality for it.

image Onlinedoc_1705929661378803cb (9).pdf

johnnywang1994 commented 6 months ago

Hi, thanks for reporting issue, did you add the config "margin" when calling the plugin function?

html2PDF([
  document.getElementById('first'),
  document.getElementById('second'),
], {
  // => margin config is here
  margin: {
    top: 10,
    right: 10,
    bottom: 30,
    left: 10,
  },
  html2canvas: {
    scrollY: 0,
    scrollX: 0,
  },
  autoResize: false,
})
tabish9936 commented 6 months ago

it is not working