Scribus Forums

Scribus => Beginner Talk => Topic started by: GALEN on February 28, 2021, 08:24:42 am

Title: Newspaper Jumpline auto page #?
Post by: GALEN on February 28, 2021, 08:24:42 am
New user here. Using Scribus for small 16 - 24 pages newspaper and wondering if anyone has a solution to producing automatic jump-lines, that is, when linking text frames to another page, inserting that page number dynamically as a footer to the origin text like "Continued on page 15"?
Title: Re: Newspaper Jumpline auto page #?
Post by: dragonfly on February 28, 2021, 01:32:39 pm

I have no experience in writing multi column newspapers but as a theoretical exercise my immediate thought is to write the origin column foot note in textframes as ..

"Continued on page %VAR_jump01%"

Repeat for other column jump lines in textframes


but of course you can use your own indexing system after the prefix %VAR_

Next create an external csv containing a table of jump lines (as documented in ScribusGenerator python script).

When you now run in Scripter the variables will be expanded to be the values in your csv file (which you can create just before publication when you know the final binding).
Title: Re: Newspaper Jumpline auto page #?
Post by: RobSay on March 09, 2021, 06:01:32 pm
It's not available as an application feature - but you can write a script to automate it ..

This is not really 'beginner' territory - but it's a reasonable introduction to scripter capabilities:
Code: [Select]
# you can be more defensive, exit if a text frame is not selected etc.
currentFrame = getSelectedObject()
lastFrame = getLastLinkedFrame(currentFrame)
pages = scribus.pageCount()
# textOverflows() doesn't work as I expected - it always includes the linked frames ?
# while (textOverflows(currentFrame,1) == 1) .. always 0
# so cheat ...
totalTextLength = len(getAllText(currentFrame))
currentTextLength = len(getText(currentFrame))

# while there are more linked frames and a jumpline frame
while ((currentTextLength < totalTextLength) and (currentFrame != lastFrame)) :
  nextFrame = getNextLinkedFrame(currentFrame)
  jumpPage = currentPage()
  while (jumpPage < pages) :
    # find page which has the next frame in the chain
    if nextFrame in getAllObjects(ITEMTYPE_TEXTFRAME, jumpPage) :
      jumpLineText = "continues on page " + str(jumpPage+1) + " in frame: " + nextFrame
    # end while
  # should check it's actually on another page
  # Add a jumpline frame to current page (x,y,width,height) - my doc is in mm, calc the xy from the size of the current Frame or margins
  jumpLineFrame = createText(10,260,60,10)
  setText(jumpLineText, jumpLineFrame)
  # go to the page where the next frame was found, select the next frame, and continue adding jumpline frames
  currentFrame = nextFrame
  currentTextLength += len(getText(currentFrame))
  # end while
You can harden that as a python script, make it more generic (look for any linked text frame) and then run it on whatever files you like when you have a new edition