Skip to content

Running Scribus Generator from the command line

Berteh edited this page Apr 15, 2021 · 4 revisions

As running Scribus Generator from the command line is currently the only option for Mac users, below is a short introduction that may help. It works just the same way for Linux users, and nearly just so for Windows users.

what is the command line

running Scribus Generator from the command line

After reading the documents above, let's imagine that your SLA template and CSV data are in your folder Documents/scribus, and that you downloaded ScribusGenerator-master.zip from Github (or the Python3 version ScribusGenerator-python3.zip for Scribus 1.5.6+) and uncompressed it in your folder Downloads/ScribusGenerator-master. You would then

  1. open a Terminal
  2. go to your project directory: cd ~/Documents/scribus
  3. create a shortcut to Scribus Generator (SG, in short) in your project folder: ln -s ~/Downloads/ScribusGenerator-master/ScribusGeneratorCLI.py .
  4. check that SG works: ./ScribusGeneratorCLI.py --outDir test Business_Card.sla. This step should create 10 SLA files with a business card in the Documents/scribus/test folder in less than a second.
  5. understand the available options to run SG from the command line (they are basically the same as the GUI), either online or directly from your command line:
    ./ScribusGeneratorCLI.py --help
  6. invent a command that will suit your needs, maybe something like: ./ScribusGeneratorCLI.py --csvFile newsletterData.csv --outDir . --outName "newsApril_%VAR_name%" newsletterTemplate.sla (in one single line!, to generate a different SLA document for each recipient based on their name), or ./ScribusGeneratorCLI.py --csvFile newsletterData.csv --outDir . --merge newsletterTemplate.sla (in one single line!) to generate a single SLA files with all your data entries.
  7. open the generated SLA files with Scribus to enjoy the result... and generate a pdf or an image out of it.

If you want more help to create a particular command don't hesitate to give me a few more details on your particular needs in a new issue... We'll make a collection of those on this wiki ;)

generate PDF from command line

A useful next step is then to generate PDF documents out of all the SLA documents, once you checked them out. For that purpose

  1. download the to-pdf.py script by Ale Rimoldi, into your Downloads/ folder.
  2. go to your project directory: cd ~/Documents/scribus
  3. run the script to generate PDF documents from all SLA files in the current directory scribus -g -py ~/Downloads/to-pdf.py -- *.sla

This step may take a while if you have many files, nothing I can do. Just tell the people at Scribus how important it is they make that process less obstructive by joining the discussion here.