Scribus Forums

Scribus => Scripts and Plugins => Topic started by: RobSay on February 24, 2021, 01:05:13 am

Title: Retrieving page numbers from sections?
Post by: RobSay on February 24, 2021, 01:05:13 am
Does anyone have a solution for retrieving the page number as defined by the document section numbering?

I have a large document (~350pp) with multiple sections including:
 - title pages (half title, frontispiece, full title, colophon etc)
 - front matter numbered i,ii,iii ...
 - content number 1,2,3 ...
 - back matter (continues content numbering)

In the main content I auto-create pages with multiple frames on every page each with indexing attributes - all of which means I can auto-create multiple indexes in the back matter.

In scripter when getting the frame and the attributes - the only page number I can get is via currentPage() - which gives the number of the page in the document ... not the section defined page number (which is added via the master page footers).

The only ways I can see to get round this when building my indexes:

Is there a better way to get the value of the section page number in scripter?

Title: Re: Retrieving page numbers from sections?
Post by: dragonfly on February 24, 2021, 05:46:56 pm
Caveat: Do not expect a proven solution from me since I am still a relatively new observer studying the internal structure of Scribus XML from sidelines. In particular how to dynamically parse content. There are more experienced users in this forum.

However, one observation is that you do not mention the uses of Sections as discussed here ..,page%20number%20in%20the%20section.

That is ... File > Document Setup > Sections.

You are somehow using Master Pages from what I read.

I can inspect Sections elements by running my test.sla through XMLCopyEditor which bypasses Scripter.

Attributes can be retrieved from Section elements.

Indeed you can dynamically change and read Section attributes through to create an index.
Title: Re: Retrieving page numbers from sections?
Post by: RobSay on February 26, 2021, 05:40:52 pm
Yes I'm using document sections to define the page numbers. Inserting a page at a specific location with scripter adds it to the pre-existing section which means the page number defined by the section is picked up. I also specify the appropriate master page for that content - which has the appropriate page furniture .. including page number control character in the footer if that is needed (I have some master pages which don't display a page number as the content is a full page images)

I understand your approach (which would definitely work) but had hoped to accomplish this in my current scripts rather than going off into XML processing ..

Finding the index of the first master page of a given type and using that as the offset when building the index entries appears to be the best solution at the moment.