Pdfmake: Multiple references to same object are ignored

Created on 16 Dec 2015  路  4Comments  路  Source: bpampuch/pdfmake

Try this with the playground: http://bpampuch.github.io/pdfmake/playground.html

var text = {text: "This is a test"};
var text2 = {text: "This is also a test"};
var dd = {content: [text, text, text2, text2]};

Notice that the second instance of each text node are not present in the document's rendering.

bug feature request

Most helpful comment

Pass myArray.slice(0) or JSON.parse(JSON.stringify(myObject))

All 4 comments

Same issue here. It makes dynamic creation more complicated.

I noticed that pdfmake alters the variables it gets when calculating things. Maybe this causes it not to work?
If you always create a copy of an object, does that work?

I have the same problem.
@bpampuch do you have an idea for a fix or a workaround?

Pass myArray.slice(0) or JSON.parse(JSON.stringify(myObject))

Was this page helpful?
0 / 5 - 0 ratings