diff options
| author | Selim Gurun <sgurun@google.com> | 2013-08-29 12:01:27 -0700 |
|---|---|---|
| committer | Selim Gurun <sgurun@google.com> | 2013-08-30 08:30:52 -0700 |
| commit | 030d8b0d1b6b0879d0ab4e9a218a784f4c110f75 (patch) | |
| tree | 228eceb9ea7b82b701e83d7e7cfdfa9daedf10d2 /core/java/android/webkit/WebView.java | |
| parent | 0d72b3e052e6289936286af6506bfd9fa8f7646b (diff) | |
| download | frameworks_base-030d8b0d1b6b0879d0ab4e9a218a784f4c110f75.zip frameworks_base-030d8b0d1b6b0879d0ab4e9a218a784f4c110f75.tar.gz frameworks_base-030d8b0d1b6b0879d0ab4e9a218a784f4c110f75.tar.bz2 | |
DO NOT MERGE Printing API changes for supporting better page layout
Bug: 10507857
Change-Id: I3120ebfd11716259b9a83312b95a6a3f98a23d89
Diffstat (limited to 'core/java/android/webkit/WebView.java')
| -rw-r--r-- | core/java/android/webkit/WebView.java | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 1b57d50..5335786 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -31,7 +31,9 @@ import android.os.Bundle; import android.os.CancellationSignal; import android.os.Looper; import android.os.Message; +import android.os.ParcelFileDescriptor; import android.os.StrictMode; +import android.print.PrintAttributes; import android.util.AttributeSet; import android.util.Log; import android.view.KeyEvent; @@ -49,7 +51,6 @@ import android.widget.AbsoluteLayout; import java.io.BufferedWriter; import java.io.File; -import java.io.OutputStream; import java.util.Map; /** @@ -1040,7 +1041,9 @@ public class WebView extends AbsoluteLayout * Exports the contents of this Webview as PDF. Only supported for API levels * {@link android.os.Build.VERSION_CODES#KEY_LIME_PIE} and above. * - * @param out The stream to export the PDF contents to. Cannot be null. + * TODO(sgurun) the parameter list is stale. Fix it before unhiding. + * + * @param fd The FileDescriptor to export the PDF contents to. Cannot be null. * @param width The page width. Should be larger than 0. * @param height The page height. Should be larger than 0. * @param resultCallback A callback to be invoked when the PDF content is exported. @@ -1049,21 +1052,26 @@ public class WebView extends AbsoluteLayout * be null. * * The PDF conversion is done asynchronously and the PDF output is written to the provided - * outputstream. The caller should not close the outputstream until the resultCallback is - * called, indicating PDF conversion is complete. Webview cannot be drawn during the pdf - * export so the application is recommended to take it offscreen, or putting in a layer - * with an overlaid progress UI / spinner. + * file descriptor. The caller should not close the file descriptor until the resultCallback + * is called, indicating PDF conversion is complete. Webview will never close the file + * descriptor. + * Limitations: Webview cannot be drawn during the PDF export so the application is + * recommended to take it offscreen, or putting in a layer with an overlaid progress + * UI / spinner. * * If the caller cancels the task using the cancellationSignal, the cancellation will be * acked using the resultCallback signal. * + * Throws an exception if an IO error occurs accessing the file descriptor. + * * TODO(sgurun) margins, explain the units, make it public. * @hide */ - public void exportToPdf(OutputStream out, int width, int height, - ValueCallback<Boolean> resultCallback, CancellationSignal cancellationSignal) { + public void exportToPdf(ParcelFileDescriptor fd, PrintAttributes attributes, + ValueCallback<Boolean> resultCallback, CancellationSignal cancellationSignal) + throws java.io.IOException { checkThread(); - mProvider.exportToPdf(out, width, height, resultCallback, cancellationSignal); + mProvider.exportToPdf(fd, attributes, resultCallback, cancellationSignal); } /** |
