8

I've been trying to solve the problem of converting an .oxps file to .pdf or other file format. Any solutions for Linux out there?

I've been searching around and cannot come up with much thus far.

Maybe even something to convert to xps first and then pdf?


I've tried ImageMagick's convert and ghostscript, but no luck. Maybe I'm doing something wrong?

Note: I'm using Gentoo and/or Ubuntu.


EDIT

The solution is covered in the answer from @ThatGuy. However, for some reason, mudraw was not pulled in with mupdf-tools on ubuntu (I am running a headless 12.04.5 LTS ubuntu).

However, the source is available from MuPDF's website. I built the source and was able to solve the problem.

Mikolaj
  • 183
  • 1
  • 1
  • 7

4 Answers4

15

Method #1 (recommended)

Software requirements: Ghostscript/GhostXPS (version 9.19 or later).

To convert OXPS to PDF, simply execute the following command:

gxps -sDEVICE=pdfwrite -sOutputFile=/path/to/output.pdf -dNOPAUSE /path/to/input.oxps

This method preserves text layers.


Method #2 (deprecated)

(This works on Windows, Mac, and Linux, but converts text layers to images)

Use mudraw (included with MuPDF; mupdf-tools on Debian-based distributions) to convert the .oxps file to a series of .png files (converting directly to PDF doesn't work properly; fonts get messed up) with a resolution of 300 dpi:

mudraw -o mudraw_output_page_number_%d.png -r 300 input.oxps

Convert the .png files to a multipage PDF using ImageMagick's convert utility:

convert mudraw_output_page_number_*.png final.pdf

Note: If convert messes up the page order you can specify each individual .png file as the input (i.e., without using wildcards):

convert 1.png 2.png 3.png final.pdf

This should work on all platforms where MuPDF and ImageMagick are available (so on Windows, too).

Glorfindel
  • 4,089
  • 8
  • 24
  • 37
ThatGuy
  • 486
  • 4
  • 9
  • Thanks, but no luck. Also, I'm not too familiar with Ubuntu, mainly Gentoo, mudraw was not pulled in when installing on Ubuntu...but was when I built it on Gentoo. However, no luck. – Mikolaj Mar 06 '15 at 19:16
  • 1
    MuPDF is split into several packages on Debian-based distributions. ``mudraw`` is included in the mupdf-tools package. Could you elaborate on why it doesn't work? – ThatGuy Mar 07 '15 at 01:09
  • 1
    I am getting these messages: `error: cannot recognize version maker`, `warning: trying to repair broken xref`, `warning: lexical error (unexpected ')')` and a bunch more like that. – Mikolaj Mar 07 '15 at 01:28
  • 1
    According to http://www.mupdf.com/docs/browse/source/pdf/pdf-xref.c, that should be ``version marker``. Anyway, maybe try explicitly specifying the output format, like so: ``mudraw -o mudraw_output_page_number_%d.png -r 300 -F png input.oxps`` – ThatGuy Mar 07 '15 at 03:15
  • Also, which version of mudraw are you using (i.e., what is the output of ``apt-cache policy mupdf-tools``)? – ThatGuy Mar 07 '15 at 03:19
  • On Ubuntu, I have `0.9-2ubuntu1`, but like I said, no mudraw was pulled in with it so I was not able to test on ubuntu. On Gentoo I have `1.1_p20121127`. – Mikolaj Mar 07 '15 at 18:49
  • Ok. The version I used was old. I downloaded the source from [mupdf.com](http://mupdf.com) and all is well. Thanks for your help. I accepted your answer. – Mikolaj Mar 07 '15 at 19:11
  • 2
    ``mudraw`` was called ``pdfdraw`` in earlier versions of MuPDF (including 0.9-2ubuntu1). Is ``pdfdraw`` installed on your system? If not, you can install it using ``sudo apt-get install mupdf-tools``. Now, I've never used ``pdfdraw`` myself, but you might be able to use ``pdfdraw`` instead of ``mudraw``. – ThatGuy Mar 07 '15 at 19:21
2

You can use this online converter - online2pdf.

Or if you have access to a Windows 8 machine, you can convert the file to pdf(or xps) using a pdf printer.

Also, MuPDF on linux can open a .oxps file(only for viewing though).

jL4
  • 151
  • 4
  • Thanks. But I cannot use the online converter and no access to windows 8. Need something local. But a good answer for others who may come across. – Mikolaj Mar 04 '15 at 15:03
  • Accepting this answer as seems the only way at this point in time. Thanks. – Mikolaj Mar 04 '15 at 16:43
  • 1
    Unfortunately, the .oxps format is a new format supported only in Windows 8 so only a few programs support it. – jL4 Mar 05 '15 at 03:01
  • Thanks, I finally gave up on the linux route. Got someone with a windows 8 box to help out. – Mikolaj Mar 05 '15 at 03:09
1

In windos8 XPS printer is already installed. Open oxps file in xps viewer and click to print, choose Microsoft XPS Document writer, option will come to save to file and in the bottom file,s name OpenXPS Document (.oxps) will appear, Do not choose it, go to down options will appear, choose XPS Document (.xps).You will get Xps document to be convertrd in PDF by XPS to PDF converter available free from cnet.com

shivanand
  • 11
  • 1
0

In 2021, tested on debian 9 and using the mupdf-tools option (in tune with ThatGuy's answer, since the system still won't let me comment on his answer due to my reputation), with mutool version 1.9a the command would remain as follows:

mutool draw -o mudraw_output_page_number_% d.png -r 300 input.oxps

And later, if the imagemagick command would be kept

convert 1.png 2.png 3.png final.pdf

I hope it serves you.