printServices = PrintServiceLookup.lookupPrintServices(null, printServiceAttributeSet); pageFormat = new PageFormat(); // If you want to adjust heigh and width etc. of your paper. pageFormat = printerjob.defaultPage();
PageFormat pageFormat = new PageFormat(); pageFormat.setOrientation( PageFormat.LANDSCAPE ); pageFormat.setPaper( a4Paper );
/** * The constructor initializes the pFormat and PJob variables. */ public ChatPrinter() { pFormat = new PageFormat(); pJob = PrinterJob.getPrinterJob(); }
/** * Initializes the printing. */ public DocumentPrinting() { m_PrintPane = new JTextPane(); m_PageFormat = new PageFormat(); m_PrinterJob = PrinterJob.getPrinterJob(); }
/** * 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(); } }
/** * Initializes the printing. */ public DocumentPrinting() { m_PrintPane = new JTextPane(); m_PageFormat = new PageFormat(); m_PrinterJob = PrinterJob.getPrinterJob(); }
/** Creates a new instance. */ public DrawingPageable(Drawing drawing) { this.drawing = drawing; Paper paper = new Paper(); pageFormat = new PageFormat(); pageFormat.setPaper(paper); }
/** @deprecated Use {@link #getPageFormat(PrinterJob)} instead. */ public PageFormat getPageFormat() { if (pageFormat == null) { PrinterJob pj = PrinterJob.getPrinterJob(); pageFormat = pj.defaultPage(new PageFormat()); pj.cancel(); } return pageFormat; }
/** @deprecated Use {@link #getPageFormat(PrinterJob)} instead. */ public PageFormat getPageFormat() { if (pageFormat == null) { PrinterJob pj = PrinterJob.getPrinterJob(); pageFormat = pj.defaultPage(new PageFormat()); pj.cancel(); } return pageFormat; }
private PageDefinition createDefaultPageDefinition() { final PageDefinition format; final ExtendedConfiguration config = ClassicEngineBoot.getInstance().getExtendedConfig(); if ( config.getBoolProperty( ClassicEngineCoreModule.NO_PRINTER_AVAILABLE_KEY ) ) { format = new SimplePageDefinition( new PageFormat() ); } else { format = new SimplePageDefinition( PrinterJob.getPrinterJob().defaultPage() ); } return format; }
PageFormat format = new PageFormat(); format.setPaper(paper);
public static PageFormat generatePageformat(Paper paper, Margin margin, Orientation orientation) { PageFormat format = new PageFormat(); format.setPaper(getAwtPaper(paper, margin)); format.setOrientation(getAwtOrientation(orientation)); return format; }
PageFormat pf = new PageFormat(); Paper paper = new Paper(); paper.setSize(width, height); paper.setImageableArea(startX, startY, width, height); pf.setPaper(paper);
/** * 获取打印页样式 * * @return */ public PageFormat getPageFormat() { Paper paper = getPaper(); // 设置成竖打 PageFormat format = new PageFormat(); format.setOrientation(noPrintPager.getOrientation()); format.setPaper(paper); return format; }
protected void setUp() throws Exception { ClassicEngineBoot.getInstance().start(); outputProcessorMetaData = new DebugOutputProcessorMetaData(); pageGrid = new DefaultPageGrid( new SimplePageDefinition( new PageFormat() ) ); }
protected void setUp() throws Exception { ClassicEngineBoot.getInstance().start(); outputProcessorMetaData = new DebugOutputProcessorMetaData(); pageGrid = new DefaultPageGrid( new SimplePageDefinition( new PageFormat() ) ); }
protected void setUp() throws Exception { ClassicEngineBoot.getInstance().start(); outputProcessorMetaData = new DebugOutputProcessorMetaData(); pageGrid = new DefaultPageGrid( new SimplePageDefinition( new PageFormat() ) ); }
protected void setUp() throws Exception { ClassicEngineBoot.getInstance().start(); outputProcessorMetaData = new DebugOutputProcessorMetaData(); pageGrid = new DefaultPageGrid( new SimplePageDefinition( new PageFormat() ) ); }
PageFormat format = new PageFormat(); format.setOrientation(PageFormat.REVERSE_LANDSCAPE); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(OrientationRequested.REVERSE_LANDSCAPE); aset.add(MediaSizeName.JAPANESE_POSTCARD); PrinterJob printerJob = PrinterJob.getPrinterJob(); printerJob.setPrintable(new ImagePrintable(sap.getGraphicImage())); printerJob.defaultPage(format); printerJob.print(aset);
/** * Construit un format de page correspondant a une feuille A4 Portrait avec des marges de 1cm. */ public static final PageFormat construireFormatA4Portrait(){ final Paper paper = new Paper(); paper.setSize(cmVersPixel(21D), cmVersPixel(29.7)); paper.setImageableArea(cmVersPixel(1D), cmVersPixel(1D), cmVersPixel(19D), cmVersPixel(27.7D)); final PageFormat r = new PageFormat(); r.setPaper(paper); r.setOrientation(PageFormat.PORTRAIT); return PrinterJob.getPrinterJob().validatePage(r); }