Pdfmake: Adding page breaks in the doc definition

Created on 14 May 2014  Â·  8Comments  Â·  Source: bpampuch/pdfmake

I looked around the source and the examples but I couldn't really figure out how to add a page break in the document. I will appreciate to document it here if it is implemented. Thanks.

question

Most helpful comment

You can set _pageBreak_ on any element to 'after' or 'before' (depending on where you want the break to occur).

_images_ and _table_ examples use this attribute:

(...)
    'You can also fit the image inside a rectangle',
    {
        image: 'fonts/sampleImage.jpg',
        fit: [100, 100],
        pageBreak: 'after'
    },
(...)

and

(...)
    { text: 'noBorders:', fontSize: 14, bold: true, pageBreak: 'before', margin: [0, 0, 0, 8] },
(...)

All 8 comments

You can set _pageBreak_ on any element to 'after' or 'before' (depending on where you want the break to occur).

_images_ and _table_ examples use this attribute:

(...)
    'You can also fit the image inside a rectangle',
    {
        image: 'fonts/sampleImage.jpg',
        fit: [100, 100],
        pageBreak: 'after'
    },
(...)

and

(...)
    { text: 'noBorders:', fontSize: 14, bold: true, pageBreak: 'before', margin: [0, 0, 0, 8] },
(...)

Thanks a lot for prompt response. I can swear that I searched for the pageBreak keyword in the examples. But, it is really there. Anyway, great work! The library is really powerful. I wish I could help with the documentation.

I've added the description to getting started

@osaatcioglu Can you show me your code, how did you do it with dynamic data?
I also having same problem. unable to find a solution.
Trying to make it work since last 3 days.
Even asked a question here https://github.com/bpampuch/pdfmake/issues/1070 also. You can see my code there.

@NikhilRadadiya commented on your issue.

I converted an old unix program to node, so i replaced all \x0C (Form feeds) to page breaks like this
content:text.split(/\x0C/).map(v=>{return {text:v,pageBreak:'after'}})

however i had to remove the page break from the last page, or a blank page was inserted

any other idea?

Did you try to check if it is the last character set of the array?

On Fri, 7 Sep 2018 at 02:16, neimanpinchas notifications@github.com wrote:

I converted an old unix program to node, so i replaced all \x0C (Form
feeds) to page breaks like this
content:text.split(/\x0C/).map(v=>{return {text:v,pageBreak:'after'}})

however i had to remove the page break from the last page, or a blank page
was inserted

any other idea?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/bpampuch/pdfmake/issues/25#issuecomment-419281100,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AKQm59SvTpK_NvxqTcylCzrTNzVjFxgUks5uYbr0gaJpZM4B7B62
.

double checked
and the document ends with a CR\LF only

On Thu, Sep 13, 2018 at 3:02 AM Haiyun Huang notifications@github.com
wrote:

Did you try to check if it is the last character set of the array?

On Fri, 7 Sep 2018 at 02:16, neimanpinchas notifications@github.com
wrote:

I converted an old unix program to node, so i replaced all \x0C (Form
feeds) to page breaks like this
content:text.split(/\x0C/).map(v=>{return {text:v,pageBreak:'after'}})

however i had to remove the page break from the last page, or a blank
page
was inserted

any other idea?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/bpampuch/pdfmake/issues/25#issuecomment-419281100,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/AKQm59SvTpK_NvxqTcylCzrTNzVjFxgUks5uYbr0gaJpZM4B7B62

.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/bpampuch/pdfmake/issues/25#issuecomment-420905229,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQJ0rVtTN6gQlTAjHG9-f3mIf_Pe0UXEks5uagMigaJpZM4B7B62
.

--
Pinchas S. Neiman
845.213.1229 #2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kumarandena picture kumarandena  Â·  3Comments

jokris1 picture jokris1  Â·  3Comments

dgrice picture dgrice  Â·  3Comments

michaelqiji picture michaelqiji  Â·  3Comments

dmatesic picture dmatesic  Â·  3Comments