I am developing an android app that converts details entered in the app to pdf using pdf-make plugin using cordova ionic lab. I am getting the following error while clicking the create button
Unrecognized document structure: {"style":"subheader","alignment":"right","_margin":[0,20,0,5]}
json code is
var dd = {
content: [
{ image: invoice.AddressTo.icon, style: 'subheader', alignment:'right'},
{ text: 'Service Order:' + invoice.AddressFrom.ServiceOrder, style: 'header', alignment: 'center' },
{ text: 'Customer Name:' + invoice.AddressFrom.CustomerName + ' '
+ 'Asset:' + invoice.AddressFrom.Asset },
{ text: 'Address:' + invoice.AddressFrom.Address },
{ text: ' '},
{
table:
{widths: ['*', '*', '*'],
body: [
[{text: 'Service Item'},{text: 'Status'},{text: 'Remarks'},],
[{text: invoice.AddressTo.s}, {text: invoice.AddressTo.c}, {text: invoice.AddressTo.r1},],
[{text: invoice.AddressTo.s2}, {text: invoice.AddressTo.c2}, {text: invoice.AddressTo.r2},],
[{text: invoice.AddressTo.s3}, {text: invoice.AddressTo.c3}, {text: invoice.AddressTo.r3},],
[{text: invoice.AddressTo.s4}, {text: invoice.AddressTo.c4}, {text: invoice.AddressTo.r4},],
[{text: invoice.AddressTo.s5}, {text: invoice.AddressTo.c5}, {text: invoice.AddressTo.r5},],
[{text: invoice.AddressTo.s6}, {text: invoice.AddressTo.c6}, {text: invoice.AddressTo.r6},],
]
}
// {
// body:[ [{text: 'Service Item' + ' '
// +'Status' + ' '
// + 'Remarks', style: 'subheader'}]]
},
{text:' '},
{text:' '},
{text:' '},
{text:' '},
{ text: 'Customer Feedback:' + invoice.AddressTo.CF, alignment: 'left' },
{text:'Customer Signature: ', style: 'subheader'},
{image: invoice.AddressTo.signc},
// { text: 'Engineer\'s Signature:'},
{text:'Engineer Signature: ', style: 'subheader'},
{image: invoice.AddressTo.signe},
// { text: 'Engineer\'s Signature:' + invoice.AddressTo.ES, alignment: 'left' },
{ text: 'Date:' + invoice.Date, alignment: 'right' },
],
styles: {
header: {
fontSize: 20,
bold: true,
margin: [0, 0, 0, 10],
alignment: 'right'
},
subheader: {
fontSize: 16,
bold: true,
margin: [0, 20, 0, 5]
},
itemsTable: {
margin: [0, 0, 0, 0]
},
itemsTableHeader: {
bold: true,
fontSize: 13,
color: 'black',
},
totalsTable: {
bold: true,
margin: [0, 0, 0, 0]
}
},
defaultStyle: {
}
}
return dd;
What is the problem with this json? I got the output ie, pdf file when clicking twice on that button. I think the error is happening at
content: [
{ image: invoice.AddressTo.icon, style: 'subheader', alignment:'right'},
What am I missing? Please help...
Hi I also had that problem,I guess it is because of Character encoding,try removing address from your document and see if it works.I solved that problem by removing address because it was saved in my db in cyrilic encoding.
Best regards