Showing
1 changed file
with
20 additions
and
1 deletions
@@ -47,7 +47,11 @@ mixin Printing { | @@ -47,7 +47,11 @@ mixin Printing { | ||
47 | return PrintingPlatform.instance.layoutPdf(onLayout, name, format); | 47 | return PrintingPlatform.instance.layoutPdf(onLayout, name, format); |
48 | } | 48 | } |
49 | 49 | ||
50 | - /// Opens the native printer picker interface, and returns the URL of the selected printer. | 50 | + /// Opens the native printer picker interface, and returns the URL of the |
51 | + /// selected printer. | ||
52 | + /// | ||
53 | + /// This is not supported on all platforms. Check the result of [info] to | ||
54 | + /// find at runtime if this feature is available or not. | ||
51 | static Future<Printer> pickPrinter({Rect bounds}) { | 55 | static Future<Printer> pickPrinter({Rect bounds}) { |
52 | bounds ??= Rect.fromCircle(center: Offset.zero, radius: 10); | 56 | bounds ??= Rect.fromCircle(center: Offset.zero, radius: 10); |
53 | 57 | ||
@@ -59,6 +63,9 @@ mixin Printing { | @@ -59,6 +63,9 @@ mixin Printing { | ||
59 | /// returns a future with a `bool` set to true if the document is printed | 63 | /// returns a future with a `bool` set to true if the document is printed |
60 | /// and false if it is canceled. | 64 | /// and false if it is canceled. |
61 | /// throws an exception in case of error | 65 | /// throws an exception in case of error |
66 | + /// | ||
67 | + /// This is not supported on all platforms. Check the result of [info] to | ||
68 | + /// find at runtime if this feature is available or not. | ||
62 | static FutureOr<bool> directPrintPdf({ | 69 | static FutureOr<bool> directPrintPdf({ |
63 | @required Printer printer, | 70 | @required Printer printer, |
64 | @required LayoutCallback onLayout, | 71 | @required LayoutCallback onLayout, |
@@ -106,6 +113,9 @@ mixin Printing { | @@ -106,6 +113,9 @@ mixin Printing { | ||
106 | } | 113 | } |
107 | 114 | ||
108 | /// Convert an html document to a pdf data | 115 | /// Convert an html document to a pdf data |
116 | + /// | ||
117 | + /// This is not supported on all platforms. Check the result of [info] to | ||
118 | + /// find at runtime if this feature is available or not. | ||
109 | static Future<Uint8List> convertHtml({ | 119 | static Future<Uint8List> convertHtml({ |
110 | @required String html, | 120 | @required String html, |
111 | String baseUrl, | 121 | String baseUrl, |
@@ -134,6 +144,15 @@ mixin Printing { | @@ -134,6 +144,15 @@ mixin Printing { | ||
134 | return (await info()).asMap(); | 144 | return (await info()).asMap(); |
135 | } | 145 | } |
136 | 146 | ||
147 | + /// Convert a PDF to a list of images. | ||
148 | + /// ```dart | ||
149 | + /// await for (final page in Printing.raster(content)) { | ||
150 | + /// final image = page.asImage(); | ||
151 | + /// } | ||
152 | + /// ``` | ||
153 | + /// | ||
154 | + /// This is not supported on all platforms. Check the result of [info] to | ||
155 | + /// find at runtime if this feature is available or not. | ||
137 | static Stream<PdfRaster> raster( | 156 | static Stream<PdfRaster> raster( |
138 | Uint8List document, { | 157 | Uint8List document, { |
139 | List<int> pages, | 158 | List<int> pages, |
-
Please register or login to post a comment