cpdf_configuration.dart 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import 'dart:ui';
  2. import 'package:compdfkit_flutter/common/util/cpdf_color_extension.dart';
  3. import 'package:flutter/material.dart';
  4. import 'core/annotation/cpdf_border_style.dart';
  5. import 'core/annotation/cpdf_font_type.dart';
  6. import 'core/annotation/cpdf_line_type.dart';
  7. /// Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
  8. ///
  9. /// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  10. /// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  11. /// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  12. /// This notice may not be removed from this file.
  13. class CPDFConfiguration {
  14. bool isVerticalMode = true;
  15. bool isDoublePage = false;
  16. bool isContinueMode = true;
  17. bool isCoverPageMode = false;
  18. bool isCropMode = false;
  19. Color readBackgroundColor = Colors.white;
  20. Map<String, dynamic> toConfiguration(){
  21. return {
  22. 'setVerticalMode': isVerticalMode,
  23. 'setDoublePage': isDoublePage,
  24. 'setContinueMode': isContinueMode,
  25. 'setCoverPageMode': isCoverPageMode,
  26. 'setCropMode': isCropMode,
  27. 'setReadBackgroundColor': readBackgroundColor.toHex(),
  28. 'annotAttribute': {
  29. 'note': {
  30. 'color': "#A5D6A7"
  31. },
  32. 'highlight': {
  33. 'color': "#A5D6A7",
  34. 'opacity': 255
  35. },
  36. 'strikeout': {
  37. 'color': "#A5D6A7",
  38. 'opacity': 255
  39. },
  40. 'underline': {
  41. 'color': "#A5D6A7",
  42. 'opacity': 255
  43. },
  44. 'squiggly': {
  45. 'color': "#A5D6A7",
  46. 'opacity': 255
  47. },
  48. 'ink': {
  49. 'color': "#A5D6A7",
  50. 'opacity': 255,
  51. 'borderWidth': 10,
  52. 'eraserWidth' : 10
  53. },
  54. 'square' : {
  55. 'lineColor' : "#A5D6A7",
  56. 'lineColorOpacity' : 255,
  57. 'fillColor' : Colors.transparent.toHex(),
  58. 'fillColorOpacity' : 0,
  59. 'borderWidth' : 10,
  60. 'borderStyle' : {
  61. 'style' : CPDFBorderStyle.solid,
  62. 'borderWidth' : 10,
  63. 'dashArr' : [8.0, 0]
  64. }
  65. },
  66. 'circle' : {
  67. 'lineColor' : "#A5D6A7",
  68. 'lineColorOpacity' : 255,
  69. 'fillColor' : Colors.transparent.toHex(),
  70. 'fillColorOpacity' : 0,
  71. 'borderWidth' : 10,
  72. 'borderStyle' : {
  73. 'style' : CPDFBorderStyle.solid,
  74. 'borderWidth' : 10,
  75. 'dashArr' : [8.0, 0]
  76. }
  77. },
  78. 'line' : {
  79. 'lineColor' : "#A5D6A7",
  80. 'lineColorOpacity' : 255,
  81. 'fillColor' : Colors.transparent.toHex(),
  82. 'fillColorOpacity' : 0,
  83. 'borderWidth' : 10,
  84. 'borderStyle' : {
  85. 'style' : CPDFBorderStyle.solid,
  86. 'borderWidth' : 10,
  87. 'dashArr' : [8.0, 0]
  88. },
  89. },
  90. 'arrow' : {
  91. 'lineColor' : "#A5D6A7",
  92. 'lineColorOpacity' : 255,
  93. 'fillColor' : Colors.transparent.toHex(),
  94. 'fillColorOpacity' : 0,
  95. 'borderWidth' : 10,
  96. 'borderStyle' : {
  97. 'style' : CPDFBorderStyle.solid,
  98. 'borderWidth' : 10,
  99. 'dashArr' : [8.0, 0]
  100. },
  101. 'headType' : CPDFLineType.none,
  102. 'tailType' : CPDFLineType.arrow
  103. },
  104. 'freetext': {
  105. 'textColor' : '#A5D6A7',
  106. 'textColorOpacity' : 255,
  107. 'fontBold': false,
  108. 'fontItalic': false,
  109. 'fontSize': 40,
  110. 'fontType': CPDFFontType.helvetica
  111. }
  112. }
  113. };
  114. }
  115. }