@martin Generating an HTML / PDF document in app is only recommended if you need to do it offline, otherwise you should generate the HTML / PDF from CloudCode.
The reason for this is the process of dynamically generating HTML / PDF in app is more complicated in app than it is in CloudCode. To do it, you need to make use of our JourneyiFrameClient (aka HTML Bridge)
I will try to give you a sample as soon as I can, but for now please check this post on how to use HTML Bridge and the Journey-iFrame-Client