1
+ // 1. Load your Application Secret and Key from the JSON file or set credentials in another way
2
+ // 2. Create an object to connect to the Pdf.Cloud API
3
+ // 3. Upload your document file
4
+ // 4. Perform the retreiving image Id from Pdf document using getIimages() function
5
+ // 5. Perform the reading image from Pdf document using getImage() function and image ID value
6
+ // 6. Check result and perform some actions with result.body object
7
+ // 7. Perform extrating image in Png format from Pdf document into local folder using putImageExtractAsPng() function and image ID value
8
+ // 8. Check result and perform some actions with result.body object
9
+ // All values of variables starting with "YOUR_****" should be replaced by real user values
10
+
11
+
12
+ var PdfApi = require ( 'asposepdfcloud' ) ;
13
+
14
+ var configProps = require ( 'YOUR_CONFIG_FFOLDER/YOUR_CONFIG.json' ) ;
15
+
16
+ var AppSID = configProps . app_sid ;
17
+ var AppKey = configProps . api_key ;
18
+ var config = { 'appSid' : AppSID , 'apiKey' : AppKey , 'debug' : true } ;
19
+
20
+ pdfApi = new PdfApi ( AppSID , AppKey ) ;
21
+
22
+ let fileName = "YOUR_PDF_DOCUMENT.pdf" ;
23
+
24
+ let resultImageId = await pdfApi . getImages ( fileName , 1 , null , null ) ;
25
+ const imageID = resultImageId . body . images . list [ 0 ] . id ;
26
+
27
+ let resultImage = await pdfApi . getImage ( fileName , imageID , null , null ) ;
28
+
29
+ console . log ( resultImage . response ) ;
30
+
31
+ console . log ( resultImage . body ) ;
32
+
33
+ let extractResult = await pdfApi . putImageExtractAsPng ( fileName , imageID , 512 , 512 , null , null , 'YOUR_DESTINATION_FOLDER' ) ;
34
+
35
+ console . log ( extractResult . response ) ;
36
+
37
+ console . log ( extractResult . body ) ;
0 commit comments