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
Print() is a method on the window object. If you create a document in a window using javascript, then call print on that window object, it should work.
Example modified from w3schools.com window open example.