TUTORIAL QUICK LINKS


How to Save as PDF

Processing provides a library, processing.pdf.* to write PDF files directly from Processing. The vector-based PDF can be scaled to any size and output at very high resolutions. It provides open possibilities for graphic designers, who need high-resolution images for print-based publication design.
The screen size function variable is relatively small, size(200,200), because graphic designers do not need to create a large size screen, such as size(1500,1500), because the small size can easily be converted into a PDF and scaled up and down without losing image quality. Increasing the screen size will only cause an unnecessarily longer running time in Processing and will not benefit the recorded PDF file.

//import PDF library
import processing.pdf.*;

void setup() {

//size has to be placed always at the beginning

size(200, 200);

//start record after size

beginRecord(PDF, "image.pdf");

//create your design

endRecord();
//end record

}

For more information: the book, TYPE+CODE Processing for Graphic designers.