As of now, I’m using Process to call GhostPDL to convert my XPS files into PDF files.
The problem is that sometimes these conversions take a while. Currently I’m using a notification to let the user wait. But I would like to have a progress bar of some sort. I read that I can use StandardError for this, but I don’t even know even how to make GhostPDL output progress status from the command line. I’ve tried searching for the manual to see if there was an argument to turn in on but I have no luck.
Is there a way to turn on status output or even so, alternative ways to convert XPS to PDF? I’m open to any ideas.
On my Lenovo T500 notebook running Ubuntu Natty, with 2 GByte RAM, using GhostPDL 9.02, it took 2.3 seconds to convert a Microsoft-provided 38 page XPS (ExchangeServer2007_ AdminComp_ chapter_02.xps) to a perfect PDF document:
However, I think
gxps(the GhostPDL command that can convert XPS to PDF currently does not provide any standard means to make it more chatty on stdout — not even-dDEBUGdoes work)…Update: I’m not familiar with any other tool that can convert XPS to PDF directly, but I know there’s a bunch of them. You may be more lucky if you consult Google search results.
Of course you can always print the XPS to a “PDF Printer”. There are different ways to do that on the commandline, which may give you some progress feedback.If you know in advance how many pages you’ll have to convert, a (crappy) workaround with GhostPDL could be to convert the file in chunks, using a construct like
-dFirstPage=1 -dLastPage=10and inform the user that currently pages 1-10 out of NNN are being processed.Update 2: Here is a way how to get a feedback on stdout as each page is being processed:
Note the single quotes
'around the-Z|. The second char is a Pipe sign, not a capital i… Result:Thanks to Ghostscript developer Tor Anderson who gave me the decisive hint in the #ghostscript IRC channel on Freenode.