/** * Prints the document at its actual size. This is the recommended way to print. */ private static void print(PDDocument document) throws IOException, PrinterException { PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(new PDFPageable(document)); job.print(); }
/** * Prints with a print preview dialog. */ private static void printWithDialog(PDDocument document) throws IOException, PrinterException { PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(new PDFPageable(document)); if (job.printDialog()) { job.print(); } }
/** * Prints using custom PrintRequestAttribute values. */ private static void printWithAttributes(PDDocument document) throws IOException, PrinterException { PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(new PDFPageable(document)); PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet(); attr.add(new PageRanges(1, 1)); // pages 1 to 1 job.print(attr); }
PrinterJob printJob = PrinterJob.getPrinterJob(); printJob.setJobName(new File(pdfFile).getName());
PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(new PDFPageable(document)); PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
throws IOException, PrinterException PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(new PDFPageable(document));
/** * The constructor initializes the pFormat and PJob variables. */ public ChatPrinter() { pFormat = new PageFormat(); pJob = PrinterJob.getPrinterJob(); }
public PrintOp (final PrinterJob printerJob, final PrintRequestAttributeSet attributeSet, final boolean suppressDialog) { this.printerJob = (printerJob != null) ? printerJob : PrinterJob.getPrinterJob(); this.attributeSet = (attributeSet != null) ? attributeSet : new HashPrintRequestAttributeSet(); this.suppressDialog = suppressDialog; }
/** * Posts the Page Setup dialog */ public void doPageSetup() { PrinterJob pjob = PrinterJob.getPrinterJob(); pformat = pjob.pageDialog(pformat); }
/** * Prints using a custom page size and custom margins. */ private static void printWithPaper(PDDocument document) throws IOException, PrinterException { PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(new PDFPageable(document)); // define custom paper Paper paper = new Paper(); paper.setSize(306, 396); // 1/72 inch paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight()); // no margins // custom page format PageFormat pageFormat = new PageFormat(); pageFormat.setPaper(paper); // override the page format Book book = new Book(); // append all pages book.append(new PDFPrintable(document), pageFormat, document.getNumberOfPages()); job.setPageable(book); job.print(); } }
/** * Concerne uniquement le bouton de modification du format de la page. */ public void actionPerformed(final ActionEvent _ae) { final String com = _ae.getActionCommand(); if ("MODIFIER".equals(com)) { pageFormat_ = PrinterJob.getPrinterJob().pageDialog(pageFormat_); majPanelPageFormat(); } }
public void actionPerformed(ActionEvent event) { PrinterJob job = PrinterJob.getPrinterJob(); PageFormat newPageFormat = job.pageDialog(attributes); if (newPageFormat != null) pageFormat = newPageFormat; canvas.repaint(); } });
public void actionPerformed(ActionEvent e) { PrinterJob printJob = PrinterJob.getPrinterJob(); printJob.setPrintable(demo); if (printJob.printDialog()) { try { printJob.print(); } catch (Exception ex) { ex.printStackTrace(); } } } });
public void print() { PrinterJob printJob = PrinterJob.getPrinterJob(); printJob.setPrintable(this); if (printJob.printDialog()) try { printJob.print(); } catch (PrinterException pe) { System.out.println("Error printing: " + pe); } }
public void print() { PrinterJob printJob = PrinterJob.getPrinterJob(); printJob.setPrintable(this); if (printJob.printDialog()) try { printJob.print(); } catch(PrinterException pe) { System.out.println("Error printing: " + pe); } }
/** * Prints the document at its actual size. This is the recommended way to print. */ private static void print(PDDocument document) throws IOException, PrinterException { PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(new PDFPageable(document)); job.print(); }
/** * Prints with a print preview dialog. */ private static void printWithDialog(PDDocument document) throws IOException, PrinterException { PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(new PDFPageable(document)); if (job.printDialog()) { job.print(); } }
public synchronized void performAction() { PrintSettings ps = (PrintSettings) PrintSettings.findObject(PrintSettings.class, true); PrinterJob pj = PrinterJob.getPrinterJob(); ps.setPageFormat(pj.pageDialog(PrintSettings.getPageFormat(pj))); }
void print(ImagePlus imp) { PrinterJob pj = PrinterJob.getPrinterJob(); pj.setPrintable(this); //pj.pageDialog(pj.defaultPage()); if (IJ.macroRunning() || pj.printDialog()) { imp.startTiming(); try {pj.print(); } catch (PrinterException e) { IJ.log(""+e); } } }
void print(ImagePlus imp) { PrinterJob pj = PrinterJob.getPrinterJob(); pj.setPrintable(this); //pj.pageDialog(pj.defaultPage()); if (IJ.macroRunning() || pj.printDialog()) { imp.startTiming(); try {pj.print(); } catch (PrinterException e) { IJ.log(""+e); } } }