I'm using pdfmake. I'm trying to figure out how to add image to the end of text line instead of the new line. For example:
var dd = {
content: [
'Test text',
{image: 'sampleImage.jpg', width: 24, height: 24}
]
}
Using this description pdfmake generates PDF where first line is 'Test text', and second contains image. I need that text and image would be in single line like 'Test text [image]'.
Has anyone done this before?
I would like to get some advice on how to do it. Thanks.
I'm using pdfmake. I'm trying to figure out how to add image to the end of text line instead of the new line. For example:
var dd = {
content: [
'Test text',
{image: 'sampleImage.jpg', width: 24, height: 24}
]
}
Using this description pdfmake generates PDF where first line is 'Test text', and second contains image. I need that text and image would be in single line like 'Test text [image]'.
Has anyone done this before?
I would like to get some advice on how to do it. Thanks.
Share Improve this question edited Aug 29, 2016 at 8:40 Sumit patel 3,90311 gold badges37 silver badges65 bronze badges asked Aug 29, 2016 at 8:20 Justinas BardauskasJustinas Bardauskas 311 silver badge3 bronze badges2 Answers
Reset to default 5Use columns
var dd = {
content: [
{
columns: [
{
width: 'auto',
text: 'Test text'
},
{
width: '*',
image: 'sampleImage.jpg',
width: 24,
height: 24
}
]
}
]
}
If you want the image to be inline with your Multiline text you can use columns + stack
Example:
columns: [
{
image: "URL",
height: 150,
width: 180
},
{
stack: [
{
columns: [
{
text: 'First column first line',
width: '35%'
},
{
text: 'Second column first line',
width: '35%'
},
{
text: 'Third column first line',
width: '30%'
}
]
},
{
columns: [
{
text: 'First column second line',
width: '35%'
},
{
text: 'Second column second line',
width: '35%'
},
{
text: 'Third column second line',
width: '30%'
}
]
}
],
width: '*'
}]