Editing invoice layout

I would like to edit the invoice layout so each product with an option is printed closer like the packaging slip. At the moment a line is left underneath the product which can be confusing when looking at what the customer has ordered. What file would i need to modify? I would also like to remove the product code whenever an option with a different product code is displayed. Thanks.