pdfmake icon indicating copy to clipboard operation
pdfmake copied to clipboard

Increase Header Size PDF make

Open nbridgemohan opened this issue 10 years ago • 2 comments

I am trying to increase the header size on a pdf using pdfmake. Currently am able to get a header on both the left and right of the page, which is what I want, but when the height passes 26, the image disappears because there is a limited amount of space for the header.

The margin can be decreased to increase the size but i want the margin to remain.

If you need to test anything, try the code I have so far on playground

var dd = {

        pageSize: 'LEGAL',
        pageOrientation: 'landscape',

        header: {
            margin: 8,
            columns: [
                {

                    table: {
                        widths: [ '50%','50%'],

                        body: [
                            [
                                { image: 'sampleImage.jpg',

                                    width: 80, height: 26,

                                },

                                { image: 'sampleImage.jpg',

                                    width: 80, height: 26,
                                    alignment:'right'}
                            ]
                        ]
                    },
                    layout: 'noBorders'
                }



            ]
        },



    content: [
        'First paragraph',
        'Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines'
    ]
}

nbridgemohan avatar Jan 26 '16 18:01 nbridgemohan

You need to add a pageMargins and adjust the second parameter to your header size.

var dd = {

        pageSize: 'LEGAL',
        pageOrientation: 'landscape',

        header: {
            margin: 8,
            columns: [
                {

                    table: {
                        widths: [ '50%','50%'],

                        body: [
                            [
                                { image: 'sampleImage.jpg',

                                    width: 80, height: 60,

                                },

                                { image: 'sampleImage.jpg',

                                    width: 80, height: 60,
                                    alignment:'right'}
                            ]
                        ]
                    },
                    layout: 'noBorders'
                }

            ]
        },

    content: [
        'First paragraph',
        'Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines'
    ],
    pageMargins: [40, 80, 40, 60]
}

ramonsan avatar Feb 09 '16 07:02 ramonsan

Answered.

liborm85 avatar Apr 02 '17 15:04 liborm85