# SVG Export in one file

**URL:** https://discourse.processing.org/t/svg-export-in-one-file/26022
**Category:** Coding Questions
**Created:** [December 7, 2020, 9:25pm UTC](https://discourse.processing.org/t/svg-export-in-one-file/26022 "2020-12-07T21:25:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Dimdimtri](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Dimdimtri](https://discourse.processing.org/u/Dimdimtri)
#### Post date: [December 7, 2020, 9:25pm UTC](https://discourse.processing.org/t/svg-export-in-one-file/26022/1 "2020-12-07T21:25:50Z")

</div>

Hello hello everyone, I used to export my svg with processing, but this time I can’t export a single svg with all the designs. Let me explain. Either it exports the first drawing, or it exports a file for each Frame. I would like it to export a single svg file with all the designs.

Thanks in advance for your help or advice 🙂

```auto
import processing.svg.*;

float a, b, a1, b1, c, d, c1, d1;

float x; 

int y = 15;

/* 
Enregistrement du temps 
*/

int savedTime; 
int totalTime = 500;

void setup() {
  
  size(1280, 800);
  

  background(255);
  frameRate(1);
  
  savedTime = millis();
  

  a = random(x);
  b = random(x);
  a1 = random(x);
  b1 = random(x);
  

    
}

void draw() {
   

 

  
  
  x = width/y;
  

   // Calculate how much time has passed
  int passedTime = millis() - savedTime;
  

 
  

  // Has five seconds passed?

  for (int i = 1; i < (x*y); i = i+1) {

    
    if (passedTime > i*totalTime) {  
      
      translate(x, 0);
      
      
      
    }
  }

  for (int i = y; i < (x*y); i = i+y) {

    if (passedTime > i*totalTime) {  
      translate(-(x*y), x);
    }
  }

  if (passedTime > ((height/x)*y)*totalTime) {    
    
   
    
    noLoop();
   
    
  }
  

  

  // Get the end point

  c = random(x);
  d = random(x);
  c1 = random(x);
  d1 = random(x);

  
  strokeWeight(1);
  // Draw the line
  line(a, b, a1, b1);
  line(a, b, c, d);
  line(c, d, c1, d1);
  line(a1, b1, c1, d1);

  strokeWeight(8);
  point(a, b);
  point(a1, b1);
  point(c, d);
  point(c1, d1);

  // Set the end point as the new start point for the next loop
  
  a = c;
  b = d;
  a1 = c1;
  b1 = d1;
  

  
  println(frameCount);
  
  
}

```

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [December 8, 2020, 12:33am UTC](https://discourse.processing.org/t/svg-export-in-one-file/26022/2 "2020-12-08T00:33:16Z")

</div>

Hi @Dimdimtri,

I suppose that when you call the `noLoop()` function, you want your program to stop and save your SVG file.

Use [`beginRecord()`](https://processing.org/reference/libraries/svg/index.html) and `endRecord()` functions to save your svg :

```auto
void setup() {
  // Begin the record of the SVG
  beginRecord(SVG, "file.svg");
}

void draw() {
  // You draw here...

  // When you finished to draw
  if (passedTime > ((height/x)*y)*totalTime) {    
    noLoop();
    endRecord(); // End the SVG drawing
  }
}

```

---

<div class="post-metadata">

### Author: ![Dimdimtri](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Dimdimtri](https://discourse.processing.org/u/Dimdimtri)
#### Post date: [December 8, 2020, 10:16am UTC](https://discourse.processing.org/t/svg-export-in-one-file/26022/3 "2020-12-08T10:16:08Z")

</div>

Thank you for your answer, I also thought about doing it like that but I don’t know why he gives me a blank page. 😬

If the position changes and I put in void draw … it only gives me a random drawing.
