Skip to content

Instantly share code, notes, and snippets.

@REAS
Last active Oct 12, 2018
Embed
What would you like to do?
Create a PDF file and draw to the screen
import processing.pdf.*; // Import PDF code
void setup() {
size(600, 600);
noLoop(); // Run the draw() only once
}
void draw() {
beginRecord(PDF, "line.pdf"); // Start writing to PDF
// START PATTERN
background(255);
strokeWeight(10);
for (int y = 100; y < height; y += 100) {
line(200, y, 400, y); // Draw lines to screen and to PDF
}
// STOP PATTERN
endRecord(); // Stop writing to PDF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment