The task is not easy, as I need to create a PDF version of a page after clicking a button. It has a complicated dom structure, with many elements positioned absolutely/relatively, and the data is dynamically loaded. I thought about using Phantom.js server for this task, as it enables generating PDF's but this introduces some problems ;
- phantomjs can be either run from a console (which is not possible here as generating PDF's must be available on both UNIX and WIN systems and only shell scripts can be run from the page) or using it's built in server
- server has a different domain as the server running the page, so same origin policy problems apear. I was thinking about using iframe with phantomjs server address as the src and my page html passed in arguments, but the arguments are too long and return 413 error. JSONP won't work, as it was built for GET requests and the same problem with too long arguments appears.
I also thought about generating it client-side but because of the complexity of the site it would probably take me many days to get proper representation of the page (as all the positioning values need to be recalculated to pts), and it has to be a generic solution.
Any other ideas how to solve this ?