当前位置: 首页>>代码示例>>Java>>正文


Java PrinterJob.showPrintDialog方法代码示例

本文整理汇总了Java中javafx.print.PrinterJob.showPrintDialog方法的典型用法代码示例。如果您正苦于以下问题:Java PrinterJob.showPrintDialog方法的具体用法?Java PrinterJob.showPrintDialog怎么用?Java PrinterJob.showPrintDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.print.PrinterJob的用法示例。


在下文中一共展示了PrinterJob.showPrintDialog方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: acaoImprimir

import javafx.print.PrinterJob; //导入方法依赖的package包/类
public void acaoImprimir() {
    PageLayout paisagem = Printer.getDefaultPrinter().createPageLayout(Paper.A4, PageOrientation.LANDSCAPE, Printer.MarginType.HARDWARE_MINIMUM);
    Double largura = paisagem.getPrintableWidth()-50;
    Double altura = paisagem.getPrintableHeight()-50;
    PrinterJob trabalho = PrinterJob.createPrinterJob();
    if(trabalho != null){
        if(trabalho.showPrintDialog(Kernel.palco)){
            Tooltip aguarde = Janela.showTooltip(Status.ADVERTENCIA, idioma.getMensagem("aguarde_impressao"));
            tabela.getChildren().remove(barraSuperior);
            trabalho.getJobSettings().setPageLayout(paisagem);
            tabela.setMaxSize(largura, altura);
            ObservableList itens = listaExtrato.getItems();
            for(int i=0; i<itens.size();i+=18){
                int end = (i+18<itens.size()) ? i+18 : itens.size();
                listaExtrato.setItems(FXCollections.observableList(itens.subList(i, end)));
                trabalho.printPage(tabela);
            }
            tabela.add(barraSuperior, 0, 0);
            tabela.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
            listaExtrato.setItems(itens);
            aguarde.hide();
        }
        trabalho.endJob();
    }
}
 
开发者ID:badernageral,项目名称:bgfinancas,代码行数:26,代码来源:RelatoriosControlador.java

示例2: handlePrintButton

import javafx.print.PrinterJob; //导入方法依赖的package包/类
@FXML
private void handlePrintButton(ActionEvent event) {
    Printer printer = Printer.getDefaultPrinter();
    printer.createPageLayout(Paper.A4, PageOrientation.PORTRAIT, Printer.MarginType.EQUAL);
    PrinterJob job = PrinterJob.createPrinterJob(printer);
    job.showPrintDialog(owner);
    if (job != null) {
        engine.print(job);
        job.endJob();
    }
}
 
开发者ID:kmrifat,项目名称:Dr-Assistant,代码行数:12,代码来源:ViewTemplateController.java

示例3: handlePrintButton

import javafx.print.PrinterJob; //导入方法依赖的package包/类
@FXML
private void handlePrintButton(ActionEvent event) {
    Printer printer = Printer.getDefaultPrinter();
    printer.createPageLayout(Paper.A4, PageOrientation.PORTRAIT, Printer.MarginType.EQUAL);
    PrinterJob job = PrinterJob.createPrinterJob(printer);
    job.showPrintDialog(owner);
    
    if (job != null) {
        engine.print(job);
        job.endJob();
    }
}
 
开发者ID:kmrifat,项目名称:Dr-Assistant,代码行数:13,代码来源:ViewPrescriptionController.java

示例4: printImage

import javafx.print.PrinterJob; //导入方法依赖的package包/类
/**
 * Print image.
 */
@FXML
public void printImage() {
    PrinterJob printerJob = PrinterJob.createPrinterJob();
    printerJob.showPrintDialog(printNode.getScene().getWindow());
    if (printerJob != null) {
        boolean success = printerJob.printPage(printNode);
        if (success) {
            printerJob.endJob();
        }
    }
}
 
开发者ID:RudyB,项目名称:Optics-Simulator,代码行数:15,代码来源:MenuBarController.java

示例5: printActiveFile

import javafx.print.PrinterJob; //导入方法依赖的package包/类
@Override
public void printActiveFile()
{
	CodeEditor activeEditor = getActiveCodeEditor();
	if (activeEditor == null)
	{
		Dialogues.showActionFailedDialogue("No file is open!");
		return;
	}
	
	PrinterJob printAction = PrinterJob.createPrinterJob();
	if (printAction == null)
	{
		Dialogues.showActionFailedDialogue("Unable to access system print utilities");
		return;
	}
	
	boolean notCancelled = printAction.showPrintDialog(stage);
	if (notCancelled)
	{
		boolean success = printAction.printPage(activeEditor);
		if (success)
			printAction.endJob();
		else
			Dialogues.showActionFailedDialogue("Print may have failed");
	}
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:28,代码来源:Main.java

示例6: printJob

import javafx.print.PrinterJob; //导入方法依赖的package包/类
/********************************
 * 작성일 : 2016. 6. 29. 작성자 : KYJ
 *
 * print 처리.
 *
 * @param window
 * @param target
 ********************************/
public static void printJob(Window window, Node target) {
	Printer printer = Printer.getDefaultPrinter();
	// PrinterAttributes printerAttributes = printer.getPrinterAttributes();
	//
	Paper a4 = Paper.A4;

	// Paper a4 = PrintHelper.createPaper("Rotate A4", Paper.A4.getHeight(),
	// Paper.A4.getWidth(), Units.MM);
	PageLayout pageLayout = printer.createPageLayout(a4, PageOrientation.REVERSE_PORTRAIT, MarginType.DEFAULT);

	PrinterJob printerJob = PrinterJob.createPrinterJob();

	// JobSettings jobSettings = printerJob.getJobSettings();
	// jobSettings.setPrintSides(PrintSides.TUMBLE);
	ImageView imageView = new ImageView();
	// 화면 사이즈에 맞게 크기 조절.
	Callback<SnapshotResult, Void> callback = param -> {
		final WritableImage image = param.getImage();
		imageView.setImage(image);

		final double scaleX = pageLayout.getPrintableWidth() / imageView.getBoundsInParent().getWidth();
		final double scaleY = pageLayout.getPrintableHeight() / imageView.getBoundsInParent().getHeight();
		imageView.getTransforms().add(new Scale(scaleX, scaleY));

		return null;
	};

	target.snapshot(callback, null, null);

	if (printerJob.showPrintDialog(window) && printerJob.printPage(pageLayout, imageView))
		printerJob.endJob();
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:41,代码来源:FxUtil.java

示例7: showPrintDialog

import javafx.print.PrinterJob; //导入方法依赖的package包/类
@Override
public boolean showPrintDialog(PrinterJob job) {
    return job.showPrintDialog(null);
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:5,代码来源:FXDialogService.java


注:本文中的javafx.print.PrinterJob.showPrintDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。