PrintForm.PrintFileName Property

Gets or sets the file name of an Encapsulated PostScript file and the path to which the file will be saved when the PrintAction property is set to PrintToFile.

Namespace:  Microsoft.VisualBasic.PowerPacks.Printing
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

public string PrintFileName { get; set; }

Property Value

Type: System.String
Returns a String that contains a file path and name.

When the PrintAction property is set to PrintToFile, an image of a form will be saved to an Encapsulated PostScript file (.eps, .ps, or .ai). The PrintFileName property specifies the path to the file.


To enable other applications to recognize the file as a PostScript file, you must use a valid PostScript file name extension (.eps, .ps, or .ai) in the PrintFileName property.

If no PrintFileName is specified, the user will be prompted for a file name at run time.

Note   The user will not be prompted for a path or a file name extension. To make sure that the file has a valid path and extension, you can implement your own dialog box. To do this, use a SaveFileDialog component and assign the return value to the PrintFileName property before calling the Print method.

The following example demonstrates how to display a dialog box to prompt a user for a file name and then assign it to the PrintFileName property. This example requires that you have a PrintForm component named PrintForm1 on a form.

Dim fileDialog As New Windows.Forms.SaveFileDialog
Dim fileToSave As String
fileDialog.Title = "Save to PostScript file"
fileDialog.AddExtension = True
fileDialog.Filter = "Encapsulated PostScript (*.eps)|"
fileDialog.InitialDirectory = _
fileToSave = fileDialog.FileName & ".eps"
PrintForm1.PrintFileName = filePath