I know you can use window.print() to print the current page... but what I want to know is can I build a document using javascript in order to populate it with data and print it
There are three approaches to printing two of which will work.
Print the entire window: window.print(); will work.
Print only a specific frame: window.parent._frame_id_.print(); will work.
Print a documentFragment will not work (at least in Firefox):
document.createDocumentFragment().print();//undefined