public class AsposeWordsPrintDocument
A single Aspose.Words document can consist of multiple sections that specify pages with different sizes,
orientation and paper trays.
On the other hand, if the document consists of a single section only, the developer can use
Constructor Summary |
---|
AsposeWordsPrintDocument(Document document)
Initializes a new instance of this class. |
public AsposeWordsPrintDocument(Document document)
document
- The document to print.Example:
Shows the standard Java print dialog that allows selecting the printer and the specified page range to print the document with.Document doc = new Document(getMyDir() + "Rendering.doc"); PrinterJob pj = PrinterJob.getPrinterJob(); // Initialize the Print Dialog with the number of pages in the document. PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet(); attributes.add(new PageRanges(1, doc.getPageCount())); // Returns true if the user accepts the print dialog. if (!pj.printDialog(attributes)) return; // Create the Aspose.Words' implementation of the Java Pageable interface. AsposeWordsPrintDocument awPrintDoc = new AsposeWordsPrintDocument(doc); // Pass the document to the printer. pj.setPageable(awPrintDoc); // Print the document with the user specified print settings. pj.print(attributes);