Skip to content

Commit 30ee285

Browse files
Aspose.PDF for Rust via C++ 25.9
1 parent 1f41ced commit 30ee285

30 files changed

+516
-13
lines changed

.cargoignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/lib/*.dll.bz2
2+
/lib/*.dll.bz2.sha256
3+
/lib/*.so.bz2
4+
/lib/*.so.bz2.sha256
5+
/lib/*.dylib.bz2
6+
/lib/*.dylib.bz2.sha256
7+
/lib/*.lib
8+
/lib/*.dll
9+
/lib/*.so
10+
/lib/*.dylib
11+
/target

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "asposepdf"
3-
version = "1.25.8"
3+
version = "1.25.9"
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."
@@ -20,11 +20,12 @@ categories = [
2020
"external-ffi-bindings",
2121
"text-processing",
2222
"graphics",
23-
"document-processing"
23+
"encoding"
2424
]
25-
exclude = ["/lib/*", "/target/*"]
2625

2726
[dependencies]
27+
serde = { version = "1.0", features = ["derive"] }
28+
serde_json = "1.0"
2829

2930
[build-dependencies]
3031
bzip2 = "0.4"

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Aspose.PDF for Rust via C++
1+
# Aspose.PDF for Rust via C++
22

33
The package asposepdf is a powerful toolkit that allows developers to manipulate PDF files directly and helps do various tasks for PDF.
44
Contains unique features for converting PDF to other formats.
@@ -18,14 +18,18 @@ Contains unique features for converting PDF to other formats.
1818
- **Document-level operations**
1919
- `optimize`, `optimize_resource`, `grayscale`, `rotate`, `set_background`, `repair`
2020
Optimize PDF layout and resources, convert to grayscale, rotate pages, set background, and repair corrupted documents.
21-
- `replace_text`, `add_page_num`, `add_text_header`, `add_text_footer`
22-
Replace text, add page numbers, and insert custom text in the header or footer of the document.
21+
- `replace_text`, `add_page_num`, `add_text_header`, `add_text_footer`, `flatten`
22+
Replace text, add page numbers, insert custom text in the header or footer, and flatten PDF-document.
23+
- `remove_annotations`, `remove_attachments`, `remove_blank_pages`, `remove_bookmarks`, `remove_hidden_text`, `remove_images`, `remove_javascripts`
24+
Remove annotations, attachments, blank pages, bookmarks, hidden text, images, and embedded JavaScript code.
2325

2426
- **Page-level operations**
2527
- `rotate`, `set_size`, `grayscale`, `add_text`
2628
Rotate individual pages, set page size, convert pages to grayscale, and add text.
2729
- `page_replace_text`, `page_add_page_num`, `page_add_text_header`, `page_add_text_footer`
2830
Replace text on a specific page, add page number to a page, and insert custom text in the header or footer of a page.
31+
- `page_remove_annotations`, `page_remove_hidden_text`, `page_remove_images`
32+
Remove annotations, hidden text, and images on a specific page.
2933

3034
- **Content extraction**
3135
- `extract_text`
@@ -43,7 +47,13 @@ Contains unique features for converting PDF to other formats.
4347
- **PDFs:**
4448
- `N-UP`, `BOOKLET`
4549
- **Others:**
46-
- `EPUB`, `DICOM`, `SVG`, `XPS`, `TEX`, `TXT`, `MARKDOWN`
50+
- `EPUB`, `DICOM`, `SVG`, `SVG(ZIP)`, `XPS`, `TEX`, `TXT`, `MARKDOWN`
51+
52+
### Metadata
53+
54+
- **Product Info:**
55+
- `about`
56+
Return metadata information about the Aspose.PDF for Rust via C++ with product name, version, release date, and license status.
4757

4858
## Platforms
4959

@@ -125,7 +135,7 @@ This package includes precompiled native libraries (`.dll`, `.so`, `.dylib`) whi
125135
2. **Build** your project (`cargo build`). On the first build, the appropriate dynamic library for your platform will be automatically unpacked from the `.bz2` archive in the `lib` folder. This may cause a short delay.
126136
127137
> **Notes**
128-
> - You do not need to manually download or extract any files — everything is included in the GitHub repository.
138+
> - You do not need to manually download or extract any files — everything is included in the GitHub repository.
129139
> - All `.bz2` archives have matching `.sha256` checksum files. The checksum is verified before unpacking.
130140
> - If the checksum verification fails or the archive is missing, the build will fail with a detailed error.
131141
> - The build script links the appropriate native library and ensures runtime availability using platform-specific options.
@@ -318,4 +328,4 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
318328
}
319329
```
320330
321-
[Home](https://www.aspose.com/) | [Product Page](https://products.aspose.com/pdf/rust-cpp/) | [Docs](https://docs.aspose.com/pdf/rust-cpp/) | [GitHub](https://github.com/aspose-pdf/aspose-pdf-rust-cpp) | [Examples](https://github.com/aspose-pdf/aspose-pdf-rust-cpp/tree/main/examples) | [API Reference](https://reference.aspose.com/pdf/rust-cpp/) | [Blog](https://blog.aspose.com/category/pdf/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/pdf) | [Temporary License](https://purchase.aspose.com/temporary-license)
331+
[Home](https://www.aspose.com/) | [Product Page](https://products.aspose.com/pdf/rust-cpp/) | [Docs](https://docs.aspose.com/pdf/rust-cpp/) | [GitHub](https://github.com/aspose-pdf/aspose-pdf-rust-cpp) | [Examples](https://github.com/aspose-pdf/aspose-pdf-rust-cpp/tree/main/examples) | [API Reference](https://reference.aspose.com/pdf/rust-cpp/) | [Blog](https://blog.aspose.com/category/pdf/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/pdf) | [Temporary License](https://purchase.aspose.com/temporary-license)

build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ use bzip2::read::BzDecoder;
1111
use sha2::{Digest, Sha256};
1212

1313
fn main() -> Result<(), Box<dyn Error>> {
14+
// If we're in publish mode (e.g. publishing to crates.io), skip library unpacking and validation
15+
// This is useful because large binaries (.dll, .so, .dylib) are not included in the published crate
16+
if std::env::var("ASPOSE_PDF_PUBLISH").is_ok() {
17+
println!("cargo:warning=ASPOSE_PDF_PUBLISH detected - skipping binary checks");
18+
return Ok(());
19+
}
20+
1421
let manifest_dir = env::var("CARGO_MANIFEST_DIR")?;
1522
let lib_dir = if let Ok(custom) = env::var("ASPOSE_PDF_LIB_DIR") {
1623
Path::new(&custom).to_path_buf()

examples/about.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use asposepdf::Document;
2+
3+
fn main() -> Result<(), Box<dyn std::error::Error>> {
4+
// Create a new PDF-document
5+
let pdf = Document::new()?;
6+
7+
// Return metadata information about the Aspose.PDF for Rust via C++.
8+
let info = pdf.about()?;
9+
10+
// Print metadata fields
11+
println!("Product Info:");
12+
println!(" Product: {}", info.product);
13+
println!(" Family: {}", info.family);
14+
println!(" Version: {}", info.version);
15+
println!(" ReleaseDate: {}", info.release_date);
16+
println!(" Producer: {}", info.producer);
17+
println!(" IsLicensed: {}", info.is_licensed);
18+
19+
Ok(())
20+
}

examples/flatten.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+
// Flatten PDF-document
8+
pdf.flatten()?;
9+
10+
// Save the previously opened PDF-document with new filename
11+
pdf.save_as("sample_flatten.pdf")?;
12+
13+
Ok(())
14+
}
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 annotations in page
8+
pdf.page_remove_annotations(1)?;
9+
10+
// Save the previously opened PDF-document with new filename
11+
pdf.save_as("sample_page1_remove_annotations.pdf")?;
12+
13+
Ok(())
14+
}
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 hidden text in page
8+
pdf.page_remove_hidden_text(1)?;
9+
10+
// Save the previously opened PDF-document with new filename
11+
pdf.save_as("sample_page1_remove_hidden_text.pdf")?;
12+
13+
Ok(())
14+
}

examples/page_remove_images.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 images in page
8+
pdf.page_remove_images(1)?;
9+
10+
// Save the previously opened PDF-document with new filename
11+
pdf.save_as("sample_page1_remove_images.pdf")?;
12+
13+
Ok(())
14+
}

examples/remove_annotations.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 annotations from PDF-document
8+
pdf.remove_annotations()?;
9+
10+
// Save the previously opened PDF-document with new filename
11+
pdf.save_as("sample_remove_annotations.pdf")?;
12+
13+
Ok(())
14+
}

0 commit comments

Comments
 (0)