[scribus] save to PDF from CLI

a.l.e ale.comp_06 at xox.ch
Tue Jun 21 11:19:01 UTC 2011

hi juraj

i will try your patches!

we already got a patch to run scribus as a CLI app, but i've never 
managed to run it (there is an issue at linking time).

if you have some time to further work on this issue, please get in touch 
with me!

i'd like get a similar set of patches as you are proposing applied to 
1.5svn and integrated in the 1.6 release!

i really hope to have a working solution before the end of the summer!


> Hi,
> since this feature is in constant demand I will try again to present
> my approach to enable saving to PDF from command line.
> Have in mind that this is just a demonstration of one possible solution
> and as such is very minimalistic and crude. It is only for showing how
> can it be done - not for production use.
> Anyway attached are several patches that enable running python script
> from command line. In that script you can for example save an opened
> document to PDF. Use it like this:
> $ scribus mydoc.sla -s script.py
> if script.py is:
> import scribus
> pdf = scribus.PDFfile()
> pdf.save()
> than you will save mydoc.sla to mydoc.pdf and scribus will exit.
> Of course while starting scribus will show GIU interface but it will
> need not your interaction.
> There are patches for saving and reading PDF options from scripter too.
> To use them you first need to set desired PDF option in GUI
> (in Save As PDF dialog), open scripter console and run command:
> saveAsPDFOptions('myoptions.xml')
> Then you can edit exported myoptions.xml in any editor and use that
> settings in other python script with:
> readPDFOptions('myoptions.xml')
> when needed. Be warned that exact format of exported file is not yet
> documented anywhere. Your best chance is to issue command
> help(PDFfile)
> in python console and use that to find out accepted values for desired
> attribute in exported options xml file.
> Have fun!
> For those interested what the patch do to source code:
> For enabling to run python script from CLI only the first patch is needed.
> When scriptplugin is initialized it create a new action in
> ScCore->primaryMainWindow()->scrActions.
> It also create a new slot that is called when this
> action is triggered. This action is triggered from mainApp function if
> it detect that script file is passed in command line.
> Also there is added code to support new -s (--script) switch and
> that is basically all it do.
> Second patch adds 'savePDFOptions' and 'readPDFOptions' to scripter.
> Third patch fix small typo that prevented reading options from file.
> Last patch fix small omission and produce error strings as intended.
> This patch does not try to hide GIU from popping up or to clean the code
> in the way that it does not need GUI code at all (if this possible with
> the curent codebase). I made a mistake last time when I produced a patch
> and mixed all above patches and lot more in one big diff and the result
> was that nobody was able to decipher what is going on. I Hope this time I
> will avoid the same mistake :)
> And last note: patch is against 1.3.9 version of scribus. So use it with
> caution with newer releases.
> Juraj Fedel
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: 01-scripterRunFile.diff
> Type: text/x-diff
> Size: 6077 bytes
> Desc: not available
> URL:<http://lists.scribus.net/pipermail/scribus/attachments/20110621/c0fdf54c/attachment.bin>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: 02-pdfoptionsio-read-save-python.diff
> Type: text/x-diff
> Size: 4932 bytes
> Desc: not available
> URL:<http://lists.scribus.net/pipermail/scribus/attachments/20110621/c0fdf54c/attachment-0001.bin>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: 03-read-pdfotions-work.diff
> Type: text/x-diff
> Size: 1264 bytes
> Desc: not available
> URL:<http://lists.scribus.net/pipermail/scribus/attachments/20110621/c0fdf54c/attachment-0002.bin>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: 04-pdfoptions-errors.diff
> Type: text/x-diff
> Size: 3658 bytes
> Desc: not available
> URL:<http://lists.scribus.net/pipermail/scribus/attachments/20110621/c0fdf54c/attachment-0003.bin>
> ___
> Scribus Mailing List: scribus at lists.scribus.net
> Edit your options or unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net

More information about the scribus mailing list