SumatraPDF

Sumatra PDF is a lightweight Open Source PDF Viewer.

Sumatra PDF home: http://blog.kowalczyk.info/software/sumatrapdf/

Version 3.2

- From version 3.2 /opt and /register are deprecated.

<package
	id="sumatrapdf"
	name="Sumatra PDF Reader"
	revision="%PKG_VERSION%"
	reboot="false"
	priority="0">
		
	<variable name="PKG_VERSION"		value="3.2" />
	<variable name="PKG_SOURCE"		value="%SOFTWARE%\SumatraPDF" />
	<variable name="PKG_NAME"		value="SumatraPDF-%PKG_VERSION%-install.exe" architecture="x86" />
	<variable name="PKG_NAME"		value="SumatraPDF-%PKG_VERSION%-64-install.exe" architecture="x64" />
	<variable name="PKG_INSTALL_SWITCH"	value="/s /with-filter /with-preview" />
	<variable name="PKG_REMOVE_SWITCH"	value="/S" />
	<variable name="PKG_DESTINATION"	value="%PROGRAMFILES%\SumatraPDF" />

	<check type="uninstall" condition="versiongreaterorequal" path="SumatraPDF" value="%PKG_VERSION%" />
		
	<install cmd='"%PKG_SOURCE%\%PKG_NAME%" %PKG_INSTALL_SWITCH%' />
		
	<upgrade include="install" />
		
	<remove cmd='"%PKG_DESTINATION%\Uninstall.exe" %PKG_REMOVE_SWITCH%'>
		<exit code="any"/>
	</remove>
	<remove cmd='ping -n 3 127.0.0.1'>
		<exit code="any"/>
	</remove>
</package>

Version 2.5.2

- "/opt plugin" removed (deprecated since 2.5.2)
<packages>
	<package
		id="sumatrapdf"
		name="Sumatra PDF Reader"
		revision="%version%"
		priority="0"
		reboot="false">
		
		<variable name="version" value="2.5.2" />
		
		<check type="uninstall" condition="exists" path="SumatraPDF" />
		
		<install cmd='"%SOFTWARE%\SumatraPDF\SumatraPDF-%VERSION%-install.exe" /s /register' />
		
		<upgrade include="install" />
		
		<remove cmd='"%PROGRAMFILES%\SumatraPDF\Uninstall.exe" /S' architecture="x86" />
		<remove cmd='"%PROGRAMFILES(x86)%\SumatraPDF\Uninstall.exe" /S' architecture="x64" />

	</package>
</packages>

Version 1.9

- Compatible script with x64 platforms.
- "/opt plugin" to add plugins with web browsers
- "/register" to link the PDF extension with Sumatra
<?xml version="1.0" encoding="utf-8" ?>

<!--                     
###############################################################################
# SCRIPT       = SumatraPDF                                                   #
# REVISION     = 23/12/2011                                                   #
# MAINTAINER   = Vince                                                        #
# COMPATIBILITY= (X) x86 | (C) x64 | (.) both separately                      #
# UNINSTALL    = Via EXEC                                                     #
# COMMENT      = Just modify variables                                        #
###############################################################################
-->

<packages>
 <package
	 id="Sumatrapdf"
	 name="Sumatra PDF Reader"
	 revision="%version%"
	 priority="20"
	 reboot="false">

	<variable name="version" value="1.9" />

	<check type="uninstall" condition="exists" path="Sumatra.+" />

	<install cmd='"%SOFTWARE%\Sumatrapdf\SumatraPDF-%version%-install.exe" /opt plugin /register /S' />

	<upgrade include="install" />

	<remove cmd='"%PROGRAMFILES%\SumatraPDF\Uninstall.exe" /S' architecture="x86" />
	<remove cmd='"%PROGRAMFILES(x86)%\SumatraPDF\Uninstall.exe" /S' architecture="x64" />

  </package>
</packages>

Version 0.9.3

<?xml version="1.0" encoding="UTF-8"?>
 
<packages>
 <package
	 id="sumatrapdf"
	 name="Sumatra PDF Reader"
	 revision="1"
	 priority="0"
	 reboot="false">

	 <check type="uninstall" condition="exists" path="Sumatra PDF reader" />
	 <install cmd='"%SOFTWARE%\sumatra\SumatraPDF-0.9.3-install.exe" /S' />
	 <install cmd='"%SOFTWARE%\sumatra\sumatra_postinstall.bat"' />
	 <upgrade cmd='"%SOFTWARE%\sumatra\SumatraPDF-0.9.3-install.exe" /S' />
	 <upgrade cmd='"%SOFTWARE%\sumatra\sumatra_postinstall.bat"' />
	 <remove cmd='"%SOFTWARE%\sumatra\sumatra_prerm.bat"' />
	 <remove cmd='"%PROGRAMFILES%\SumatraPDF\Uninstall.exe" /S' />
  </package>
</packages>

The installer places shortcuts under the default user profile when installed via WPKG. The following script moves the shortcuts to the All Users profile.

  REM sumatra_postinstall.bat
  move "%ALLUSERSPROFILE%\..\Default User\Start Menu\Programs\SumatraPDF" "%ALLUSERSPROFILE%\Start Menu\Programs\"

The following script moves the shortcuts back to their original location.

  REM sumatra_prerm.bat
  move "%ALLUSERSPROFILE%\Start Menu\Programs\SumatraPDF" "%ALLUSERSPROFILE%\..\Default User\Start Menu\Programs\"

Change the default background color

If you don't want to keep yellow background color, proceed as follows :

First install SumatraPDF on you workstation. Then, edit the default shortcut in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\SumatraPDF.lnk by right click -> Properties and add -bg-color 0xffffff (0xffffff is hexadecimal code for white color, but you can put what you want) at the end of the target. Press OK for validate. Next, copy the specified shortcut on your %SOFTWARE% directory, and add this line on your WPKG package :

<install cmd='%COMSPEC% /C XCOPY /R /Y "%SOFTWARE%\SumatraPDF.lnk" "%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\"' />

This trick is for windows 7, but should work on Windows XP, just by changing the location of the shortcut.

  • Note: You can install silently sumatra pdf with the help of "/s" run parameter.