Skip to content

Commit 60ff019

Browse files
committed
compress and extract pages functions
1 parent 81ba62b commit 60ff019

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,25 @@ a2pClient.pdfsharpAddPassword(url, userpassword).then(function(result) {
287287
console.log(result);
288288
});
289289
```
290+
291+
**Compress existing PDF**
292+
```
293+
var url = 'https://LINK-TO-PDF';
294+
a2pClient.pdfsharpCompress(url).then(function(result) {
295+
console.log(result);
296+
});
297+
```
298+
299+
**Extract pages from existing PDF**
300+
```
301+
var url = 'https://LINK-TO-PDF';
302+
var start = "2";
303+
var end = null;
304+
a2pClient.pdfsharpExtractPages(url, start, end).then(function(result) {
305+
console.log(result);
306+
});
307+
```
308+
290309
---
291310

292311
## <a name="helpers"></a>Helper Methods

index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ module.exports = class Api2Pdf {
8888
return this._makeRequest("/pdfsharp/compress", payload)
8989
}
9090

91+
pdfsharpExtractPages(url, start = null, end = null, options = null) {
92+
var payload = this._createBaseOptions(options)
93+
payload['url'] = url
94+
if (start != null) {
95+
payload['start'] = start
96+
}
97+
if (end != null) {
98+
payload['end'] = end
99+
}
100+
}
101+
91102
pdfsharpAddBookmarks(url, bookmarks, options = null) {
92103
var payload = this._createBaseOptions(options)
93104
payload['url'] = url

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "api2pdf",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "This client library is a wrapper for the Api2Pdf.com REST API. See full REST api documentation at https://www.api2pdf.com/documentation/v2. Api2Pdf is a powerful API that supports HTML to PDF, URL to PDF, HTML to Image, URL to Image, Thumbnail / image preview of an Office file, Office files (Word to PDF), HTML to Docx, HTML to excel, PDF to HTML, merge PDFs together, add bookmarks to PDFs, add passwords to PDFs",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)