printing.dart 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com>
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import 'package:pdf/widgets.dart';
  17. import 'src/fonts/gfonts.dart';
  18. export 'src/asset_utils.dart';
  19. export 'src/cache.dart';
  20. export 'src/callback.dart';
  21. export 'src/fonts/gfonts.dart';
  22. export 'src/preview/actions.dart';
  23. export 'src/preview/pdf_preview.dart';
  24. export 'src/printer.dart';
  25. export 'src/printing.dart';
  26. export 'src/printing_info.dart';
  27. export 'src/raster.dart';
  28. export 'src/widget_wrapper.dart';
  29. Future<void> pdfDefaultTheme() async {
  30. if (ThemeData.buildThemeData != null) {
  31. return;
  32. }
  33. final base = await PdfGoogleFonts.openSansRegular();
  34. final bold = await PdfGoogleFonts.openSansBold();
  35. final italic = await PdfGoogleFonts.openSansItalic();
  36. final boldItalic = await PdfGoogleFonts.openSansBoldItalic();
  37. final emoji = await PdfGoogleFonts.notoColorEmoji();
  38. final icons = await PdfGoogleFonts.materialIcons();
  39. ThemeData.buildThemeData = () {
  40. return ThemeData.withFont(
  41. base: base,
  42. bold: bold,
  43. italic: italic,
  44. boldItalic: boldItalic,
  45. icons: icons,
  46. fontFallback: [emoji, base],
  47. );
  48. };
  49. }