NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android 2.0.0

dotnet add package NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android --version 2.0.0
                    
NuGet\Install-Package NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android --version 2.0.0
                    
#r "nuget: NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NkkinSoft.Bhuvaneshw.Pdf.PdfViewer.Android&version=2.0.0
                    
Install as a Cake Tool

PdfViewer.Android

NuGet License: MIT

A complete, production-ready .NET for Android binding library for the PdfViewer Android library by Bhuvaneshw.

This library provides a powerful, feature-rich, and highly customizable PDF viewer component for .NET Android (formerly Xamarin.Android) applications.

? Features

Core Capabilities

  • PDF Rendering: High-quality PDF rendering powered by Android's native PdfRenderer
  • Multiple Loading Sources: Load PDFs from URL, File, Assets, or URI
  • Zoom & Pan: Smooth pinch-to-zoom and pan gestures
  • Page Navigation: Jump to specific pages, scroll through pages

Scroll & Layout Modes

  • Horizontal Scrolling: Swipe left/right through pages
  • Vertical Scrolling: Traditional vertical document scrolling
  • Single Page Mode: Display one page at a time
  • Wrapped Mode: Continuous document flow

Page Spread Options

  • None: Single page view (default)
  • Odd Spread: Book-like view starting with odd page
  • Even Spread: Book-like view starting with even page

UI Components

  • PdfViewer: Core PDF rendering component
  • PdfViewerContainer: Complete container with integrated UI
  • PdfToolBar: Navigation toolbar with page controls
  • PdfScrollBar: Visual scroll indicator

Additional Features

  • Page Snapping: Snap to page boundaries while scrolling
  • Page Rotation: Rotate pages (0�, 90�, 180�, 270�)
  • Custom Alignment: Control page alignment within viewport
  • Editor Support: Basic annotation capabilities (Undo/Redo)
  • Gesture Detection: Double-click and long-click support

?? Installation

NuGet Package Manager

Install-Package PdfViewer.Android

.NET CLI

dotnet add package PdfViewer.Android

PackageReference

<PackageReference Include="PdfViewer.Android" Version="3.0.8" />

?? Quick Start

1. Add to Layout (XML)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.bhuvaneshw.pdf.ui.PdfViewerContainer
        android:id="@+id/pdfViewerContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.bhuvaneshw.pdf.ui.PdfToolBar
            android:id="@+id/pdfToolBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <com.bhuvaneshw.pdf.PdfViewer
            android:id="@+id/pdfViewer"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <com.bhuvaneshw.pdf.ui.PdfScrollBar
            android:id="@+id/pdfScrollBar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </com.bhuvaneshw.pdf.ui.PdfViewerContainer>

</LinearLayout>

2. Initialize in Code (C#)

using Com.Bhuvaneshw.Pdf;
using Com.Bhuvaneshw.Pdf.UI;

public class MainActivity : Activity
{
    protected override void OnCreate(Bundle? savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        SetContentView(Resource.Layout.activity_main);

        // Find views
        var viewer = FindViewById<PdfViewer>(Resource.Id.pdfViewer);
        var container = FindViewById<PdfViewerContainer>(Resource.Id.pdfViewerContainer);
        var toolbar = FindViewById<PdfToolBar>(Resource.Id.pdfToolBar);
        var scrollBar = FindViewById<PdfScrollBar>(Resource.Id.pdfScrollBar);

        // Setup UI components
        toolbar.SetupWith(viewer);
        scrollBar.SetupWith(viewer, toolbar, false);

        // Load PDF from URL
        viewer.LoadFromUrl("https://example.com/document.pdf");
    }
}

?? API Reference

Loading Content

Method Description
LoadFromUrl(string url) Load PDF from a remote URL
LoadFromAsset(string assetName) Load PDF from app's Assets folder
LoadFromFile(Java.IO.File file) Load PDF from local file
LoadFromFileUri(Android.Net.Uri uri) Load PDF from Android Uri

Scroll Modes

// Set scroll mode
viewer.ScrollMode = PdfViewer.PageScrollMode.Vertical;    // Default
viewer.ScrollMode = PdfViewer.PageScrollMode.Horizontal;
viewer.ScrollMode = PdfViewer.PageScrollMode.SinglePage;
viewer.ScrollMode = PdfViewer.PageScrollMode.Wrapped;

Spread Modes

// Set spread mode for book-like viewing
viewer.SpreadMode = PdfViewer.PageSpreadMode.None;  // Default
viewer.SpreadMode = PdfViewer.PageSpreadMode.Odd;
viewer.SpreadMode = PdfViewer.PageSpreadMode.Even;

Alignment Options

// Set page alignment
viewer.AlignMode = PdfViewer.PageAlignMode.Start;
viewer.AlignMode = PdfViewer.PageAlignMode.CenterHorizontal;
viewer.AlignMode = PdfViewer.PageAlignMode.CenterVertical;
viewer.AlignMode = PdfViewer.PageAlignMode.CenterBoth;

Additional Properties

Property Type Description
SnapPage bool Enable page snapping while scrolling
SinglePageArrangement bool Optimize for single page viewing
PageRotation int Rotation angle (0, 90, 180, 270)
DoubleClickThreshold long Double-click detection time (ms)
LongClickThreshold long Long-click detection time (ms)
ScrollSpeedLimit float Maximum scroll speed multiplier

Editor Features

// Access annotation features
viewer.Editor.Undo();
viewer.Editor.Redo();

// Customize editor properties
viewer.Editor.HighlightColor = Android.Graphics.Color.Yellow;
viewer.Editor.InkColor = Android.Graphics.Color.Red;

?? Requirements

  • .NET Version: .NET 8.0+ Android / .NET 10.0 Android
  • Minimum Android SDK: API 23 (Android 6.0 Marshmallow)
  • Target Android SDK: API 34+ recommended

?? Dependencies

This binding library includes the following AndroidX dependencies:

  • Xamarin.AndroidX.ConstraintLayout
  • Xamarin.Kotlin.StdLib
  • Xamarin.Google.Android.Material
  • Xamarin.AndroidX.WebKit

?? License

This binding library is licensed under the MIT License.

The original PdfViewer Android library is created by Bhuvaneshw.

?? Credits

?? Changelog

v3.0.8

  • Initial NuGet release
  • Complete binding for PdfViewer Android library
  • Full support for .NET 10 Android

?? Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

?? Support

For issues related to this .NET binding, please open an issue on the repository.

For issues related to the core PDF functionality, please refer to the original library.

Product Compatible and additional computed target framework versions.
.NET net10.0-android36.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0-android36.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 536 12/11/2025