-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set custom size and margin for each page #325
Comments
I believe I can add something here I'll try to play around some more... |
To allow for custom dimensions, I've included these parameters to be added at the beginning of the document definition. if (!docDefinition.pageSize && docDefinition.pageCustomWidth && docDefinition.pageCustomHeight) {
pageSize = { width: docDefinition.pageCustomWidth, height: docDefinition.pageCustomHeight }
} else
pageSize = pageSize2widthAndHeight(docDefinition.pageSize || 'a4'); If This works for all the pages though. Looking for a solution that customizes the size of every single page in the document. |
Would it be possible to have some leads on the pieces of code that I can edit to obtain this result? I tried several solutions but till now they all failed.. If you could give me some insight on what section of the code deals with the new pages and how the size is passed I can try to hack a bit :) I'm using pdfmake for a project and I need to have it done... thanks for any help! |
The trouble is, there is not a single piece of code you need to touch. It's a bit spread through the code. The page is created internally here: https://github.com/bpampuch/pdfmake/blob/master/src/documentContext.js#L194 But because we have tables and column contexts spanning across pages, it's not that simple. Have a look at That's everything from the top of my mind. |
Thanks, I'll try something and let you know how it goes... |
I'd be interested in that kind of functionality, too. |
Hi, I need this feature to show some parts of a document in A3. |
Hi, I've set up a simple way to create a document in multiple page sizes.
I've worked directly on sources for version 1.4. First, when generating contents, I added the property pageSize to identify the page size of the element, like 'a4' or 'a3'. Then file src/browser-extensions/pdfMake.js line ~32 is changed as following:
And also the file /src/printer.js at line ~85
Currently this solution seems to work well also with tables and images. Best Regards |
Hi.. All.. need a Help. i want to have pageMargins dynamically to be set for footer.. if there is more than one page i need pageMargins for the first page to be as [40,15,40,60] and for the another page it should be like [40,15,40,250] as in the footer i need to mention some text and images.. as i tried here but couldn't found the solution or else i am missing out something.. so if anyone know the solution.. for this kind of thing.. I would be grateful |
I need to set my own margins and dimensions for each page. I managed to do that for the whole document but not for a single page.
Could you point out where I need to change the code? Kind of the same way we change the page orientation, but for the size.
Or is there any other way to do it? I'm developing a front-end app so cannot use nodejs.
Thanks
The text was updated successfully, but these errors were encountered: