Scribusoid

Author Topic: Displaying page numbers on top of images/shapes  (Read 4091 times)

shanidcruze

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
  • Scribus User
Displaying page numbers on top of images/shapes
« on: October 05, 2013, 05:47:06 pm »
Hi
I'm just getting to know Scribus and realising it will do all sorts of jobs for me.

I'm putting together a 30pp booklet, with page numbers in the outside bottom corners of pages.
I want these to be within the main margins, and I want them to display even when images or shapes are positioned up against the page margin, or bleed to the edge of the page.

I've set up my page numbers, no problem, in relevant master pages, but they sit at the bottom level.

I've searched the Help Wiki, but obviously missed something. [Layers? - the document has just one layer at present]

Scribus can do so much I'm sure it must be able to do this!

Advice would be very welcome.
Thanks
Shani

Nermander

  • Hero Member
  • *****
  • Posts: 1315
  • Karma: 17
Re: Displaying page numbers on top of images/shapes
« Reply #1 on: October 05, 2013, 06:22:39 pm »
That is a well known "glitch", Master Pages are behind all the page layers. So you will have to put the page numbers in their own frame on each page and make sure that frame is on top. You can still use the # page number variable though.

Double-clicking an item in a scrapbook is probably the best way to insert the frame in the same location on several pages. Double-click, next page, double-click, next page etc.

shanidcruze

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
  • Scribus User
Re: Displaying page numbers on top of images/shapes
« Reply #2 on: October 07, 2013, 10:48:07 am »
That is a well known "glitch", Master Pages are behind all the page layers. So you will have to put the page numbers in their own frame on each page and make sure that frame is on top. You can still use the # page number variable though.

Double-clicking an item in a scrapbook is probably the best way to insert the frame in the same location on several pages. Double-click, next page, double-click, next page etc.


Thanks so much for this. It saves me the hours of trying everything and assuming that I've missed something obvious. Thankfully it isn't a 600 page book. Despite this glitch I still think Scribus is great.


Greg P

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
  • Scribus User
Re: Displaying page numbers on top of images/shapes
« Reply #3 on: October 07, 2013, 07:09:43 pm »
Where there is a will, there is a way.

I wrote a script some time ago, for this very kind of thing. After attempting to figure out a way to be able to copy something from the Scrapbook to multiple pages at once, I made this script:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: paste2all.py
# © 2012.01.29 Gregory Pittman
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
"""
USAGE
You must have a document open. Select a single object. Run the script, which asks whether you want

all, odd, or even pages to get a copy of the selected object (no copy is made to the original

page of the object). Any other input is ignored. When pasted, the copies go to the same page

coordinates of the original.

The script does not work with groups, and in fact Scribus will hang and then crash if you have

selected a group. If you select more than one item without grouping, an error is generated.



"""
import scribus

if scribus.haveDoc():


    if scribus.selectionCount() == 0:
        scribus.messageBox('Scribus - Usage Error',
                           "There is no object selected.\nPlease try again.",
                           scribus.ICON_WARNING, scribus.BUTTON_OK)
        sys.exit(2)
    if scribus.selectionCount() > 1:
   scribus.messageBox('Scribus - Usage Error', "You have more than one object selected.\nPlease select one text frame and try again.", scribus.ICON_WARNING, scribus.BUTTON_OK)
   sys.exit(2)
    paste2 = scribus.valueDialog('Paste to...',"Paste where?\n(all, odd, even)","all")
    selframe = scribus.getSelectedObject()
    pages = scribus.pageCount()
    currpage = scribus.currentPage()
    scribus.copyObject(selframe)
    if (paste2 == 'all'):
   i = 1
   while (i <= pages):
       if (i != currpage):
      scribus.gotoPage(i)
      scribus.pasteObject(selframe)
       i=i+1
    elif (paste2 == 'odd'):
   i = 1
   while (i <= pages):
       if (i != currpage):
      scribus.gotoPage(i)
      scribus.pasteObject(selframe)
       i=i+2
    elif (paste2 == 'even'):
   i = 2
   while (i <= pages):
       if (i != currpage):
      scribus.gotoPage(i)
      scribus.pasteObject(selframe)
       i=i+2
    scribus.setRedraw(1)
    scribus.docChanged(1)
    scribus.messageBox("Finished", "Done",icon=0,button1=1)

