Mimsy Were the Borogoves

Hacks: Articles about programming in Python, Perl, Swift, BASIC, and whatever else I happen to feel like hacking at.

Save all Scribus pages as EPS

Jerry Stratton, November 20, 2007

Scribus is great at PDF, but Word isn’t. When I import PDFs into Word, Word converts them to bitmap graphics, which defeats the purpose of embedding PDF. Word does support EPS (as long as you’re printing to a postscript printer, such as CUPS-PDF), but Scribus can’t save pages separately to EPS files all at once like it can PDFs.

This script will go from page to page in the current Scribus document and save it as an EPS file.

[toggle code]

  • #!/usr/bin/env python
  • # -*- coding: utf-8 -*-
  • import scribus
  • import os.path
  • #don't do anything unless there's a document open
  • if scribus.haveDoc():
    • #get the base filename to save to
    • #fileDialog seems to require three unnamed arguments
    • saveTo = scribus.fileDialog('Select filename to save EPS files', '*.eps *.pdf *.sla', "", issave=True)
    • if saveTo:
      • #deselect, or it will only print the current selection
      • scribus.deselectAll()
      • pagecount = scribus.pageCount()
      • basePath, ext = os.path.splitext(saveTo)
      • if not ext:
        • basePath = saveTo
      • for page in range(1, pagecount+1):
        • scribus.gotoPage(page)
        • filepath = basePath + ' page ' + str(page) + '.eps'
        • scribus.savePageAsEPS(filepath)
  • else:
    • scribus.messageBox("No Open Document", "You need to have a document open to save it as EPS.")

Save this script as something like “scribus2eps.py”, and then select it from your Scribus “Scripts” menu. Whatever filename you select, the script saves as that filename and “ page x.eps”. For example, if you choose "Joe.pdf", and the current document is three pages long, the pages will be saved as “Joe page 1.eps”, “Joe page 2.eps”, and “Joe page 3.eps”.

Update: issave=True doesn’t seem to have any effect in fileDialog. The button remains “open” instead of “save”, and the dialog requires choosing an existing file to determine the base name of the file. Just typing a new file name won’t cut it.

  1. <- ELinks text browser
  2. Inline Django Forms ->