-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImageInfoExample.js
40 lines (33 loc) · 1.21 KB
/
ImageInfoExample.js
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
import {
ImageResource,
ImageInfo,
} from "@dynamicpdf/api"
// https://cloud.dynamicpdf.com/docs/tutorials/cloud-api/image-info/tutorial-image-info
export class ImageInfoExample {
static async Run() {
var basePath = "C:/temp/dynamicpdf-api-usersguide-examples/";
var apiKey = "DP.xxx-api-key-xxx";
await ImageInfoExample.RunOne(apiKey, basePath);
await ImageInfoExample.RunTwo(apiKey, basePath);
}
static async RunOne(apiKey, basePath) {
var imageResource = new ImageResource(basePath + "getting-started.png");
var imageInfo = new ImageInfo(imageResource);
imageInfo.apiKey = apiKey;
var response = await imageInfo.process();
if (response.isSuccessful) {
console.log(JSON.parse(response.content));
}
}
static async RunTwo(apiKey, basePath)
{
var imageResource = new ImageResource(basePath + "multipage.tiff");
var imageInfo = new ImageInfo(imageResource);
imageInfo.apiKey = apiKey;
var response = await imageInfo.process();
if (response.isSuccessful) {
console.log(JSON.parse(response.content));
}
}
}
await ImageInfoExample.Run();