PDF export doesn't work with Hyper framework


#1

Hello,

I recently used Joshua Davis’ fantastic hype framework for a poster design. It worked great, until I decided to export to a pdf as a vector. All I get is an empty pdf with no graphics. Pls help me if there any one out there who also uses this great framework and can get pdf with vectors.

Thank you so much!


Export to PDF will not render vectors
#2

Oh, I just watched Joshua’s videos on Skillshare and he actually shows how to get vectors out, very clearly. Thank you Joshua :slight_smile:

So problem solved, case closed :slight_smile:


Export to PDF will not render vectors
#3

@buraquex that’s great news! Do you mind posting the link to Joshua’s videos for future readers please?


#4

I think that is:


#5

oh yes, this is the one. Close to the last chapters, he shows how to output image and vector files.


#6

@buraquex it sounds like I am having the same problem you were, only I can’t get proper vector output by following Joshua’s process, it renders but only as a pixel based image. I would be super grateful if for any insight as to what I am missing: Export to PDF will not render vectors


#7

Hi @Hub33s, here is how you do it:

  1. First add this line to the beginning of your code: import processing.pdf.*;

  2. Also don’t forget to add the hype framework: import hype.*;

  3. Don’t forget to add this code in setup() function: H.init(this).background(#FFFFFF);

  4. In your draw() function add this code:

void draw() {
  PGraphics tmp = null;

  if (record) {
    tmp = beginRecord(PDF, "render-######.pdf");
  }

  if (tmp == null) {
    H.drawStage();
  } else {
    PGraphics g = tmp;
    boolean uses3D = false;
    float alpha = 1;
    H.stage().paintAll(g, uses3D, alpha);
  }

  if (record) {
    endRecord();
    record = false;
  }
}
  1. And finally add this code outside of any other functions:
void keyPressed() {
  if (key == 's') {
    record = true;
    draw();
  }
}

Each time you press ‘s’ key, a new version of the pdf will be saved to where the project is.

Hope this helps!


#8

Thank you, much appreciated.