--

View All Messages /
Post a new message / Reply to this message


Subject8. PDF Export Example 1 : PDF_Export_FRAME
FromDavid

--

Hello Everyone,

As promised, I have prepared examples to use directly for PDF export. There are three examples that I have made and commented. These all use th PDF Export library which is standard in Processing.

This first Example is the simplest and exports ONE FRAME of drawing to ONE PDF when it is run. This must be run locally in order to work. Therefore, copy and paste the code below into your Processing application and save it with the name PDF_Export_FRAME.

David

--

// PDF_Export_FRAME

// EXAMPLE 1, OUTPUT 1 FRAME TO PDF FILE.
// CREATED FOR PROCESSINGPROCESSING, SPRING 2007.

// THIS IS A SIMPLE EXAMPLE USING THE PDF EXPORT LIBRARY
// THE PROGRAM WILL RUN THROUGH THE DRAW LOOP ONE TIME AND
// THEN WRITE WHATEVER IS DRAWN INTO A FILE NAMED FRAME.pdf

// THE RESULTING FILE CAN BE FOUND WITHIN THE SKETCH FOLDER.
// THE SKETCH FOLDER CAN BE LOCATED BY USING THE COMMAND
// UNDER SKETCH: SHOW SKETCH FOLDER.

// THIS IS REQUIRED TO LOAD THE PDFEXPORT LIBRARY
import processing.pdf.*;

void setup() {
size(400, 400, PDF, "FRAME.pdf");
}


void draw() {

// DRAW A LINE WITH RANDOM COORDINATES, FOR EXAMPLE
// YOU COULD DRAW ANYTHING ELSE THAT YOU WANT INSTEAD.
line(random(400), random(400), random(400), random(400));

// NOW EXIT THE PROGRAM AND WRITE FINISHED.
// SIMPLE!
println("finished.");
exit();
}




--

Information

CURRENTLY 080910 04:54:36