The AmagnoVirtualPrinter is an interface which forwards any print job given from a specified printer, to a specified application that processes the 'print job'.
There are two ways of using the AmagnoVirtualPrinter:
- If you just want to install the driver build the project in release mode, navigate to the folder VirtualPrinter.WixSharpinstaller and execute the created .msi file. After the installation, a new printer, with the name set in Defaults.cs, can be located under Printer & Scanner in the Microsoft® Windows settings.
- To debug the AmagnoVirtualPrinter, follow step one. After the installation, go to Windows Services and stop AmagnoPrinterService. In Visual Studio, select AmagnoVirtualPrinter.Agent.Console as startup project and run in debug mode. To start a test print (and debug the solution) start PowerShell or cmd and navigate to the root folder of the repository. Go to
Files
and run.\setupdrv.exe test
, which will create a test page and send it to the virtual printer. Or just print any document you want to.
If you want to use the official installer, you can download it here or use the latest release in GitHub. Make sure to run the installer with extended rights. After installation, you may need to configure the AmagnoVirtualPrinter. After installation, a new printer with the name set in Defaults.cs can be located under Printer & Scanner in the Microsoft® Windows settings.
To compile the installer, please make sure the Wix Toolset is installed. The WixSharp library is used to define the package in AmagnoVirtualPrinter.WixSharpInstaller
.
To install the driver from source, build the project in release mode. When the build is run successfully, open up powershell and navigate to C:\[Git]\AmagnoVirtualPrinter\Files
. Then run the AmagnoPrinterInstaller.exe "/MSBUILD:C:\[Git]\AmagnoVirtualPrinter\Installer\AmagnoVirtualPrinter.WixSharpInstaller" "/p:C:\[Git]\AmagnoVirtualPrinter\"
where /p:
is the output directory for the msi and working directory for the WixSharp project. Make sure the given working directory contains a Files
folder with all binaries needed for AmagnoVirtualPrinter. This command will use WixSharp to create the msi package right next to the AmagnoPrinterInstaller.exe called AmagnoPrinterInstaller.msi.
Alternatively use create_msi.ps1
which automates the building step above.
Make sure Ghostscript is installed on your machine.
While installing, several registry entries are inserted into Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\vpd\PrinterDriver\
. The most important ones are those under the key Application
- Pre-Converter: Contains the exe to be executed (pre convert process) and the
arg
to be processed by the application (for example:C:\Program Files\MyApp.exe PRINT
). - Post-Converter: Contains the exe to be executed (post convert process) and the args to be processed by the application (for example:
C:\Program Files\MyApp.exe PRINTCOMPLETE
).
The Converter
key defines the settings which are needed for the convert process, e.g. server port (9101 by default).
The output directory can be set in Computer\HKEY_CURRENT_USER\SOFTWARE\vpd\PrinterDriver\Converter
for the converted prints, which can be processed by the application. If the value is set to an empty string, the default temp path will be used (e.g. C:\temp\PrinterOuput
).
To use another application for print forwarding, its name can be stored in the registry. This is useful, for example, when forwarding does not work with the system account.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\vpd\PrinterDriver]
"CustomRedirection"="Application name"
To debug the AmagnoVirtualPrinter, run the msi. After installation, go to Windows Services and stop the AmagnoPrinterService. In your IDE, select the AmagnoVirtualPrinter.Agent.Console as startup project and run in debug mode. To start a test print (and debug the solution) start PowerShell or cmd and navigate to the root folder of the repository. Go to Files
and run .\setupdrv.exe test
, which will create a test page and send it to the virtual printer. Or just print any document you want to.
To create a release, you have to tag a commit. Then the release pipeline compiles the source code, builds the installation, and creates the release on GitHub.
Use Set-Version.ps1 and versioninfo.txt to update the assembly and file version of all files and the setup.