Repository navigation
Command line arguments
The general format of the command line for SumatraPDF is SumatraPDF.exe [Options ...] [Filepath ...]
All options start with a dash and have (where indicated) arguments that have to follow them immediately. Anything that isn't recognized as an option will be interpreted as a file path. It's possible to freely mix file paths and command line options.
-register-for-pdf
Registers SumatraPDF as the default PDF reader for the current user and (if the user is administrator) for all other users. After the registration, SumatraPDF exits immediately.
-restrict
Locks SumatraPDF down so that it doesn't allow access to any drives, the registry or the internet. See /docs/sumatrapdfrestrict.ini for a more subtle alternative.
-presentation
Displays the first indicated file directly in presentation view.
-fullscreen
Displays the first indicated file directly in fullscreen view.
-invert-colors
Swaps text and background color for most documents (used to be a shortcut for -set-color-range #ffffff #000000 but now uses the actual values of the TextColor and BackgroundColor settings.
-print-to-default
Prints all files indicated on this command line to the system default printer. After printing, SumatraPDF exits immediately (check the error code for failure).
-print-to <printer-name>
Prints all files indicated on this command line to the named printer. After printing, SumatraPDF exits immediately (check the error code for failure).
E.g. -print-to "Microsoft XPS Document Writer" prints all indicated files to the XPS virtual printer.
-print-settings <settings-list>
Used in combination with -print-to and -print-to-default. Allows to tweak some of the printing related settings without using the Print dialog. The settings-list is a comma separated list of page ranges and advanced options such as "even" or "odd"; "noscale", "shrink" and "fit"; and "compat" (for printing as image); "duplex", "duplexshort", "duplexlong" and "simplex".
E.g. -print-settings "1-3,5,10-8,odd,fit" prints pages 1, 3, 5, 9 (i.e. the odd pages from the ranges 1-3, 5-5 and 10-8) and scales them so that they fit into the printable area of the paper.
print-settings "3x" prints the document 3 times.
-silent
Used in combination with -print-to and -print-to-default. Silences any error messages related to command line printing.
-print-dialog
Displays the Print dialog for all the files indicated on this command line.
-exit-when-done
Used in combination with -print-dialog (and -stress-test). Exits SumatraPDF after the Print dialog has been dismissed and the document printed.
-forward-search <sourcepath> <line>
Performs a forward search from a LaTeX source file to a loaded PDF document (using PdfSync or SyncTeX). This is an alternative to the ForwardSearch DDE command.
E.g. -forward-search main.tex 123 highlights all text related to line 123 in main.tex.
-reuse-instance
Tells an already open SumatraPDF to load the indicated files. If there are several running instances, behavior is undefined. Only needed when communicating with SumatraPDF through DDE (use the ReuseInstance setting instead otherwise).
-inverse-search <command-line>
Sets the command line to be used for performing an inverse search from a PDF document (usually back to a LaTeX source file). The inverse search command line can also be set from the Setting dialog. Use the variable %f for the current filename and %l for the current line.
[Deprecated]: This setting is exposed in the Options dialog after the first PDF document with corresponding .synctex or .pdfsync file has been loaded. Alternatively, use the corresponding advanced setting instead.
-fwdsearch-offset <offset> -fwdsearch-width <width> -fwdsearch-color <hexcolor> -fwdsearch-permanent <flag>
Allows to customize the forward search highlight. Set the offset to a positive number to change the highlight style to a rectangle at the left of the page (instead of rectangles over the whole text). The flag for -fwdsearch-permanent can be 0 (make the highlight fade away, default) or 1.
[Deprecated]: Use the corresponding advanced settings instead.
-named-dest <destination-name>
Searches the first indicated file for a destination or a table-of-contents entry (or starting with version 3.1 also a page label) matching destination-name and scrolls the document to it. Combine with -reuse-instance if the document is already open.
-page <pageNo>
Scrolls the first indicated file to the indicated page. Combine with -reuse-instance if the document is already open.
-view <view-mode>
Sets the view mode for the first indicated file. Alternatives are "single page", "continuous single page", "facing", "continuous facing", "book view", "continuous book view". Combine with -reuse-instance if the document is already open.
-zoom <zoom-level>
Sets the zoom level for the first indicated file. Alternatives are "fit page", "fit width", "fit content" or any percentage value. Combine with -reuse-instance if the document is already open.
-scroll <x,y>
Scrolls to the given coordinates for the first indicated file. Combine with -reuse-instance if the document is already open.
-console
Opens a console window alongside SumatraPDF for accessing (MuPDF) debug output.
-stress-test <path> [file-filter] [range] [cycle-count]
Renders all pages of the indicated file/directory for stability and performance testing.
E.g.
-stress-test file1.pdf 25x
-stress-test file2.pdf 1-3
-stress-test dir *.pdf;*.xps 15- 3x
renders file1.pdf 25 times, renders pages 1 to 3 of file2.pdf and renders all but the first 14 PDF and XPS files from dir 3 times.
-bench <filepath> [page-range]
Renders all pages (or just the indicated ones) for the given file and then outputs the required rendering times for performance testing and comparisons. Often used together with -console.
-plugin [url] <hwnd>
Makes SumatraPDF a child of the given window, so that it can be used as a plugin. Optionally pass in a URL/filepath that should be displayed instead of the actual filename (in case the actual filename is a temporary file).
The following options just set values in the settings file and may be removed in any future version:
-bg-color <hexcolor>
Changes the yellow background color to a different color. See e.g. html-color-codes.info for a way to generate the hexcode for a color.
E.g. -bg-color #999999 changes the color to gray.
[Deprecated]: Use the [setting](http://blog.kowalczyk.info/software/sumatrapdf/settings.html#MainWindowBackground MainWindowBackground) instead.
-esc-to-exit
Enables the Escape key to quit SumatraPDF.
[Deprecated]: Use the EscToExit setting instead.
-set-color-range <text-hexcolor> <background-hexcolor>
Uses the given two colors for foreground and background and maps all other colors used in a document in between these two.
E.g. -set-color-range #dddddd #333333 displays soft white text on a dark gray background.
[Deprecated]: Use the TextColor and BackgroundColor settings for FixedPageUI instead.
-lang <language-code>
Sets the UI language. See [/scripts/trans_langs.py] (https://code.google.com/p/sumatrapdf/source/browse/trunk/scripts/trans_langs.py) for the list of available language codes.
E.g. -lang de
[Deprecated]: Use the UiLanguage setting instead.
-manga-mode <mode>
Enables or disables "Manga mode" for reading (mainly Japanese) comic books from right to left. Mode must be "true" or 1 for enabling and "false" or 0 for disabling this feature.
[Deprecated]: Use the CbxMangaMode setting for ComicBookUI instead.