[scribus] How to print guides, empty image frames and other internal indications ?

a.l.e ale.comp_06 at xox.ch
Thu Sep 1 13:17:57 UTC 2011


hi

> On 09/01/2011 05:02 AM, a.l.e wrote:
> > salut frédéric
> >
> >
> >> I am currently designing a page layout with Scribus, having to
> >> decide how to arrange my elements, etc.
> >>
> >> I'd like to print the page as I see it within Scribus (so that I
> >> can print it in A3, discuss and annotate it), that is, including
> >> the guides and the frames (even though they may be empty for now).
> >>
> >> I did not find any way of doing this; did I just miss it or is it
> >> difficult/impossible ?
> >
> > ... this is a typical task for a script :-)
> >
> > the script below will add a layer and draw on it a rectangle with
> > the page margins and vertical / horizontal lines for the guides...
> >
> >
> The empty image frames might be a bit trickier. You could always
> create a dummy image that says "image missing" inside it to import to
> empty frames. It might be simpler to just give those empty frames a
> border and/or fill color to mark off the space they take up.

here a second version of the script, with placeholders for "empty"
rectangular image frames:

#!/usr/bin/python

"""
create "printable" guides and page margins for a draft
@author: ale rimoldi
@version: 1.0 / 20110901
@copyright (c) 2011 alessandro rimoldi under the mit license
           http://www.opensource.org/licenses/mit-license.html
"""
import sys
try:
   import scribus
except ImportError:
   print "This script only works from within Scribus"
   sys.exit(1)

page = scribus.getPageSize()
margin = scribus.getPageMargins()

layer = scribus.getActiveLayer()

if ('guides' in scribus.getLayers()) :
    scribus.setActiveLayer('guides')
else:
    scribus.createLayer('guides')


# add the page margins
rectangle = scribus.createRect(margin[1], margin[0], (page[0] -
margin[1] - margin[2]), (page[1] - margin[0] - margin[3]))
scribus.setFillColor('none', rectangle) scribus.setLineColor('Blue',
rectangle) scribus.setLineWidth(0.4, rectangle)

# add horizontal and vertical guides
for item in scribus.getHGuides():
    line = scribus.createLine(0, item , page[0], item)
    scribus.setLineColor('Black', line)
    scribus.setLineWidth(0.6, line)
    scribus.setLineStyle(scribus.LINE_DASHDOT, line)

for item in scribus.getVGuides():
    line = scribus.createLine(item, 0 , item, page[0])
    scribus.setLineColor('Black', line)
    scribus.setLineWidth(0.6, line)
    scribus.setLineStyle(scribus.LINE_DASHDOT, line)

# add a "crossed frame" for missing images
for item in scribus.getAllObjects():
    if scribus.getObjectType(item) == 'ImageFrame':
        image = scribus.getImageFile(item)
        if image == '':
            pos = scribus.getPosition(item)
            size = scribus.getSize(item)
            rectangle = scribus.createRect(pos[0], pos[1], size[0],
size[1]) scribus.setFillColor('none', rectangle)
            scribus.setLineColor('Black', rectangle)
            scribus.setLineWidth(0.4, rectangle)
            line = scribus.createLine(pos[0], pos[1] , pos[0] +
size[0], pos[1] + size[1]) scribus.setLineColor('Black', line)
            scribus.setLineWidth(0.4, line)
            line = scribus.createLine(pos[0], pos[1] + size[1], pos[0]
+ size[0], pos[1]) scribus.setLineColor('Black', line)
            scribus.setLineWidth(0.4, line)

scribus.setActiveLayer(layer)



More information about the scribus mailing list