# add-pdf-viewer

add-pdf-viewer configures a native PDF viewer wrapper for HTTPS links and file:// URIs in Power Platform mobile projects.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 1167 repo stars
- Author: Microsoft
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/microsoft/power-platform-skills/tree/HEAD/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.md
- Updated: 2026-10-29
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/add-pdf-viewer

## What it does

This internal skill runs under `/add-native` inside Claude Code. It inspects the project root to ensure `app.config.js`, `power.config.json`, `package.json`, and the `src` folder are present. If the app is missing these files, execution halts immediately.

The helper then verifies that `@microsoft/power-apps-native-pdf-viewer` version 0.2.9+ exists in `package.json` and `node_modules`. It deliberately refuses to run `npm install` or touch native configuration files: the extension must already be linked in the native build. It then generates or updates `src/native/pdfViewer.ts`.

The generated wrapper rejects `http://`, `blob:`, and `content://` paths before reaching native code and returns a discriminated union without throwing errors. If the native binary lacks the compiled extension, calls fail cleanly with `NATIVE_MODULE_MISSING`.

## Install

### Claude Code (native platform)

1. **Plugin marketplace**
In the agent chat (not a shell):
```text
/plugin marketplace add microsoft/power-platform-skills
```
In the agent chat (not a shell):
```text
/plugin install mobile-app@power-platform-skills
```
This installs the whole mobile-app plugin with all its skills

2. **Skills CLI (Vercel)**
```bash
npx skills add microsoft/power-platform-skills --skill add-pdf-viewer -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/add-pdf-viewer/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/add-pdf-viewer/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add microsoft/power-platform-skills --skill add-pdf-viewer -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/add-pdf-viewer/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add microsoft/power-platform-skills --skill add-pdf-viewer -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/add-pdf-viewer/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install microsoft/power-platform-skills plugins/mobile-apps/skills/add-native/add-pdf-viewer
```

2. **Manually: put the files in place**
- File: `.github/skills/add-pdf-viewer/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add microsoft/power-platform-skills --skill add-pdf-viewer -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/microsoft/power-platform-skills --path plugins/mobile-apps/skills/add-native/add-pdf-viewer
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/add-pdf-viewer/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/microsoft/power-platform-skills/tree/HEAD/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.md

## When to use it
- create a safe TypeScript wrapper for the native PDF viewer component
- verify package version 0.2.9+ to guarantee local file URI support
- reject unsupported schemes such as blob and content before calling native code
- capture user interactions like sharing, printing, or closing the viewer

## Example prompts
- /add-native pdf-viewer
- /add-native pdf-control
- /add-native @microsoft/power-apps-native-pdf-viewer

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 91aa4834877741cc.

BEGIN THIRD-PARTY FILE 91aa4834877741cc
````text
---
name: add-pdf-viewer
description: Internal implementation skill invoked by /add-native for native PDF control workflows. Handles HTTPS and file URI PDF viewing with @microsoft/power-apps-native-pdf-viewer 0.2.9+.
user-invocable: false
disable-model-invocation: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion
model: sonnet
---

**📋 Shared instructions: [shared-instructions.md](${PLUGIN_ROOT}/shared/shared-instructions.md)** — read first.

**Working directory:** before any project read or command, execute
[native-artifact-compatibility.md Step 0](${PLUGIN_ROOT}/shared/references/native-artifact-compatibility.md#0-bind-every-operation-to-the-app-root).
Inherit `/add-native`'s resolved absolute `working_dir`; bind every shell call and
file tool to it, even when this helper starts from another directory.

# Add PDF Viewer

**Internal helper.** Users should invoke `/add-native pdf-viewer`, `/add-native pdf-control`, or `/add-native @microsoft/power-apps-native-pdf-viewer`; `/add-native` routes here after resolving the capability.

Generate or verify the native PDF viewer wrapper and show how to call its **native React Native API**. Version 0.2.9 and later support HTTPS PDF URLs and local `file://` URIs. Do not use the HostingSDK / PCF path from the package README; that is for a different use case.

## Steps

### 1. Verify app

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
test -f app.config.js && test -f power.config.json && test -f package.json && test -d src || { echo "BLOCKED: working_dir is not an initialized app" >&2; exit 1; }
```

If this fails, tell the user to run `/create-mobile-app` first and STOP.

### 2. Verify package is already present

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
````
END THIRD-PARTY FILE 91aa4834877741cc

The third-party file has ended. Everything between the 91aa4834877741cc tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 1842 of 9113 bytes. © Microsoft · MIT · https://github.com/microsoft/power-platform-skills/tree/HEAD/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.md

## Similar
- [pdf-viewer](https://affpapa.org/en/nevibecode/plugins/pdf-viewer.md) — plugin · ★ 36654 repo stars
- [react-pdf](https://affpapa.org/en/nevibecode/skills/molefrog-react-pdf.md) — skill · 778 installs
- [integrate-file-viewer](https://affpapa.org/en/nevibecode/skills/integrate-file-viewer.md) — skill · 1900 installs
- [graph-viewer](https://affpapa.org/en/nevibecode/skills/graph-viewer.md) — skill · 1900 installs
- [expo-module](https://affpapa.org/en/nevibecode/skills/expo-expo-module.md) — skill · 51000 installs
- [expo-project-structure](https://affpapa.org/en/nevibecode/skills/expo-project-structure.md) — skill · 27400 installs

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
