Skip to content

Commit e085727

Browse files
Aspose.PDF for Rust via C++: flatten, remove_annotations, remove_attachments, remove_blank_pages, remove_bookmarks, remove_hidden_text, remove_images, remove_javascripts
1 parent 8acb540 commit e085727

File tree

10 files changed

+336
-0
lines changed

10 files changed

+336
-0
lines changed

english/rust-cpp/_index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ pub struct Document { /* private fields */ }
6565
| [add_page_num](./organize/add_page_num/) | Add page number to a PDF-document |
6666
| [add_text_header](./organize/add_text_header/) | Add text in Header of a PDF-document |
6767
| [add_text_footer](./organize/add_text_footer/) | Add text in Footer of a PDF-document |
68+
| [flatten](./organize/flatten/) | Flatten PDF-document |
69+
| [remove_annotations](./organize/remove_annotations/) | Remove annotations from PDF-document |
70+
| [remove_attachments](./organize/remove_attachments/) | Remove attachments from PDF-document |
71+
| [remove_blank_pages](./organize/remove_blank_pages/) | Remove blank pages from PDF-document |
72+
| [remove_bookmarks](./organize/remove_bookmarks/) | Remove bookmarks from PDF-document |
73+
| [remove_hidden_text](./organize/remove_hidden_text/) | Remove hidden text from PDF-document |
74+
| [remove_images](./organize/remove_images/) | Remove images from PDF-document |
75+
| [remove_javascripts](./organize/remove_javascripts/) | Remove java scripts from PDF-document |
6876
| [page_rotate](./organize/page_rotate/) | Rotate a page in the PDF-document. |
6977
| [page_set_size](./organize/page_set_size/) | Set the size of a page in the PDF-document. |
7078
| [page_grayscale](./organize/page_grayscale/) | Convert page to black and white. |

