I'm working actually on a project of a CrafToys generator on Processing. Like my old project "Pince Vocale"
to produce some paper avatar, ready to manifest their opinion like this small Eniarofer with eniarof placards
I would like to print automatically the template in the Processing application. After some research on internet I've found my treasure, some function in the library java.awt.print
----------------------------------------------
a small function below, just for print the screen :
void printscreen()
{
try {
java.awt.print.PrinterJob pjob = java.awt.print.PrinterJob.getPrinterJob();
pjob.setJobName("monvisuel");
pjob.setCopies(1);
pjob.setPrintable(new java.awt.print.Printable() {
public int print(Graphics pg, java.awt.print.PageFormat pf, int pageNum) {
if (pageNum > 0)
return java.awt.print.Printable.NO_SUCH_PAGE;
superPaint(pg);
return java.awt.print.Printable.PAGE_EXISTS;
}
});
// comment the 2 line to avoid printer dialog box
if (pjob.printDialog() == false)
return;
pjob.print();
} catch (java.awt.print.PrinterException pe) {
}
}
void superPaint(Graphics g) {
super.paint(g);
}
----------------------------------------------
SOME good links about Papertoys :
papercritters
ShinTanaka Website
the big 3D papermodel website
6/28/2008
Inscription à :
Articles (Atom)