Welcome, Guest
  • Author Topic: Print! - please help, I need to print my TextArea text but can't :-(  (Read 1070 times)

    Pluda

    • Senior Programmer
    • ****
    • Posts: 270
      • View Profile
    Hello,

    I'm trying to make one text editor to use as my default organizer.

    Everithing works except the print function.

    I need to be able to print his text in 1 or more pages, but this just doesn't work.

    I was searching the net, found one example using one datagrid, but whith TextArea doesn't work.

    Can you point me to the solution of this?

    Many thanks in advance!

    Pluda

    vesa kortelainen

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 3450
      • View Profile
    what kind of code you use?

    Pluda

    • Senior Programmer
    • ****
    • Posts: 270
      • View Profile
    Hello, thanks for reply :-)

    Well, what I'm trying to do is:

    Have one movieclip whith some input fields like Name, Telephone, Email and one TextArea or if best another inputfield (multiline in this case) where I can write what I need.

    Then, using the code I'm posting (not that one, he doesn't work :-) ), I want to print the first textfields and all the content of the TextArea. But the TextArea must be splited in several pages, depending of the amount of text he has.

    This is my not working code

    _root.folha.imprimir.onPress = function() {

    //  texto_orc is the instance name of the TextArea, who is inside movieclip _root.folha

          _root.folha.texto_orc.setSize(285, r.folha.texto_orc.maxVPosition*12);
          trace(_root.folha.texto_orc.maxVPosition*12+(212.5));
       };
       //
       _root.folha.imprimir.onRelease = function() {
          var print_:PrintJob = new PrintJob();

    // Here I'm trying to define the number of pages I need, folowing this think

    // var paginas:Number = (_root.folha.texto_orc.maxVPosition*12+(212.5)/593);

    // I'm trying to know how many lines the TextArea has, then multipling it for 12 pixel (8 for each line of text plus 4 for leading), // + 212.5 whitch is the space I need to print all the other textfields  / 593 (the page size)

          var paginas:Number = (_root.folha.texto_orc.maxVPosition*12+(212.5)/593);
          trace(paginas);
          for (var i = 0; i<paginas; i++) {
             if (print_.start()) {
                if (print_.addPage(paginas, {xMin:0, xMax:419, yMin:0, yMax:593}, null, 1)) {
                }
             }
          }
          if (paginas>0) {
             print_.send();
          }
          delete print_;
       };