compdfkit.dart 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /// Copyright © 2014-2023 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. import 'dart:io';
  8. import 'package:flutter/services.dart';
  9. class ComPDFKit {
  10. static const _methodChannel = MethodChannel('com.compdfkit.flutter.plugin');
  11. static const initSDK = 'init_sdk';
  12. static const sdkVersionCode = 'sdk_version_code';
  13. static const sdkBuildTag = "sdk_build_tag";
  14. /// init ComPDFKit sdk, please enter your ComPDFKit key and secret
  15. static void init(String key, String secret) async {
  16. _methodChannel.invokeMethod(initSDK, {'key': key, 'secret': secret});
  17. }
  18. /// get ComPDFKit SDK version code
  19. static Future<String> getVersionCode() async {
  20. String versionCode =
  21. await _methodChannel.invokeMethod(ComPDFKit.sdkVersionCode);
  22. return versionCode;
  23. }
  24. static Future<String> getSDKBuildTag() async {
  25. String buildTag = await _methodChannel.invokeMethod(ComPDFKit.sdkBuildTag);
  26. return buildTag;
  27. }
  28. static Future<Directory> getTemporaryDirectory() async {
  29. String path = await _methodChannel.invokeMethod('getTemporaryDirectory');
  30. return Directory(path);
  31. }
  32. }