convert_contain_options_bean.dart 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import 'package:ConversionFlutterDemo/models/convert_bean.dart';
  2. /// convert_contain_options_bean.dart
  3. ///
  4. /// Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
  5. ///
  6. /// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  7. /// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  8. /// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  9. /// This notice may not be removed from this file.
  10. class ConvertOptionsBean {
  11. //The 'containImage' parameter is used when converting to ppt, word, excel、rtf、html format
  12. bool containImages;
  13. //The 'containImage' parameter is used when converting to ppt、word、excel、image、rtf、html format
  14. bool containAnnotations;
  15. //Only used when converting to excel
  16. ExcelWorkSheetOptions workSheetOptions;
  17. //Only used when converting to excel
  18. ContentOptions contentOptions = ContentOptions.AllContent;
  19. //Only used when converting to image, the limited range is 1~1000
  20. int imageDpi = 300;
  21. //Only used when converting to image
  22. ImagePageOptions imagePageOptions;
  23. //Only used when converting to csv
  24. bool mergeCSV = false;
  25. //Only used when converting to html
  26. HtmlPageOptions htmlPageOptions;
  27. ConvertOptionsBean(
  28. {this.containImages = true,
  29. this.containAnnotations = true,
  30. this.workSheetOptions = ExcelWorkSheetOptions.ForEachPage,
  31. this.contentOptions = ContentOptions.AllContent,
  32. this.imageDpi = 300,
  33. this.imagePageOptions = ImagePageOptions.PNG,
  34. this.mergeCSV = false,
  35. this.htmlPageOptions = HtmlPageOptions.SinglePage});
  36. ///You do not need to pass all the parameters below. Please pass them according to the format of the conversion.
  37. ///convert to ppt,word,rtf : containImages,containAnnotations
  38. ///convert to excel : containImages, containAnnotations, workSheetOptions, contentOptions
  39. ///convert to image : containAnnotations, imageDpi, imagePageOptions
  40. ///convert to csv : mergeCSV
  41. ///convert to html : containImages, containAnnotations, htmlPageOptions
  42. ///
  43. Map<String, String> getOptions(ConvertBean bean) {
  44. return {
  45. 'dataTag' : bean.tag,
  46. 'convertType' : bean.convertType,
  47. 'filePath' : bean.filePath,
  48. 'fileName' : bean.fileName,
  49. 'containImages': containImages.toString(),
  50. 'containAnnotations': containAnnotations.toString(),
  51. 'workSheetOptions' : workSheetOptions.name,
  52. 'contentOptions' : contentOptions.name,
  53. 'imageDpi' : imageDpi.toString(),
  54. 'imagePageOptions' : imagePageOptions.name,
  55. 'mergeCSV' : mergeCSV.toString(),
  56. 'htmlPageOptions' : htmlPageOptions.name
  57. };
  58. }
  59. }
  60. enum ExcelWorkSheetOptions { ForEachTable, ForEachPage, ForTheDocument }
  61. enum ContentOptions { OnlyText, OnlyTable, AllContent }
  62. enum ImagePageOptions {
  63. JPEG,
  64. PNG,
  65. }
  66. enum HtmlPageOptions {
  67. SinglePage,
  68. SinglePageNavigationByBookmark,
  69. MultiplePages,
  70. MultiplePagesSplitByBookmarks
  71. }