Skip to content

Commit 82f8f05

Browse files
Aspose.PDF for Rust via C++: word_count, character_count, page_word_count, page_character_count, page_is_blank, remove_tables, page_remove_tables
1 parent 542910e commit 82f8f05

File tree

10 files changed

+306
-0
lines changed

10 files changed

+306
-0
lines changed

english/rust-cpp/_index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub struct Document { /* private fields */ }
7474
| [remove_hidden_text](./organize/remove_hidden_text/) | Remove hidden text from PDF-document |
7575
| [remove_images](./organize/remove_images/) | Remove images from PDF-document |
7676
| [remove_javascripts](./organize/remove_javascripts/) | Remove java scripts from PDF-document |
77+
| [remove_tables](./organize/remove_tables/) | Remove tables from a PDF-document. |
7778
| [page_rotate](./organize/page_rotate/) | Rotate a page in the PDF-document. |
7879
| [page_set_size](./organize/page_set_size/) | Set the size of a page in the PDF-document. |
7980
| [page_grayscale](./organize/page_grayscale/) | Convert page to black and white. |
@@ -85,6 +86,7 @@ pub struct Document { /* private fields */ }
8586
| [page_remove_annotations](./organize/page_remove_annotations/) | Remove annotations in page. |
8687
| [page_remove_hidden_text](./organize/page_remove_hidden_text/) | Remove hidden text in page. |
8788
| [page_remove_images](./organize/page_remove_images/) | Remove images in page. |
89+
| [page_remove_tables](./organize/page_remove_tables/) | Remove tables in page. |
8890

8991

9092
## Core PDF functions
@@ -97,10 +99,15 @@ pub struct Document { /* private fields */ }
9799
| [save_as](./core/save_as/) | Save the previously opened PDF-document with new filename. |
98100
| [set_license](./core/set_license/) | Set license with filename. |
99101
| [extract_text](./core/extract_text/) | Return the PDF-document contents as plain text. |
102+
| [word_count](./core/word_count/) | Return word count in PDF-document. |
103+
| [character_count](./core/character_count/) | Return character count in PDF-document. |
100104
| [page_add](./core/page_add/) | Add new page in PDF-document. |
101105
| [page_insert](./core/page_insert/) | Insert new page at the specified position in PDF-document. |
102106
| [page_delete](./core/page_delete/) | Delete specified page in PDF-document. |
103107
| [page_count](./core/page_count/) | Return the number of pages in the PDF-document. |
108+
| [page_word_count](./core/page_word_count/) | Return word count on specified page in PDF-document. |
109+
| [page_character_count](./core/page_character_count/) | Return character count on specified page in PDF-document. |
110+
| [page_is_blank](./core/page_is_blank/) | Return page is blank in PDF-document. |
104111

105112

106113
## Miscellaneous

english/rust-cpp/core/_index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ url: /rust-cpp/core/
1616
| [save_as](./save_as/) | Save the previously opened PDF-document with new filename. |
1717
| [set_license](./set_license/) | Set license with filename. |
1818
| [extract_text](./extract_text/) | Return the PDF-document contents as plain text. |
19+
| [word_count](./word_count/) | Return word count in PDF-document. |
20+
| [character_count](./character_count/) | Return character count in PDF-document. |
1921
| [page_add](./page_add/) | Add new page in PDF-document. |
2022
| [page_insert](./page_insert/) | Insert new page at the specified position in PDF-document. |
2123
| [page_delete](./page_delete/) | Delete specified page in PDF-document. |
2224
| [page_count](./page_count/) | Return the number of pages in the PDF-document. |
25+
| [page_word_count](./page_word_count/) | Return word count on specified page in PDF-document. |
26+
| [page_character_count](./page_character_count/) | Return character count on specified page in PDF-document. |
27+
| [page_is_blank](./page_is_blank/) | Return page is blank in PDF-document. |
2328

2429

