Skip to content

jonas1ara/Glance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Glance

Glance Logo

License: MIT Framework: WinUI 3 Platform: Windows 11 Language: C#

Get it from Microsoft Store

Glance is a fast, lightweight, and elegant PDF document viewer designed specifically for Windows 11. Built from the ground up following Fluent Design principles, it offers a visually integrated experience featuring Mica transparency and smooth transitions. It combines the speed and minimalist design of classic document viewers like GNOME Evince with modern annotation tools inspired by Adobe Acrobat.


Key Features

  • Premium Aesthetics and Fluent Design:
    • Native use of Windows 11 Mica backdrop that adapts dynamically to the user's desktop wallpaper.
    • Integrated window title bar and translucent sidebar for an immersive reading experience.
    • Full support for automatic light and dark system themes.
  • Visual Welcome Screen (Evince-style):
    • Grid layout displaying recent documents using cover page thumbnails rendered from the first page of each PDF.
    • Single-click quick access to recently opened files with automatic registry cleanup if files are moved or deleted.
  • Side-by-Side Comparison (Split View):
    • Compare two PDF documents side-by-side dynamically with synchronous vertical layout grids.
    • Clear comparison toggle that safely restores localized viewer states on close.
  • Freehand Drawing Tools:
    • Smooth digital freehand ink drawing with a rounded pen pointer (PenMode), ideal for digital signatures, sketches, or writing handwritten notes directly on the page.
  • Precision Highlighter Tool:
    • Accurate text selection highlight mapping.
    • Dynamic 7-color palette (Yellow, Green, Cyan, Magenta, Red, Blue, Black) that appears exclusively in editing modes.
    • Automatic Alpha channel calculation (31% opacity) to ensure the translucent color highlights the text without obscuring the original content.
  • Sticky Notes:
    • Drop floating comment bubbles anywhere on the PDF with a clean popover overlay to write, view, edit, and store reader remarks.
  • System Language Localization:
    • Automatic interface localization detection (Spanish and English supported natively).
  • Interactive Close and Save Flow:
    • Prompts users with a localized 3-button confirmation ("Save and Exit", "Exit without saving", "Cancel") if unsaved changes exist and auto-save is off, preventing data loss.
  • Auto-saving Annotations:
    • All notes, highlights, and freehand drawing strokes are saved automatically to a local JSON database upon pointer release, ensuring immediate persistence.
  • Real-time Document Rotation:
    • Native rotation controls to rotate the document in 90-degree increments, dynamically updating dimensions to prevent page clipping.
  • Keyboard Shortcuts (Undo):
    • Full edit history with support for undoing annotations using the universal Ctrl + Z shortcut.
  • Fluent Sidebar Index:
    • Navigation via high-definition page thumbnails rendered sequentially to prevent visual layout scrambling during UI virtualization recycling.

Architecture

Glance uses a hybrid C# + Rust architecture for optimal performance:

  • Frontend: WinUI 3 (C#/.NET 10.0) - Native Windows 11 aesthetics with Mica backdrop
  • Backend: Rust - Native performance for PDF rendering and storage
  • Bridge: P/Invoke FFI - Type-safe C# ↔ Rust interop

Libraries & Key Dependencies

Glance relies on several open-source libraries and native projections to achieve high-performance rendering, PDF manipulations, and native platform integration:

Frontend (.NET / C#)

  • Windows App SDK (WinUI 3): The modern Fluent user interface framework for native Windows desktop development.
  • PDFsharp: The open-source .NET library used for compiling and burning user drawings, highlights, and annotations back into the original PDF files.

Backend & FFI (Rust)

  • windows-rs: Microsoft's official Rust projection library, providing native access to Windows APIs directly from Rust.
  • pdfium-render: A safe Rust binding layer around Google's PDFium.
  • pdfium-binaries: The pre-compiled binary distributions of Google's PDFium library (compiled by Benoît Blanchon) used to build the unmanaged rendering backend.

System Requirements

  • OS: Windows 10 or later
  • Platform: Windows App SDK 1.5+ (WinUI 3)
  • Runtime: .NET 10.0

📚 Development & Building (For Contributors)

Prerequisites

Build Instructions

  1. Clone repository:

    git clone https://github.com/jonas1ara/Glance.git
    cd Glance
  2. Build Rust backend:

    cd native/glance-native
    cargo build --release

    (Note: Building in release mode is required as the C# project is configured to automatically look for the Rust DLL in target/release/).

  3. Build and Run C# frontend:

    cd ../../src
    dotnet run --project Glance.csproj

    (Note: The MSBuild system automatically copies the compiled glance_native.dll and pdfium.dll to the output directory during build, so no manual file copying is needed).

Architecture Phases

  • Phase 1: FFI Foundation (P/Invoke bridge)
    • Established C-compatible unmanaged boundaries.
    • Registered dynamic DLL resolvers (NativeLibrary.SetDllImportResolver) to locate Glance backend binaries.
  • Phase 2: Persistence (JSON file I/O)
    • Engineered Rust-side serialization adaptors using Serde.
    • Formulated local drawing database formats to store vectors, comments, and marks.
  • Phase 3: Annotation Processing (validation, geometry)
    • Formulated validation rules for comments, highlights, and colors.
    • Created safety checks for drawing coordinates.
  • Phase 4: PDF Rendering (lazy loading, async)
    • Integrated Google PDFium via dynamic library binding.
    • Designed async rendering buffers on C# thread pools using CancellationToken loops to prevent thread collisions.
  • Phase 5: Localization & UX Polish
    • Integrated operating system locale detector.
    • Formulated localized interactive exit confirmation dialog flows (Save, Discard, Cancel).

Build Variants

  • Debug: cargo build --debug && dotnet build
  • Release: cargo build --release && dotnet build -c Release
  • Clean: cargo clean && dotnet clean

Support & Funding

If you find Glance PDF useful and would like to support its development, you can sponsor the project through the following platforms:

  • Buy Me A Coffee:
    Buy Me A Coffee
  • Mercado Pago (Mexico):
    Mercado Pago

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A fast, lightweight, and modern PDF viewer for Windows 11 built with WinUI 3, Mica transparency, and native page-by-page annotation tools.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages