Pdfmake: About the image position

Created on 27 Apr 2017  路  3Comments  路  Source: bpampuch/pdfmake

Hey, I am using pdfmake to generate all of my pdf files, very good work. But in recent research, I am trying to control the position of the image by x, y dimension. I can do that in pdfkit, but it doesn't work in pdfmake. The example is here.

    { image: 'data:image/png;base64.......', 50, 100, fit:[80,80] }

This is work in pdfkit and move the image to the position I want. But there is an error when I do this in pdfmake. Any good suggestions?

Most helpful comment

Example with absolute position:

var dd = {
    content: [
        {
            image:  'sampleImage.jpg',
            fit: [80,80],
            absolutePosition: {x: 50, y: 100}
        }
    ]
}

All 3 comments

Example with absolute position:

var dd = {
    content: [
        {
            image:  'sampleImage.jpg',
            fit: [80,80],
            absolutePosition: {x: 50, y: 100}
        }
    ]
}

Thank you very much, that's the answer!

I was also trying this for a footer text and it seems that the absolutePosition is relative to the size of your footer space, set from pageMargins: [50, 200, 20, 150]

So the footer has a size of 150, thus x:50 and y:100 will place it at the bottom and has a remaining vertical space of 150-100=50 for your text.

Hopes this helps and is clear enough

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kumarandena picture kumarandena  路  3Comments

jkd003 picture jkd003  路  3Comments

kamilkp picture kamilkp  路  3Comments

stefanmihoc picture stefanmihoc  路  3Comments

imoum007 picture imoum007  路  3Comments