Problems Exporting PDF With the Processing.pdf library

edited December 2014 in Library Questions

Hi all, i'm just trying to import the - final image - I get on the sketch, when I try to save it, it just saves the first frame of the sketch, in that case , The letter "N" . The code is the nest one ;+

            import processing.pdf.*;

            void setup(){
              size(450,450);

              beginRecord(PDF,"clarendonstringrandom2.pdf");
             PFont myFont =
              createFont("clarendon-medium",36);
              background(255);
              String st=
              "N A U  3 N A U  3 N A U  3 N A U  3 N A U  3";
              translate(10,40);
              for(int i=0;i<26;i=i+1)


          {
            textFont(myFont,random(170));
            fill(0,0,0);
            text(st.charAt(i),i*15,i*15);
            endRecord();
          }}

I have been trying with the basic tutorial of the library, on "processing.org" with the diferent syntaxes , but I'm not capable of doing a proper export. I'm experimenting with the Typefaces, and all the previous PDF I exported, were with success, showing the last frame in the PDF. But when I use the "String" syntax it just export the first frame. Any suggestions ? Thank you

Comments

  • Put the endRecord() after the for-loop. You are ending the PDF with the first iteration of i.

  • thank you !

    I just changed the endRecord() position to here :

    import processing.pdf.*;
    
    void setup(){
      size(450,450);
    
      beginRecord(PDF,"clarendonstringrandom2.pdf");
     PFont myFont =
      createFont("clarendon-medium",36);
      background(255);
      String st=
      "N A U  3 N A U  3 N A U  3 N A U  3 N A U  3";
      translate(10,40);
    
      for(int i=0;i<26;i=i+1)
    
    
      {
        textFont(myFont,random(170));
        fill(0,0,0);
        text(st.charAt(i),i*15,i*15);
    
      }endRecord();}
    
Sign In or Register to comment.