Skip to content

Instantly share code, notes, and snippets.

@jrsmith3
Created March 12, 2014 01:31
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jrsmith3/9498924 to your computer and use it in GitHub Desktop.
Save jrsmith3/9498924 to your computer and use it in GitHub Desktop.
Converts every scribus document to a PDF in a specified directory.
"""
Convert every .sla to a pdf in a specified directory.
This script can only be run from within [scribus](http://http://scribus.net).
"""
import os
work_dir = #you have to explicitly tell scribus where your working directory is.
filenames = os.listdir(work_dir)
for filename in filenames:
if filename.endswith(".sla"):
full_path = os.path.join(work_dir, filename)
filename_root = os.path.splitext(filename)[0]
filename_pdf = os.path.join(work_dir, filename_root+".pdf")
openDoc(full_path)
pdf = PDFfile()
pdf.file = filename_pdf
pdf.save()
closeDoc()
@mara004
Copy link

mara004 commented Nov 18, 2022

For any others finding this, I've implemented a somewhat more sophisticated command-line and Python API wrapper for Scribus PDF export: https://github.com/sla2pdf-team/sla2pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment