Showing
1 changed file
with
12 additions
and
8 deletions
| @@ -24,6 +24,7 @@ mixin Printing { | @@ -24,6 +24,7 @@ mixin Printing { | ||
| 24 | static Completer<List<int>> _onHtmlRendered; | 24 | static Completer<List<int>> _onHtmlRendered; |
| 25 | static Completer<bool> _onCompleted; | 25 | static Completer<bool> _onCompleted; |
| 26 | 26 | ||
| 27 | + /// Callbacks from platform plugins | ||
| 27 | static Future<void> _handleMethod(MethodCall call) async { | 28 | static Future<void> _handleMethod(MethodCall call) async { |
| 28 | switch (call.method) { | 29 | switch (call.method) { |
| 29 | case 'onLayout': | 30 | case 'onLayout': |
| @@ -78,9 +79,10 @@ mixin Printing { | @@ -78,9 +79,10 @@ mixin Printing { | ||
| 78 | 79 | ||
| 79 | /// Prints a [PdfDocument] or a pdf stream to a local printer using the platform UI | 80 | /// Prints a [PdfDocument] or a pdf stream to a local printer using the platform UI |
| 80 | @Deprecated('use Printing.layoutPdf(onLayout: (_) => document.save());') | 81 | @Deprecated('use Printing.layoutPdf(onLayout: (_) => document.save());') |
| 81 | - static Future<void> printPdf( | ||
| 82 | - {@Deprecated('use bytes with document.save()') PdfDocument document, | ||
| 83 | - List<int> bytes}) async { | 82 | + static Future<void> printPdf({ |
| 83 | + @Deprecated('use bytes with document.save()') PdfDocument document, | ||
| 84 | + List<int> bytes, | ||
| 85 | + }) async { | ||
| 84 | assert(document != null || bytes != null); | 86 | assert(document != null || bytes != null); |
| 85 | assert(!(document == null && bytes == null)); | 87 | assert(!(document == null && bytes == null)); |
| 86 | 88 | ||
| @@ -90,11 +92,12 @@ mixin Printing { | @@ -90,11 +92,12 @@ mixin Printing { | ||
| 90 | } | 92 | } |
| 91 | 93 | ||
| 92 | /// Displays a platform popup to share the Pdf document to another application | 94 | /// Displays a platform popup to share the Pdf document to another application |
| 93 | - static Future<void> sharePdf( | ||
| 94 | - {@Deprecated('use bytes with document.save()') PdfDocument document, | ||
| 95 | - List<int> bytes, | ||
| 96 | - String filename, | ||
| 97 | - Rect bounds}) async { | 95 | + static Future<void> sharePdf({ |
| 96 | + @Deprecated('use bytes with document.save()') PdfDocument document, | ||
| 97 | + List<int> bytes, | ||
| 98 | + String filename, | ||
| 99 | + Rect bounds, | ||
| 100 | + }) async { | ||
| 98 | assert(document != null || bytes != null); | 101 | assert(document != null || bytes != null); |
| 99 | assert(!(document == null && bytes == null)); | 102 | assert(!(document == null && bytes == null)); |
| 100 | 103 | ||
| @@ -115,6 +118,7 @@ mixin Printing { | @@ -115,6 +118,7 @@ mixin Printing { | ||
| 115 | return await _channel.invokeMethod('sharePdf', params); | 118 | return await _channel.invokeMethod('sharePdf', params); |
| 116 | } | 119 | } |
| 117 | 120 | ||
| 121 | + /// Convert an html document to a pdf data | ||
| 118 | static Future<List<int>> convertHtml( | 122 | static Future<List<int>> convertHtml( |
| 119 | {@required String html, | 123 | {@required String html, |
| 120 | String baseUrl, | 124 | String baseUrl, |
-
Please register or login to post a comment