If you don't know the number of pages in your document, simply pass the UNKNOWN_NUMBER_OF_PAGES value to the append() method. This method's parameters are the PageFormat object, which defines the physical characteristics of the page, and a PagePainter object, which implements the Printable interface. To add pages, you simply use one of the two append() methods (see my explanation of this class in the API section for more details). ![]() When first created, the Book object is empty. Since the Book class implements the Pageable interface, you could implement your own Book class when the provided Book class lacks the features that you require.Ī Book class represents a collection of pages. Each page can have its own format and its own painter, giving you the flexibility to create sophisticated documents. This class allows you to create multiple-page documents. The Pageable job doesn't need to know how many pages are in the document.Īlso new since version 1.2 is the Book class.Again, you don't have to worry about this as long as you can supply any page in your document on demand. The print subsystem might ask your application to print pages out of sequence, and some pages may be skipped if necessary.In a Pageable job, you can mix portrait and landscape pages. You can set a different page format for each page in the book.For example, you could have a painter implemented to print the cover page, another painter to print the table of contents, and a third to print the entire document. I will explain the Book class in a moment.Ī Pageable job has the following characteristics: Pageable jobs are most often used with Books, a collection of pages that can have different formats. Pageable jobs offer more flexibility than Printable jobs, as each page in a Pageable job can feature a different layout. If your application displays a print dialog box, the total number of pages to be printed will not be displayed since it's impossible to know in advance the number of pages in the document using this model. As an example, if your application is asked to render pages five through seven, the print subsystem will ask for all pages up to the seventh page, but will only print pages five, six, and seven. The print subsystem will always request that the application render the pages in sequence. When the last page prints, your PagePainter must return the NO_SUCH_PAGE value. Pages are rendered in sequence, starting with page zero. This model only uses one PagePainter for the entire document. Printable jobs are the simpler of the two printing models. more than 600 DPI), you /// should use PDFRasterizer or PDFNet vector output instead of PDFDraw.There are two printing models in Java: Printable jobs and Pageable jobs. / /// If you would like to rasterize page at high resolutions (e.g. On other operating systems this will be a no-op /// /// The second example uses PDFDraw send unoptimized rasterized data via awt.print API. For earlier Windows versions /// the print path will be used. If the OS is Windows 7, then the /// XPS print path will be used to preserve vector quality. / /// The first example uses the new PDF::Print::StartPrintJob function to send a rasterization /// of the document with optimal compression to the printer. * /// The following sample illustrates how to print PDF document using currently selected /// default printer. ![]() Consult legal.txt regarding legal and license information. - // Copyright (c) 2001-2023 by PDFTron Systems Inc.
0 Comments
Leave a Reply. |