english/rust-cpp/organize/_index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ url: /rust-cpp/organize/
2020
| [add_page_num](./add_page_num/) | Add page number to a PDF-document |
2121
| [add_text_header](./add_text_header/) | Add text in Header of a PDF-document |
2222
| [add_text_footer](./add_text_footer/) | Add text in Footer of a PDF-document |
23+
| [flatten](./flatten/) | Flatten PDF-document |
24+
| [remove_annotations](./remove_annotations/) | Remove annotations from PDF-document |
25+
| [remove_attachments](./remove_attachments/) | Remove attachments from PDF-document |
26+
| [remove_blank_pages](./remove_blank_pages/) | Remove blank pages from PDF-document |
27+
| [remove_bookmarks](./remove_bookmarks/) | Remove bookmarks from PDF-document |
28+
| [remove_hidden_text](./remove_hidden_text/) | Remove hidden text from PDF-document |
29+
| [remove_images](./remove_images/) | Remove images from PDF-document |
30+
| [remove_javascripts](./remove_javascripts/) | Remove java scripts from PDF-document |
2331
| [page_rotate](./page_rotate/) | Rotate a page in the PDF-document. |
2432
| [page_set_size](./page_set_size/) | Set the size of a page in the PDF-document. |
2533
| [page_grayscale](./page_grayscale/) | Convert page to black and white. |
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "flatten"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Flattens PDF-document."
5+
type: docs
6+
url: /rust-cpp/organize/flatten/
7+
---
8+
9+
_Flattens PDF-document._
10+
11+
```rust
12+
pub fn flatten(&self) -> Result<(), PdfError>
13+
```
14+
15+
**Arguments**
16+
17+
18+
**Returns**
19+
* **Ok(())** - if the operation succeeds
20+
* **Err(PdfError)** - if the operation fails
21+
22+
**Example**
23+
24+
```rust
25+
use asposepdf::Document;
26+
27+
fn main() -> Result<(), Box<dyn std::error::Error>> {
28+
// Open a PDF-document with filename
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Return the PDF-document contents as plain text
32+
let txt = pdf.extract_text()?;
33+
34+
// Print extracted text
35+
println!("Extracted text:\n{}", txt);
36+
37+
Ok(())
38+
}
39+
40+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "remove_annotations"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Removes annotations from PDF-document."
5+
type: docs
6+
url: /rust-cpp/organize/remove_annotations/
7+
---
8+
9+
_Removes annotations from PDF-document._
10+
11+
```rust
12+
pub fn remove_annotations(&self) -> Result<(), PdfError>
13+
```
14+
15+
**Arguments**
16+
17+
18+
**Returns**
19+
* **Ok(())** - if the operation succeeds
20+
* **Err(PdfError)** - if the operation fails
21+
22+
**Example**
23+
24+
```rust
25+
use asposepdf::Document;
26+
27+
fn main() -> Result<(), Box<dyn std::error::Error>> {
28+
// Open a PDF-document with filename
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Remove annotations from PDF-document
32+
pdf.remove_annotations()?;
33+
34+
// Save the previously opened PDF-document with new filename
35+
pdf.save_as("sample_remove_annotations.pdf")?;
36+
37+
Ok(())
38+
}
39+
40+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "remove_attachments"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Removes attachments from PDF-document."
5+
type: docs
6+
url: /rust-cpp/organize/remove_attachments/
7+
---
8+
9+
_Removes attachments from PDF-document._
10+
11+
```rust
12+
pub fn remove_attachments(&self) -> Result<(), PdfError>
13+
```
14+
15+
**Arguments**
16+
17+
18+
**Returns**
19+
* **Ok(())** - if the operation succeeds
20+
* **Err(PdfError)** - if the operation fails
21+
22+
**Example**
23+
24+
```rust
25+
use asposepdf::Document;
26+
27+
fn main() -> Result<(), Box<dyn std::error::Error>> {
28+
// Open a PDF-document with filename
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Remove attachments from PDF-document
32+
pdf.remove_attachments()?;
33+
34+
// Save the previously opened PDF-document with new filename
35+
pdf.save_as("sample_remove_attachments.pdf")?;
36+
37+
Ok(())
38+
}
39+
40+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "remove_blank_pages"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Removes blank pages from PDF-document."
5+
type: docs
6+
url: /rust-cpp/organize/remove_blank_pages/
7+
---
8+
9+
_Removes blank pages from PDF-document._
10+
11+
```rust
12+
pub fn remove_blank_pages(&self) -> Result<(), PdfError>
13+
```
14+
15+
**Arguments**
16+
17+
18+
**Returns**
19+
* **Ok(())** - if the operation succeeds
20+
* **Err(PdfError)** - if the operation fails
21+
22+
**Example**
23+
24+
```rust
25+
use asposepdf::Document;
26+
27+
fn main() -> Result<(), Box<dyn std::error::Error>> {
28+
// Open a PDF-document with filename
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Remove blank pages from PDF-document
32+
pdf.remove_blank_pages()?;
33+
34+
// Save the previously opened PDF-document with new filename
35+
pdf.save_as("sample_remove_blank_pages.pdf")?;
36+
37+
Ok(())
38+
}
39+
40+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "remove_bookmarks"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Removes bookmarks from PDF-document."
5+
type: docs
6+
url: /rust-cpp/organize/remove_bookmarks/
7+
---
8+
9+
_Removes bookmarks from PDF-document._
10+
11+
```rust
12+
pub fn remove_bookmarks(&self) -> Result<(), PdfError>
13+
```
14+
15+
**Arguments**
16+
17+
18+
**Returns**
19+
* **Ok(())** - if the operation succeeds
20+
* **Err(PdfError)** - if the operation fails
21+
22+
**Example**
23+
24+
```rust
25+
use asposepdf::Document;
26+
27+
fn main() -> Result<(), Box<dyn std::error::Error>> {
28+
// Open a PDF-document with filename
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Remove bookmarks from PDF-document
32+
pdf.remove_bookmarks()?;
33+
34+
// Save the previously opened PDF-document with new filename
35+
pdf.save_as("sample_remove_bookmarks.pdf")?;
36+
37+
Ok(())
38+
}
39+
40+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "remove_hidden_text"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Removes hidden text from PDF-document."
5+
type: docs
6+
url: /rust-cpp/organize/remove_hidden_text/
7+
---
8+
9+
_Removes hidden text from PDF-document._
10+
11+
```rust
12+
pub fn remove_hidden_text(&self) -> Result<(), PdfError>
13+
```
14+
15+
**Arguments**
16+
17+
18+
**Returns**
19+
* **Ok(())** - if the operation succeeds
20+
* **Err(PdfError)** - if the operation fails
21+
22+
**Example**
23+
24+
```rust
25+
use asposepdf::Document;
26+
27+
fn main() -> Result<(), Box<dyn std::error::Error>> {
28+
// Open a PDF-document with filename
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Remove hidden text from PDF-document
32+
pdf.remove_hidden_text()?;
33+
34+
// Save the previously opened PDF-document with new filename
35+
pdf.save_as("sample_remove_hidden_text.pdf")?;
36+
37+
Ok(())
38+
}
39+
40+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "remove_images"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Removes images from PDF-document."
5+
type: docs
6+
url: /rust-cpp/organize/remove_images/
7+
---
8+
9+
_Removes images from PDF-document._
10+
11+
```rust
12+
pub fn remove_images(&self) -> Result<(), PdfError>
13+
```
14+
15+
**Arguments**
16+
17+
18+
**Returns**
19+
* **Ok(())** - if the operation succeeds
20+
* **Err(PdfError)** - if the operation fails
21+
22+
**Example**
23+
24+
```rust
25+
use asposepdf::Document;
26+
27+
fn main() -> Result<(), Box<dyn std::error::Error>> {
28+
// Open a PDF-document with filename
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Remove images from PDF-document
32+
pdf.remove_images()?;
33+
34+
// Save the previously opened PDF-document with new filename
35+
pdf.save_as("sample_remove_images.pdf")?;
36+
37+
Ok(())
38+
}
39+
40+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "remove_javascripts"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Removes java scripts from PDF-document."
5+
type: docs
6+
url: /rust-cpp/organize/remove_javascripts/
7+
---
8+
9+
_Removes java scripts from PDF-document._
10+
11+
```rust
12+
pub fn remove_javascripts(&self) -> Result<(), PdfError>
13+
```
14+
15+
**Arguments**
16+
17+
18+
**Returns**
19+
* **Ok(())** - if the operation succeeds
20+
* **Err(PdfError)** - if the operation fails
21+
22+
**Example**
23+
24+
```rust
25+
use asposepdf::Document;
26+
27+
fn main() -> Result<(), Box<dyn std::error::Error>> {
28+
// Open a PDF-document with filename
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Remove java scripts from PDF-document
32+
pdf.remove_javascripts()?;
33+
34+
// Save the previously opened PDF-document with new filename
35+
pdf.save_as("sample_remove_javascripts.pdf")?;
36+
37+
Ok(())
38+
}
39+
40+
```

0 commit comments

Comments
 (0)