# Hi-Res PDF Image Does Not Reflect Canvas Drawing

**URL:** <https://discourse.processing.org/t/hi-res-pdf-image-does-not-reflect-canvas-drawing/20215>\
**Category:** Coding Questions\
**Created:** [April 27, 2020, 11:57pm UTC](https://discourse.processing.org/t/hi-res-pdf-image-does-not-reflect-canvas-drawing/20215 "2020-04-27T23:57:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [April 27, 2020, 11:57pm UTC](https://discourse.processing.org/t/hi-res-pdf-image-does-not-reflect-canvas-drawing/20215/1 "2020-04-27T23:57:28Z")

</div>

Hello Forum,

I am working with one of the examples from the `[Generative Design book](// http://www.generative-gestaltung.de)` and I am trying to make a super hi-res image of the drawings I do. But, the PDF lines are never as delicate as they are in the design window. Does anyone know how to fix this? Thanks in advance for your suggestions. 🙂

```auto
import processing.pdf.*;
import java.util.Calendar;

boolean recordPDF = false;

ArrayList history = new ArrayList();
float dist = 80;

 
void setup() {
  size(1000,700);
  background(255);
  stroke(0, 150);
  strokeWeight(.01);
  noFill();
}
void draw() {
}

void mouseDragged() {
 
  PVector d = new PVector(mouseX, mouseY, 0);
  history.add(0, d); 
  for (int p=0; p<history.size (); p++) {
    PVector v = (PVector) history.get(p);
    float join = p/history.size() + d.dist(v)/dist;
    if (join < random(0.9) && mouseButton == LEFT) {  
      line(d.x, d.y, v.x, v.y);
    }  
  }
}
 
void keyPressed() {
  if (key == 'x') {
    background(255);
    history.clear();
  }
  // ------ pdf export ------
  // press 'r' to start pdf recordPDF and 'e' to stop it
  // ONLY by pressing 'e' the pdf is saved to disk!
  if (key =='r' || key =='R') {
    if (recordPDF == false) {
      beginRecord(PDF, timestamp()+"_.pdf");
      println("recording started");
      recordPDF = true;
    }
  } 
  else if (key == 'e' || key =='E') {
    if (recordPDF) {
      println("recording stopped");
      endRecord();
      recordPDF = false;
      background(255); 
    }
  } 
}

// timestamp
String timestamp() {
  Calendar now = Calendar.getInstance();
  return String.format("%1$ty%1$tm%1$td_%1$tH%1$tM%1$tS", now);
}

```

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [April 28, 2020, 12:18am UTC](https://discourse.processing.org/t/hi-res-pdf-image-does-not-reflect-canvas-drawing/20215/2 "2020-04-28T00:18:25Z")

</div>

Have u tried zooming in? I don’t know the mechanics behind the pdf library but it seems that all the lines are drawn as vectors (meaning they should scale nicely to whatever resolution you’re using)

---

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [April 28, 2020, 12:33am UTC](https://discourse.processing.org/t/hi-res-pdf-image-does-not-reflect-canvas-drawing/20215/3 "2020-04-28T00:33:58Z")

</div>

Hi Tony,

Thanks for writing back. The links are clean but super thick.

Here’s the canvas:

 ![Screen Shot 2020-04-27 at 5.30.28 PM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b501d6554dd1b5be1e1b4d970d4f3ff65162e25d.png)

Here’s the PDF

 ![Screen Shot 2020-04-27 at 5.32.00 PM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1b3102e99e7f88053c8fcf4466e39cd9e14756d8.png)

It seems like there are extra layers to me…

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [April 28, 2020, 3:32am UTC](https://discourse.processing.org/t/hi-res-pdf-image-does-not-reflect-canvas-drawing/20215/4 "2020-04-28T03:32:18Z")

</div>

Interesting problem.

Do you need it to be a pdf? If you’re fine with just a screengrab, maybe save the raw canvas with save()?

If you’re set on a pdf, you might try messing around with the stroke() and strokewidth() in setup?

---

<div class="post-metadata">

**Author:** ![mnoble](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnoble/32/99_2.png) [@mnoble](https://discourse.processing.org/u/mnoble)\
**Post date:** [May 3, 2020, 6:50pm UTC](https://discourse.processing.org/t/hi-res-pdf-image-does-not-reflect-canvas-drawing/20215/5 "2020-05-03T18:50:52Z")

</div>

Hello Tony and Forum,

So, I basically went through every version of PDF making here:  
[https://processing.org/reference/libraries/pdf/index.html](https://processing.org/reference/libraries/pdf/index.html)

And, " **Single Frame (No Screen Display)**" produced the best results.
