Rendering HTML+Javascript server-side

前端 未结 4 554
礼貌的吻别
礼貌的吻别 2020-12-09 23:12

I need to render an HTML page server-side and \"extract\" the raw bytes of a canvas element so I can save it to a PNG. Problem is, the canvas element is created from javascr

相关标签:
4条回答
  • 2020-12-09 23:27

    Basically you are trying to do things, which are not intended to be done in that way.

    You generate HTML + Javascript to enable the browser to draw it. You write C# to enable any kind of server side things.

    Generating HTML + Javascript on server to load it into a browser on server to be able to save PNG sounds bad.

    Did you think about other approaches like generating the image using server side C# component? Basically, why do you really need to save it on server? Maybe somebody can provide better solution?

    0 讨论(0)
  • 2020-12-09 23:35

    See Generating HTML Canvas image data server-side? for a PhantomJs solution (similar to Node.js, but different, single file, no install)

    0 讨论(0)
  • 2020-12-09 23:36

    I found Awesomium Does exactly what I need! "Windowless web-browser framework". Brilliant.

    0 讨论(0)
  • 2020-12-09 23:39

    You can consider using Watin. Generate your page then use Watin api to capture the generated page.

    http://fwdnug.com/blogs/ddodgen/archive/2008/06/19/watin-api-capturewebpagetofile.aspx

    0 讨论(0)
提交回复
热议问题