dongshang5862
dongshang5862
2013-10-26 07:19
浏览 61

如何在Canvas上拖放图像/文本并将画布保存为HTML?

How can I show Html/pdf on page(Using Canvas) and add images and text by dragging and dropping them and save Canvas as html ? I have tried jQuery UI for drag and drop images and text but it's not up to mark. Can I load html into canvas and perform the drag and drop on canvas?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongmi0760
    dongmi0760 2013-10-26 16:38
    已采纳

    No, you can't load actual html into canvas itself (largely for security reasons).

    This canvas library does a fairly good job of "faking it":

    http://html2canvas.hertzen.com/

    But with a little learning, you may find that canvas itself has all the formatting/drawing capabilities you need.

    • Drawing basic elements: lines, rectangles, arcs, images
    • Drawing text including fonts and font sizes
    • Drawing custom paths
    • Drawing effects: opacity, shadowing, compositing (blending), clipping
    • Strokes, fills (including gradients), patterns
    • Transforms: move, rotate, scale, skew

    And you can tie into window events (mouse, touch, requestAnimationFrame, etc) to get more:

    • Drag/Drop
    • Animations
    • Transitions
    • Spriting
    • Capture & Alter video streams
    点赞 评论

相关推荐