import java.awt.print.PrinterAbortException;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import javax.print.CancelablePrintJob;
import javax.print.Doc;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
import javax.print.PrintException;
import javax.print.SimpleDoc;
import javax.print.StreamPrintService;
import javax.print.StreamPrintServiceFactory;
import javax.print.event.PrintJobAdapter;
import javax.print.event.PrintJobEvent;
public class Main {
public static void main(String[] argv) throws Exception {
try {
OutputStream fos = new BufferedOutputStream(new FileOutputStream(
用Java取消打印作业
最新推荐文章于 2024-07-14 03:21:18 发布
该博客演示了如何使用Java的javax.print包来取消打印作业。通过创建StreamPrintService,DocPrintJob对象,并监听PrintJobEvent,实现了在打印过程中取消作业的功能。主要涉及的类包括PrintJobAdapter、PrintJobWatcher、CancelablePrintJob。
摘要由CSDN通过智能技术生成