/**@class android.graphics.pdf.PdfRenderer implements java.lang.AutoCloseable @extends java.lang.Object <p> This class enables rendering a PDF document. This class is not thread safe. </p> <p> If you want to render a PDF, you create a renderer and for every page you want to render, you open the page, render it, and close the page. After you are done with rendering, you close the renderer. After the renderer is closed it should not be used anymore. Note that the pages are rendered one by one, i.e. you can have only a single page opened at any given time. </p> <p> A typical use of the APIs to render a PDF looks like this: </p> <pre> // create a new renderer PdfRenderer renderer = new PdfRenderer(getSeekableFileDescriptor()); // let us just render all pages final int pageCount = renderer.getPageCount(); for (int i = 0; i < pageCount; i++) { Page page = renderer.openPage(i); // say we render for showing on the screen page.render(mBitmap, null, null, Page.RENDER_MODE_FOR_DISPLAY); // do stuff with the bitmap // close the page page.close(); } // close the renderer renderer.close(); </pre> <h3>Print preview and print output</h3> <p> If you are using this class to rasterize a PDF for printing or show a print preview, it is recommended that you respect the following contract in order to provide a consistent user experience when seeing a preview and printing, i.e. the user sees a preview that is the same as the printout. </p> <ul> <li> Respect the property whether the document would like to be scaled for printing as per {@link #shouldScaleForPrinting}(). </li> <li> When scaling a document for printing the aspect ratio should be preserved. </li> <li> Do not inset the content with any margins from the {@link android.print.PrintAttributes} as the application is responsible to render it such that the margins are respected. </li> <li> If document page size is greater than the printed media size the content should be anchored to the upper left corner of the page for left-to-right locales and top right corner for right-to-left locales. </li> </ul> @see #close() */ var PdfRenderer = { /**Closes this renderer. You should not use this instance after this method is called. */ close : function( ) {}, /**Gets the number of pages in the document. @return {Number} The page count. */ getPageCount : function( ) {}, /**Gets whether the document prefers to be scaled for printing. You should take this info account if the document is rendered for printing and the target media size differs from the page size. @return {Boolean} If to scale the document. */ shouldScaleForPrinting : function( ) {}, /**Opens a page for rendering. @param {Number} index The page index. @return {Object {android.graphics.pdf.PdfRenderer.Page}} A page that can be rendered. @see android.graphics.pdf.PdfRenderer.Page#close() PdfRenderer.Page.close() */ openPage : function( ) {}, };