cpdf_options.dart 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. // Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
  2. //
  3. // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  4. // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  5. // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  6. // This notice may not be removed from this file.
  7. enum CPDFViewMode { viewer, annotations, contentEditor, forms, signatures }
  8. /// The [CPDFToolbarAction.back] button will only be displayed on the leftmost side of the top toolbar on the Android platform
  9. enum CPDFToolbarAction { back, thumbnail, search, bota, menu }
  10. enum CPDFToolbarMenuAction {
  11. viewSettings,
  12. documentEditor,
  13. security,
  14. watermark,
  15. flattened,
  16. documentInfo,
  17. save,
  18. share,
  19. openDocument,
  20. /// The PDF capture function allows you to capture an area
  21. /// in the PDF document and convert it into an image.
  22. snip
  23. }
  24. enum CPDFDisplayMode { singlePage, doublePage, coverPage }
  25. /// readerView background themes
  26. enum CPDFThemes {
  27. /// Bright mode, readerview background is white
  28. light,
  29. /// dark mode, readerview background is black
  30. dark,
  31. /// brown paper color
  32. sepia,
  33. /// Light green, eye protection mode
  34. reseda
  35. }
  36. enum CPDFAnnotationType {
  37. note,
  38. highlight,
  39. underline,
  40. squiggly,
  41. strikeout,
  42. ink,
  43. // only ios platform
  44. pencil,
  45. circle,
  46. square,
  47. arrow,
  48. line,
  49. freetext,
  50. signature,
  51. stamp,
  52. pictures,
  53. link,
  54. sound
  55. }
  56. enum CPDFConfigTool { setting, undo, redo }
  57. enum CPDFAnnotBorderStyle { solid, dashed }
  58. enum CPDFLineType { none, openArrow, closedArrow, square, circle, diamond }
  59. enum CPDFAlignment { left, center, right }
  60. enum CPDFTypeface { courier, helvetica, timesRoman }
  61. extension CPDFTypefaceExtension on CPDFTypeface {
  62. String getFontName() {
  63. switch (name) {
  64. case 'courier':
  65. return 'Courier';
  66. case 'helvetica':
  67. return 'Helvetica';
  68. case 'timesRoman':
  69. return 'Times-Roman';
  70. default:
  71. return 'Courier';
  72. }
  73. }
  74. }
  75. extension CPDFTypefaceEnumExten on Iterable<CPDFTypeface> {
  76. CPDFTypeface byFontName(String fontName) {
  77. switch (fontName.toLowerCase()) {
  78. case 'courier':
  79. return CPDFTypeface.courier;
  80. case 'helvetica':
  81. return CPDFTypeface.helvetica;
  82. case 'times-roman':
  83. return CPDFTypeface.timesRoman;
  84. default:
  85. return CPDFTypeface.courier;
  86. }
  87. }
  88. }
  89. enum CPDFContentEditorType { editorText, editorImage }
  90. enum CPDFFormType {
  91. textField,
  92. checkBox,
  93. radioButton,
  94. listBox,
  95. comboBox,
  96. signaturesFields,
  97. pushButton
  98. }
  99. enum CPDFCheckStyle { check, circle, cross, diamond, square, star }
  100. enum CPDFThemeMode { light, dark, system }
  101. /// The [CPDFEdgeInsets] is used to set the padding of the PDF document.
  102. ///
  103. /// [Android] can only set horizontal margins, [top] and [bottom] margins.
  104. /// Horizontal spacing cannot be set independently.
  105. /// The horizontal spacing value is set using the [left] attribute,
  106. /// the spacing between two pages is the same as the top spacing.
  107. ///
  108. /// The [iOS] platform can set the [top], [bottom], [left] and [right] margins,
  109. /// and the spacing between two pages is the same as the top spacing.
  110. class CPDFEdgeInsets {
  111. final int left;
  112. final int top;
  113. final int right;
  114. final int bottom;
  115. const CPDFEdgeInsets.all(int value)
  116. : left = value,
  117. top = value,
  118. right = value,
  119. bottom = value;
  120. const CPDFEdgeInsets.symmetric(
  121. {required int horizontal, required int vertical})
  122. : left = horizontal,
  123. top = vertical,
  124. right = horizontal,
  125. bottom = vertical;
  126. const CPDFEdgeInsets.only(
  127. {required this.left,
  128. required this.top,
  129. required this.right,
  130. required this.bottom});
  131. Map<String, dynamic> toJson() => {
  132. 'left': left,
  133. 'top': top,
  134. 'right': right,
  135. 'bottom': bottom,
  136. };
  137. }