PrintFileDocumentAdapterpublic class PrintFileDocumentAdapter extends PrintDocumentAdapter Adapter for printing PDF files. This class could be useful if you
want to print a file and intercept when the system is ready
spooling the data, so you can delete the file if it is a
temporary one. To achieve this one must override {@link #onFinish()}
and delete the file yourself. |
Fields Summary |
---|
private static final String | LOG_TAG | private final android.content.Context | mContext | private final File | mFile | private final PrintDocumentInfo | mDocumentInfo | private WriteFileAsyncTask | mWriteFileAsyncTask |
Constructors Summary |
---|
public PrintFileDocumentAdapter(android.content.Context context, File file, PrintDocumentInfo documentInfo)Constructor.
if (file == null) {
throw new IllegalArgumentException("File cannot be null!");
}
if (documentInfo == null) {
throw new IllegalArgumentException("documentInfo cannot be null!");
}
mContext = context;
mFile = file;
mDocumentInfo = documentInfo;
|
Methods Summary |
---|
public void | onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, android.os.CancellationSignal cancellationSignal, LayoutResultCallback callback, android.os.Bundle metadata)
callback.onLayoutFinished(mDocumentInfo, false);
| public void | onWrite(PageRange[] pages, android.os.ParcelFileDescriptor destination, android.os.CancellationSignal cancellationSignal, WriteResultCallback callback)
mWriteFileAsyncTask = new WriteFileAsyncTask(destination, cancellationSignal, callback);
mWriteFileAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
(Void[]) null);
|
|