What is the DocumentName field for?

The DocumentName field is set by your application whenever it prints a document. It may include the path to a file or the name of the application or both. On the other hand there is no standard, applications are free to do what they want, some will even leave it blank.

You can use this field in most actions in Print Distributor. The most common use is as part of the path in the Write File action, here you can insert the document name using the ?DN? field. When you print this will be translated into the content of the field.

As I mentioned some applications are better than others at filling this field, if you want to find out what your application is doing then open your Printers folder and pause the printer, then print a document.

Screenshot of Windows print queue

If the Document Name is a path to an original file you may want to remove the extension before you use it, you can do this with the ?DX? field. Using this allows you to ignore the original extension in the name and include your own, for example:

C:\Archive\?DX?.ps

This will remove the original extension such as .doc or .xls and add a .ps extension.

Sometimes the document name will contains a full path but you only want the file name, in this case you can use the ?DY? field, for example

C:\Archive\?DY?.ps

This would take a document name of C:\Some\Path\To\a\File\myfile.doc and write out to C:\Archive\myfile.ps

Characters which are illegal in a file name are automatically removed so you don't have to worry about *, ? and : appearing in the document name.

If you need something more advanced then you can modify the document name using the Script action, it is available as the DocumentName global and can be modified. An example might be to try and tidy the URL's Internet Explorer puts in the field. If you have a document name: http://www.frogmorecs.com/content/support and want to remove the http:// part and translate the slashes to underscores you can use the following script:

DocumentName = Replace(DocumentName, "http://", "")
DocumentName = Replace(DocumentName, "/", "_")

This will stop Print Distributor from creating extra folders and give you a tidy path, just make sure you move the Script action to the top of the list so it gets run first.

If you are printing from a remote system, in particular from a Mac or Unix system you may see a Document Name of "remote downlevel document". In this case we can often recover the document name from the content of the file, you will need to contact support with a sample print file and we will investigate for you.