locked
XPS Name when Sent to Printer

    Question

  • Hi,

    I am creating a XPS document which i am later sending to a print (which produces a file.  e.g. PDF Printer, Microsoft Document Imaging Printer)

    However the default file name is always "System.Windows.Document".

    I have tried setting various properties on the XPS document and XPS Package.  However non of them seem to affect this default name.

    Is there anyway i can set this?

    many thanks

    Arran

    Monday, June 19, 2006 3:59 PM

All replies

  • Bump. 

    But rather than simply bump i'll copy-paste my equivalent question from StackOverflow

     

    http://stackoverflow.com/questions/1196110/way-to-default-the-name-of-the-generated-xps-file

     

    If a user prints a report, and they happen to be using the Microsoft XPS printer, i would like the default the filename to something meaningful.

    i would have thought that the XPS printer would take the name of the print job, and use that as the default filename - but it doesn't.

    Is there some other, programatic, way to default the name of the generated XPS file when i print to that printer? i was thinking there might be something like:

    • a registry key
    • global shared memory
    • API call like SetDefaultXPSFilename()
    • extended attributes about a print job

    Example

    Automate Excel to create a spreadsheet:

    Excel xl = new ExcelApplication();
    Workbook wb = xl.Workbooks.Add();
    GenerateReport(wb);
    wb.PrintOut();
    

    Now if the user's default printer is the Microsoft XPS Document Writer, then the user will get:

    enter image description here

    i would like a way for that File name to be defaulted to something useful, such as:

    20110729 - Chip Bank Settlement Sheet.xps
    

    The user will accept the default filename, and files will organized automatically, rather than the user typing:

    asdfadf.xps
    

    Friday, July 29, 2011 6:39 PM