# Export SVG problems

**URL:** <https://discourse.processing.org/t/export-svg-problems/14796>\
**Category:** Coding Questions\
**Created:** [October 19, 2019, 10:57am UTC](https://discourse.processing.org/t/export-svg-problems/14796 "2019-10-19T10:57:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Malvan](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@Malvan](https://discourse.processing.org/u/Malvan)\
**Post date:** [October 19, 2019, 10:57am UTC](https://discourse.processing.org/t/export-svg-problems/14796/1 "2019-10-19T10:57:44Z")

</div>

Hello there! I’m trying to export a frame from an animation from processing with .svg format, because i need that frame in a vector graphic format (because i’d like to print it), but so far i couldnt do it. Every time i try to save it, it only saves the svg as a blank white background.

Do any of you guys knows any sort of solution regarding this code?

```auto
import processing.svg.*;

boolean record;

PFont font;
PGraphics pg;

void setup() {
  font = createFont("RobotoMono-Regular.ttf", 600);
  size(800, 800, P2D);
  pg = createGraphics(800, 800, P2D);
   

}

void draw() {
  background(0);

 if (record) {
    beginRaw(SVG, "output.svg");
  }

  // PGraphics 

  pg.beginDraw();
  pg.background(0);
  pg.fill(255);
  pg.textFont(font);
  pg.textSize(800);
  pg.pushMatrix();
  pg.translate(width/2, height/2-215);
  pg.textAlign(CENTER, CENTER);
  pg.text("z", 0, 0);
  pg.popMatrix();
  pg.endDraw();

  int tilesX = 16;
  int tilesY = 16;

  int tileW = int(width/tilesX);
  int tileH = int(height/tilesY);

  for (int y = 0; y < tilesY; y++) {
    for (int x = 0; x < tilesX; x++) {

      // WARP
      int wave = int(sin(frameCount * 0.05 + ( x * y ) * 0.07) * 100);

      // SOURCE
      int sx = x*tileW + wave;
      int sy = y*tileH;
      int sw = tileW;
      int sh = tileH;

      // DESTINATION
      int dx = x*tileW;
      int dy = y*tileH;
      int dw = tileW;
      int dh = tileH;
      
      copy(pg, sx, sy, sw, sh, dx, dy, dw, dh);
      endRecord();

    }
  }
    if (record) {
    endRaw();
    record = false;
  }
}

// Hit 'r' to record a single frame
void keyPressed() {
  if (key == 'r') {
    record = true;
  }
}

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [October 19, 2019, 11:44am UTC](https://discourse.processing.org/t/export-svg-problems/14796/2 "2019-10-19T11:44:53Z")

</div>

did you try from  
[https://processing.org/reference/libraries/svg/index.html](https://processing.org/reference/libraries/svg/index.html)

```auto
import processing.svg.*;

PGraphics svg = createGraphics(300, 300, SVG, "output.svg");

```

* * *

because you create a image on P2D, that would not show up anything in SVG

while with the normal save(outfile);  
you could use

```auto
  pg.save(outfile);

```

that not works with SVG lib??

* * *

other problem:

```auto
copy(pg, sx, sy, sw, sh, dx, dy, dw, dh);

```

is a pixel thing, does not work for SVG

* * *

try all without your pg.  
ended at [r] with error

```auto

texture() is not available with this renderer.
vertex(x, y, u, v) is not available with this renderer.

```

so possibly font problems too
