-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPdfJs.uno
60 lines (36 loc) · 1 KB
/
PdfJs.uno
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using Uno;
using Uno.UX;
using Uno.Threading;
using Uno.Text;
using Uno.Platform;
using Uno.Compiler.ExportTargetInterop;
using Uno.Collections;
using Fuse;
using Fuse.Scripting;
using Fuse.Reactive;
namespace PDF
{
[UXGlobalModule]
public sealed class PDFmodule: NativeModule
{
static readonly PDFmodule _instance;
public PDFmodule()
{
if(_instance != null) return;
Uno.UX.Resource.SetGlobalKey(_instance = this, "PDF");
AddMember(new NativePromise<string, string>("DecodeFromBase64", DecodeFromBase64));
AddMember(new NativePromise<string, string>("EncodeToBase64", EncodeToBase64));
}
Future<string> DecodeFromBase64(object[] args)
{
var base64 = (string)args[0];
var filename = (string)args[1];
return new PDF.DecodeFromBase64(base64, filename);
}
Future<string> EncodeToBase64(object[] args)
{
var filename = (string)args[0];
return new PDF.EncodeToBase64(filename);
}
}
}