PDF Export on mousePressed?
in
Core Library Questions
•
7 months ago
Hi, I'm new to Processing and programing in general. My apologies if this has been addressed elsewhere, but I couldn't find what I needed in the reference or other forums. I have a basic program that is structured like this:
- void setup () {
- // set size/background
- }
- void draw () {
- // draw random shapes
- noLoop ();
- }
- void mousePressed() {
- saveFrame ("rs-###.jpg");
- }
- void keyPressed() {
- setup();
- redraw();
- }
What I'd like to do now is get a PDF in place of a JPEG when I click the mouse. But all I can figure out is this:
- import processing.pdf.*;
- void setup () {
- // set size/background
- beginRecord(PDF, "rs-###.pdf");
- }
- void draw () {
- // draw random shapes
- noLoop ();
- endRecord();
- }
- void mousePressed() {
- saveFrame ("rs-###.jpg");
- }
- void keyPressed() {
- setup();
- redraw();
- }
Thanks,
Jeff
1