Wednesday, 24 May 2017

Rendering a user modified page using PhantomJS

My use case is: a user goes onto a webpage and modifies it by either filling in a form, populating the page with data from the database, or dragging around some draggables on the page. He can then download the page he modified as pdf. I was thinking of using PhantomJS to do the conversion from html to pdf.

I understand the basic functionality of PhantomJS and got the basic example working but in all the examples I've seen, either a local file or a url is passed in. Example:

page.open('./test.html', function () { ... }

How would I render the page that is getting modified by a user using PhantomJS? I have 2 ideas:

  1. Have the url change as the user modifies the page, and simply pass in the url. For example, the url contains the position of a draggable div.
  2. Send the modified html to back-end, save it, and run PhantomJS

Do these solutions make sense? I'm hoping there would be a simpler way.



via user3768533

No comments:

Post a Comment