|
@@ -53,7 +53,23 @@ class _HomePageState extends State<HomePage> {
|
|
|
}
|
|
|
|
|
|
void _init() async {
|
|
|
- // await ComPDFKit.setImportFontDir('fonts directory',addSysFont: true);
|
|
|
+ final tempDir = await ComPDFKit.getTemporaryDirectory();
|
|
|
+
|
|
|
+ await extractAsset(context, 'extraFonts/arial.ttf');
|
|
|
+ await extractAsset(context, 'extraFonts/Arial Bold.ttf');
|
|
|
+ await extractAsset(context, 'extraFonts/Arial_Italic.ttf');
|
|
|
+ await extractAsset(context, 'extraFonts/arialmt.ttf');
|
|
|
+ await extractAsset(context, 'extraFonts/ArialUnicode.ttf');
|
|
|
+ await extractAsset(context, 'extraFonts/PlaywriteAUSA-ExtraLight.ttf');
|
|
|
+ await extractAsset(context, 'extraFonts/PlaywriteAUSA-Light.ttf');
|
|
|
+ await extractAsset(context, 'extraFonts/PlaywriteAUSA-Regular.ttf');
|
|
|
+ await extractAsset(context, 'extraFonts/PlaywriteAUSA-Thin.ttf');
|
|
|
+ await extractAsset(context, 'extraFonts/字魂白鸽天行体(商用需授权).ttf');
|
|
|
+ await ComPDFKit.setImportFontDir('${tempDir.path}/extraFonts/',addSysFont: false);
|
|
|
+ print('path:${tempDir.path}/extraFonts/');
|
|
|
+ // online license auth
|
|
|
+ // Please replace it with your ComPDFKit license
|
|
|
+ // ComPDFKit.initialize(androidOnlineLicense: 'IVTAsbJCW0X45qIy5cTEuzxZzKpYIpJe6WPY7uCPIiI=',iosOnlineLicense: 'lkw3Gr0HuD5pV1/+DVRSxp7qBlvK+Izo3mOKyAEHXz4=');
|
|
|
|
|
|
// offline license auth
|
|
|
ComPDFKit.init(Platform.isAndroid ? androidLicenseKey : iosLicenseKey);
|