Different pageMargins/page
Hy! Is there any way to change pageMargins dynamically? I would like to use higher margin on the last page becouse it contains more content... Thx your help!
Are there any workarounds for this?
My footer contains the date and the page number/count:
`my_content.push(...)
var my_pdf = { pageOrientation: "landscape", pageMargins: [20,40,20,40], content: my_content, footer: function (page, pages) {return [ {canvas: [{type: "line", lineWidth: 2, x1: 10, y1: 10, x2: 830, y2: 10}]}, {columns: [ {text: my_date.toString(), style: "doc_footer", alignment: "left"}, {tect: page.toString() + " /" + pages.toString(), style "doc_footer", alignment: "right"} ]} ] }, styles: {...} ` At the end of my report I wanted to display the clause (which contains more data), so I added an if structure, but the footer was too low to display the full clause:
footer: function (page, pages) { if (page == pages) { return [{ table: { widths: [80,"*"], body: [ [{text: "Made:", style: "doc_footer"},{text: "3 copies", style: "doc_footer"}], [{text: "One copy:", style: "doc_footer"},{text: pages + " page", style: "doc_footer"}], ..., ..., ... ] }, layout: "noBorders" }] } else {...the first mentioned code...} }
No idea? How can I get total page number in the content section?
Feature request: https://github.com/bpampuch/pdfmake/issues/368
Is there any way to set pagemargins dynamically? I'm asking because I'm trying to generate reports clientside but the reports have different headers and footers. I can get it to dynamically write out the correct headers but because the header content changes, the page margins need to also get adjusted otherwise there is overlap or two much space depending on what is in the header.
I was hoping there was a way to dynamically reset the pageMargin property before outputting a new page using pagebreakafter. Is there anybody who's done something similar? I saw the example where there's a method that returns the current page when setting .pageMargin value but because the reports generated aren't known, I need the ability to set the pageMargins. Thanks in advance.
I was looking for dynamic margins too, as @mouaxiong.
In my case some pages many not have header (specially the first page). If I have to put the margins to cover the headers of the whole document, the first page gets an undesired gap on the top.
Other case is that left pages and right pages have different headers height.
Why is the reason for this feature to be closed?
any solution around this yet?
Any solution to this yet?