PDF to XPS Converting via Microsoft XPS Document Writer

0 votes
asked Feb 18, 2010 by lanfear

Printing pdf document with Microsoft XPS Document Writer:

string filename = "C:\\1.pdf";

Process process = new Process();
process.StartInfo.Verb = "PrintTo";

process.StartInfo.FileName = @"C:\Program Files\Adobe\Reader 9.0\Reader\acrord32.exe";

process.StartInfo.Arguments = 
    "/t \"C:\\1.pdf\" \"Microsoft XPS Document Writer\" \"xps\"  XPSPort:";

process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.CreateNoWindow = true;

process.StartInfo.UseShellExecute = false;

process.Start();
process.StandardOutput.ReadToEnd();

process.WaitForExit();

The only problem is Save Dialog, which requests file name (*.xps) where to save result. Everbody advices DOCINFO to solve this problem, but I didn't find any example of using. I need programatically print PDF File via Microsoft XPS Document Writer with default output file name. How should I use DOCINFO in this situation?

Can you help me?

1 Answer

0 votes
answered Feb 18, 2010 by necrostaz

DOCINFO struct manages file names in print spooler but not linked with xps driver save dialog realization. But you may find Save dialog window, enter file name and close it programmatically. Read this article for example.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...