Skip to content

Commit 1f4ad77

Browse files
Aspose.PDF for Rust via C++ 25.11
1 parent 9299fff commit 1f4ad77

21 files changed

+406
-27
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "asposepdf"
3-
version = "1.25.10"
3+
version = "1.25.11"
44
edition = "2021"
55
license = "MIT"
66
description = "Aspose.PDF for Rust via C++ is a powerful toolkit that allows developers to manipulate PDF files directly and helps do various tasks for PDF. Contains unique features for converting PDF to other formats."

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,22 @@ Contains unique features for converting PDF to other formats.
1818
Add, insert, delete, and count pages in a document.
1919

2020
- **Document-level operations**
21-
- `optimize`, `optimize_resource`, `grayscale`, `rotate`, `set_background`, `repair`
22-
Optimize PDF-document layout and resources, convert to grayscale, rotate pages, set background, and repair corrupted documents.
23-
- `replace_text`, `add_page_num`, `add_text_header`, `add_text_footer`, `flatten`
24-
Replace text, add page numbers, insert custom text in the header or footer, and flatten PDF-document.
25-
- `remove_annotations`, `remove_attachments`, `remove_blank_pages`, `remove_bookmarks`, `remove_hidden_text`, `remove_images`, `remove_tables`, `remove_javascripts`
26-
Remove annotations, attachments, blank pages, bookmarks, hidden text, images, tables, and embedded JavaScript code.
21+
- `optimize`, `optimize_resource`, `optimize_file_size`, `grayscale`, `flatten`, `rotate`, `set_background`, `repair`
22+
Optimize PDF-document layout, size and resources, convert to grayscale, flatten, rotate pages, set background, and repair corrupted documents.
23+
- `replace_text`, `add_page_num`, `add_text_header`, `add_text_footer`, `add_watermark`
24+
Replace text, add page numbers, insert custom text in the header or footer, and add watermark.
25+
- `remove_annotations`, `remove_attachments`, `remove_blank_pages`, `remove_bookmarks`, `remove_hidden_text`, `remove_images`, `remove_tables`, `remove_watermarks`, `remove_javascripts`
26+
Remove annotations, attachments, blank pages, bookmarks, hidden text, images, tables, watermark, and embedded JavaScript code.
27+
- `embed_fonts`, `unembed_fonts`
28+
Embed and unembed fonts a PDF-document.
2729

2830
- **Page-level operations**
29-
- `rotate`, `set_size`, `grayscale`, `add_text`
30-
Rotate individual pages, set page size, convert pages to grayscale, and add text.
31+
- `page_rotate`, `page_set_size`, `page_grayscale`, `page_add_text`, `page_add_watermark`
32+
Rotate individual pages, set page size, convert pages to grayscale, add text, and add watermark.
3133
- `page_replace_text`, `page_add_page_num`, `page_add_text_header`, `page_add_text_footer`
3234
Replace text on a specific page, add page number to a page, and insert custom text in the header or footer of a page.
33-
- `page_remove_annotations`, `page_remove_hidden_text`, `page_remove_images`, `page_remove_tables`
34-
Remove annotations, hidden text, images and tables on a specific page.
35+
- `page_remove_annotations`, `page_remove_hidden_text`, `page_remove_images`, `page_remove_tables`, `page_remove_watermarks`
36+
Remove annotations, hidden text, images, tables and watermarks on a specific page.
3537

3638
- **Content extraction**
3739
- `extract_text`, `bytes`

examples/add_watermark.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use asposepdf::Document;
2+
3+
fn main() -> Result<(), Box<dyn std::error::Error>> {
4+
// Open a PDF-document with filename
5+
let pdf = Document::open("sample.pdf")?;
6+
7+
// Add watermark to PDF-document
8+
pdf.add_watermark(
9+
"WATERMARK",
10+
"Arial",
11+
16.0,
12+
"#010101",
13+
100,
14+
100,
15+
45,
16+
true,
17+
0.5,
18+
)?;
19+
20+
// Save the previously opened PDF-document with new filename
21+
pdf.save_as("sample_add_watermark.pdf")?;
22+
23+
Ok(())
24+
}

examples/embed_fonts.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use asposepdf::Document;
2+
3+
fn main() -> Result<(), Box<dyn std::error::Error>> {
4+
// Open a PDF-document with filename
5+
let pdf = Document::open("sample.pdf")?;
6+
7+
// Embed fonts a PDF-document
8+
pdf.embed_fonts()?;
9+
10+
// Save the previously opened PDF-document with new filename
11+
pdf.save_as("sample_embed_fonts.pdf")?;
12+
13+
Ok(())
14+
}

examples/optimize_file_size.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use asposepdf::Document;
2+
3+
fn main() -> Result<(), Box<dyn std::error::Error>> {
4+
// Open a PDF-document with filename
5+
let pdf = Document::open("sample.pdf")?;
6+
7+
// Optimize size of PDF-document with image compression quality
8+
pdf.optimize_file_size(50)?;
9+
10+
// Save the previously opened PDF-document with new filename
11+
pdf.save_as("sample_optimize_file_size.pdf")?;
12+
13+
Ok(())
14+
}

examples/page_add_watermark.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use asposepdf::Document;
2+
3+
fn main() -> Result<(), Box<dyn std::error::Error>> {
4+
// Open a PDF-document with filename
5+
let pdf = Document::open("sample.pdf")?;
6+
7+
// Add watermark on page
8+
pdf.page_add_watermark(
9+
1,
10+
"WATERMARK",
11+
"Arial",
12+
16.0,
13+
"#010101",
14+
100,
15+
100,
16+
45,
17+
true,
18+
0.5,
19+
)?;
20+
21+
// Save the previously opened PDF-document with new filename
22+
pdf.save_as("sample_page1_add_watermark.pdf")?;
23+
24+
Ok(())
25+
}

examples/page_remove_watermarks.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use asposepdf::Document;
2+
3+
fn main() -> Result<(), Box<dyn std::error::Error>> {
4+
// Open a PDF-document from file
5+
let pdf = Document::open("sample.pdf")?;
6+
7+
// Remove watermarks in page
8+
pdf.page_remove_watermarks(1)?;
9+
10+
// Save the previously opened PDF-document with new filename
11+
pdf.save_as("sample_page1_remove_watermarks.pdf")?;
12+
13+
Ok(())
14+
}

examples/remove_watermarks.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use asposepdf::Document;
2+
3+
fn main() -> Result<(), Box<dyn std::error::Error>> {
4+
// Open a PDF-document with filename
5+
let pdf = Document::open("sample.pdf")?;
6+
7+
// Remove watermarks from PDF-document
8+
pdf.remove_watermarks()?;
9+
10+
// Save the previously opened PDF-document with new filename
11+
pdf.save_as("sample_remove_watermarks.pdf")?;
12+
13+
Ok(())
14+
}

0 commit comments

Comments
 (0)