Retrieving page numbers from sections?

Previous topic - Next topic

RobSay

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:

  • Prompt the user to enter the offset when they run the indexing script  .. not so keen on this one, seems like it should not be needed
  • Drop a hidden named framed on to the end of the frontmatter with a count of pages - find the frame, use the content or page number as the offset (uggh!)
  • Use a master page type that only applies to the main content .. find the first page with that master page .. get the page number and use that as the offset

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

thanks!

dragonfly

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 .. https://www.linuxjournal.com/content/four-hidden-tools-scribus#:~:text=To%20do%20either%20function%2C%20go,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 ScribusGenerator.py to create an index.

RobSay

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.

thanks

Rob