pdf_oxide 0.3.24

The fastest Rust PDF library with text extraction: 0.8ms mean, 100% pass rate on 3,830 PDFs. 5× faster than pdf_extract, 17× faster than oxidize_pdf. Extract, create, and edit PDFs.
Documentation
# Open a PDF, modify metadata, delete a page, and save.
# Run: python main.py input.pdf output.pdf

import sys

from pdf_oxide import DocumentEditor


def main():
    if len(sys.argv) < 3:
        print("Usage: python main.py <input.pdf> <output.pdf>")
        sys.exit(1)

    input_path, output_path = sys.argv[1], sys.argv[2]

    editor = DocumentEditor(input_path)
    print(f"Opened: {input_path}")

    editor.set_title("Edited Document")
    print('Set title: "Edited Document"')

    editor.set_author("pdf_oxide")
    print('Set author: "pdf_oxide"')

    editor.delete_page(1)  # 0-indexed, deletes page 2
    print("Deleted page 2")

    editor.save(output_path)
    print(f"Saved: {output_path}")

if __name__ == "__main__":
    main()