# Displaying, exporting generated svgs

**URL:** https://discourse.processing.org/t/displaying-exporting-generated-svgs/35015
**Category:** Coding Questions
**Created:** [February 7, 2022, 4:21am UTC](https://discourse.processing.org/t/displaying-exporting-generated-svgs/35015 "2022-02-07T04:21:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bcabc](https://avatars.discourse-cdn.com/v4/letter/b/6a8cbe/32.png) [@bcabc](https://discourse.processing.org/u/bcabc)
#### Post date: [February 7, 2022, 4:21am UTC](https://discourse.processing.org/t/displaying-exporting-generated-svgs/35015/1 "2022-02-07T04:21:09Z")

</div>

hi there -

i have been through the examples of exporting svgs from processing, at this url:  
[https://processing.org/reference/libraries/svg/index.html](https://processing.org/reference/libraries/svg/index.html)

i am looking for a solution that falls between these examples, though.  
i’d like to use the space bar to generate a new image, display it on the screen, and export it as a file. attached below is the code that i tried to put together. it seems to be allowing new iterations of the image, but it does not seem to update the display. any help would be appreciated. thank you.

```auto
import processing.svg.*;
int horiz = 17;
int vert = 11;
void setup() {
  size(400, 400);
  background(100, 100, 10);
  noLoop();
  drawShapes();

}

void drawShapes() {
  beginRecord(SVG, "filename.svg");
  for (int x=0; x<horiz; x++){
    pushMatrix();
    translate(x*40, 0);
    for (int y=0; y<vert; y++){
          pushMatrix();
          translate(0, y*40);
          fill(color(10, 90, 10));
          circle(0, random(90), random(20));  
          popMatrix();
          };  
          popMatrix();
        }; 

endRecord();
}

void keyReleased() {
  if (key == 32) {
    size(400, 400);
    noLoop();
    background(random(100), random(100), random(100));
    drawShapes();
  }
}

```

---

<div class="post-metadata">

### Author: ![Tinkerer](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tinkerer](https://discourse.processing.org/u/Tinkerer)
#### Post date: [February 7, 2022, 6:22am UTC](https://discourse.processing.org/t/displaying-exporting-generated-svgs/35015/2 "2022-02-07T06:22:10Z")

</div>

hi

you dont have a void draw() section in your code

processing won’t register key presses or code after setup finishes unless you have a draw loop