else:
    scribus.messageBox('Usage Error', 'You need a Document open', icon=0, button1=1)
    sys.exit(2)

Greg P

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
  • Scribus User
Re: Displaying page numbers on top of images/shapes
« Reply #4 on: October 07, 2013, 07:14:30 pm »
I even made another version, for the situation when you might not want all, or even, or odd pages, but a list.

In this case, you just enter for example,  2 5 8 34
to paste the item to those particular pages only. The script will keep you from trying to paste to a page that doesn't exist.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: paste2pagelist.py
# © 2012.03.22 Gregory Pittman
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
"""
USAGE
You must have a document open. Select a single object. Run the script, which asks for a list

of page numbers -- do not use commas to separate, just whitespace.

When pasted, the copies go to the same page coordinates of the original.

The script does not work with groups, and in fact Scribus will hang and then crash if you have

selected a group. If you select more than one item without grouping, an error is generated.



"""
import scribus

if scribus.haveDoc():


    if scribus.selectionCount() == 0:
        scribus.messageBox('Scribus - Usage Error',
                           "There is no object selected.\nPlease try again.",
                           scribus.ICON_WARNING, scribus.BUTTON_OK)
        sys.exit(2)
    if scribus.selectionCount() > 1:
   scribus.messageBox('Scribus - Usage Error', "You have more than one object selected.\nPlease select one object and try again.", scribus.ICON_WARNING, scribus.BUTTON_OK)
   sys.exit(2)
    pagelist = scribus.valueDialog('Paste to...',"Paste to which pages?\n(page numbers, separated by white space)","1")
    pageslist = pagelist.split()
    selframe = scribus.getSelectedObject()
    pages = scribus.pageCount()
    for p in pageslist:
        p_no = int(p)
        if ((p_no > pages) or (p_no < 1)):
            scribus.messageBox('OOPS!', "You have a page number outside the range of pages in your document", scribus.ICON_WARNING, scribus.BUTTON_OK)
            sys.exit(2)
    currpage = scribus.currentPage()
    scribus.copyObject(selframe)

    for p in pageslist:
   p_no = int(p)
   scribus.gotoPage(p_no)
   scribus.pasteObject(selframe)
    scribus.setRedraw(1)
    scribus.docChanged(1)
    scribus.messageBox("Finished", "Done",icon=0,button1=1)

else:
    scribus.messageBox('Usage Error', 'You need a Document open', icon=0, button1=1)
    sys.exit(2)

Greg P

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
  • Scribus User
Re: Displaying page numbers on top of images/shapes
« Reply #5 on: October 07, 2013, 07:17:43 pm »
Just to warn you -- there are some alignment issues with the script text as displayed in this forum.


(but maybe not) If it doesn't work, let me know.
« Last Edit: October 07, 2013, 07:21:03 pm by Greg P »

shanidcruze

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
  • Scribus User
Re: Displaying page numbers on top of images/shapes
« Reply #6 on: October 07, 2013, 07:32:10 pm »
Hey thanks.
I'll keep this on file.
As it turned out there were only three pages to change, and I managed it without any problem.


Nermander

  • Hero Member
  • *****
  • Posts: 1315
  • Karma: 17
Re: Displaying page numbers on top of images/shapes
« Reply #7 on: October 08, 2013, 08:25:57 am »
Greg, for correct indention you could wrap the script inside code tags (the button is a # sign).

Code: [Select]
  This is a way
     to get indention correct