Hi All Sorry if my question is not up to the mark I am new to StackOverflow I am trying to generate a custom object of arrays from an array of objects. I am using map function to loop over the existing array of object
Current Array of object looks like
const serials = [{serial:'ikhlaq'},{serial:'dayim'},{serial:'ikhlaq'},{serial:'dayim'},{serial:'ikhlaq'},{serial:'dayim'},{serial:'ikhlaq'},{serial:'dayim'},{serial:'ikhlaq'},{serial:'dayim'},{serial:'ikhlaq'},{serial:'dayim'},{serial:'ikhlaq'},{serial:'dayim'},{serial:'ikhlaq'},{serial:'dayim'},]
And the result should be like this
{
columns: [
{qr:"ikhlaq",},
{ qr:"dayim",},
{qr:"ikhlaq",},
{qr:"dayim",}
]
},
{
columns: [
{text: " ",},
]
},
{
columns: [
{qr:"ikhlaq",},
{ qr:"dayim",},
{qr:"ikhlaq",},
{qr:"dayim",}
]
},
{
columns: [
{text: " ",},
]
},
{
columns: [
{qr:"ikhlaq",},
{qr:"dayim",},
{qr:"ikhlaq",},
{qr:"dayim",}
]
}
This is my current Approach
serials.map((serial,index)=>{
if(index % 4 == 0){
columns.push ({columns: [{text:serial.serial}]})
}
columns.push ({columns : [{qr:serial.serial}]})
})
My real problem is I am trying to make pdf of QR code but it goes off-screen when I align then horizontally but if I can get an array as in the result I can solve my challenge
Thank You
This is how it looks on the desired array Qr code from result array of objects