[scribus] Printing via script

Gregory Pittman gpittman at iglou.com
Fri Mar 23 16:02:28 UTC 2012


On 03/23/2012 08:20 AM, Lars Behrens wrote:
> Lars Behrens schrieb:
>> Hi there,
>>
>> I'm just trying to find out how to print a file via the scripting
>> environment (Need to export to PS and then do some GS things afterwards)
>
>>
>> I found this snippet:
>>
>> ---------------------------
>> myprinter=scribus.Printer()
>> myprinter.pages=[1]
>> myprinter.printNow()
>> ---------------------------
>>
>> which works well with the preselected printer and preselected settings.
>> But how can one adjust the settings or choose a different printer?
>>
>> Maybe someone can point me to where I can find out how? I have searched
>> the internet all up and down :-)
>
> To answer my own question and for the mailing list record:
>
> I looked through the scribus sources and in
> scribus/plugins/scriptplugin/objprinter.cpp there is:
>
> ----------------------------------------------------------------------
> typedef struct
> {
> PyObject_HEAD
> PyObject *allPrinters; // list of strings - names of installed printers
> PyObject *printer; // string - selected printer
> PyObject *file; // string - name of file to print into (eg. output.ps)
> PyObject *cmd; // string - if "" use standard command else use this as
> command (eg. "kprinter", "xpp" ...)
> PyObject *pages; // list of integers - pages to be printed
> int copies; // numer of printed copies
> PyObject *separation; // string - No; All; Cyan; Magenta; Yellow; Black
> int color; // bool - do we print in color=1 or greyscale=0
> int useICC; // bool - do we use ICC Profiles 0 = No 1 = Yes
> int pslevel; // integer - 1, 2 or 3 level of used postscript
> int mph; // bool - mirror pages horizontally
> int mpv; // bool - mirror pages vertically
> int ucr; // bool - Under Color Removal
> } Printer;
> -------------------------------------------------------------------
>
>
> So using my snippet from above a greyscale print of page No. 1 into a ps
> file could look like
>
> ---------------------------
> myprinter=scribus.Printer()
> myprinter.file='/tmp/Test.ps'
> myprinter.pages=[1]
> myprinter.copies = 1
> myprinter.color = 0
> myprinter.printNow()
> --------------------------
>
> or two color copies to a certain printer:
>
> ----------------------------------
> myprinter=scribus.Printer()
> myprinter.printer='certain_printer'
> myprinter.pages=[1]
> myprinter.copies = 2
> myprinter.color = 1
> myprinter.printNow()
> ----------------------------------
>
> What do you folks think, should I post that in the wiki (will share the
> script there anyways, when it's done)?
>

Thanks, Lars.

Why don't you post it along with an example script that demonstrates 
this in the context of a particular use?

Greg




More information about the scribus mailing list