您可以使用附加命令行选项启动 Sumatra:SumatraPDF.exe [argument ...] [filepath ...]
。
所有参数均以破折号 (-) 开头。一些参数后面跟着附加参数。
任何不被识别为已知选项的内容都被解释为文件路径,因此可以混合文件路径和命令行参数。
命令行选项列表
-presentation
:从演示视图开始
-fullscreen
:以全屏视图启动
-new-window
:打开文件时,始终在新窗口中打开它,而不是在选项卡中(自 3.2 起)
-appdata <directory>
:设置我们将存储SumatraPDF-settings.txt
文件和缩略图缓存的自定义目录
-restrict
:在受限模式下运行,您可以禁用需要访问文件系统、注册表和互联网的功能。对于类似信息亭的使用很有用。阅读更详细的文档。
导航选项
-named-dest <destination-name>
:在第一个指定文件中搜索与目标名称匹配的目标或目录条目(或从版本 3.1 开始也是页面标签),并将文档滚动到该目标。如果文档已打开,请与 -reuse-instance 结合使用。
-page <pageNo>
:将第一个指定文件滚动到指定页面。如果文档已打开,请与 -reuse-instance 结合使用。
-view <view-mode>
:设置第一个指定文件的查看模式。可用的查看模式:
"single page"
"continuous single page"
facing
"continuous facing"
"book view"
"continuous book view"
请注意,带有空格的选项必须用“”引号引起来。
-reuse-instance
如果文档已打开,则与 合并。
-zoom <zoom-level>
:设置第一个指定文件的缩放级别。替代方案是“适合页面”、“适合宽度”、“适合内容”或任何百分比值。如果文档已打开,请与 -reuse-instance 结合使用。
-scroll <x,y>
:滚动到第一个指定文件的给定坐标。-reuse-instance
如果文档已打开,则与 合并。
search <term>
:打开文档时开始搜索给定术语,例如SumatraPDF.exe -search "foo" bar.pdf
。从 3.4 开始
打印选项
-print-to-default
:将此命令行上指示的所有文件打印到系统默认打印机。打印后,SumatraPDF立即退出(检查错误代码是否失败)。
-print-to <printer-name>
:将此命令行上指定的所有文件打印到指定的打印机。打印后,SumatraPDF立即退出(检查错误代码是否失败)。例如,-print-to "Microsoft XPS Document Writer"
将所有指示的文件打印到 XPS 虚拟打印机。
-print-settings <settings-list>
-print-to
与和结合使用-print-to-default
。允许在不使用“打印”对话框的情况下调整一些与打印相关的设置。设置列表是一个逗号分隔的页面范围和高级选项列表,例如
even
或者odd
。
portrait
或landscape
:可以提供内容 90 度旋转(不是纸张旋转,必须通过打印机默认值的选择来预先设置)
noscale
,shrink
和fit
color
或者monochrome
duplex
,duplexshort
,duplexlong
和simplex
bin=<num or name>
:选择要打印到的纸盘
paper=<page size>
: page size is A2
, A3
, A4
, A5
, A6
, letter
, legal
, tabloid
, statement
- e.g.
-print-settings "1-3,5,10-8,odd,fit,bin=2"
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.
Developer options
-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
.
Deprecated options
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 MainWindowBackground setting 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 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.
-invert-colors
Deprecated: Use the
CbxMangaMode setting for ComicBookUI instead.