Save PDF document programmatically

Save PDF document to file system

The example demonstrates the new method for creating a new PDF document, which is a fundamental feature for generating documents dynamically, such as reports or invoices.

The code is simple and can act as a template for more advanced features like adding text, images, or annotations to the PDF.

This example demonstrates the straightforward use of the Aspose.PDF Rust library, showcasing its potential for creating, modifying, and saving documents.


    use asposepdf::Document;

    fn main() -> Result<(), Box<dyn std::error::Error>> {
        // Create a new PDF-document
        let pdf = Document::new()?;

        // Save the previously opened PDF-document with new filename
        pdf.save_as("sample_new.pdf")?;

        Ok(())
    }