bpampuch / pdfmake

Client/server side PDF printing in pure JavaScript
http://pdfmake.org
Other
11.7k stars 2.04k forks source link

Multiple references to same object are ignored #465

Open seurimas opened 8 years ago

seurimas commented 8 years ago

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.

tom-on-the-internet commented 8 years ago

Same issue here. It makes dynamic creation more complicated.

ljack commented 8 years ago

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?

ninfaj commented 8 years ago

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

BeatriceThalo commented 6 years ago

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