Solved

Print XPS documents from command line.

Posted on 2010-08-13
3
3,023 Views
Last Modified: 2012-05-10
I need to know how to print XPS comments from command line. We are trying to create a code that will print xps documents that are in a folder. We are unable to find a way to send xps print documents from command line. ANy help would be great. Thanks.
0
Comment
Question by:cstallings
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 33434130
One method... requires converting to PDF. See: http://verydoc.com/xps-to-pdf.html

@echo off
xps2pdf.exe C:\in\*.xps C:\out\*.pdf
for /f "delims=?" %%f in ('dir C:\out\*.pdf /b') do (
	AcroRd32.exe /t "%%f" "\\servername\printername"
        del %%f
)

Open in new window

0
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 33434170
If you have XPS Viewer installed... start "example.xps" -p  also works if installed and associated with XPS files.
@echo off
for /f "delims=?" %%f in ('dir *.xps /b') do (
	xpsrchvw "%%f" -p
)

Open in new window

0
 
LVL 15

Accepted Solution

by:
Giovanni Heward earned 500 total points
ID: 33434282
Here you go... all-in-one solution.

Requires Microsoft XPS Viewer
Requires KiXtart @ http://www.kixtart.org/binary/distrib/KiX2010_461.zip

@echo off

:: create kix script for print dialog
:: download from http://www.kixtart.org/binary/distrib/KiX2010_461.zip
>"%temp%\xpsprt.kix" echo sleep 1
>>"%temp%\xpsprt.kix" echo if setfocus( "print" ) = 0
>>"%temp%\xpsprt.kix" echo    $rc = sendkeys( "{enter}" )
>>"%temp%\xpsprt.kix" echo endif

:: print each xps file
:: requires xps viewer
for /f "delims=?" %%f in ('dir *.xps /b') do (
	call cmd /c start %%f -p
	kix32 "%temp%\xpsprt.kix"
)

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reactjs with .NET 3 70
Jquery if else not working ... WHY? 5 23
javascript and jquery question 4 21
Calculating percentage 2 28
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question