Please enable JavaScript to view this site.

Navigation: Developer Information > Using the Windows registry

Specifying an output file name

Scroll Prev Top Next More

In addition to being able to control the output file using the Win32 API, you can control the output file name by creating a string value in the registry at any of the standard registry locations. The "PDFFileName" value should be set to the full path name of the document.  If the "PDFFileName" entry does not exist in the registry, the user will be prompted to enter a file name.

 

From Visual Basic or VB.NET, you can set the output file name using the following code sample:

 

SaveSetting "Dane Prairie Systems", "Win2PDF", "PDFFileName", filename 

 

From C#, you can set the output file name using:

 

Microsoft.VisualBasic.Interaction.SaveSetting("Dane Prairie Systems", "Win2PDF", "PDFFileName", filename)

 

Where the filename parameter is the full path name for the file. By default, the "PDFFileName" entry is removed from the registry after each document is created and you must add the "PDFFileName" each time you print.

 

If you don't want the setting to be reset after each document, you can use "PDFDefaultFileName" in place of "PDFFileName". You can also prevent the "PDFFileName" from being removed by creating a DWord value named "persistent" at one of the standard registry locations.

 

The format type is determined by the filename extension. The following extensions are supported:

.PDF - Portable Document Format

.PDFA -PDF for Archiving (PDF/A). File is renamed with a .PDF extension after creation.

.PDFI -PDF Image Only (monochrome). File is renamed with a .PDF extension after creation.

.PDFC -PDF Image Only (color). File is renamed with a .PDF extension after creation.

.PDFO -PDF OCR (Searchable). File is renamed with a .PDF extension after creation. Requires the Win2PDF OCR Add-on.

.PDFS -Portable Document Format. Used to force PDF standard instead of PDF/A or PDF Image Only. File is renamed with a .PDF extension after creation.

.XPS - XML Paper Specification

.TIFF or .TIF - Tagged Image File Format

.TIFM - Tagged Image File Format (monochrome). File is renamed with a .TIF extension after creation.

.TIFC - Tagged Image File Format (color). File is renamed with a .TIF extension after creation.

.SVG - Scalable Vector Graphics

 

The following extensions are supported by both the Win2PDF or Win2Image Printer:

.JPGG - JPEG (grayscale). File is renamed with a .JPG extension after creation.

.JPGC - JPEG (color). File is renamed with a .JPG extension after creation.

.TIFM - Tagged Image File Format (monochrome). File is renamed with a .TIF extension after creation.

.TIFC - Tagged Image File Format (color). File is renamed with a .TIF extension after creation.

.GIFG - GIF (grayscale). File is renamed with a .GIF extension after creation.

.GIFC - GIF (color). File is renamed with a .GIF extension after creation.

.PNGG - PNG (grayscale). File is renamed with a .PNG extension after creation.

.PNGC - PNG (color). File is renamed with a .PNG extension after creation.

.BMPG - BMP (grayscale). File is renamed with a .BMP extension after creation.

.BMPC - BMP (color). File is renamed with a .BMP extension after creation.

 

 

If a file already exists at the location specified by "PDFFileName", it will be overwritten. If you want to prevent files from being overwritten, you can add a single asterisk character "*" to the file name to specify a wildcard. If a wildcard character exists, it will be replaced by a sequential number so that documents are never overwritten.

 

If you want to create a unique document name, you can use a single "%" character in the file name. The "%" character will be expanded to include a sequence of numbers based on the current date and time.

 

If you create the "PDFFileName" registry value as a REG_EXPAND_SZ instead of a REG_SZ type, the file name will be expanded from environment variables. The environment variables are specified with "%" characters at the beginning and end of the variables as in "%HOMEPATH%". If the environment variable does not exist, the first "%" character will be expanded by a sequences of numbers based on the date and time as described previously. The REG_EXPAND_SZ option is not available from the Visual Basic SaveSetting command. The %DATE% and %TIME% environment variables are not expanded by this option.

 

Win2PDF sets the current PDF document title in an environment variable named "PDFTitle". You can use this in combination with a REG_EXPAND_SZ environment variable to set the file name to the document title. For example, if a "PDFFileName" entry with a REG_EXPAND_SZ type is set to "c:\test\%PDFTitle%*.pdf", Win2PDF will create a document using the document specified title without displaying a file save window and it will never overwrite an existing file.

 

Win2PDF also supports a number of variables that can be used to dynamically create a date and time stamp. These are listed in the auto-name: user defined documentation.

 

If the application needs to determine when Win2PDF has finished creating the document, it can use "PDFPostFileName" instead of "PDFFileName". The behavior of "PDFPostFileName" is identical to "PDFFileName" except the registry value is not deleted by Win2PDF until the document has been created. The application can monitor the existence of this registry value to determine if Win2PDF is still processing the document.