Home > BSPrinter documentation > Reference

SaveToFile Method

Applies to: PrintPreview, IPrinterEx object

  Return Type:     None.  
   In     Required     DeviceNameToUse     As     String  
   In     Required     FileFullPath     As     String  


Saves the document to a file instead of printing it.
It should be used only with printers drivers that produce a meaningful output file.
The file format and its corresponding extension depends on the printer driver. Most drivers will produce an intermediate file that is used by the spooling system, such as PostScript files, but some printers driver can produce a useful output such as PDF files or XPS files.
In Windows 10, the "Microsoft Print to PDF" driver produces a PDF file, whereas "Microsoft XPS Document Writer" outputs XPS files.

Parameters explained:

DeviceNameToUse is the printer driver to be used.

FileFullPath is the full path of the output file.

Notes: Unlike the ShowSaveToFile method, this method saves the file without displaying any dialog unless the driver itself shows dialogs on the operation.
If the printer driver is not installed the end user will get a message telling that the file cannot be saved because the printer driver is not installed.
You can use the PrinterExists method to check whether a particular printer driver is installed.

See Also:

ShowSaveToFile method.