Skip to content

Commit

Permalink
compress and extract pages functions
Browse files Browse the repository at this point in the history
  • Loading branch information
apexdodge committed Feb 27, 2023
1 parent 81ba62b commit 60ff019
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,25 @@ a2pClient.pdfsharpAddPassword(url, userpassword).then(function(result) {
console.log(result);
});
```

**Compress existing PDF**
```
var url = 'https://LINK-TO-PDF';
a2pClient.pdfsharpCompress(url).then(function(result) {
console.log(result);
});
```

**Extract pages from existing PDF**
```
var url = 'https://LINK-TO-PDF';
var start = "2";
var end = null;
a2pClient.pdfsharpExtractPages(url, start, end).then(function(result) {
console.log(result);
});
```

---

## <a name="helpers"></a>Helper Methods
Expand Down
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ module.exports = class Api2Pdf {
return this._makeRequest("/pdfsharp/compress", payload)
}

pdfsharpExtractPages(url, start = null, end = null, options = null) {
var payload = this._createBaseOptions(options)
payload['url'] = url
if (start != null) {
payload['start'] = start
}
if (end != null) {
payload['end'] = end
}
}

pdfsharpAddBookmarks(url, bookmarks, options = null) {
var payload = this._createBaseOptions(options)
payload['url'] = url
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api2pdf",
"version": "2.0.2",
"version": "2.0.3",
"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",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 60ff019

Please sign in to comment.