2530
## Detailed Description
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "character_count"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Returns character count in PDF-document."
5+
type: docs
6+
url: /rust-cpp/core/character_count/
7+
---
8+
9+
_Returns character count in PDF-document._
10+
11+
```rust
12+
pub fn character_count(&self) -> Result<i32, PdfError>
13+
```
14+
15+
**Arguments**
16+
17+
18+
**Returns**
19+
* **Ok(i32)** - 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 from file
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Return character count in PDF-document
32+
let count = pdf.character_count()?;
33+
34+
// Print the character count
35+
println!("Character count: {}", count);
36+
37+
Ok(())
38+
}
39+
40+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "page_character_count"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Returns character count on specified page in PDF-document."
5+
type: docs
6+
url: /rust-cpp/core/page_character_count/
7+
---
8+
9+
_Returns character count on specified page in PDF-document._
10+
11+
```rust
12+
pub fn page_character_count(&self) -> Result<i32, PdfError>
13+
```
14+
15+
**Arguments**
16+
* **num** - the page number (1-based)
17+
18+
19+
**Returns**
20+
* **Ok(i32)** - if the operation succeeds
21+
* **Err(PdfError)** - if the operation fails
22+
23+
**Example**
24+
25+
```rust
26+
use asposepdf::Document;
27+
28+
fn main() -> Result<(), Box<dyn std::error::Error>> {
29+
// Open a PDF-document from file
30+
let pdf = Document::open("sample.pdf")?;
31+
32+
// Specify the page number (1-based index)
33+
let page_number = 1;
34+
35+
// Return character count on the specified page
36+
let count = pdf.page_character_count(page_number)?;
37+
38+
// Print the character count
39+
println!("Character count on page {}: {}", page_number, count);
40+
41+
Ok(())
42+
}
43+
44+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "page_is_blank"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Returns page is blank in PDF-document."
5+
type: docs
6+
url: /rust-cpp/core/page_is_blank/
7+
---
8+
9+
_Returns page is blank in PDF-document._
10+
11+
```rust
12+
pub fn page_is_blank(&self) -> Result<bool, PdfError>
13+
```
14+
15+
**Arguments**
16+
* **num** - the page number (1-based)
17+
18+
19+
**Returns**
20+
* **Ok(bool)** - if the operation succeeds
21+
* **Err(PdfError)** - if the operation fails
22+
23+
**Example**
24+
25+
```rust
26+
use asposepdf::Document;
27+
28+
fn main() -> Result<(), Box<dyn std::error::Error>> {
29+
// Open a PDF-document from file
30+
let pdf = Document::open("sample.pdf")?;
31+
32+
// Specify the page number (1-based index)
33+
let page_number = 1;
34+
35+
// Return page is blank in PDF-document
36+
let is_blank = pdf.page_is_blank(page_number)?;
37+
38+
// Print if the specified page is blank
39+
println!("Is page {} blank? {}", page_number, is_blank);
40+
41+
Ok(())
42+
}
43+
44+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "page_word_count"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Returns word count on specified page in PDF-document."
5+
type: docs
6+
url: /rust-cpp/core/page_word_count/
7+
---
8+
9+
_Returns word count on specified page in PDF-document._
10+
11+
```rust
12+
pub fn page_word_count(&self) -> Result<i32, PdfError>
13+
```
14+
15+
**Arguments**
16+
* **num** - the page number (1-based)
17+
18+
19+
**Returns**
20+
* **Ok(i32)** - if the operation succeeds
21+
* **Err(PdfError)** - if the operation fails
22+
23+
**Example**
24+
25+
```rust
26+
use asposepdf::Document;
27+
28+
fn main() -> Result<(), Box<dyn std::error::Error>> {
29+
// Open a PDF-document from file
30+
let pdf = Document::open("sample.pdf")?;
31+
32+
// Specify the page number (1-based index)
33+
let page_number = 1;
34+
35+
// Return word count on the specified page
36+
let count = pdf.page_word_count(page_number)?;
37+
38+
// Print the word count
39+
println!("Word count on page {}: {}", page_number, count);
40+
41+
Ok(())
42+
}
43+
44+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "word_count"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Returns word count in PDF-document."
5+
type: docs
6+
url: /rust-cpp/core/word_count/
7+
---
8+
9+
_Returns word count in PDF-document._
10+
11+
```rust
12+
pub fn word_count(&self) -> Result<i32, PdfError>
13+
```
14+
15+
**Arguments**
16+
17+
18+
**Returns**
19+
* **Ok(i32)** - 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 from file
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Return word count in PDF-document
32+
let count = pdf.word_count()?;
33+
34+
// Print the word count
35+
println!("Word count: {}", count);
36+
37+
Ok(())
38+
}
39+
40+
```

english/rust-cpp/organize/_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ url: /rust-cpp/organize/
2828
| [remove_hidden_text](./remove_hidden_text/) | Remove hidden text from PDF-document |
2929
| [remove_images](./remove_images/) | Remove images from PDF-document |
3030
| [remove_javascripts](./remove_javascripts/) | Remove java scripts from PDF-document |
31+
| [remove_tables](./remove_tables/) | Remove tables from a PDF-document. |
3132
| [page_rotate](./page_rotate/) | Rotate a page in the PDF-document. |
3233
| [page_set_size](./page_set_size/) | Set the size of a page in the PDF-document. |
3334
| [page_grayscale](./page_grayscale/) | Convert page to black and white. |
@@ -39,6 +40,7 @@ url: /rust-cpp/organize/
3940
| [page_remove_annotations](./page_remove_annotations/) | Remove annotations in page. |
4041
| [page_remove_hidden_text](./page_remove_hidden_text/) | Remove hidden text in page. |
4142
| [page_remove_images](./page_remove_images/) | Remove images in page. |
43+
| [page_remove_tables](./page_remove_tables/) | Remove tables in page. |
4244

4345

4446
## Detailed Description
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "page_remove_tables"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Removes tables in page."
5+
type: docs
6+
url: /rust-cpp/organize/page_remove_tables/
7+
---
8+
9+
_Removes tables in page._
10+
11+
```rust
12+
pub fn page_remove_tables(&self, num: i32) -> Result<(), PdfError>
13+
```
14+
15+
**Arguments**
16+
* **num** - the page number (1-based)
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 from file
29+
let pdf = Document::open("sample.pdf")?;
30+
31+
// Remove tables in page
32+
pdf.page_remove_tables(1)?;
33+
34+
// Save the previously opened PDF-document with new filename
35+
pdf.save_as("sample_page1_remove_tables.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_tables"
3+
second_title: Aspose.PDF for Rust via C++
4+
description: "Removes tables from PDF-document."
5+
type: docs
6+
url: /rust-cpp/organize/remove_tables/
7+
---
8+
9+
_Removes tables from PDF-document._
10+
11+
```rust
12+
pub fn remove_tables(&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 tables from PDF-document
32+
pdf.remove_tables()?;
33+
34+
// Save the previously opened PDF-document with new filename
35+
pdf.save_as("sample_remove_tables.pdf")?;
36+
37+
Ok(())
38+
}
39+
40+
```

0 commit comments

Comments
 (0)