cpdf_options.dart 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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('#FFFFFF'),
  29. /// dark mode, readerview background is black
  30. dark('#000000'),
  31. /// brown paper color
  32. sepia('#FFEFBE'),
  33. /// Light green, eye protection mode
  34. reseda('#CDE6D0');
  35. final String color;
  36. const CPDFThemes(this.color);
  37. // 获取颜色值
  38. String getColor() {
  39. return color;
  40. }
  41. }
  42. enum CPDFAnnotationType {
  43. note,
  44. highlight,
  45. underline,
  46. squiggly,
  47. strikeout,
  48. ink,
  49. // only ios platform
  50. pencil,
  51. circle,
  52. square,
  53. arrow,
  54. line,
  55. freetext,
  56. signature,
  57. stamp,
  58. pictures,
  59. link,
  60. sound
  61. }
  62. enum CPDFConfigTool { setting, undo, redo }
  63. enum CPDFAnnotBorderStyle { solid, dashed }
  64. enum CPDFLineType { none, openArrow, closedArrow, square, circle, diamond }
  65. enum CPDFAlignment { left, center, right }
  66. enum CPDFTypeface { courier, helvetica, timesRoman }
  67. extension CPDFTypefaceExtension on CPDFTypeface {
  68. String getFontName() {
  69. switch (name) {
  70. case 'courier':
  71. return 'Courier';
  72. case 'helvetica':
  73. return 'Helvetica';
  74. case 'timesRoman':
  75. return 'Times-Roman';
  76. default:
  77. return 'Courier';
  78. }
  79. }
  80. }
  81. extension CPDFTypefaceEnumExten on Iterable<CPDFTypeface> {
  82. CPDFTypeface byFontName(String fontName) {
  83. switch (fontName.toLowerCase()) {
  84. case 'courier':
  85. return CPDFTypeface.courier;
  86. case 'helvetica':
  87. return CPDFTypeface.helvetica;
  88. case 'times-roman':
  89. return CPDFTypeface.timesRoman;
  90. default:
  91. return CPDFTypeface.courier;
  92. }
  93. }
  94. }
  95. enum CPDFContentEditorType { editorText, editorImage }
  96. enum CPDFFormType {
  97. textField,
  98. checkBox,
  99. radioButton,
  100. listBox,
  101. comboBox,
  102. signaturesFields,
  103. pushButton
  104. }
  105. enum CPDFCheckStyle { check, circle, cross, diamond, square, star }
  106. enum CPDFThemeMode { light, dark, system }
  107. /// [CPDFEdgeInsets] defines the padding for a PDF document.
  108. ///
  109. /// - On **Android**, you can set individual margins for [top], [bottom], [left], and [right].
  110. /// To adjust the spacing between pages, use the `setPageSpacing()` method.
  111. ///
  112. /// - On **iOS**, you can also configure [top], [bottom], [left], and [right] margins.
  113. /// The spacing between pages is equal to the [top] margin.
  114. class CPDFEdgeInsets {
  115. final int left;
  116. final int top;
  117. final int right;
  118. final int bottom;
  119. const CPDFEdgeInsets.all(int value)
  120. : left = value,
  121. top = value,
  122. right = value,
  123. bottom = value;
  124. const CPDFEdgeInsets.symmetric(
  125. {required int horizontal, required int vertical})
  126. : left = horizontal,
  127. top = vertical,
  128. right = horizontal,
  129. bottom = vertical;
  130. const CPDFEdgeInsets.only(
  131. {required this.left,
  132. required this.top,
  133. required this.right,
  134. required this.bottom});
  135. Map<String, dynamic> toJson() => {
  136. 'left': left,
  137. 'top': top,
  138. 'right': right,
  139. 'bottom': bottom,
  140. };
  141. }
  142. enum CPDFDocumentPermissions {
  143. none,
  144. user,
  145. owner
  146. }
  147. /// Error types of the opening document.
  148. enum CPDFDocumentError {
  149. /// No read permission.
  150. noReadPermission,
  151. /// SDK No verified license
  152. notVerifyLicense,
  153. /// open document success.
  154. success,
  155. /// Unknown error
  156. unknown,
  157. /// File not found or could not be opened.
  158. errorFile,
  159. /// File not in PDF format or corrupted.
  160. errorFormat,
  161. /// Password required or incorrect password.
  162. errorPassword,
  163. /// Unsupported security scheme.
  164. errorSecurity,
  165. /// Error page.
  166. errorPage
  167. }