PHPackages                             pteal/plugin-pdf-viewer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. pteal/plugin-pdf-viewer

ActiveNativephp-plugin[PDF &amp; Document Generation](/categories/documents)

pteal/plugin-pdf-viewer
=======================

PDF document viewer with pinch-to-zoom, popup screen panel with close and native share functionality for iOS and Android

1.0.7(2mo ago)162↓76.9%MITKotlinPHP ^8.2

Since Mar 23Pushed 2mo agoCompare

[ Source](https://github.com/pteal79/pdf-viewer)[ Packagist](https://packagist.org/packages/pteal/plugin-pdf-viewer)[ RSS](/packages/pteal-plugin-pdf-viewer/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (7)Dependencies (4)Versions (9)Used By (0)

PdfViewer Plugin for NativePHP Mobile
=====================================

[](#pdfviewer-plugin-for-nativephp-mobile)

Opens PDF documents in a full-screen native viewer with **pinch-to-zoom**, a **share button** (left), and a **close button** (right). Supports both remote URLs and local file paths. Works on iOS and Android.

- **iOS** — uses `PDFKit` (built-in, no external dependencies, iOS 11+)
- **Android** — uses the built-in `PdfRenderer` (no external dependencies, API 21+)

Installation
------------

[](#installation)

```
composer require pteal/plugin-pdf-viewer

# Register the plugin
php artisan native:plugin:register pteal/plugin-pdf-viewer

# Verify
php artisan native:plugin:list
```

Requirements
------------

[](#requirements)

### Android

[](#android)

- Minimum API 21 (Android 5.0)
- No external dependencies or Gradle repository changes required
- **Optional:** declare a `FileProvider` with authority `${applicationId}.provider` for the best share experience (see [Android FileProvider Setup](#android-fileprovider-setup)). Without it, the plugin falls back to sharing via `MediaStore.Downloads` (API 29+)

### iOS

[](#ios)

- iOS 11+, Xcode 13+
- No additional configuration needed

Usage
-----

[](#usage)

### Open a remote URL

[](#open-a-remote-url)

```
use Pteal\PdfViewer\Facades\PdfViewer;

PdfViewer::url('https://example.com/document.pdf');

// With title and description
PdfViewer::url('https://example.com/report.pdf', 'Annual Report', 'Q4 2025 financial summary');
```

### Open a local file

[](#open-a-local-file)

```
use Pteal\PdfViewer\Facades\PdfViewer;

PdfViewer::path('/absolute/path/to/file.pdf');

// With title and description
PdfViewer::path(storage_path('app/documents/invoice.pdf'), 'Invoice #1042', 'Due 2026-04-01');
```

### Method signatures

[](#method-signatures)

```
PdfViewer::url(string $url, string $title = '', string $description = ''): mixed
PdfViewer::path(string $path, string $title = '', string $description = ''): mixed
```

- **`$title`** — displayed in the viewer toolbar. If empty, no title is shown.
- **`$description`** — displayed as a subtitle below the title. If empty, no subtitle is shown.

Viewer UI
---------

[](#viewer-ui)

ControlPositionBehaviourShareLeft of toolbarOpens the system native share sheet for the PDF fileCloseRight of toolbarDismisses the viewer and fires `PdfViewerClosed`Remote PDFs are downloaded before display. The share sheet always shares the actual PDF file (not just a link), even for remote URLs.

Events
------

[](#events)

EventPayloadDescription`PdfViewerClosed``{ filePath: string }`Fired when the user dismisses the viewer. `filePath` contains the original URL or file path that was opened.### Listening in Livewire

[](#listening-in-livewire)

```
use Native\Mobile\Attributes\OnNative;
use Pteal\PdfViewer\Events\PdfViewerClosed;

#[OnNative(PdfViewerClosed::class)]
public function onPdfClosed(string $filePath): void
{
    // $filePath is the URL or path that was opened
}
```

Android FileProvider Setup
--------------------------

[](#android-fileprovider-setup)

Adding a `FileProvider` gives the best share experience on all Android versions. Without it, the plugin falls back to `MediaStore.Downloads` (API 29+) — sharing will silently fail on API 21–28 without FileProvider.

Add the following inside `` in your `AndroidManifest.xml`:

```

```

Create `res/xml/file_paths.xml`:

```

```

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance84

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

8

Last Release

82d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/167c450c5528b16682698e73dc0a8cb5b537244340d1696502cfc3f3f92ebdd1?d=identicon)[pteal79](/maintainers/pteal79)

---

Top Contributors

[![Elite-Cleaning](https://avatars.githubusercontent.com/u/102381701?v=4)](https://github.com/Elite-Cleaning "Elite-Cleaning (9 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/pteal-plugin-pdf-viewer/health.svg)

```
[![Health](https://phpackages.com/badges/pteal-plugin-pdf-viewer/health.svg)](https://phpackages.com/packages/pteal-plugin-pdf-viewer)
```

###  Alternatives

[qipsius/tcpdf-bundle

A bundle to easily integrate TCPDF into Symfony

23749.5k](/packages/qipsius-tcpdf-bundle)[macopedia/magmi2

Magento Mass Importer 'Magmi' for Magento 2

11615.7k](/packages/macopedia-magmi2)[tarfin-labs/easy-pdf

Makes pdf processing easy.

1719.4k](/packages/tarfin-labs-easy-pdf)[ikkez/f3-sheet

Some Excel and CSV utilities for PHP Fat-Free Framework

1414.8k](/packages/ikkez-f3-sheet)[nilgems/laravel-textract

A Laravel package to extract text from files like DOC, XL, Image, Pdf and more. I've developed this package by inspiring "npm textract".

195.7k](/packages/nilgems-laravel-textract)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
