Print n subdocument

my requirements is to print n copies of a subdocument related to the same document.
More in details, I want to print a proforma invoice as a subdocument of delivery note, and when I print a delivery note I want to print n copies of the proforma invoice (where n is a parameter from dynamic).
Can anyone help me to understand how to do?