How to print file from Processing, USB printer


I’m making my new project as student.
it works vary simple process.
1_click the button that showed on screen, and 2_print image from printer that connected with computer via usb.
the image is pdf file. and i use my labtop window 10 and peripage A6 mini print.
mini print’s working process is same with other printer, open file and click ctrl+P.

I read some information that said it could possible.
but I can’t find sepecific code about print file from processing, so i need your help.

sorry my english is not perfect, I hope you understand.
thank you!

As far as I am aware, there is no simple Processing call to send a document to a printer. It is likely that you will need java code for this. Look in java docs for documentation on Printable (it’s in java.awt.print).

Another technique uses DocFlavor found in javax.print. On macos DocFlavor.INPUT_STREAM.PDF seems to work ok. Could use DocFlavor.INPUT_STREAM.GIF if you have some other operating system and .PDF doesn’t work.