# Open a PDF at a page or search term

Open a document at a given page, chapter or search result, with the zoom and layout you want, from a script, a desktop shortcut or another program.

**Run `SumatraPDF.exe -page 42 book.pdf` to open `book.pdf` at page 42.** At a glance:

- **Page:** `-page <n>`
- **Chapter, bookmark or page label:** `-named-dest "<name>"`
- **Search:** `-search "<text>"` (ver 3.4+)
- **Layout, zoom, scroll position:** `-view`, `-zoom`, `-scroll`
- **Where you are now:** **Copy Location To Clipboard** (`CmdCopyLocationToClipboard`, ver 3.7+) copies these arguments for you.
- **Document already open:** the same arguments move the open document; or send [DDE commands](DDE-Commands.md).

Put options before or after the file name; the full list is in [Command-line arguments](Command-line-arguments.md#navigation-options).

## Open at a page

```
SumatraPDF.exe -page 42 "C:\Books\manual.pdf"
```

`-page` counts physical pages: `1` is the first page of the file, whatever number is printed on it. To go to a printed page number such as `xii` or `A-3`, use `-named-dest`.

## Open at a chapter or page label

`-named-dest` looks for, in this order:

1. a named destination stored in the PDF (e.g. `chapter.3` in LaTeX output)
2. a table of contents entry whose title matches (case and extra spaces don't matter), then one whose title contains the text, starting at a word
3. a page label (the page number printed in the book)

```
SumatraPDF.exe -named-dest "Installation" manual.pdf
SumatraPDF.exe -named-dest xii manual.pdf
```

If both `-named-dest` and `-page` are given, `-named-dest` wins.

## Open and search for text

**Available in version 3.4 or later.**

```
SumatraPDF.exe -search "invoice total" report.pdf
```

SumatraPDF opens the document, shows the find bar with the text and goes to the first match. Press `F3` for the next match, `Shift + F3` for the previous one.

## Open with a layout and zoom

```
SumatraPDF.exe -page 10 -view "continuous" -zoom "fit width" report.pdf
SumatraPDF.exe -page 3 -view facing -zoom 150 report.pdf
```

- `-view`: `"single page"`, `"continuous single page"` (or `continuous`), `facing`, `"continuous facing"`, `"book view"`, `"continuous book view"`
- `-zoom`: `"fit page"`, `"fit width"`, `"fit height"`, `"fit content"`, `"fit visible"`, or a percentage such as `150` or `"150%"`
- `-scroll x,y`: the position on the page, in document units; the easiest way to get it is **Copy Location To Clipboard**

Values with spaces need quotes.

## Reopen exactly where you are

**Available in [pre-release 3.7](https://www.sumatrapdfreader.org/prerelease)**

1. In SumatraPDF, press `Ctrl + K` and run `Copy Location To Clipboard` in [Command Palette](Command-Palette.md) (`CmdCopyLocationToClipboard`).
2. The clipboard now holds the page, zoom, scroll position and file, e.g.:

   ```
   -page 33 -zoom "193%" -scroll 0,0 "C:\Books\Material.pdf"
   ```

3. Paste it after `SumatraPDF.exe` in a script, a note, or the **Target** of a desktop shortcut.

## Jump in a document that is already open

When SumatraPDF is already running, the file opens in that window, and if it is already open there the same options move it to the page, destination, or search. This uses the `ReuseInstance` setting, which is on by default. If you turned it off, add `-reuse-instance`:

```
SumatraPDF.exe -reuse-instance -page 37 "C:\Books\manual.pdf"
```

Programs that talk DDE (editors, scripts, [LaTeX tools](LaTeX-integration.md)) can send commands to the `SUMATRA` server, `control` topic, for a file that is already open:

- `[GotoPage("C:\Books\manual.pdf", 37)]` — go to page 37
- `[GotoNamedDest("C:\Books\manual.pdf", "Installation")]` — go to a destination or bookmark
- `[Search("C:\Books\manual.pdf", "firewall")]` — find the first match
- `[GotoPageWord("C:\Books\manual.pdf", 12, "firewall")]` — go to page 12 and select the word if it is on that page (ver 3.7+)
- `[SetView("C:\Books\manual.pdf", "continuous", -2)]` — continuous layout, fit width

From the command line, send them with `-dde` (ver 3.5+). Inside the command, `"` and `\` are escaped with `\`; see [DDE commands](DDE-Commands.md) for the format and all commands.

## Make a desktop shortcut to a page

1. Right-click the desktop → **New → Shortcut**.
2. For the location, enter the program, the options and the file, e.g.:

   ```
   "C:\Program Files\SumatraPDF\SumatraPDF.exe" -page 120 -zoom "fit width" "C:\Books\manual.pdf"
   ```

3. Name it and click **Finish**.

Use the path of your `SumatraPDF.exe`; the portable version can be anywhere.

## Adobe Reader style options

**Available in version 3.5 or later.**

Programs written for Adobe Reader can use `/A`:

```
SumatraPDF.exe /A "page=5" report.pdf
SumatraPDF.exe /A "nameddest=Installation;search=firewall" report.pdf
```

`page=`, `nameddest=` and `search=` are supported; other Adobe open parameters are ignored. See [Command-line arguments](Command-line-arguments.md#navigation-options).

## Tips

- Use `-named-dest` with a bookmark title in scripts: it keeps working when pages are added before the chapter.
- Use `-new-window` to open the document in its own window instead of a tab.
- Add `-presentation` to start a talk at a slide (see [Present a PDF as slides](Present-a-PDF.md)).
- Use `-search` with a unique phrase to open a long log or report at the right spot.

## See also

- [Command-line arguments](Command-line-arguments.md): all options
- [DDE commands](DDE-Commands.md): control a running SumatraPDF
- [LaTeX integration](LaTeX-integration.md): forward and inverse search
- [Tabs and windows](Tabs-and-windows.md)
