Dokumente drucken
Drucken eines Dokuments
Mit Aspose.Note für Java API können Sie OneNote-Dokumente auf dem Drucker ausgeben. Mit der Print-Methode, die von der Document-Klasse bereitgestellt wird, können Sie das geladene Dokument auf dem Drucker ausgeben.
1String dataDir = Utils.getSharedDataDir(AlternativeText.class) + "load/";
2
3Document document = new Document(dataDir + "Aspose.one");
4
5document.print();
Drucken von Dokumenten mit Druckoptionen
Mit der Klasse PrintOptions können Sie ein Dokument auch mit bestimmten Druckoptionen auf Printer drucken. Die Klasse PrinterSettings kann verwendet werden, um zusätzliche Druckereinstellungen wie Seitenlayout und Ränder anzugeben.
1String dataDir = Utils.getSharedDataDir(AlternativeText.class) + "load/";
2
3Document document = new Document(dataDir + "Aspose.one");
4
5//Prints first and second pages using Microsoft XPS Document Writer
6final DocumentPrintAttributeSet asposeAttr = new DocumentPrintAttributeSet("Microsoft XPS Document Writer");
7asposeAttr.setPrintRange(1, 2);
8
9//Uncomment line below to retarget output to specified file.
10//This functionality is supported by Microsoft XPS Document Writer.
11//It is not guaranteed that other printers support it.
12//asposeAttr.add(new Destination((new java.io.File("./out.xps")).toURI()));
13
14document.print(asposeAttr);
Dokumente auf virtuellem Drucker drucken
1//Prints 3 copies of first and second pages using virtual pdf printer doPDF 8
2//It is free and can be downloaded here http://www.dopdf.com/download.php
3String dataDir = Utils.getSharedDataDir(AlternativeText.class) + "load/";
4Document doc = new Document(dataDir + "test.one");
5
6
7final DocumentPrintAttributeSet asposeAttr = new DocumentPrintAttributeSet("doPDF 8");
8asposeAttr.setPrintRange(1, 2);
9asposeAttr.setCopies(3);
10
11PrintOptions printOptions = new PrintOptions();
12printOptions.setDocumentName("Test.one");
13printOptions.setPrinterSettings(asposeAttr);
14
15doc.print(printOptions);