pdf -Template for custom module with related module


I have created 2 new custom modules A and B. A has a 1:m relationship to B, so I can assign many Bs to one A Module.

How Can I get the PDF-Templates working that the fields from Module B can be selected when I create a template for Module A.

Any Ideas?

regards Robert