Search code examples
javascriptangularjspdfmake

magic space between image in pdfMake


When I'm trying to locate images in 2 colomns, I get a space between them.

My docDefinition:

var dd = {
    pageSize: 'A4',
    pageOrientation: 'landscape',
    pageMargins: [ 0, 0, 0, 0 ],
    content: [
        {
            columns: [
                {
                    width: 250,
                    alignment: 'left',
                    image: 'sampleImage.jpg',
                    margin: [0,0,0,0]
                },{
                    width: 250,
                    alignment: 'left',
                    image: 'sampleImage.jpg',
                    margin: [0,0,0,0]
                }
            ]
        },
    ],
    defaultStyle: {
        columnGap: 0,
    }
}; 

Result: result.

The most instesting is result on pdfmake.org/playground. That's OK. result2

What happens and how to fix it?


Solution

  • Well its working fine, with my fiddle also, check this link. Make sure you are using latest version of pdf make, As some bugs was detected in the previous versions of pdfmake, try using this version of pdfmake.

    var dd = {
        pageSize: 'A4',
        pageOrientation: 'landscape',
        pageMargins: [ 0, 0, 0, 0 ],
        content: [
            {
                columns: [
                    {
                        width: 250,
                        alignment: 'left',
                        image: 'sampleImage.jpg',
                        margin: [0,0,0,0]
                    },{
                        width: 250,
                        alignment: 'left',
                        image: 'sampleImage.jpg',
                        margin: [0,0,0,0]
                    }
                ]
            },
        ],
        defaultStyle: {
            columnGap: 0,
        }
    }; 
    

    here is my fiddle:

    http://jsfiddle.net/sorb999/yxjzeuos/1/