Example of automatic PDF generation when printing with the selection of the file name

Introduction

Automatic PDF generation is easily possible in PrintMulti, as described here. One wish was for the user to be able to choose the name of the PDF to be generated when printing.

Solution using ‘File:’ port

PrintMulti itself does not offer the possibility to show a dialogue, but with a little trick it still works.

You simply select ‘FILE:’ as the port for the PrintMulti printer and the application or Windows displays a file save dialogue to select a prn file when printing.

ChoosePrnFileD
ChoosePrnFileDialogD

The trick now is to let the user select a prn file whose name is available with the new macro ‘#O’ within PrintMulti. There, ‘.prn’ is then simply replaced by ‘.pdf’ and the PDF is created as in the other example.

The PrintMulti.ini could look like this if the PrintMulti printer is called ‘PrintMulti Colour File’.

[MicrosoftPrintToPDF]
Printer=Microsoft Print To PDF
Save2File=$(#O;.prn;.pdf;replace)
Color=1
Execute=yes
ExecuteAsUser=true
ExecuteFlags=0x08000000
ExecuteTimeout=INF
ExecuteCmd=cmd /c del @"#O"

[TestPrinter]
Printer=Testprinter

[PrintMulti Color File]
Active=1
ActionCreatePDF=Print;MicrosoftPrintToPDF
ActionPrint=Print;TestPrinter
PrintSelf=0