To print an HTML document: await Printing.layoutPdf( Or share the document to other applications: await Printing.sharePdf(bytes: await doc.save(), filename: 'my-document.pdf') OnLayout: (PdfPageFormat format) async => doc.save()) You can also print the document using the iOS or Android print service: await Printing.layoutPdf( To save the pdf file using the path_provider library: final output = await getTemporaryDirectory() įinal file = File('$/example.pdf') Īwait file.writeAsBytes(await doc.save()) To use a TrueType font from a flutter bundle: final ttf = await fontFromAssetBundle('assets/open-sans.ttf') Ĭhild: pw.Text('Dart is awesome', style: pw.TextStyle(font: ttf, fontSize: 40)), To load an image from a Flutter asset: final image = await imageFromAssetBundle('assets/image.png') See the releases here: Examples # final doc = pw.Document() Set(PDFIUM_ARCH "圆4" CACHE STRING "" FORCE) On your main CMakeLists.txt with: set(PDFIUM_VERSION "4929" CACHE STRING "" FORCE) įor Windows and Linux, you can force the pdfium version and architecture Has to be added to your web/index.html file, just before. If you want to manually set the PdfJs library version for the web, a small script Import the libraries import 'package:pdf/pdf.dart' Įnable Swift on the iOS project, in ios/Podfile: target 'Runner' do Īdd this package to your package's pubspec.yaml file as described This example is also available on the web here. See the example on how to use the plugin. A plugin that allows Flutter apps to generate and printĭocuments to android or ios compatible printers
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |