Last active
October 12, 2018 23:43
-
-
Save REAS/32ec9ad511dbbce67de75204c997c7fc to your computer and use it in GitHub Desktop.
Create a PDF file and draw to the screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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