We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
.PDF question (Read 306 times)
.PDF question
Aug 18th, 2009, 11:32am
 
Hello,

As a follow up to my last post, I'm also having problems with the .PDF library. This time, I can't even get .PDFs generated and saved in the sketch folder. Can someone tell me what I'm doing wrong? Thanks from a Processing beginner.

import processing.pdf.*;
boolean record;
int frame = 0;


void setup () {
 size (3000,2400);
 smooth ();
 fill (0);
 background (random(210,255));
 frameRate(500);
}

void draw () {
  if (record) {
   beginRecord(PDF, "frame-####.pdf");
 }

strokeWeight (random (.05,.2));
 println(frameCount);
 line (10, random (10,2990), 2990, random (10,2990));
 }
 if (frameCount>=10000) {
   stroke (255,0,0);
   }
 if (frameCount>=20000) {
   stroke (255,255,255);
}
if (frameCount>=30000) {
 stroke (250,255,0);
}
if (record) {
   endRecord();
     record = false;
 }
}
 
void mousePressed() {
 record = true;
}
Re: .PDF question
Reply #1 - Aug 18th, 2009, 11:59am
 
There is a right bracket after the line(...) statement. It should be at the end of the code.

It runs well otherwise : I got a PDF with one grey line on the page. But I guess you want all the generated lines onto the PDF file : you should start recording at the beginning of the sketch (just before the background() call in setup) if this is what you expect.

Tip: Please use the editor's formatting tools when you post some code, it's easier to read (the # icon is for code).
Page Index Toggle Pages: 1