Package org.mozilla.geckoview
Class GeckoViewPrintDocumentAdapter
Object
android.print.PrintDocumentAdapter
org.mozilla.geckoview.GeckoViewPrintDocumentAdapter
-
Nested Class Summary
Nested classes/interfaces inherited from class android.print.PrintDocumentAdapter
PrintDocumentAdapter.LayoutResultCallback, PrintDocumentAdapter.WriteResultCallback
-
Field Summary
Fields inherited from class android.print.PrintDocumentAdapter
EXTRA_PRINT_PREVIEW
-
Constructor Summary
ConstructorDescriptionGeckoViewPrintDocumentAdapter
(File pdfFile) Default GeckoView PrintDocumentAdapter to be used with a PrintManager to print documents using the default Android print functionality.GeckoViewPrintDocumentAdapter
(InputStream pdfInputStream, Context context) Default GeckoView PrintDocumentAdapter to be used with a PrintManager to print documents using the default Android print functionality.GeckoViewPrintDocumentAdapter
(InputStream pdfInputStream, Context context, GeckoResult<Boolean> printDialogFinish) GeckoView PrintDocumentAdapter to be used with a PrintManager to print documents using the default Android print functionality. -
Method Summary
Modifier and TypeMethodDescriptionstatic File
makeTempPdfFile
(InputStream pdfInputStream, Context context) Writes the PDF InputStream to a file for the PrintDocumentAdapter to use.void
onFinish()
void
onLayout
(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, PrintDocumentAdapter.LayoutResultCallback layoutResultCallback, Bundle bundle) void
onWrite
(PageRange[] pageRanges, ParcelFileDescriptor parcelFileDescriptor, CancellationSignal cancellationSignal, PrintDocumentAdapter.WriteResultCallback writeResultCallback) Methods inherited from class android.print.PrintDocumentAdapter
onStart
-
Constructor Details
-
GeckoViewPrintDocumentAdapter
Default GeckoView PrintDocumentAdapter to be used with a PrintManager to print documents using the default Android print functionality. Will make a temporary PDF file from InputStream.- Parameters:
pdfInputStream
- an input stream containing a PDFcontext
- context that should be used for making a temporary file
-
GeckoViewPrintDocumentAdapter
public GeckoViewPrintDocumentAdapter(@NonNull InputStream pdfInputStream, @NonNull Context context, @Nullable GeckoResult<Boolean> printDialogFinish) GeckoView PrintDocumentAdapter to be used with a PrintManager to print documents using the default Android print functionality. Will make a temporary PDF file from InputStream.- Parameters:
pdfInputStream
- an input stream containing a PDFcontext
- context that should be used for making a temporary fileprintDialogFinish
- result to report that the print finished
-
GeckoViewPrintDocumentAdapter
Default GeckoView PrintDocumentAdapter to be used with a PrintManager to print documents using the default Android print functionality. Will use existing PDF file for rendering. The filename may be displayed to users.Note: Recommend using other constructor if the PDF file still needs to be created so that the UI reflects progress.
- Parameters:
pdfFile
- PDF file
-
-
Method Details
-
makeTempPdfFile
@AnyThread @Nullable public static File makeTempPdfFile(@NonNull InputStream pdfInputStream, @NonNull Context context) Writes the PDF InputStream to a file for the PrintDocumentAdapter to use.- Parameters:
pdfInputStream
- - InputStream containing a PDFcontext
- context that should be used for making a temporary file- Returns:
- temporary PDF file
-
onLayout
public void onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, PrintDocumentAdapter.LayoutResultCallback layoutResultCallback, Bundle bundle) - Specified by:
onLayout
in classPrintDocumentAdapter
-
onWrite
public void onWrite(PageRange[] pageRanges, ParcelFileDescriptor parcelFileDescriptor, CancellationSignal cancellationSignal, PrintDocumentAdapter.WriteResultCallback writeResultCallback) - Specified by:
onWrite
in classPrintDocumentAdapter
-
onFinish
public void onFinish()- Overrides:
onFinish
in classPrintDocumentAdapter
-