Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17

Thread: Text on Canvas

  1. #16
    Regular Coder
    Join Date
    Sep 2011
    Posts
    310
    Thanks
    23
    Thanked 0 Times in 0 Posts
    Oh by the way, y canvas issues have not been solved.

    Anyway, is there a method, where you are writing on a DIV, using document.execcomand, then you press a button it saves the DIV as image? Sadly, document.execommand does not work on canvas. Even you can save Canvas as image, but to write on it now is a pain in the a**.

  2. #17
    Regular Coder
    Join Date
    Sep 2011
    Posts
    310
    Thanks
    23
    Thanked 0 Times in 0 Posts
    HOLY COW AND HOLY DEER! I know what I have to do. Simple lol, I will use Canvas to write. I put a textbox, give the value a variable, then put the variable in canvas and write like a BOSS.

    Example:

    Code:
    <canvas id="canvas" width="200" height="200"></canvas>
    <input type="text" size="25" id="lol"/>
    <input type="button" value="write" onClick="writethecrap();"/>
    Code:
    <script>
    function writethecrap () {
        var canvas = document.getElementById('canvas');
        var context = canvas.getContext('2d');
        var loltext = document.getElementById("lol").value;
        context.fillText(loltext, 20, 10);
    }
    </script>
    Good?
    Last edited by angelali; 11-22-2012 at 03:21 PM.


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •