<I’m an art student that got a Processing project in three stages for my Digital Art Class. No a programmer by myself.
I ended up making a humble but nice autogerenating art code. What i need for the instalation is Processing taking a screenshot and deliver it straight to printing, not even going through the printer setup part.
I keep googling and googling and can’t find an answer for that.
It’s possible to get a brief explanation/code guide for how can i achieve it?
Well, thanks for taking your time. The deal is, there is no filename, there should be only clipboard data.
What a i need is directly print what’s on screen by using keyPressed or mousePressed.
With this technique, if you don’t want to save the image then you would have to print it and then delete the file with a delay() in between.
void mousePressed() {
String mySaveStr = "/Users/xxxxxx/Desktop/image2.png";
save(mySaveStr);
exec("lp", mySaveStr);
println("Image sent to printer.");
delay(1000);
File imgFile = new File(mySaveStr);
if (imgFile.exists()) {
imgFile.delete();
println("imgFile deleted.");
}
}
There are other ways of printing image files using Java, but they are more complex and you would have to do your drawing on one of their controls, for example, a JPanel.
Thanks a lot, man. I can work with this.
If i crack exactly what i mean for this installations, i’ll share the code for anyone who wants something like that.